- string type The type of the model.
- string id The id of the model.
Serialize a model.
- object opts The options for serialization. Available properties:
{array=}
attributes
The list of attributes to be serialized (default: all attributes).{array=}
relationships
The list of relationships to be serialized (default: all relationships).
- object JSONAPI-compliant object
Set/add an attribute to a model.
- string attrName The name of the attribute.
- object value The value of the attribute.
Set/add a relationships to a model.
- string relName The name of the relationship.
- object models The linked model(s).
Remove a model from the store.
- object model The model to destroy.
Retrieve a model by type and id. Constant-time lookup.
- string type The type of the model.
- string id The id of the model.
- object The corresponding model if present, and null otherwise.
Retrieve all models by type.
- string type The type of the model.
- object Array of the corresponding model if present, and empty array otherwise.
Empty the store.
Sync a JSONAPI-compliant payload with the store and return any metadata included in the payload
- object data The JSONAPI payload
- object The model/array of models corresponding to the payload's primary resource(s) and any metadata.
Sync a JSONAPI-compliant payload with the store.
- object data The JSONAPI payload
- object The model/array of models corresponding to the payload's primary resource(s).