refresh

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler wires HTTP decode/encode + auth.Mount for http.auth.refresh.v1.

func NewHandler

func NewHandler(svc Service) *Handler

NewHandler creates a Handler for http.auth.refresh.v1. This endpoint is Public (JWT-exempt); no policy argument is accepted. auth.Route{Public: true} is emitted by RegisterRoutes so the listener auth middleware skips JWT verification for this route.

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.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler so *Handler can be used directly in tests and as an http.Handler argument without wrapping.

type Refresh200JSONResponse

type Refresh200JSONResponse Response

Refresh200JSONResponse renders an HTTP 200 success response. Marshals the underlying Response DTO as a JSON body.

type Refresh400ErrorResponse

type Refresh400ErrorResponse struct {
	Body errcode.Error
}

Refresh400ErrorResponse 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 Refresh401ErrorResponse

type Refresh401ErrorResponse struct {
	Body errcode.Error
}

Refresh401ErrorResponse renders an HTTP 401 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 Refresh413ErrorResponse

type Refresh413ErrorResponse struct {
	Body errcode.Error
}

Refresh413ErrorResponse renders an HTTP 413 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 Refresh503ErrorResponse

type Refresh503ErrorResponse struct {
	Body errcode.Error
}

Refresh503ErrorResponse renders an HTTP 503 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 RefreshResponseObject

type RefreshResponseObject interface {
	// contains filtered or unexported methods
}

RefreshResponseObject is the typed response envelope for http.auth.refresh.v1. Service.Refresh must return one of the Refresh{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 Request

type Request struct {
	RefreshToken string `json:"refreshToken,omitempty"`
}

Request — http.auth.refresh.v1.request

type Response

type Response struct {
	Data *ResponseData `json:"data"`
}

Response — http.auth.refresh.v1.response

type ResponseData

type ResponseData struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	// format: date-time
	ExpiresAt             string `json:"expiresAt"`
	SessionID             string `json:"sessionId"`
	UserID                string `json:"userId"`
	PasswordResetRequired bool   `json:"passwordResetRequired"`
}

ResponseData is a generated DTO for contract http.auth.refresh.v1.

type Service

type Service interface {
	Refresh(ctx context.Context, req *Request) (RefreshResponseObject, error)
}

Service is the business interface that the http.auth.refresh.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 Refresh{Status}{Suffix} structs (each implements RefreshResponseObject 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL