Request
Http request object.
Static Method Summary
Static Public Methods | ||
public static |
runAsyncTask(taskGenerator: function*()) Helper method to run an asynchronous task defined by a task generator function. |
Static Private Methods | ||
private static |
_callAxios(config: AxiosRequestConfig): Promise<AxiosResponse> Internal method to make an axios request. |
|
private static |
_handleRequestError(error: Object) Internal method to handle errors produced by HTTP requests. |
Constructor Summary
Public Constructor | ||
public |
constructor(auth: Object, contentType: string, timeout: number) Constructor |
Method Summary
Public Methods | ||
public |
Perform a DELETE request. |
|
public |
Perform a GET request. |
|
public |
Perform a POST request. |
|
public |
Perform a PUT request. |
Private Methods | ||
private |
_getConfig(url: string, method: string): AxiosRequestConfig Internal method to create a config file for axios. |
|
private |
_postOrPut(requestMethod: string, url: string, data: Object, uploadFileObj: Object): Promise<AxiosResponse> Internal method to make either a POST or PUT request. |
Static Public Methods
public static runAsyncTask(taskGenerator: function*()) source
Helper method to run an asynchronous task defined by a task generator function.
Params:
Name | Type | Attribute | Description |
taskGenerator | function*() | generator function |
Static Private Methods
private static _callAxios(config: AxiosRequestConfig): Promise<AxiosResponse> source
Internal method to make an axios request.
Params:
Name | Type | Attribute | Description |
config | AxiosRequestConfig | axios configuration object |
Public Constructors
Public Members
Public Methods
public delete(url: string): Promise<AxiosResponse> source
Perform a DELETE request.
Params:
Name | Type | Attribute | Description |
url | string | url of the resource |
public post(url: string, data: Object, uploadFileObj: Object): Promise<AxiosResponse> source
Perform a POST request.
public put(url: string, data: Object, uploadFileObj: Object): Promise<AxiosResponse> source
Perform a PUT request.
Private Methods
private _getConfig(url: string, method: string): AxiosRequestConfig source
Internal method to create a config file for axios.
Return:
AxiosRequestConfig | axios configuration object |
private _postOrPut(requestMethod: string, url: string, data: Object, uploadFileObj: Object): Promise<AxiosResponse> source
Internal method to make either a POST or PUT request.
Params:
Name | Type | Attribute | Description |
requestMethod | string | either 'post' or 'put' |
|
url | string | url of the resource |
|
data | Object | JSON data object |
|
uploadFileObj | Object |
|
custom object with a property with the same name as the API descriptor corresponding to the file and whose value is the file blob |