Class: Store

Store(String, Object)

Basic query object of the `Reqt` API. This also defines the query language used in Reqt requests.

Constructor

new Store(String, Object)

Parameters:
Name Type Description
String collection - RESTful resource name
Object request - Override request parameters in `fetch()`.
Source:

Methods

as(String)

Define the format of the request, expressed as a file extension.
Parameters:
Name Type Description
String format - File extension of the resource
Source:

at(string)

Define the base URL of the request
Parameters:
Name Type Description
string url - Base URL to request from
Source:

byID(String)

Manipulate the `path` of this request to use the ID given in the argument.
Parameters:
Name Type Description
String id - ID of the resource.
Source:

catch(Function)

Attach a `callback` to the error state of the `Promise` returned by `fetch()`. This function will be called whenever the promise is rejected.
Parameters:
Name Type Description
Function callback
Source:

done()

Convenience method for invoking the `Promise` returned by `fetch()`, but not needing to actually pass a callback into it.
Source:
Returns:
Object the return value of the `Promise`.

sort(String, String)

Manipulate the query params to use the given `by` and `direction` values in the `sort` param.
Parameters:
Name Type Description
String by - Param to sort by
String direction - Direction to sort, e.g. "up", "down",
Source:

then(Function)

Invoke the `Promise` returned by `fetch()` and pass the given callback into it.
Parameters:
Name Type Description
Function callback
Source:
Returns:
Object the return value of the `Promise`.

where(Object)

Pass the given `params` as query parameters to the request.
Parameters:
Name Type Description
Object params - Query parameters
Source:

with(Object)

Send a payload along with the HTTP request. When the `body` passed in is a JS object, it will be converted into JSON, but if it is a String we will just use the raw value as the body.
Parameters:
Name Type Description
Object body - Payload to be sent.
Source: