Manual Reference Source Test
import TemporaryIdService from 'clinical6/src/services/TemporaryIdService.js'
public class | source

TemporaryIdService

Extends:

AbstractServiceJsonApiService → TemporaryIdService

Service handling TemporaryId calls with specific endpoints.

Constructor Summary

Public Constructor
public

Update type to be temporaryIds

Method Summary

Public Methods
public

async get(temporaryId: Object, cacheMode: String): Promise<TemporaryId>

public

async insert(temporaryId: Object, cacheMode: String): Promise<TemporaryId>

Inherited Summary

From class AbstractService
public get
public set
public
private
From class JsonApiService
public

options: *

public

async delete(obj: Object, options: String): Promise

Call a DELETE request on the main obj.type expecting JSON API information.

public

async get(params: Object, options: String): Promise

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

async insert(obj: Object, options: String): Promise

Call a POST request on the main obj.type expecting JSON API information.

public

async update(obj: Object, options: String): Promise

Call a PATCH request on the main obj.type expecting JSON API information.

Public Constructors

public constructor() source

Update type to be temporaryIds

Override:

JsonApiService#constructor

Public Methods

public async get(temporaryId: Object, cacheMode: String): Promise<TemporaryId> source

Call a GET request expecting JSON API information.

Override:

JsonApiService#get

Params:

NameTypeAttributeDescription
temporaryId Object
  • optional

Parameters used to get information from server (such as token)

cacheMode String
  • optional

Override the caching method for this call

Return:

Promise<TemporaryId>

Promise object that returns one TemporaryId

Throw:

Clinical6Error

If missing token or missing required parameters

Example:

import { temporaryIdService } from 'clinical6';

// You will be able to access the temporary identifier data and associated user using the `get` method.
temporaryIdService.get().then(temporaryId => console.log(temporaryId));

// You can retrieve the temporary identifier data and associated user using `get`
// method, using the temporary identifier token as a parameter.
temporaryIdService.get(temporaryId).then(temporaryId => console.log(temporaryId));

Test:

public async insert(temporaryId: Object, cacheMode: String): Promise<TemporaryId> source

Call a POST request on the main obj.type expecting JSON API information.

Override:

JsonApiService#insert

Params:

NameTypeAttributeDescription
temporaryId Object
  • optional

Parameters used to get information from server (such as id)

cacheMode String
  • optional

Override the caching method for this call

Return:

Promise<TemporaryId>

Inserted temporaryId

Example:

import { TemporaryId, temporaryIdService } from 'clinical6';
const temporaryId = new TemporaryId({...});

// you can insert a temporaryId using the `insert` method.
temporaryIdService.insert(temporaryId).then(temporaryId => console.log(temporaryId));

// you could also just call `save` on the temporaryId if it doesn't have an id, which will also
// invoke the `insert` method
temporaryId.save();

Test: