#Index
Classes
#class: EndpointConfig Members
##new EndpointConfig() This class represents one configuration for an endpoint
##endpointConfig.route(route) Set the route to this endpoint
Params
- route
string
- The endpoint route defined as string
Returns: EndpointConfig - Returns the endpoint config object
##endpointConfig.model(model)
Set the model that is used to transform the response
Params
- model
string
- The model defined as string
Returns: EndpointConfig - Returns the endpoint config object
##endpointConfig.container(container)
Set the container that wraps the response. Default is null.
Params
- container
string
- The container defined as string
Returns: EndpointConfig - Returns the endpoint config object
#class: Endpoint
Members
##new Endpoint(endpoint, endpointConfig, baseRoute, headResponseHeaderPrefix, $resource, $log, $injector, $q) Class representing an Endpoint with all the functionality for receiving, saving and updating data from the backend
Params
- endpoint
string
- The name of the endpoint - endpointConfig
EndpointConfig
- Config of the endpoint which was defined earlier - baseRoute
string
- URL to the backend - headResponseHeaderPrefix
string
- Prefix of head request header - $resource
$resource
- The Angular $resource factory - $log
$log
- The Angular $log factory - $injector
$injector
- The Angular $injector factory - $q
$q
- The Angular $q factory
##endpoint.put Update an object
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters - model
Model
- The model to be updated
Returns: Promise.<Model,Error>
##endpoint.post
Save an object
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters - model
Model
- The model to be updated
Returns: Promise.<Model,Error>
##endpoint.get(params)
Call an endpoint and map the response to one or more models given in the endpoint config
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters
Returns: Promise.<Model,Error>
##endpoint.query(params)
Call an endpoint and map the response to one or more models given in the endpoint config. As opposed
to the get
, this method expects an array to be returned from the endpoint.
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters
Returns: Promise.<Model,Error>
##endpoint.head(params)
Call an endpoint with the HEAD method
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters
Returns: Promise.<object,Error>
##endpoint.update(params, model)
Update an object
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters - model
Model
- The model to be updated
Returns: Promise.<Model,Error>
##endpoint.save(params, model)
Save an object
Params
- params
object
- The parameters that ether map in the route or get appended as GET parameters - model
Model
- The model to be updated
Returns: Promise.<Model,Error>
#class: Model
Members
##new Model() Abstract model class
##model.afterLoad() This method gets called after the response was transformed into te model. It's helpful when you want to remap attributes or make some changed. To use it, just override it in the concrete model.
##model.beforeSave() This method gets called before a model gets sent to the backend. It's helpful when you want to remap attributes or make some changed. To use it, just override it in the concrete model.
##model.init(object) Every model must call this method in it's constructor. It in charge of mapping the given object to the model.
Params
- object
object
- The given object. This can come ether from the backend or created manualy
##model.callBeforeSave(models)
This method can be used to call the beforeSave method on a related model.
Params
- models
Model/array
- Can ether be a model or an array of models
Deprecated
##model.isValid()
Validate the properties of the model