-
Notifications
You must be signed in to change notification settings - Fork 1
HalDocument
Mihael Safaric edited this page Feb 20, 2019
·
14 revisions
When fetching a list of resources, some other data may be retrieved in the response (ie. pagination information).
Note: HalDocument
is opinionated. If behaviours of HalDocument
are not fully suitable for your case, you can create an additional class which extends HalDocument
and then use that class instead of pure HalDocument
class. (TBD this feature still does not exist)
When an instance of HalDocument
is created, it gets two parameters in the constructor:
-
rawResponse
:HttpResponse<any>
- response retrieved from the API
-
modelClass
:{new(...args): Model }
- model class which will be used for creating models
Once instantioated, HalDocument
parses rawResponse
and generates models and pagination properties.
-
models
:Array<Model>
- instances of
modelClass
class which is passed through the constructor
- instances of
-
pagination
:Pagination
- instance of
Pagination
class, TODO make a way to override Pagination class on DatastoreService level, and on ModelService level
- instance of