Documentation
¶
Overview ¶
Package rest implements Githome's REST API v3. It mounts onto a mizu router and is the only place HTTP request handling for the REST surface lives. Handlers call the domain layer for data and the presenter layer for rendering; they never touch the store or git directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
Mount wires the REST routes onto root. The API is served both at the GHES-style /api/v3 prefix and at the bare github.com-style root, sharing one set of handlers and the version/media-type middleware. Health probes sit outside that chain, and any unmatched path returns the GitHub-shaped 404.
Types ¶
type Deps ¶
type Deps struct {
Config config.Config
Logger *slog.Logger
Ready Pinger
Auth *auth.Service
Users *domain.UserService
Repos *domain.RepoService
Issues *domain.IssueService
Pulls *domain.PRService
Reviews *domain.ReviewService
Checks *domain.ChecksService
Hooks *domain.HookService
Events *domain.EventService
Search *domain.SearchService
URLs *presenter.URLBuilder
NodeFormat nodeid.Format
}
Deps are the dependencies the REST surface needs to mount. The auth, domain, and presenter members arrive in M1; a zero member leaves its routes unmounted, which keeps the M0 foundation tests able to build a minimal surface.
type FieldError ¶
type FieldError struct {
Resource string `json:"resource"`
Field string `json:"field"`
Code string `json:"code"`
Message string `json:"message,omitempty"`
}
FieldError is one entry in a 422 validation error's errors array. Code is one of: missing, missing_field, invalid, already_exists, unprocessable, custom.