type
EndpointContext
Raw HTTP, route parameters, verified actor identity, and LocalAPI supplied to a custom endpoint.
Arguments
| Argument | Type | Description |
|---|---|---|
Writer | http.ResponseWriter | Receives the endpoint response. |
Request | *http.Request | Carries request body, headers, cancellation, and PathValue parameters. |
RequestID | string | Matches the X-Request-ID response header. |
ClientIP | string | Framework-resolved direct or trusted-forwarded client address. |
RouteParams | map[string]string | Decoded named path parameters. |
Collection | schema.CollectionSlug | Owning collection when collection-scoped. |
Global | schema.CollectionSlug | Owning global when global-scoped. |
Actor | *store.Document | Authenticated actor or nil for an anonymous request. |
ActorCollection | schema.CollectionSlug | Auth collection owning Actor. |
Local | *LocalAPI | Enters the access-controlled operation engine. |
AdmitAuthAttempt | func(context.Context, | Applies distributed auth-attempt admission. |
ReportError | func(error, | 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)
}Related types
CollectionSlugA validated collection or global slug.
DocumentA stored document with status and version metadata.
LocalAPIIn-process content operations that share the REST authorization and lifecycle pipeline.