Schedule
Mixin Extends:
Helper class representing a schedule.
Example:
import { Schedule, scheduleService } from 'clinical6';
// Typically use ScheduleService.get()
scheduleService.get().then(schedules => console.log(schedules));
const schedule = new Schedule({
"data": {
"id": "1",
"type": "schedules",
"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 Schedule |
Member Summary
Public Members | ||
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
Method Summary
Public Methods | ||
public |
Saves a schedule (insert if id doesn't exist, update if it does) |
|
public |
Saves a schedule (insert if id doesn't exist, update if it does) |
Inherited Summary
From class ScheduleModel | ||
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
enabled: * |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
Public Constructors
public constructor(json: Object) source
Constructor for helper class representing an Schedule
Override:
ScheduleModel#constructorParams:
Name | Type | Attribute | Description |
json | Object | json api response from server |
Public Members
public get scheduleable: EntryGroup | Rule source
public set scheduleable: EntryGroup | Rule source
Public Methods
public delete(): Promise source
Saves a schedule (insert if id doesn't exist, update if it does)
Example:
import { Schedule, Client } from 'clinical6';
// Removes schedule from server and local storage
const schedule = new Schedule({
"id": 1,
"type": "schedules",
"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
}
});
schedule.delete();
// No longer in storage
Client.instance.storageUtility.has('schedules', { id: 1 });
public save(): Promise<Schedule> source
Saves a schedule (insert if id doesn't exist, update if it does)
Example:
import { Schedule, scheduleService } from 'clinical6';
// Insert is different from other inserts. Uses mobile application key
const schedule = new Schedule({
"type": "schedules",
"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
}
});
schedule.save();
// After you have the authtoken and then you've logged in
// Updates existing schedule (has existing id)
scheduleService.get().then(schedules => schedules[0].save());