Get HTTP client for a resource Class This is meant to be overridden if we want to define a client at any time
Set HTTP client
instanceof Client
Backwards compatibility Remove in next major release @todo
Backwards compatibility Remove in next major release @todo
Get an attribute of Resource instance
You can use dot notation here -- eg. resource.get('user.username')
You can also get all properties by not providing any arguments
Alias of resource.resolveAttribute(key)
Like calling instance.constructor but safer: changing objects down the line won't creep up the prototype chain and end up on native global objects like Function or Object
Get related class by key
Persist getting an attribute and get related keys until a key can be found (or not found) TypeError in get() will be thrown, we're just doing the resolveRelated() work for you...
Match all related values in attributes[key]
where key is primary key of related instance defined in Resource.related[key]
Same as Resource.prototype.resolveRelated
except options.deep
defaults to true
Saves the instance -- sends changes as a PATCH or sends whole object as a POST if it's new
Set an attribute of Resource instance and apply getters/setters Do not use Dot Notation here
Setter -- Translate new value into an internal value onto this._attributes[key] Usually this is just setting a key/value but we want to be able to accept anything -- another Resource instance for example. If a Resource instance is provided, set the this.managers[key] as the new manager instance, then set the this.attributes[key] field as just the primary key of the related Resource instance
Validate attributes -- returns empty if no errors exist -- you should throw new errors here
Error[]
Array of Exceptions
Get time delta in seconds of cache expiry
Cache a resource onto this class' cache for cacheMaxAge seconds
Get a cached resource by ID
Get detail route path (eg. /users/123) to be used with HTTP requests
Querystring
Get list route path (eg. /users) to be used with HTTP requests and allow a querystring object
Querystring
Unique resource hash key used for caching and organizing requests
HTTP Get of resource's list route--returns a promise
Options object
Promise
Replace attributes on a cached resource onto this class' cache for cacheMaxAge seconds (useful for bubbling up changes to states that may be already rendered)
Generated using TypeDoc
Cache getter