Comparing version 8.0.5 to 8.1.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [8.1.0](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v8.0.5...v8.1.0) (2020-02-28) | ||
### Chores | ||
* **release:** update documentation ([8f1b075](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/8f1b075)) | ||
### New Features | ||
* **kitsu:** deserialise POST and PATCH responses ([#371](https://github.com/wopian/kitsu/tree/master/packages/kitsu/issues/371)) ([3c9c3ce](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/3c9c3ce)) | ||
## [8.0.5](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v8.0.4...v8.0.5) (2020-02-12) | ||
@@ -8,0 +24,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("axios")),s=e(require("pluralize")),a=require("kitsu-core");module.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!1===e.camelCaseTypes?this.camel=e=>e:this.camel=a.camel,"none"===e.resourceCase?this.resCase=e=>e:"snake"===e.resourceCase?this.resCase=a.snake:this.resCase=a.kebab,!1===e.pluralize?this.plural=e=>e:this.plural=s,this.headers=Object.assign({},e.headers,{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json"}),this.axios=t.create(Object.assign({},{baseURL:e.baseURL||"https://kitsu.io/api/edge",timeout:e.timeout||3e4},e.axiosOptions)),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.interceptors=this.axios.interceptors}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const[i,r,h]=e.split("/");let o=this.plural(this.resCase(i));r&&(o+="/".concat(r)),h&&(o+="/".concat(this.resCase(h)));const{data:c}=await this.axios.get(o,{params:t,paramsSerializer:e=>a.query(e),headers:Object.assign(this.headers,s)});return a.deserialise(c)}catch(e){throw a.error(e)}}async patch(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const i=a.serialise.apply(this,[e,t,"PATCH"]),r=this.plural(this.resCase(e))+"/"+t.id,{data:h}=await this.axios.patch(r,i,{headers:Object.assign(this.headers,s)});return h}catch(e){throw a.error(e)}}async post(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const i=this.plural(this.resCase(e)),{data:r}=await this.axios.post(i,a.serialise.apply(this,[e,t]),{headers:Object.assign(this.headers,s)});return r}catch(e){throw a.error(e)}}async delete(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const i=this.plural(this.resCase(e))+"/"+t,{data:r}=await this.axios.delete(i,{data:a.serialise.apply(this,[e,{id:t},"DELETE"]),headers:Object.assign(this.headers,s)});return r}catch(e){throw a.error(e)}}async self(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{return(await this.get("users",Object.assign({filter:{self:!0}},e),t)).data[0]}catch(e){throw a.error(e)}}}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("axios")),s=e(require("pluralize")),a=require("kitsu-core");module.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!1===e.camelCaseTypes?this.camel=e=>e:this.camel=a.camel,"none"===e.resourceCase?this.resCase=e=>e:"snake"===e.resourceCase?this.resCase=a.snake:this.resCase=a.kebab,!1===e.pluralize?this.plural=e=>e:this.plural=s,this.headers=Object.assign({},e.headers,{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json"}),this.axios=t.create(Object.assign({},{baseURL:e.baseURL||"https://kitsu.io/api/edge",timeout:e.timeout||3e4},e.axiosOptions)),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.interceptors=this.axios.interceptors}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const[i,r,h]=e.split("/");let o=this.plural(this.resCase(i));r&&(o+="/".concat(r)),h&&(o+="/".concat(this.resCase(h)));const{data:l}=await this.axios.get(o,{params:t,paramsSerializer:e=>a.query(e),headers:Object.assign(this.headers,s)});return a.deserialise(l)}catch(e){throw a.error(e)}}async patch(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const i=a.serialise.apply(this,[e,t,"PATCH"]),r=this.plural(this.resCase(e))+"/"+t.id,{data:h}=await this.axios.patch(r,i,{headers:Object.assign(this.headers,s)});return a.deserialise(h)}catch(e){throw a.error(e)}}async post(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const i=this.plural(this.resCase(e)),{data:r}=await this.axios.post(i,a.serialise.apply(this,[e,t]),{headers:Object.assign(this.headers,s)});return a.deserialise(r)}catch(e){throw a.error(e)}}async delete(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const i=this.plural(this.resCase(e))+"/"+t,{data:r}=await this.axios.delete(i,{data:a.serialise.apply(this,[e,{id:t},"DELETE"]),headers:Object.assign(this.headers,s)});return r}catch(e){throw a.error(e)}}async self(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{return(await this.get("users",Object.assign({filter:{self:!0}},e),t)).data[0]}catch(e){throw a.error(e)}}}; |
{ | ||
"version": "8.0.5", | ||
"version": "8.1.0", | ||
"name": "kitsu", | ||
@@ -50,3 +50,3 @@ "description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs", | ||
"axios": "^0.19.0", | ||
"kitsu-core": "^8.0.5", | ||
"kitsu-core": "^8.1.0", | ||
"pluralize": "^8.0.0" | ||
@@ -64,3 +64,3 @@ }, | ||
], | ||
"gitHead": "34901a9bf1e995522bbf7d8d061cf48cf24d6406", | ||
"gitHead": "0b3b903953ff9f7d4abea62e3f970ff3fefaac1f", | ||
"devDependencies": { | ||
@@ -67,0 +67,0 @@ "@size-limit/preset-small-lib": "~4.0.1" |
@@ -195,3 +195,3 @@ <h1 align=center>Kitsu</h1> | ||
[packages/kitsu/src/index.js:30-324](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L30-L324 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:30-324](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L30-L324 "Source code on GitHub") | ||
@@ -243,3 +243,3 @@ Creates a new `kitsu` instance | ||
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub") | ||
@@ -264,3 +264,3 @@ - **See: <https://www.npmjs.com/package/pluralize> for documentation** | ||
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub") | ||
@@ -296,3 +296,3 @@ Get the current headers or add additional headers | ||
[packages/kitsu/src/index.js:111-111](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L111-L111 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:111-111](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L111-L111 "Source code on GitHub") | ||
@@ -345,3 +345,3 @@ Axios Interceptors (alias of `axios.interceptors`) | ||
[packages/kitsu/src/index.js:184-203](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L184-L203 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:184-203](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L184-L203 "Source code on GitHub") | ||
@@ -458,3 +458,3 @@ Fetch resources (alias `fetch`) | ||
[packages/kitsu/src/index.js:219-233](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L219-L233 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:219-233](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L219-L233 "Source code on GitHub") | ||
@@ -485,3 +485,3 @@ Update a resource (alias `update`) | ||
[packages/kitsu/src/index.js:256-269](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L256-L269 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:256-269](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L256-L269 "Source code on GitHub") | ||
@@ -519,3 +519,3 @@ Create a new resource (alias `create`) | ||
[packages/kitsu/src/index.js:282-294](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L282-L294 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:282-294](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L282-L294 "Source code on GitHub") | ||
@@ -543,3 +543,3 @@ Remove a resource (alias `remove`) | ||
[packages/kitsu/src/index.js:316-323](https://github.com/wopian/kitsu/blob/09d337313e18403be78eb7853f441b8b41c44b8e/packages/kitsu/src/index.js#L316-L323 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:316-323](https://github.com/wopian/kitsu/blob/3c9c3ced7d139ed24a29653f538fc4f870bc8bc3/packages/kitsu/src/index.js#L316-L323 "Source code on GitHub") | ||
@@ -546,0 +546,0 @@ Get the authenticated user's data |
Sorry, the diff of this file is not supported yet
85952
Updatedkitsu-core@^8.1.0