DeviceService
Extends:
Service handling Device calls with specific endpoints.
Constructor Summary
Public Constructor | ||
public |
Update type to be devices |
Method Summary
Public Methods | ||
public |
|
|
public |
|
|
public |
|
|
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 Members
Public Methods
public delete(device: Device, cacheMode: String): Promise source
Call a DELETE request on the main obj.type expecting JSON API information.
Override:
JsonApiService#deleteExample:
import { deviceService } from 'clinical6';
// You will be able to delete a device using `delete`.
deviceService.delete({ id: 23 });
// This will also clear the local storage of this type and id
Test:
- [unit] DeviceService.delete should exist
- [unit] DeviceService.delete should return a promise
- [unit] DeviceService.delete should throw errors for invalid parameters
- [unit] DeviceService.delete should receive a valid response for a delete request
- [unit] DeviceService.delete should remove the element from local storage
public get(params: Object, cacheMode: String): Promise<Device[]|Device> source
Call a GET request expecting JSON API information.
Override:
JsonApiService#getThrow:
If missing token or missing required parameters |
Example:
import { deviceService } from 'clinical6';
// You will be able to access these devices using the `get` method.
deviceService.get().then(devices => console.log(devices));
// Additionally, you can retrieve a specific device with the `get`
// method, using the ID of the desired device as a parameter.
deviceService.get(23).then(device => console.log(device));
public insert(mobileApplicationKey: String, cacheMode: String): Promise<Device> source
Call a POST request on the main obj.type expecting JSON API information.
Override:
JsonApiService#insertExample:
import { Device, deviceService } from 'clinical6';
const device = new Device({...});
// you can insert a device using the `insert` method.
deviceService.insert(mobileApplicationKey).then(device => console.log(device));
// you could also just call `save` on the device if it doesn't have an id, which will also
// invoke the `insert` method
device.save();
public update(device: Device, cacheMode: String): Promise<Device> source
Call a PATCH request on the main obj.type expecting JSON API information.
Override:
JsonApiService#updateExample:
import { Device, deviceService } from 'clinical6';
const device = new Device({...});
// you can update a device using the `update` method.
deviceService.update(device).then(device => console.log(device));
// you could also just call `save` on the device if it has an id, which will also
// invoke the `update` method
device.save();