Function
Static Public Summary | ||
public |
parseRequest(data: object): String parseRequest() parses the public API's request. It stringifies the object data. |
|
public |
parseResponse(responseText: String, request: XMLHttpRequest): Object({json, error}) parseResponse() is for parsing the response received from the request. |
|
public |
request(method: String, path: String, data: object, accessToken: String, headerChange: String): Promise request() Executes the public API's request. With the Data and URL it calls for the sendAndFollow method. |
|
public |
sendAndFollow(method: String, url: String, data: Object, accessToken: String, headerChange: String): Promise sendAndFollow() executes the public API's request. With the params passed from request(), it hits the API to get a response. It parses the object data with the help of parseRequest() and parseResponse() data. |
|
public |
sendRequest(method: String, url: String, requestData: String, accessToken: String, headerChange: String): Promise sendRequest() executes the public API's request and returns the response. |
Static Public
public parseRequest(data: object): String source
import {parseRequest} from 'FreeBird_SDK/src/APIFunc.js'
parseRequest() parses the public API's request. It stringifies the object data.
Params:
Name | Type | Attribute | Description |
data | object | The original XMLHttpRequest |
public parseResponse(responseText: String, request: XMLHttpRequest): Object({json, error}) source
import {parseResponse} from 'FreeBird_SDK/src/APIFunc.js'
parseResponse() is for parsing the response received from the request.
Params:
Name | Type | Attribute | Description |
responseText | String | The API raw response |
|
request | XMLHttpRequest | The original XMLHttpRequest |
Return:
Object({json, error}) | Parses the public API's response and constructs error messages |
public request(method: String, path: String, data: object, accessToken: String, headerChange: String): Promise source
import {request} from 'FreeBird_SDK/src/APIFunc.js'
request() Executes the public API's request. With the Data and URL it calls for the sendAndFollow method.
public sendAndFollow(method: String, url: String, data: Object, accessToken: String, headerChange: String): Promise source
import {sendAndFollow} from 'FreeBird_SDK/src/APIFunc.js'
sendAndFollow() executes the public API's request. With the params passed from request(), it hits the API to get a response. It parses the object data with the help of parseRequest() and parseResponse() data.