Class Document

public

A 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.

Show:

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

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.

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.

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.

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.

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.