Skip to content
This repository has been archived by the owner on Feb 23, 2019. It is now read-only.

Latest commit

 

History

History
328 lines (258 loc) · 14.5 KB

api.md

File metadata and controls

328 lines (258 loc) · 14.5 KB

redux-coreapi API Reference

Constants

CLIENT_ACTION

Dispatched by action to initiate a Core API action request.

CLIENT_ACTION_FAILURE : string

Dispatched when a Core API action request fails.

CLIENT_ACTION_REQUEST : string

Dispatched immediately before a Core API action request is sent.

CLIENT_ACTION_SUCCESS : string

Dispatched when a Core API action request succeeds.

CLIENT_GET

Dispatched by get to initiate a Core API document request.

CLIENT_GET_FAILURE : string

Dispatched when a Core API document request fails.

CLIENT_GET_REQUEST : string

Dispatched immediately before a Core API document request is sent.

CLIENT_GET_SUCCESS : string

Dispatched when a Core API document request succeeds.

Functions

action(client, document, keys, [params])ClientAction

Make a Core API action request.

get(client)ClientGet

Make a Core API document request.

coreapiMiddleware()

Redux middleware that processes Core API action and document requests.

For both Core API action and get requests made by calling the corresponding redux-coreapi action and get functions, the behavior is as follows:

  1. A ClientActionRequest or ClientGetRequest is dispatched with the data used to make the request.
  2. The supplied coreapi.Client is used to asynchronously make the request.
  3. Upon completion, a Redux action for the result is dispatched:

Any other action types will not be processed.

Typedefs

ClientAction : Object

Contains the data for an action call.

ClientActionFailure : Object

Contains the data for a failed Core API action request.

ClientActionRequest : Object

Contains the data for a Core API action request.

ClientActionSuccess : Object

Contains the response data for a successful Core API action request.

ClientGet : Object

Contains the data for a get call.

ClientGetFailure : Object

Contains the data for a failed Core API document request.

ClientGetRequest : Object

Contains the data for a Core API document request.

ClientGetSuccess : Object

Contains the response data for a successful Core API document request.

CLIENT_ACTION

Dispatched by action to initiate a Core API action request.

Kind: global constant

CLIENT_ACTION_FAILURE : string

Dispatched when a Core API action request fails.

Kind: global constant

CLIENT_ACTION_REQUEST : string

Dispatched immediately before a Core API action request is sent.

Kind: global constant

CLIENT_ACTION_SUCCESS : string

Dispatched when a Core API action request succeeds.

Kind: global constant

CLIENT_GET

Dispatched by get to initiate a Core API document request.

Kind: global constant

CLIENT_GET_FAILURE : string

Dispatched when a Core API document request fails.

Kind: global constant

CLIENT_GET_REQUEST : string

Dispatched immediately before a Core API document request is sent.

Kind: global constant

CLIENT_GET_SUCCESS : string

Dispatched when a Core API document request succeeds.

Kind: global constant

action(client, document, keys, [params]) ⇒ ClientAction

Make a Core API action request.

Kind: global function
Returns: ClientAction - - A Redux action for the Core API action request. If an argument contains invalid data, a {@see ClientActionError} will be returned instead.

Param Type Description
client coreapi.Client The Core API client instance with which the request will be made.
document coreapi.Document The Core API document describing the API to which the request will be sent.
keys Array.<string> An array of strings describing the action to request. For example, ["users", "list"] or ["widgets", 0, "update"].
[params] Object Optional data to include with the request. The structure of the object depends on the action being requested.

get(client) ⇒ ClientGet

Make a Core API document request.

Kind: global function
Returns: ClientGet - - A Redux action for the Core API get request. If an argument contains invalid data, a {@see ClientGetError} will be returned instead.

Param Type Description
client coreapi.Client The Core API client instance with which the request will be made.

Properties

Name Type Description
url string The URL of the document to request.

coreapiMiddleware()

Redux middleware that processes Core API action and document requests.

For both Core API action and get requests made by calling the corresponding redux-coreapi action and get functions, the behavior is as follows:

  1. A ClientActionRequest or ClientGetRequest is dispatched with the data used to make the request.
  2. The supplied coreapi.Client is used to asynchronously make the request.
  3. Upon completion, a Redux action for the result is dispatched:

Any other action types will not be processed.

Kind: global function

ClientAction : Object

Contains the data for an action call.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_ACTION}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request will be made.
payload.document coreapi.Document The Core API schema document describing the API to which the request will be sent.
payload.keys Array.<string> An array of strings describing the action to request. For example, ["users", "list"] or ["widgets", 0, "update"].
payload.params Object Optional data to include with the request. The structure of the object depends on the action being requested.

ClientActionFailure : Object

Contains the data for a failed Core API action request.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_ACTION_FAILURE}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request was be made.
payload.document coreapi.Document The Core API schema document describing the API to which the request was sent.
payload.keys Array.<string> An array of strings describing the action that was requested. For example, ["users", "list"] or ["widgets", 0, "update"].
payload.params Object Optional data included with the request. The structure of the object depends on the action requested.
payload.error Error The error encountered by the action request.

ClientActionRequest : Object

Contains the data for a Core API action request.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_ACTION_REQUEST}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request will be made.
payload.document coreapi.Document The Core API schema document describing the API to which the request will be sent.
payload.keys Array.<string> An array of strings describing the action to request. For example, ["users", "list"] or ["widgets", 0, "update"].
payload.params Object Optional data to include with the request. The structure of the object depends on the action being requested.

ClientActionSuccess : Object

Contains the response data for a successful Core API action request.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_ACTION_SUCCESS}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request was be made.
payload.document coreapi.Document The Core API schema document describing the API to which the request was sent.
payload.keys Array.<string> An array of strings describing the action that was requested. For example, ["users", "list"] or ["widgets", 0, "update"].
payload.params Object Optional data included with the request. The structure of the object depends on the action requested.
payload.result Object The response data from the request.

ClientGet : Object

Contains the data for a get call.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_GET}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request will be made.
payload.url string The URL of the document being requested.

ClientGetFailure : Object

Contains the data for a failed Core API document request.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_GET_FAILURE}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request will be made.
payload.url string The URL of the document that was requested.
payload.error Error The error encountered by the document request.

ClientGetRequest : Object

Contains the data for a Core API document request.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_GET_REQUEST}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request will be made.
payload.url string The URL of the document being requested.

ClientGetSuccess : Object

Contains the response data for a successful Core API document request.

Kind: global typedef
Properties

Name Type Description
type string The type of the Redux action. Must always be set to {@see CLIENT_GET_SUCCESS}.
payload Object An object containing the data for the request.
payload.client coreapi.Client The Core API client instance with which the request will be made.
payload.url string The URL of the document that was requested.
payload.document coreapi.Document The Core API document.