Deferred promises when this.resolve()
hits the max requests in this.batchSize
List of stringified Primary Keys, even if this.value
is a list of objects, or Resource instances
Is true
when resolve()
is called and first page of results loads up to this.batchSize
objects
Getter -- Same as manager.resources except returns first node
Getter -- get this._resources
but make sure we've actually retrieved the objects first
Throws AttributeError if this.resolve()
hasn't finished
Add a resource to the manager
Resource instance
Calls pending functions in this.deferred
until it's empty. Runs this.resolve()
first if it hasn't been ran yet
DetailOpts
Create a copy of this
except with new value(s)
Get all loaded resources relevant to this relation
Like manager.resources getter except it won't throw an AttributeError and will return with any loaded resources if its ID is listed in this.primaryKeys
Get unique key property from object literal and turn it into a string
Object
Get unique key from resource instance
Resource
Get a single resource from the endpoint given an ID
String | Number
Same as getOne but allow lookup by index
Number
Get the current value and the content type and turn it into a list of primary keys
String
Return a constructor so we can guess the content type. For example, if an object literal
is passed, this function should return Object
, and it's likely one single object literal representing attributes.
If the constructor is an Array
, then all we know is that there are many of these sub items (in which case, we're
taking the first node of that array and using that node to guess). If it's a Number
, then it's likely
that it's just a primary key. If it's a Resource
instance, it should return Resource
. Etc.
Function
Check if values exist on manager
Primary function of the RelatedManager -- get some objects (this.primaryKeys
) related to some
other Resource (this.to
instance). Load the first n objects (this.batchSize
) and set this.resolved = true
.
Subsequent calls may be required to get all objects in this.primaryKeys
because there is an inherent
limit to how many requests that can be made at one time. If you want to remove this limit, set this.batchSize
to Infinity
DetailOpts
Generated using TypeDoc
When sending
this.resolve()
, only send out the firstn
requests wheren
isthis.batchSize
. You can callthis.all()
to recursively get all objects