Resource endpoint for this request
Options for this request instance
Options passed via the constructor
Options passed to the actual fetch request
Optional
responseFetch response object, available after the request is done
Static
defaultOptions used for all requests, unless overridden individually
Load attributes defined by the resource but not part of the model
request.auxiliary('measurements')
The attribute to filter on
Group results by a given attribute
request.groupBy('work_id')
Allows for filtering through relations
request.filter('authors', 'name', 'LIKE', 'John')
request.filter('authors', 'name', 'LIKE', ['John', 'Doe'])
request.filter('authors', 'name', 'LIKE', 'John', 'AND')
request.filter('authors', 'name', 'EQUAL', 'John', 'AND')
The relation to filter on
Optional
attribute: stringThe attribute to filter on
Optional
operator: OperatorOperator to use for filtering
Optional
value: string | string[]Value to filter on
Combinator for any further has
filters
Lists all available resources on the specified endpoint
Limit the number of results returned
Usage:
request.limit(10)
request.limit(10, 20)
Number of result to return
Optional
offset: numberStarting offset
Specify a subset of attributes to return in the response
request.only('name', 'description')
Order results by a given attribute
request.orderBy('name', 'ASC')
request.orderBy('name', 'DESC')
The attribute to order by
Optional
direction: "ASC" | "DESC"Direction to order by
Allows for filtering through pre defined scopes, if any
request.scope('published')
Optional
qualifier: stringRetrieves a single resource from the specified endpoint
Optional
id: stringUpdates a single resource on the specified endpoint
Optional
payload: unknownAllows for filtering on attributes on the requested object
request.where('name', 'LIKE', 'John')
request.where('name', 'LIKE', ['John', 'Doe'])
request.where('name', 'LIKE', 'John', 'AND')
request.where('name', 'EQUAL', 'John', 'AND')
The attribute to filter on
Operator to use for filtering
Value to filter on
Combinator for any further where
filters
Load relations for the requested object
E.g. .with('authors') or a deeper nested relation .with('authors.name'), which will load parent relations as well.
request.with('authors')
request.with('authors.works')
Static
fromCreate a new ApiRequest from a given URL
PublitApiRequest.fromUrl("https://api.publit.com/publishing/v2.0/works/1")
Class for making requests to Publit Core and similar API:s