EventService
Extends:
Service handling Event calls with specific endpoints.
Constructor Summary
Public Constructor | ||
public |
Update type to be events |
Method Summary
Public Methods | ||
public |
|
|
public |
|
|
public |
|
|
public |
trackEvents(resource: String, action: String, context: Object): Promise this method was deprecated. Track an event done by a mobile user
This controller allows the client to report actions that the user has taken in order to respond with the correct callbacks
|
|
public |
|
Inherited Summary
From class AbstractService | ||
public get |
|
|
public set |
|
|
public |
|
|
private |
|
From class JsonApiService | ||
public |
options: * |
|
public |
Call a DELETE request on the main obj.type expecting JSON API information. |
|
public |
Call a GET request expecting JSON API information. |
|
public |
async getChildren(parent: Object, child: Object, options: String): Promise Call a GET request expecting JSON API information for children given a parent. |
|
public |
Call a POST request on the main obj.type expecting JSON API information. |
|
public |
Call a PATCH request on the main obj.type expecting JSON API information. |
Public Constructors
Public Methods
public delete(event: Event, cacheMode: String): Promise source
Call a DELETE request on the main obj.type expecting JSON API information.
Override:
JsonApiService#deleteExample:
import { eventService } from 'clinical6';
// You will be able to delete a event using `delete`.
eventService.delete({ id: 23 });
// This will also clear the local storage of this type and id
Test:
- [unit] EventService.delete should exist
- [unit] EventService.delete should return a promise
- [unit] EventService.delete should throw errors for invalid parameters
- [unit] EventService.delete should receive a valid response for a delete request
- [unit] EventService.delete should remove the element from local storage
public get(params: Object, cacheMode: String): Promise<Event[]|Event> source
Call a GET request expecting JSON API information.
Override:
JsonApiService#getThrow:
If missing token or missing required parameters |
Example:
import { eventService } from 'clinical6';
// You will be able to access these events using the `get` method.
eventService.get().then(events => console.log(events));
// Additionally, you can retrieve the subcategories for a specific event with the `get`
// method, using the ID of the desired event as a parameter.
eventService.get({ id: 23 }).then(event => console.log(event));
public insert(event: Event, cacheMode: String): Promise<Event> source
Call a POST request on the main obj.type expecting JSON API information.
Override:
JsonApiService#insertExample:
import { Event, eventService } from 'clinical6';
const event = new Event({...});
// you can insert a event using the `insert` method.
eventService.insert(mobileApplicationKey).then(event => console.log(event));
// you could also just call `save` on the event if it doesn't have an id, which will also
// invoke the `insert` method
event.save();
public trackEvents(resource: String, action: String, context: Object): Promise source
Params:
Name | Type | Attribute | Description |
resource | String |
|
The resource to be tracked |
action | String |
|
The resource to be tracked |
context | Object |
|
Hash of fields that provide context for the action |
context.value | String |
|
The value (example: "approved") |
Throw:
If missing token or missing required parameters |
Decorators:
- deprecate
Example:
import { eventService } from 'clinical6';
eventService.trackEvents('callback', 'patient');
eventService.trackEvents('callback', 'patient', { value: 'approved' });
public update(event: Event, cacheMode: String): Promise<Event> source
Call a PATCH request on the main obj.type expecting JSON API information.
Override:
JsonApiService#updateExample:
import { Event, eventService } from 'clinical6';
const event = new Event({...});
// you can update a event using the `update` method.
eventService.update(event).then(event => console.log(event));
// you could also just call `save` on the event if it has an id, which will also
// invoke the `update` method
event.save();