Documentation ¶
Index ¶
- func AddTopLinks(links jsonapi.Links) jsonapi.ResponseOption
- func Created(resource *jsonapi.Resource, opts ...jsonapi.ResponseOption) jsonapi.Response
- func Error(statusCode int, cause error, opts ...jsonapi.ResponseOption) jsonapi.Response
- func InternalError(err error) jsonapi.Response
- func Ok(body *jsonapi.Document, opts ...jsonapi.ResponseOption) jsonapi.Response
- func ResolveRelativeLinkURLs(baseURL string, resolver jsonapi.URLResolver) jsonapi.ResponseOption
- func ResourceNotFound(ctx *jsonapi.RequestContext) jsonapi.Response
- func WithErrors(causes ...error) jsonapi.ResponseOption
- func WithHeader(key, value string) jsonapi.ResponseOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTopLinks ¶
func AddTopLinks(links jsonapi.Links) jsonapi.ResponseOption
AddTopLinks adds links to the top level of the document.
func InternalError ¶
InternalError sends a JSONAPI formatted 500 error response to the client.
func ResolveRelativeLinkURLs ¶
func ResolveRelativeLinkURLs(baseURL string, resolver jsonapi.URLResolver) jsonapi.ResponseOption
ResolveRelativeLinkURLs traverses the document, affixing the provided base url to any links with relative paths.
func ResourceNotFound ¶
func ResourceNotFound(ctx *jsonapi.RequestContext) jsonapi.Response
ResourceNotFound sends a JSONAPI formatted 404 error response to the client.
func WithErrors ¶
func WithErrors(causes ...error) jsonapi.ResponseOption
WithErrors populates the response document errors field with the provided error messages. If the message is of type jsonapi.ErrorNode, the error will be added directly to the list; otherwise, the error message will be wrapped in a jsonapi.ErrorNode.
func WithHeader ¶
func WithHeader(key, value string) jsonapi.ResponseOption
WithHeader sets the response header.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.