A class implementing the Angular HtttpClient methods get
,patch
,post
, delete
and request
.
The base CRUD url.
The data cache time to live. (default 100 seconds, minimum 10 seconds)
Additional endpoint for filtering operations used in the advancedList
method.
Disable new updates to be cached.
Set additional headers to all requests of the service.
Function to serialize the instance data before sending to serve in the edit()
and create()
methods.
By setting the parameter setFullRecordOnGet
to true
,
the retrieved record using the get()
method will be automatically marked as full
.
In this context, 'full' means that the record possesses all fields, including any required nested fields.
On the other hand, if setFullRecordOnGet
is set to false
, the retrieved record will not be marked as 'full'.
In this case, you need to add a calculated field _full: true
to the fully serialized records on the server-side.
Is the data service initiated?
This method constucts a POST
request that retrives a list of selected entity instances.
The selecting parameters are passed in the request body through the parameter options
. These parameters must be interpreted
by the backend.
In principle this method should be used in list views where the server would return non-nested or partial objects.
String query parameter: search string to be processed by the server.
Define the pagination properties. Example: { itemsPerPage: 50, page: 2, orderBy: 'last_name' } will be parsed to "http://my_url/?limit=50&page=2&orderBy=last_name&search=qsearch"
Selecting parameters passed to the server within the request body.
Alternative endpoint URL.
An Observable
of the response.
Constructs a POST
request to create a new entity record in the server database.
partial instance of object.
An Observable
of the response. If the server response includes the data of the created record, this data will be cached.
Constructs a PATCH
request to update an existing record in the server database.
Unique identifier of the entity record.
An Observable
of the response. If the server response includes the data of the created record, this data will update the cache.
Free memory by deleting outdated instances from the cache.
Constructs a PATCH
request to update an existing instance in the server database.
partial record of object.
An Observable
of the response. If the server response includes the data of the created instance, this data will update the cache.
Constructs a GET
request that retrieves the entity's fully nested data by its unique identifier (id) and saves it in the data cache, reducing the number of server accesses.
The default URL endpoint is used, appended by "/${id}/".
If the property setFullRecordOnGet
is set to true
, the retrieved record will automatically receive an extra field _full=true
, indicating that the record contains all fields and required nested fields.
This method will always request the server if the _full
field of the record is set to false
.
The unique identifier of the entity instance.
false
: Get data from the local cache if available. true
: Get data from the server and update the local cache.
An alternative endpoint URL.
An Observable
of the service response.
Constructs a GET
request that retrives a list of entity instances. In principle this method should be used to fetched non-nested or partial objects.
The fully nested object could be retrived in the detail view by using the method get().
String query parameter: search string to be processed by the server.
Define the pagination properties. Example: { itemsPerPage: 50, page: 2, orderBy: 'last_name' } will be parsed to "http://my_url/?limit=50&page=2&orderBy=last_name&search=qsearch"
Alternative endpoint URL.
An Observable
of the response.
Mark all cached data as outdated
Mark cached record as outdated
Instance id to be marked as outdated.
Delete short-lived server response cache. This data cache is only used for listing, common in pagination operations.
Search instances locally.
String to search in the object fields.
Limiting search to specific collection of ids.
The cached items that matches the search input.
Generated using TypeDoc
Create a Cached Data Service.