Class: RequestBuilder

Request~RequestBuilder(clientnullable, apiFunction, datanullable)

This class is a utility to create custom requests.

Constructor

new RequestBuilder(clientnullable, apiFunction, datanullable)

RequestBuilder Constructor.

RequestBuilder Constructor.

Parameters:
Name Type Attributes Description
client Client <nullable>
apiFunction string
data Object <nullable>
Source:

Methods

createResponse() → {Response}

Create a response object from the response data.

Create a response object from the response data.

Source:
Returns:
Type
Response

get(field, defaultValue) → {*}

Get a defined field value or defaultValue if it does not exist.

Get a defined field value or defaultValue if it does not exist.

Parameters:
Name Type Default Description
field string
defaultValue * null
Source:
Returns:
Type
*

has(field) → {bool}

Check if a field is defined in the request data.

Check if a field is defined in the request data.

Parameters:
Name Type Description
field string
Source:
Returns:
Type
bool

remove(field) → {RequestBuilder}

Remove a field from the request data.

Remove a field from the request data.

Parameters:
Name Type Description
field string
Source:
Returns:
Type
RequestBuilder

set(field, value) → {RequestBuilder}

Set a field value.

Set a field value.

Parameters:
Name Type Description
field string
value *
Source:
Returns:
Type
RequestBuilder

setFunction(apiFunction) → {RequestBuilder}

Set the api function name to call.

Set the api function name to call.

Parameters:
Name Type Description
apiFunction string
Source:
Returns:
Type
RequestBuilder

setScope(apiFunction) → {RequestBuilder}

Set the request scope.

Set the request scope. Use store or domain.

Parameters:
Name Type Description
apiFunction string
Source:
Throws:

Error

Returns:
Type
RequestBuilder

toObject() → {Object}

Reduce the request to a an object.

Reduce the request to a an object.

Source:
Returns:
Type
Object