Versions in this module Expand all Collapse all v0 v0.1.1 Nov 4, 2026 v0.1.0 Oct 28, 2026 Changes in this version + const ActionReceive + const ActionSend + const CodeConflict + const CodeNotFound + const CodeTimeout + const CodeValidation + const ExtAuthorizeParams + const ExtClientID + const ExtCredentialsLocation + const ExtDefaultScopes + const ExtRedirectURI + const ExtTokenName + const ExtTokenParams + const ExtUsePKCE + const SecurityTypeHTTP + const SecurityTypeHTTPAPIKey + const SecurityTypeOAuth2 + const SecurityTypeOpenIDConnect + const Version + var ErrConflict = NewError(CodeConflict, "conflict") + var ErrNotFound = NewError(CodeNotFound, "not found") + var ErrTimeout = &Error + var ErrValidation = NewError(CodeValidation, "validation failed") + func AllowPublish[T, Req any](ch *ChannelHandle[T], ...) + func Check(generated []byte, path string) error + func MergeSchemas(dst, src map[string]json.RawMessage) error + func Register[Req, Res any](r Registrar, op Operation, ...) + func SchemaFromType(v any, opts ...ReflectOption) (json.RawMessage, map[string]json.RawMessage, error) + type API struct + func New(cfg Config, opts ...Option) *API + func (a *API) Attach(node *centrifuge.Node, c *centrifuge.Client) + func (a *API) Call(ctx context.Context, method string, data []byte) ([]byte, error) + func (a *API) DocsHandler(prefix string, opts ...DocsOptions) http.Handler + func (a *API) DocsRoute() string + func (a *API) DocsRoutes() []Route + func (a *API) Document() *Document + func (a *API) Group(prefix string, tags ...string) *Group + func (a *API) Handle(method string, h Handler, opts ...RouteOption) + func (a *API) JSON() ([]byte, error) + func (a *API) JsonDocHandler() http.Handler + func (a *API) JsonRoute() string + func (a *API) RouteGroup(prefix string, mw ...Middleware) *RouteGroup + func (a *API) Router() *Router + func (a *API) Routes() []Route + func (a *API) ServeDocs(m Mux) + func (a *API) ServeSpec(m Mux) + func (a *API) SpecRoutes() []Route + func (a *API) Use(mw ...Middleware) + func (a *API) UseChannelGate(g ...ChannelGate) + func (a *API) UseMiddleware(mw ...OpMiddleware) + func (a *API) YamlDocHandler() http.Handler + func (a *API) YamlRoute() string + type CallInfo struct + Client *centrifuge.Client + ClientID string + Method string + Received time.Time + RequestID string + UserID string + func InfoFrom(ctx context.Context) (CallInfo, bool) + type Channel struct + Description string + Extensions map[string]any + ID string + Pattern string + PublishExtensions map[string]any + Security []map[string][]string + Summary string + Tags []string + type ChannelAction string + const ChannelPublish + const ChannelSubscribe + type ChannelGate func(ctx context.Context, ch *ChannelInfo, action ChannelAction, params Params, ...) error + type ChannelHandle struct + func RegisterChannel[T any](api *API, ch Channel) *ChannelHandle[T] + func (ch *ChannelHandle[T]) OnSubscribe(fn func(ctx context.Context, params Params, info SubscribeInfo) error) *ChannelHandle[T] + func (ch *ChannelHandle[T]) Publish(node *centrifuge.Node, params Params, msg T) error + type ChannelInfo struct + Extensions map[string]any + ID string + Pattern string + PublishExtensions map[string]any + Security []map[string][]string + type Codec interface + Marshal func(v any) ([]byte, error) + Unmarshal func(data []byte, v any) error + var JSON Codec = jsonCodec{} + type Components struct + Channels map[string]SpecChannel + Extensions Extensions + Messages map[string]Message + Parameters map[string]Parameter + Schemas map[string]json.RawMessage + SecuritySchemes map[string]SecurityScheme + Servers map[string]Server + func (c *Components) UnmarshalJSON(data []byte) error + func (c Components) MarshalJSON() ([]byte, error) + type Config struct + Codec Codec + Docs DocsOptions + DocsPath string + JSONPath string + ReflectOptions []ReflectOption + SecuritySchemes map[string]SecurityScheme + Validator func(document []byte) error + YAMLPath string + func DefaultConfig(title, version string) Config + type Contact struct + Email string + Name string + URL string + type DocsOptions struct + ConnectSrc []string + SpecURL string + SpecYAMLURL string + Title string + WebSocketURL string + type Document struct + AsyncAPI string + Channels map[string]SpecChannel + Components *Components + DefaultContentType string + Extensions Extensions + ID string + Info Info + Operations map[string]SpecOperation + Servers map[string]Server + func NewDocument(title, version string) *Document + func (d *Document) UnmarshalJSON(data []byte) error + func (d Document) MarshalJSON() ([]byte, error) + type Error struct + Code uint32 + Message string + Temporary bool + func NewError(code uint32, message string) *Error + func (e *Error) Error() string + func (e *Error) Is(target error) bool + func (e *Error) Unwrap() error + func (e *Error) WithMessage(msg string) *Error + func (e *Error) Wrap(cause error) *Error + type ErrorMapper func(err error) (*Error, bool) + type Extensions map[string]any + func OAuthExtensions(o OAuthOptions) Extensions + type ExternalDocs struct + Description string + URL string + type Group struct + func (g *Group) Group(prefix string, tags ...string) *Group + type Handler func(ctx context.Context, req Request) (Response, error) + type Info struct + Contact *Contact + Description string + Extensions Extensions + ExternalDocs *ExternalDocs + License *License + Tags []Tag + TermsOfService string + Title string + Version string + func (i *Info) UnmarshalJSON(data []byte) error + func (i Info) MarshalJSON() ([]byte, error) + type License struct + Name string + URL string + type Logger interface + Error func(msg string, args ...any) + Info func(msg string, args ...any) + Warn func(msg string, args ...any) + type Message struct + Bindings json.RawMessage + ContentType string + Description string + Examples json.RawMessage + Extensions Extensions + Headers json.RawMessage + Name string + Payload json.RawMessage + Ref string + Summary string + Tags []Tag + Title string + func (m *Message) UnmarshalJSON(data []byte) error + func (m Message) MarshalJSON() ([]byte, error) + type Middleware func(Handler) Handler + func Logging(l Logger) Middleware + func Observe(fn func(info CallInfo, d time.Duration, err error)) Middleware + func RequireUser() Middleware + type Mux interface + Handle func(pattern string, h http.Handler) + type OAuthFlow struct + AuthorizationURL string + AvailableScopes map[string]string + RefreshURL string + TokenURL string + type OAuthFlows struct + AuthorizationCode *OAuthFlow + ClientCredentials *OAuthFlow + Implicit *OAuthFlow + Password *OAuthFlow + type OAuthOptions struct + AuthorizeParams map[string]string + ClientID string + CredentialsLocation string + DefaultScopes []string + RedirectURI string + TokenName string + TokenParams map[string]string + UsePKCE string + type OpHandler func(ctx context.Context, data []byte) ([]byte, error) + type OpMiddleware func(op *Operation, next OpHandler) OpHandler + type Operation struct + Description string + Errors []uint32 + Extensions map[string]any + Method string + OperationID string + Security []map[string][]string + Summary string + Tags []string + Timeout time.Duration + func OperationFrom(ctx context.Context) (*Operation, bool) + type OperationReply struct + Channel RefObj + Extensions Extensions + Messages []RefObj + func (r *OperationReply) UnmarshalJSON(data []byte) error + func (r OperationReply) MarshalJSON() ([]byte, error) + type Option func(*config) + func WithDefaultTimeout(d time.Duration) Option + func WithErrorMapper(m ErrorMapper) Option + func WithLogger(l Logger) Option + func WithMaxInflight(n int) Option + type Parameter struct + Default string + Description string + Enum []string + Examples []string + Extensions Extensions + Location string + func (p *Parameter) UnmarshalJSON(data []byte) error + func (p Parameter) MarshalJSON() ([]byte, error) + type Params map[string]string + type RefObj struct + Ref string + func Ref(target string) RefObj + type ReflectOption func(*reflectConfig) + func RequireAll() ReflectOption + type Registrar interface + type Request struct + Data []byte + Method string + type Response struct + Data []byte + type Route struct + Handler http.Handler + Path string + Subtree bool + type RouteGroup struct + func (g *RouteGroup) Handle(method string, h Handler, opts ...RouteOption) + func (g *RouteGroup) RouteGroup(prefix string, mw ...Middleware) *RouteGroup + func (g *RouteGroup) Use(mw ...Middleware) + type RouteOption func(*routeConfig) + func WithMiddleware(mw ...Middleware) RouteOption + func WithTimeout(d time.Duration) RouteOption + type Router struct + func NewRouter(opts ...Option) *Router + func (r *Router) Attach(c *centrifuge.Client) + func (r *Router) Call(ctx context.Context, method string, data []byte) ([]byte, error) + func (r *Router) Handle(method string, h Handler, opts ...RouteOption) + func (r *Router) RouteGroup(prefix string, mw ...Middleware) *RouteGroup + func (r *Router) Routes() []string + func (r *Router) Use(mw ...Middleware) + type SecurityScheme struct + BearerFormat string + Description string + Extensions Extensions + Flows *OAuthFlows + In string + Name string + OpenIDConnectURL string + Scheme string + Scopes []string + Type string + func (s *SecurityScheme) UnmarshalJSON(data []byte) error + func (s SecurityScheme) MarshalJSON() ([]byte, error) + type Server struct + Bindings json.RawMessage + Description string + Extensions Extensions + Host string + Pathname string + Protocol string + Security []RefObj + Summary string + Tags []Tag + Title string + func (s *Server) UnmarshalJSON(data []byte) error + func (s Server) MarshalJSON() ([]byte, error) + type SpecChannel struct + Address string + Bindings json.RawMessage + Description string + Extensions Extensions + Messages map[string]Message + Parameters map[string]Parameter + Servers []RefObj + Summary string + Tags []Tag + Title string + func (c *SpecChannel) UnmarshalJSON(data []byte) error + func (c SpecChannel) MarshalJSON() ([]byte, error) + type SpecOperation struct + Action string + Bindings json.RawMessage + Channel RefObj + Description string + Extensions Extensions + Messages []RefObj + Reply *OperationReply + Security []RefObj + Summary string + Tags []Tag + Title string + func (o *SpecOperation) UnmarshalJSON(data []byte) error + func (o SpecOperation) MarshalJSON() ([]byte, error) + type SubscribeInfo struct + Channel string + ClientID string + UserID string + type Tag struct + Description string + Extensions Extensions + Name string + func (t *Tag) UnmarshalJSON(data []byte) error + func (t Tag) MarshalJSON() ([]byte, error) + type Validator interface + Validate func() error