Enables GET and HEAD, retrieving the resource.
The query component of the request selects what to retrieve. It may state a @grafctory/qest template, or
form-encoded criteria filtering the collection the resource holds, as a client filtering a list would state
them. An empty query retrieves the default view the shape describes. Localised content is negotiated through the
Accept-Language header, as @grafctory/qest prescribes. The server locale serves requests accepting any
language or stating no such header. Values tagged with no language are served whatever the header states.
Every response is marked as varying by Accept-Language, so that HTTP caches keep each language apart.
200 OK with the resource as JSON404 Not Found where the store holds no such resource and the driver is not virtual, or review withholds itOptionalhooks: {Retrieval hooks; if omitted, the shape alone describes what clients may retrieve
Optional Readonlymodel?: Template | ((request: Request) => Template)The server template fixing the entries it states and the collection views clients filter within; if omitted, the shape alone describes what clients may retrieve, hidden members included. A function is called for each request, so the view may depend on the caller, as when scoping a collection to a tenant
Optional Readonlyreview?: (Reviews the retrieved resource before it is served, returning the resource to send, or
undefined to answer 404 Not Found as if the store held none, as when the caller may not see it
This driver
Enables POST, creating a resource from the request body in the collection the resource holds.
The body is validated against the shape of the collected resources. A body stating no identifier is named after
the Slug header, or given a generated name where the header is missing or holds no letter or digit.
201 Created with a Location header pointing to the new resource409 Conflict where the store refuses to create the resource, as when its identifier is takenOptionalhooks: { decode?: (state: unknown, request: Request) => unknown | Promise<unknown> }
Write hooks
Optional Readonlydecode?: (state: unknown, request: Request) => unknown | Promise<unknown>Prepares the decoded JSON body of each request before it is validated, so that defaults may be filled in or values derived from the request, as when stamping the resource with its author
This driver
TypeError Where the driver is virtual, or the shape holds no collection ranging over resources, or several, so that no single collection can receive the new resources
Enables PUT, replacing the resource with the request body, validated against the shape.
The resource keeps the identifier of the request target, so a client cannot redirect the update elsewhere: a
body naming another resource is rejected with 422 Unprocessable Content, and one naming none is completed.
204 No Content where the resource is replaced404 Not Found where the store holds no such resourceOptionalhooks: { decode?: (state: unknown, request: Request) => unknown | Promise<unknown> }
Write hooks
Optional Readonlydecode?: (state: unknown, request: Request) => unknown | Promise<unknown>Prepares the decoded JSON body of each request before it is validated, so that defaults may be filled in or values derived from the request, as when stamping the resource with its author
This driver
TypeError Where the driver is virtual
Model-driven resource driver.
Serves a resource through the HTTP methods enabled on it: its retrieval, the creation of new resources in the collection it holds, its replacement and its removal, so that one driver serves containers, items and standalone resources alike, each enabling only the methods its role in the API calls for and answering others with
405.