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

Commit

Permalink
Updated changelog and readme files.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-manuilov committed Jun 18, 2017
1 parent 26895d6 commit e99b13f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log

## v1.1.0 (2017-06-dd)
## v1.1.0 (2017-06-19)

**Implemented enhancements:**

- createActions and createRequests functions: `namespace` argument has been replaced with `args` to allow support multiple options, `namespace` argument becomes a part of `args` object.
- createActions: added ability to skip some fetch functions generation.
- createRequests: added ability to skip some request functions generation.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,22 @@ This package uses ES6 fetch and promises to make AJAX requests, so you might als

The package exports three function which you can use to create actions and build a reducer.

### createActions(name, host, endpoints, namespace)
### createActions(name, host, endpoints, args)

Returns an object with a set of function which you can use to fetch data from REST API.

- **name** _(string)_ - Arbitrary name which will be used in action types to distinguish different actions.
- **host** _(string)_ - URL address to your API's root. Usually it will look like: `http://mysite.com/wp-json/`.
- **endpoints** _(array)_ - A list of endpoints which you want to build actions for. It could be something like `['posts', 'categories']`.
- **namespace** _(string)_ - Optional. The namespace for your endpoints. By default it is `wp/v2`.
- **args** _(object)_ - Optional. The options objects which supports following params:
- **namespace** _(string)_ - The namespace for your endpoints. By default it is `wp/v2`.
- **fetch** _(boolean)_ - Determines whether or not `fetch` function need to be generated.
- **fetchEndpoint** _(boolean)_ - Determines whether or not `fetchEndpoint` function need to be generated.
- **fetchById** _(boolean)_ - Determines whether or not `fetchById` function need to be generated.
- **fetchEndpointById** _(boolean)_ - Determines whether or not `fetchEndpointById` function need to be generated.
- **fetchAll** _(boolean)_ - Determines whether or not `fetchAll` function need to be generated.
- **fetchAllEndpoint** _(boolean)_ - Determines whether or not `fetchAllEndpoint` function need to be generated.
- **fetchAllEndpointById** _(boolean)_ - Determines whether or not `fetchAllEndpointById` function need to be generated.

```js
// actionCreators.js
Expand Down Expand Up @@ -76,13 +84,21 @@ const rootReducer = combineReducers({

export default rootReducer;
```
### createRequests(host, endpoints, namespace)
### createRequests(host, endpoints, args)

Helper function which generates request functions to endpoints which you can use to group multiple requests into one action:

- **host** _(string)_ - URL address to your API's root. Usually it will look like: `http://mysite.com/wp-json/`.
- **endpoints** _(array)_ - A list of endpoints which you want to build actions for. It could be something like `['posts', 'categories']`.
- **namespace** _(string)_ - Optional. The namespace for your endpoints. By default it is `wp/v2`.
- **args** _(object)_ - Optional. The options objects which supports following params:
- **namespace** _(string)_ - The namespace for your endpoints. By default it is `wp/v2`.
- **request** _(boolean)_ - Determines whether or not `request` function need to be generated.
- **requestEndpoint** _(boolean)_ - Determines whether or not `requestEndpoint` function need to be generated.
- **requestById** _(boolean)_ - Determines whether or not `requestById` function need to be generated.
- **requestEndpointById** _(boolean)_ - Determines whether or not `requestEndpointById` function need to be generated.
- **requestAll** _(boolean)_ - Determines whether or not `requestAll` function need to be generated.
- **requestAllEndpoint** _(boolean)_ - Determines whether or not `requestAllEndpoint` function need to be generated.
- **requestAllEndpointById** _(boolean)_ - Determines whether or not `requestAllEndpointById` function need to be generated.

```js
// actionCreators.js
Expand Down

0 comments on commit e99b13f

Please sign in to comment.