Manual Reference Source Test
public class | source

Schedule

Mixin Extends:

ScheduleModel, Helper

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
    }
  }
});

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

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

Static Public Members

public static get type: String source

Public Constructors

public constructor(json: Object) source

Constructor for helper class representing an Schedule

Override:

ScheduleModel#constructor

Params:

NameTypeAttributeDescription
json Object

json api response from server

Public Members

public get mobileUser: User source

public set mobileUser: User source

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)

Return:

Promise

Returns a promise via ajax call.

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)

Return:

Promise<Schedule>

Returns a promise via ajax call.

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());