Class: Collection

Collection

Provides an interface to iterate over all objects in a collection that has pagination via Link headers

new Collection(client, uri, Ctor [, request])

Creates an instance of Collection.
Parameters:
Name Type Argument Description
client ApiClient A reference to the top-level api client
uri String E.g. /api/v1/resources
Ctor Object Class of each item in the collection
request Request <optional>
Fetch API request object

Methods


each(iterator)

Parameters:
Name Type Description
iterator function Function to call with each resource instance

subscribe(config)

Returns a subscription for this collection. Not all collections support this (only System Log at this time).
Parameters:
Name Type Description
config Object Subscription configuration options
Properties
Name Type Description
interval Number Time in ms to wait before checking for more items
next function Function to call with each resource instance
error function Synchronous function to call with each error.
complete function Function to call when the stream is finished