Home Manual Reference Source Test

Function

Static Public Summary
public

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:

NameTypeAttributeDescription
data object

The original XMLHttpRequest

Return:

String

Stringify 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:

NameTypeAttributeDescription
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.

Params:

NameTypeAttributeDescription
method String

HTTP method

path String

The resource's path

data object

Data to send along with the request

accessToken String

Auth token for authentication

headerChange String

Parameters that will be sent

Return:

Promise

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.

Params:

NameTypeAttributeDescription
method String

The HTTP method (GET, POST, PUT, DELETE)

url String

The resource's url

data Object

Data to send along with the request

accessToken String

Authentication token for authentication

headerChange String

Parameters that will be sent

Return:

Promise

public sendRequest(method: String, url: String, requestData: String, accessToken: String, headerChange: String): Promise source

import {sendRequest} from 'FreeBird_SDK/src/APIFunc.js'

sendRequest() executes the public API's request and returns the response.

Params:

NameTypeAttributeDescription
method String

The HTTP method (GET, POST, PUT, DELETE)

url String

The resource's url

requestData String

Data to send along with the request

accessToken String

Authentication token for authentication

headerChange String

Parameters that will be sent

Return:

Promise