24 lines
1.2 KiB
Go
24 lines
1.2 KiB
Go
// Package api holds the request and response bodies of the HTTP API — the
|
|
// wire contract, kept apart from the handlers that serve it. The swaggo
|
|
// annotations on the handlers reference these types by name (api.VideoResponse
|
|
// and so on), so renaming one changes the generated spec.
|
|
package api
|
|
|
|
// HealthResponse is the body of GET /health.
|
|
type HealthResponse struct {
|
|
Status string `json:"status" example:"ok"`
|
|
}
|
|
|
|
// ProblemDetails is an error body in the RFC 9457 "Problem Details for HTTP
|
|
// APIs" format. Type stays "about:blank" — the value RFC 9457 defines for
|
|
// problems with no dedicated documentation URI. Title is a short summary that
|
|
// stays identical for every occurrence of the same problem, so clients can
|
|
// branch on it; Detail explains this particular occurrence and is the only
|
|
// member that varies with request data.
|
|
type ProblemDetails struct {
|
|
Type string `json:"type" example:"about:blank"`
|
|
Title string `json:"title" example:"Title is required."`
|
|
Status int `json:"status" example:"422"`
|
|
Detail string `json:"detail,omitempty" example:"The 'title' field was absent or contained only whitespace. Every video needs a non-empty title."`
|
|
}
|