ItemResource
Extends:
Direct Subclass:
API abstract item resource class.
Constructor Summary
Public Constructor | ||
public |
constructor(url: string, auth: Object) Constructor |
Member Summary
Public Members | ||
public |
collection: * |
|
public get |
Get the item's data object (REST API descriptors). |
Method Summary
Public Methods | ||
public |
Fetch this item resource from the REST API. |
|
public |
getPUTParameters(): string[] Get an array of parameter names that can be used as properties of the data object in PUT requests. |
Private Methods | ||
private |
Internal helper method to make a DELETE request to this item resource through the REST API. |
|
private |
_getResource(linkRelation: string, ResourceClass: Object, searchParams: Object, timeout: number): Promise<ResourceClass> Internal method to fetch a related resource from the REST API that is referenced by a link relation within the item object. |
|
private |
Internal helper method to make a PUT request to this item resource through the REST API. |
Inherited Summary
From class Resource | ||
public static |
Helper method to make a deep copy clone of the passed object resource. |
|
public get |
Return true if the resource object contains any data. |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
Make a deep copy clone of this object resource. |
Public Constructors
Public Members
Public Methods
public get(timeout: number): Promise<this> source
Fetch this item resource from the REST API.
Params:
Name | Type | Attribute | Description |
timeout | number |
|
request timeout |
public getPUTParameters(): string[] source
Get an array of parameter names that can be used as properties of the data object in PUT requests.
Return:
string[] (nullable: true) | array of PUT data property name or null if this list resource's data has not been fetched from the API yet or it doesn't support PUT requests. |
Private Methods
private _delete(timeout: number): Promise source
Internal helper method to make a DELETE request to this item resource through the REST API.
Params:
Name | Type | Attribute | Description |
timeout | number |
|
request timeout |
private _getResource(linkRelation: string, ResourceClass: Object, searchParams: Object, timeout: number): Promise<ResourceClass> source
Internal method to fetch a related resource from the REST API that is referenced by a link relation within the item object.
Params:
Name | Type | Attribute | Description |
linkRelation | string | ||
ResourceClass | Object | ||
searchParams | Object |
|
search parameters object which is resource-specific |
searchParams.limit | number |
|
page limit |
searchParams.offset | number |
|
page offset |
timeout | number |
|
request timeout |
Throw:
throw error if this item resource has not yet been fetched from the REST API |
|
throw error when the link relation is not found |