type

EndpointContext

Raw HTTP, route parameters, verified actor identity, and LocalAPI supplied to a custom endpoint.

Arguments

ArgumentTypeDescription
Writerhttp.ResponseWriterReceives the endpoint response.
Request*http.RequestCarries request body, headers, cancellation, and PathValue parameters.
RequestIDstringMatches the X-Request-ID response header.
ClientIPstringFramework-resolved direct or trusted-forwarded client address.
RouteParamsmap[string]stringDecoded named path parameters.
Collectionschema.CollectionSlugOwning collection when collection-scoped.
Globalschema.CollectionSlugOwning global when global-scoped.
Actor*store.DocumentAuthenticated actor or nil for an anonymous request.
ActorCollectionschema.CollectionSlugAuth collection owning Actor.
Local*LocalAPIEnters the access-controlled operation engine.
AdmitAuthAttemptfunc(context.Context, string, string) errorApplies distributed auth-attempt admission.
ReportErrorfunc(error, string)Records a stable observation code and trusted diagnostic detail.

Full signature

type EndpointContext struct { // Writer receives the status, headers, and body chosen by the handler. Writer http.ResponseWriter // Request is the matched HTTP request. Use its Context for cancellation, // deadlines, and dependent work. Request *http.Request // RequestID is the framework request ID also returned in X-Request-ID. RequestID string // ClientIP is resolved through the configured trusted-proxy policy. ClientIP string // RouteParams contains decoded named path parameters. RouteParams map[string]string // Collection identifies the owning collection endpoint, when applicable. Collection schema.CollectionSlug // Global identifies the owning global endpoint, when applicable. Global schema.CollectionSlug // Actor is the authenticated user, or nil for an anonymous request. Actor *store.Document // ActorCollection identifies the auth collection that owns Actor. ActorCollection schema.CollectionSlug // Local enters the same access-controlled operation engine as REST and the // generated SDK. Local *LocalAPI // AdmitAuthAttempt applies the distributed authentication-attempt policy for // endpoints implementing an authentication flow. AdmitAuthAttempt func(context.Context, string, string) error // ReportError records a stable code and sends trusted detail to // HandlerOptions.RequestError without exposing it to the client. ReportError func(error, string) }

Source core/endpoint.go:42

Related types

  • CollectionSlug

    A validated collection or global slug.

  • Document

    A stored document with status and version metadata.

  • LocalAPI

    In-process content operations that share the REST authorization and lifecycle pipeline.