Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dequeue200JSONResponse ¶
type Dequeue200JSONResponse Response
Dequeue200JSONResponse renders an HTTP 200 success response. Marshals the underlying Response DTO as a JSON body.
type Dequeue400ErrorResponse ¶
Dequeue400ErrorResponse renders an HTTP 400 error response. Body carries an errcode.Error whose Kind/Code/Message/Details follow the canonical wire schema in contracts/shared/errors/error-response-v1.schema.json (5xx Details are stripped by Error.MarshalJSON; Internal never serializes).
type DequeueResponseObject ¶
type DequeueResponseObject interface {
// contains filtered or unexported methods
}
DequeueResponseObject is the typed response envelope for http.device.command.dequeue.v1. Service.Dequeue must return one of the Dequeue{Status}{Suffix} structs declared below; the generated handler dispatches via the unexported method, which keeps the implementation set closed to types declared in this package.
ref: oapi-codegen pkg/codegen/templates/strict/strict-responses.tmpl@main
(buffer-then-commit pattern: encode to bytes.Buffer first so encode failures don't commit a half-written response status to wire)
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler wires HTTP decode/encode + auth.Mount for http.device.command.dequeue.v1.
func NewHandler ¶
NewHandler creates a Handler for http.device.command.dequeue.v1.
func (*Handler) RegisterRoutes ¶
func (h *Handler) RegisterRoutes(mux cell.RouteHandler) error
RegisterRoutes mounts the handler on mux via auth.Mount. Uses http.HandlerFunc(h.handle) so governance CH-04/CH-05 AST scans can resolve the handler function body via the Contract→Handler correlation.
type Request ¶
type Request struct {
ID string `json:"id"`
Cursor string `json:"cursor,omitempty"`
Limit int64 `json:"limit,omitempty"`
}
Request — http.device.command.dequeue.v1.request
type Response ¶
type Response struct {
Data []*ResponseDataItem `json:"data"`
NextCursor string `json:"nextCursor"`
HasMore bool `json:"hasMore"`
}
Response — http.device.command.dequeue.v1.response
type ResponseDataItem ¶
type ResponseDataItem struct {
ID string `json:"id"`
DeviceID string `json:"deviceId"`
CommandType string `json:"commandType"`
Payload string `json:"payload"`
Status string `json:"status"`
Attempt int64 `json:"attempt"`
// format: date-time
CreatedAt string `json:"createdAt"`
// format: date-time
SentAt string `json:"sentAt,omitempty"`
// format: date-time
DeliveredAt string `json:"deliveredAt,omitempty"`
// format: date-time
CompletedAt string `json:"completedAt,omitempty"`
}
ResponseDataItem is a generated DTO for contract http.device.command.dequeue.v1.
type Service ¶
type Service interface {
Dequeue(ctx context.Context, req *Request) (DequeueResponseObject, error)
}
Service is the business interface that the http.device.command.dequeue.v1 server cell must implement.
The signature follows the typed-response-envelope strict-server pattern (PR-V1-CONTRACT-TYPED-RESPONSE-ENVELOPE):
- The Service implementation returns one of the generated typed Dequeue{Status}{Suffix} structs (each implements DequeueResponseObject declared in types_gen.go). CH-04 governance enforces that this typed-response set matches contract.yaml http.responses[] declaration exactly.
- The Go error return is reserved for *un-declared* framework 5xx situations (panics, infrastructure faults). The generated handler falls back to httputil.WriteError(err) on this path, which derives the response status from errcode.Kind (or returns 500 for non-errcode errors). Business 4xx / 5xx must be returned as a typed struct.
ref: oapi-codegen pkg/codegen/templates/strict/strict-interface.tmpl@main