Comparing version 7.1.0 to 7.2.0
@@ -6,2 +6,19 @@ # Change Log | ||
# [7.2.0](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v7.1.0...v7.2.0) (2019-11-25) | ||
### Chores | ||
* **release:** update documentation ([e7b4975](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/e7b4975)) | ||
* **release:** update documentation ([e6bfd2f](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/e6bfd2f)) | ||
### New Features | ||
* alias interceptors from axios to Kitsu ([#344](https://github.com/wopian/kitsu/tree/master/packages/kitsu/issues/344)) ([f756e07](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/f756e07)) | ||
# [7.1.0](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v7.0.4...v7.1.0) (2019-10-15) | ||
@@ -8,0 +25,0 @@ |
@@ -18,3 +18,3 @@ 'use strict'; | ||
timeout: options.timeout || 30000 | ||
}, options.axiosOptions)), this.fetch = this.get, this.update = this.patch, this.create = this.post, this.remove = this.delete; | ||
}, options.axiosOptions)), this.fetch = this.get, this.update = this.patch, this.create = this.post, this.remove = this.delete, this.interceptors = this.axios.interceptors; | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -17,3 +17,3 @@ 'use strict'; | ||
timeout: options.timeout || 30000 | ||
}, options.axiosOptions)), this.fetch = this.get, this.update = this.patch, this.create = this.post, this.remove = this.delete; | ||
}, options.axiosOptions)), this.fetch = this.get, this.update = this.patch, this.create = this.post, this.remove = this.delete, this.interceptors = this.axios.interceptors; | ||
} | ||
@@ -20,0 +20,0 @@ |
{ | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"name": "kitsu", | ||
@@ -4,0 +4,0 @@ "description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs", |
@@ -184,21 +184,23 @@ <h1 align=center>Kitsu</h1> | ||
- [Examples](#examples-2) | ||
- [interceptors](#interceptors) | ||
- [Examples](#examples-3) | ||
- [get](#get) | ||
- [Parameters](#parameters-1) | ||
- [Examples](#examples-3) | ||
- [Examples](#examples-4) | ||
- [patch](#patch) | ||
- [Parameters](#parameters-2) | ||
- [Examples](#examples-4) | ||
- [Examples](#examples-5) | ||
- [post](#post) | ||
- [Parameters](#parameters-3) | ||
- [Examples](#examples-5) | ||
- [Examples](#examples-6) | ||
- [delete](#delete) | ||
- [Parameters](#parameters-4) | ||
- [Examples](#examples-6) | ||
- [Examples](#examples-7) | ||
- [self](#self) | ||
- [Parameters](#parameters-5) | ||
- [Examples](#examples-7) | ||
- [Examples](#examples-8) | ||
### Kitsu | ||
[packages/kitsu/src/index.js:30-292](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L30-L292 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:30-324](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L30-L324 "Source code on GitHub") | ||
@@ -250,3 +252,3 @@ Creates a new `kitsu` instance | ||
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub") | ||
@@ -271,3 +273,3 @@ - **See: <https://www.npmjs.com/package/pluralize> for documentation** | ||
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub") | ||
@@ -301,5 +303,53 @@ Get the current headers or add additional headers | ||
#### interceptors | ||
[packages/kitsu/src/index.js:111-111](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L111-L111 "Source code on GitHub") | ||
Axios Interceptors (alias of `axios.interceptors`) | ||
You can intercept responses before they are handled by `get`, `post`, `patch` and `delete` and before requests are sent to the API server. | ||
##### Examples | ||
Request Interceptor | ||
```javascript | ||
// Add a request interceptor | ||
api.interceptors.request.use(config => { | ||
// Do something before request is sent | ||
return config | ||
}, error => { | ||
// Do something with request error | ||
return Promise.reject(error) | ||
}) | ||
``` | ||
Response Interceptor | ||
```javascript | ||
// Add a response interceptor | ||
api.interceptors.response.use(response => { | ||
// Any status code that lie within the range of 2xx cause this function to trigger | ||
// Do something with response data | ||
return response | ||
}, error => { | ||
// Any status codes that falls outside the range of 2xx cause this function to trigger | ||
// Do something with response error | ||
return Promise.reject(error) | ||
}) | ||
``` | ||
Removing Interceptors | ||
```javascript | ||
const myInterceptor = api.interceptors.request.use(function () {...}) | ||
api.interceptors.request.eject(myInterceptor) | ||
``` | ||
#### get | ||
[packages/kitsu/src/index.js:152-171](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L152-L171 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:184-203](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L184-L203 "Source code on GitHub") | ||
@@ -416,3 +466,3 @@ Fetch resources (alias `fetch`) | ||
[packages/kitsu/src/index.js:187-201](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L187-L201 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:219-233](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L219-L233 "Source code on GitHub") | ||
@@ -443,3 +493,3 @@ Update a resource (alias `update`) | ||
[packages/kitsu/src/index.js:224-237](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L224-L237 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:256-269](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L256-L269 "Source code on GitHub") | ||
@@ -477,3 +527,3 @@ Create a new resource (alias `create`) | ||
[packages/kitsu/src/index.js:250-262](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L250-L262 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:282-294](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L282-L294 "Source code on GitHub") | ||
@@ -501,3 +551,3 @@ Remove a resource (alias `remove`) | ||
[packages/kitsu/src/index.js:284-291](https://github.com/wopian/kitsu/blob/b5fd092aa99591bc4d2a6277698046f45f0243bb/packages/kitsu/src/index.js#L284-L291 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:316-323](https://github.com/wopian/kitsu/blob/e6bfd2f7daf2e614cd80dc1658bb42a0a75b05b1/packages/kitsu/src/index.js#L316-L323 "Source code on GitHub") | ||
@@ -504,0 +554,0 @@ Get the authenticated user's data |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
131846
12
610