Class Document
publicA Document is a class that wraps the response content from a request to the API
returned by Cache.put
or Cache.peek
, converting resource-identifiers into
record instances.
It is not directly instantiated by the user, and its properties should not be directly modified. Whether individual properties are mutable or not is determined by the record instance itself.
fetch (options) public
Defined in ../packages/store/src/-private/document.ts:110
- options
- Object
- returns
Promise
Fetches the related link for this document, returning a promise that resolves with the document when the request completes. If no related link is present, will fallback to the self link if present
first (options) public
Defined in ../packages/store/src/-private/document.ts:155
- options
- Object
- returns
Promise
Fetches the first link for this document, returning a promise that resolves with the new document when the request completes, or null if there is no first link.
last (options) public
Defined in ../packages/store/src/-private/document.ts:169
- options
- Object
- returns
Promise
Fetches the last link for this document, returning a promise that resolves with the new document when the request completes, or null if there is no last link.
next (options) public
Defined in ../packages/store/src/-private/document.ts:127
- options
- Object
- returns
Promise
Fetches the next link for this document, returning a promise that resolves with the new document when the request completes, or null if there is no next link.
prev (options) public
Defined in ../packages/store/src/-private/document.ts:141
- options
- Object
- returns
Promise
Fetches the prev link for this document, returning a promise that resolves with the new document when the request completes, or null if there is no prev link.
toJSON public
Defined in ../packages/store/src/-private/document.ts:183
- returns
Implemented for JSON.stringify
support.
Returns the JSON representation of the document wrapper.
This is a shallow serialization, it does not deeply serialize the document's contents, leaving that to the individual record instances to determine how to do, if at all.
data public
Defined in ../packages/store/src/-private/document.ts:46
The primary data for this document, if any.
If this document has no primary data (e.g. because it is an error document)
this property will be undefined
.
For collections this will be an array of record instances, for single resource requests it will be a single record instance or null.
errors public
Defined in ../packages/store/src/-private/document.ts:61
The errors returned by the API for this request, if any
identifier public
Defined in ../packages/store/src/-private/document.ts:79
The identifier associated with this document, if any
links public
Defined in ../packages/store/src/-private/document.ts:30
The links object for this document, if any
e.g.
{
self: '/articles?page[number]=3',
}
meta public
Defined in ../packages/store/src/-private/document.ts:70
The meta object for this document, if any