Event
Mixin Extends:
Helper class representing a event.
Example:
import { Event, eventService } from 'clinical6';
// Typically use EventService.get()
eventService.get().then(events => console.log(events));
const event = new Event({
"data": {
"id": "1",
"type": "events",
"attributes": {
"udid": "this-is-a-udid-string",
"technology": "ios",
"access_token": "cd68fa04e458d6d1a9d29faec6a329d3",
"push_id": null,
"created_at": "2017-05-19T17:21:26.311Z",
"updated_at": "2017-05-19T17:21:26.311Z",
"app_version": null
}
}
});
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) Constructor for helper class representing an Event |
Member Summary
Public Members | ||
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
Method Summary
Public Methods | ||
public |
Saves a event (insert if id doesn't exist, update if it does) |
|
public |
Saves the current instance of Event |
|
public |
Saves a event (insert if id doesn't exist, update if it does) |
|
public |
Saves/Tracks reported actions from an event - if a mobile user token is available |
Inherited Summary
From class EventModel | ||
public |
|
|
public |
|
|
public |
extras: Any |
|
public |
|
|
public |
|
|
public |
|
Public Constructors
public constructor(json: Object) source
Constructor for helper class representing an Event
Override:
EventModel#constructorParams:
Name | Type | Attribute | Description |
json | Object | json api response from server |
Public Members
Public Methods
public delete(): Promise source
Saves a event (insert if id doesn't exist, update if it does)
Example:
import { Event, Client } from 'clinical6';
// Removes event from server and local storage
const event = new Event({
"id": 1,
"type": "events",
"attributes": {
"udid": "this-is-a-udid-string",
"technology": "ios",
"access_token": "cd68fa04e458d6d1a9d29faec6a329d3",
"push_id": null,
"created_at": "2017-05-19T17:21:26.311Z",
"updated_at": "2017-05-19T17:21:26.311Z",
"app_version": null
}
});
event.delete();
// No longer in storage
Client.instance.storageUtility.has('events', { id: 1 });
public mark(ruleId: String, eventAction: String): Promise source
Saves the current instance of Event
public save(): Promise<Event> source
Saves a event (insert if id doesn't exist, update if it does)
Example:
import { Event, eventService } from 'clinical6';
// Insert is different from other inserts. Uses mobile application key
const event = new Event({
"type": "events",
"attributes": {
"udid": "this-is-a-udid-string",
"technology": "ios",
"access_token": "cd68fa04e458d6d1a9d29faec6a329d3",
"push_id": null,
"created_at": "2017-05-19T17:21:26.311Z",
"updated_at": "2017-05-19T17:21:26.311Z",
"app_version": null
}
});
event.save();
// After you have the authtoken and then you've logged in
// Updates existing event (has existing id)
eventService.get().then(events => events[0].save());