RelatedUserService
Extends:
Service handling RelatedUser calls with specific endpoints.
Constructor Summary
Public Constructor | ||
public |
Update type to be related_users |
Method Summary
Public Methods | ||
public |
delete(relatedUser: RelatedUser, cacheMode: String): Promise |
|
public |
getByUser(params: Object, cacheMode: String): Promise<RelatedUser[]|RelatedUser> |
|
public |
insert(relatedUser: RelatedUser, cacheMode: String): Promise<RelatedUser> |
|
public |
update(relatedUser: RelatedUser, cacheMode: String): Promise<RelatedUser> |
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 Methods
public delete(relatedUser: RelatedUser, cacheMode: String): Promise source
Call a DELETE request on the main obj.type expecting JSON API information.
Override:
JsonApiService#deleteParams:
Name | Type | Attribute | Description |
relatedUser | RelatedUser | RelatedUser in which to delete |
|
cacheMode | String |
|
Override the caching method for this call |
public getByUser(params: Object, cacheMode: String): Promise<RelatedUser[]|RelatedUser> source
Return:
Promise<RelatedUser[]|RelatedUser> | Promise object that returns one relatedUser or a key:relatedUser hashtable |
Throw:
If missing token or missing required parameters |
Example:
import { relatedUserService } from 'clinical6';
// You will be able to access these relatedUsers using the `getByUser` method.
relatedUserService.getByUser().then(relatedUsers => console.log(relatedUsers));
// Additionally, you can retrieve a specific relatedUser with the `get`
// method, using the ID, user type and relationship ('follower' || 'followed') of the desired relatedUser as a parameter.
relatedUser.getByUser({id: 23, type: 'mobile_users', relationship: 'follower'}).then(relatedUser => console.log(relatedUser));
public insert(relatedUser: RelatedUser, cacheMode: String): Promise<RelatedUser> source
Call a POST request on the main obj.type expecting JSON API information.
Override:
JsonApiService#insertParams:
Name | Type | Attribute | Description |
relatedUser | RelatedUser | RelatedUser object in which to insert |
|
cacheMode | String |
|
Override the caching method for this call |
Example:
import { RelatedUser, relatedUserService } from 'clinical6';
const relatedUser = new RelatedUser({...});
// you can insert a relatedUser using the `insert` method.
relatedUserService.insert(relatedUser).then(relatedUser => console.log(relatedUser));
// you could also just call `save` on the relatedUser if it doesn't have an id, which will also
// invoke the `insert` method
relatedUser.save();
public update(relatedUser: RelatedUser, cacheMode: String): Promise<RelatedUser> source
Call a PATCH request on the main obj.type expecting JSON API information.
Override:
JsonApiService#updateParams:
Name | Type | Attribute | Description |
relatedUser | RelatedUser | RelatedUser object in which to update |
|
cacheMode | String |
|
Override the caching method for this call |
Example:
import { RelatedUser, relatedUserService } from 'clinical6';
const relatedUser = new RelatedUser({...});
// you can update a relatedUser using the `update` method.
relatedUserService.update(relatedUser).then(relatedUser => console.log(relatedUser));
// you could also just call `save` on the relatedUser if it has an id, which will also
// invoke the `update` method
relatedUser.save();