Comparing version 5.1.1 to 5.2.0
@@ -0,1 +1,22 @@ | ||
### 5.2.0 (2018-06-25) | ||
##### Build System / Dependencies | ||
* update dependency eslint to ~5.0.0 (#179) (91dd6e5f) | ||
* update dependency rollup to ~0.61.0 (#178) (8244747e) | ||
* update dependency cross-env to ~5.2.0 (#176) (84ca9373) | ||
* update dependency documentation to ~8.0.0 (#173) (a1e441b8) | ||
* update dependency rollup to ~0.60.0 (#174) (1ead68dd) | ||
##### Chores | ||
* **deps:** update dependency jest to ~23.1.0 (#172) (b84b615f) | ||
* **renovate:** scope package updates (00f934da) | ||
##### New Features | ||
* **kitsu:** | ||
* alias `remove` to `delete` (closes #180) (90cad878) | ||
* rename `remove` to `delete` (ae38b027) | ||
#### 5.1.1 (2018-06-01) | ||
@@ -2,0 +23,0 @@ |
@@ -1,2 +0,2 @@ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/regenerator'),require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios'),require('kitsu-core/legacy')):'function'==typeof define&&define.amd?define(['babel-runtime/regenerator','babel-runtime/helpers/slicedToArray','babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios','kitsu-core'],b):a.Kitsu=b(a._regeneratorRuntime,a._slicedToArray,a._asyncToGenerator,a._classCallCheck,a._createClass,a.axios,a.kitsuCore)})(this,function(a,b,c,d,e,f,g){'use strict';a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f;var h=function(){function h(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d(this,h),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?function(a){return a}:g.camel,this.resCase='none'===a.resourceCase?function(a){return a}:'snake'===a.resourceCase?g.snake:g.kebab,this.plural=!1===a.pluralize?function(a){return a}:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=f.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}return e(h,[{key:'get',value:function(){var d=c(a.mark(function c(d){var e,f,h,i,j,k,l,m,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=d.split('/'),f=b(e,3),h=f[0],i=f[1],j=f[2],k=this.plural(this.resCase(h)),i&&(k+='/'+i),j&&(k+='/'+this.resCase(j)),a.next=7,this.axios.get(k,{params:n,paramsSerializer:function(a){return g.query(a)},headers:Object.assign(this.headers,o)});case 7:return l=a.sent,m=l.data,a.abrupt('return',g.deserialise(m));case 12:throw a.prev=12,a.t0=a['catch'](0),g.error(a.t0);case 15:case'end':return a.stop();}},c,this,[[0,12]])}));return function(){return d.apply(this,arguments)}}()},{key:'patch',value:function(){var b=c(a.mark(function b(c,d){var e,f,h,i,j=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,g.serialise.apply(this,[c,d,'PATCH']);case 3:return e=a.sent,f=this.plural(this.resCase(c))+'/'+d.id,a.next=7,this.axios.patch(f,e,{headers:Object.assign(this.headers,j)});case 7:return h=a.sent,i=h.data,a.abrupt('return',i);case 12:throw a.prev=12,a.t0=a['catch'](0),g.error(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return b.apply(this,arguments)}}()},{key:'post',value:function(){var b=c(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c)),a.t0=this.axios,a.t1=e,a.next=6,g.serialise.apply(this,[c,d]);case 6:return a.t2=a.sent,a.t3={headers:Object.assign(this.headers,i)},a.next=10,a.t0.post.call(a.t0,a.t1,a.t2,a.t3);case 10:return f=a.sent,h=f.data,a.abrupt('return',h);case 15:throw a.prev=15,a.t4=a['catch'](0),g.error(a.t4);case 18:case'end':return a.stop();}},b,this,[[0,15]])}));return function(){return b.apply(this,arguments)}}()},{key:'remove',value:function(){var b=c(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c))+'/'+d,a.t0=this.axios,a.t1=e,a.next=6,g.serialise.apply(this,[c,{id:d},'DELETE']);case 6:return a.t2=a.sent,a.t3=Object.assign(this.headers,i),a.t4={data:a.t2,headers:a.t3},a.next=11,a.t0.delete.call(a.t0,a.t1,a.t4);case 11:return f=a.sent,h=f.data,a.abrupt('return',h);case 16:throw a.prev=16,a.t5=a['catch'](0),g.error(a.t5);case 19:case'end':return a.stop();}},b,this,[[0,16]])}));return function(){return b.apply(this,arguments)}}()},{key:'self',value:function(){var b=c(a.mark(function b(){var c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get('users',Object.assign({filter:{self:!0}},d),e);case 3:return c=a.sent,a.abrupt('return',c.data[0]);case 7:throw a.prev=7,a.t0=a['catch'](0),g.error(a.t0);case 10:case'end':return a.stop();}},b,this,[[0,7]])}));return function(){return b.apply(this,arguments)}}()}]),h}();return h}); | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/regenerator'),require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios'),require('kitsu-core/legacy')):'function'==typeof define&&define.amd?define(['babel-runtime/regenerator','babel-runtime/helpers/slicedToArray','babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios','kitsu-core'],b):a.Kitsu=b(a._regeneratorRuntime,a._slicedToArray,a._asyncToGenerator,a._classCallCheck,a._createClass,a.axios,a.kitsuCore)})(this,function(a,b,c,d,e,f,g){'use strict';a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f;var h=function(){function h(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d(this,h),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.camel=!1===a.camelCaseTypes?function(a){return a}:g.camel,this.resCase='none'===a.resourceCase?function(a){return a}:'snake'===a.resourceCase?g.snake:g.kebab,this.plural=!1===a.pluralize?function(a){return a}:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=f.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}return e(h,[{key:'get',value:function(){var d=c(a.mark(function c(d){var e,f,h,i,j,k,l,m,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=d.split('/'),f=b(e,3),h=f[0],i=f[1],j=f[2],k=this.plural(this.resCase(h)),i&&(k+='/'+i),j&&(k+='/'+this.resCase(j)),a.next=7,this.axios.get(k,{params:n,paramsSerializer:function(a){return g.query(a)},headers:Object.assign(this.headers,o)});case 7:return l=a.sent,m=l.data,a.abrupt('return',g.deserialise(m));case 12:throw a.prev=12,a.t0=a['catch'](0),g.error(a.t0);case 15:case'end':return a.stop();}},c,this,[[0,12]])}));return function(){return d.apply(this,arguments)}}()},{key:'patch',value:function(){var b=c(a.mark(function b(c,d){var e,f,h,i,j=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,g.serialise.apply(this,[c,d,'PATCH']);case 3:return e=a.sent,f=this.plural(this.resCase(c))+'/'+d.id,a.next=7,this.axios.patch(f,e,{headers:Object.assign(this.headers,j)});case 7:return h=a.sent,i=h.data,a.abrupt('return',i);case 12:throw a.prev=12,a.t0=a['catch'](0),g.error(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return b.apply(this,arguments)}}()},{key:'post',value:function(){var b=c(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c)),a.t0=this.axios,a.t1=e,a.next=6,g.serialise.apply(this,[c,d]);case 6:return a.t2=a.sent,a.t3={headers:Object.assign(this.headers,i)},a.next=10,a.t0.post.call(a.t0,a.t1,a.t2,a.t3);case 10:return f=a.sent,h=f.data,a.abrupt('return',h);case 15:throw a.prev=15,a.t4=a['catch'](0),g.error(a.t4);case 18:case'end':return a.stop();}},b,this,[[0,15]])}));return function(){return b.apply(this,arguments)}}()},{key:'delete',value:function(){var b=c(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c))+'/'+d,a.t0=this.axios,a.t1=e,a.next=6,g.serialise.apply(this,[c,{id:d},'DELETE']);case 6:return a.t2=a.sent,a.t3=Object.assign(this.headers,i),a.t4={data:a.t2,headers:a.t3},a.next=11,a.t0.delete.call(a.t0,a.t1,a.t4);case 11:return f=a.sent,h=f.data,a.abrupt('return',h);case 16:throw a.prev=16,a.t5=a['catch'](0),g.error(a.t5);case 19:case'end':return a.stop();}},b,this,[[0,16]])}));return function(){return b.apply(this,arguments)}}()},{key:'self',value:function(){var b=c(a.mark(function b(){var c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get('users',Object.assign({filter:{self:!0}},d),e);case 3:return c=a.sent,a.abrupt('return',c.data[0]);case 7:throw a.prev=7,a.t0=a['catch'](0),g.error(a.t0);case 10:case'end':return a.stop();}},b,this,[[0,7]])}));return function(){return b.apply(this,arguments)}}()}]),h}();return h}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';function _interopDefault(a){return a&&'object'==typeof a&&'default'in a?a['default']:a}var _regeneratorRuntime=_interopDefault(require('babel-runtime/regenerator')),_slicedToArray=_interopDefault(require('babel-runtime/helpers/slicedToArray')),_asyncToGenerator=_interopDefault(require('babel-runtime/helpers/asyncToGenerator')),axios=_interopDefault(require('axios')),kitsuCore=require('kitsu-core');class Kitsu{constructor(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?a=>a:kitsuCore.camel,this.resCase='none'===a.resourceCase?a=>a:'snake'===a.resourceCase?kitsuCore.snake:kitsuCore.kebab,this.plural=!1===a.pluralize?a=>a:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=axios.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}get(a){var b=this,c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h,i,j,k,l,m;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f=a.split('/'),g=_slicedToArray(f,3),h=g[0],i=g[1],j=g[2],k=b.plural(b.resCase(h)),i&&(k+=`/${i}`),j&&(k+=`/${b.resCase(j)}`),e.next=7,b.axios.get(k,{params:c,paramsSerializer:function(a){return kitsuCore.query(a)},headers:Object.assign(b.headers,d)});case 7:return l=e.sent,m=l.data,e.abrupt('return',kitsuCore.deserialise(m));case 12:throw e.prev=12,e.t0=e['catch'](0),kitsuCore.error(e.t0);case 15:case'end':return e.stop();}},e,b,[[0,12]])}))()}patch(a,b){var c=this,d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h,i;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,kitsuCore.serialise.apply(c,[a,b,'PATCH']);case 3:return f=e.sent,g=c.plural(c.resCase(a))+'/'+b.id,e.next=7,c.axios.patch(g,f,{headers:Object.assign(c.headers,d)});case 7:return h=e.sent,i=h.data,e.abrupt('return',i);case 12:throw e.prev=12,e.t0=e['catch'](0),kitsuCore.error(e.t0);case 15:case'end':return e.stop();}},e,c,[[0,12]])}))()}post(a,b){var c=this,d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f=c.plural(c.resCase(a)),e.t0=c.axios,e.t1=f,e.next=6,kitsuCore.serialise.apply(c,[a,b]);case 6:return e.t2=e.sent,e.t3={headers:Object.assign(c.headers,d)},e.next=10,e.t0.post.call(e.t0,e.t1,e.t2,e.t3);case 10:return g=e.sent,h=g.data,e.abrupt('return',h);case 15:throw e.prev=15,e.t4=e['catch'](0),kitsuCore.error(e.t4);case 18:case'end':return e.stop();}},e,c,[[0,15]])}))()}remove(a,b){var c=this,d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f=c.plural(c.resCase(a))+'/'+b,e.t0=c.axios,e.t1=f,e.next=6,kitsuCore.serialise.apply(c,[a,{id:b},'DELETE']);case 6:return e.t2=e.sent,e.t3=Object.assign(c.headers,d),e.t4={data:e.t2,headers:e.t3},e.next=11,e.t0.delete.call(e.t0,e.t1,e.t4);case 11:return g=e.sent,h=g.data,e.abrupt('return',h);case 16:throw e.prev=16,e.t5=e['catch'](0),kitsuCore.error(e.t5);case 19:case'end':return e.stop();}},e,c,[[0,16]])}))()}self(){var a=this,b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function d(){var e;return _regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.prev=0,d.next=3,a.get('users',Object.assign({filter:{self:!0}},b),c);case 3:return e=d.sent,d.abrupt('return',e.data[0]);case 7:throw d.prev=7,d.t0=d['catch'](0),kitsuCore.error(d.t0);case 10:case'end':return d.stop();}},d,a,[[0,7]])}))()}}module.exports=Kitsu; | ||
'use strict';function _interopDefault(a){return a&&'object'==typeof a&&'default'in a?a['default']:a}var _regeneratorRuntime=_interopDefault(require('babel-runtime/regenerator')),_slicedToArray=_interopDefault(require('babel-runtime/helpers/slicedToArray')),_asyncToGenerator=_interopDefault(require('babel-runtime/helpers/asyncToGenerator')),axios=_interopDefault(require('axios')),kitsuCore=require('kitsu-core');class Kitsu{constructor(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.camel=!1===a.camelCaseTypes?a=>a:kitsuCore.camel,this.resCase='none'===a.resourceCase?a=>a:'snake'===a.resourceCase?kitsuCore.snake:kitsuCore.kebab,this.plural=!1===a.pluralize?a=>a:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=axios.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}get(a){var b=this,c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h,i,j,k,l,m;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f=a.split('/'),g=_slicedToArray(f,3),h=g[0],i=g[1],j=g[2],k=b.plural(b.resCase(h)),i&&(k+=`/${i}`),j&&(k+=`/${b.resCase(j)}`),e.next=7,b.axios.get(k,{params:c,paramsSerializer:function(a){return kitsuCore.query(a)},headers:Object.assign(b.headers,d)});case 7:return l=e.sent,m=l.data,e.abrupt('return',kitsuCore.deserialise(m));case 12:throw e.prev=12,e.t0=e['catch'](0),kitsuCore.error(e.t0);case 15:case'end':return e.stop();}},e,b,[[0,12]])}))()}patch(a,b){var c=this,d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h,i;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,kitsuCore.serialise.apply(c,[a,b,'PATCH']);case 3:return f=e.sent,g=c.plural(c.resCase(a))+'/'+b.id,e.next=7,c.axios.patch(g,f,{headers:Object.assign(c.headers,d)});case 7:return h=e.sent,i=h.data,e.abrupt('return',i);case 12:throw e.prev=12,e.t0=e['catch'](0),kitsuCore.error(e.t0);case 15:case'end':return e.stop();}},e,c,[[0,12]])}))()}post(a,b){var c=this,d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f=c.plural(c.resCase(a)),e.t0=c.axios,e.t1=f,e.next=6,kitsuCore.serialise.apply(c,[a,b]);case 6:return e.t2=e.sent,e.t3={headers:Object.assign(c.headers,d)},e.next=10,e.t0.post.call(e.t0,e.t1,e.t2,e.t3);case 10:return g=e.sent,h=g.data,e.abrupt('return',h);case 15:throw e.prev=15,e.t4=e['catch'](0),kitsuCore.error(e.t4);case 18:case'end':return e.stop();}},e,c,[[0,15]])}))()}delete(a,b){var c=this,d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function e(){var f,g,h;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f=c.plural(c.resCase(a))+'/'+b,e.t0=c.axios,e.t1=f,e.next=6,kitsuCore.serialise.apply(c,[a,{id:b},'DELETE']);case 6:return e.t2=e.sent,e.t3=Object.assign(c.headers,d),e.t4={data:e.t2,headers:e.t3},e.next=11,e.t0.delete.call(e.t0,e.t1,e.t4);case 11:return g=e.sent,h=g.data,e.abrupt('return',h);case 16:throw e.prev=16,e.t5=e['catch'](0),kitsuCore.error(e.t5);case 19:case'end':return e.stop();}},e,c,[[0,16]])}))()}self(){var a=this,b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return _asyncToGenerator(_regeneratorRuntime.mark(function d(){var e;return _regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.prev=0,d.next=3,a.get('users',Object.assign({filter:{self:!0}},b),c);case 3:return e=d.sent,d.abrupt('return',e.data[0]);case 7:throw d.prev=7,d.t0=d['catch'](0),kitsuCore.error(d.t0);case 10:case'end':return d.stop();}},d,a,[[0,7]])}))()}}module.exports=Kitsu; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';function _interopDefault(a){return a&&'object'==typeof a&&'default'in a?a['default']:a}var _slicedToArray=_interopDefault(require('babel-runtime/helpers/slicedToArray')),_asyncToGenerator=_interopDefault(require('babel-runtime/helpers/asyncToGenerator')),axios=_interopDefault(require('axios')),kitsuCore=require('kitsu-core/node');class Kitsu{constructor(a={}){this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?a=>a:kitsuCore.camel,this.resCase='none'===a.resourceCase?a=>a:'snake'===a.resourceCase?kitsuCore.snake:kitsuCore.kebab,this.plural=!1===a.pluralize?a=>a:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=axios.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}get(a,b={},c={}){var d=this;return _asyncToGenerator(function*(){try{var e=a.split('/'),f=_slicedToArray(e,3);let h=f[0],i=f[1],j=f[2],k=d.plural(d.resCase(h));i&&(k+=`/${i}`),j&&(k+=`/${d.resCase(j)}`);var g=yield d.axios.get(k,{params:b,paramsSerializer:function(a){return kitsuCore.query(a)},headers:Object.assign(d.headers,c)});const l=g.data;return kitsuCore.deserialise(l)}catch(a){throw kitsuCore.error(a)}})()}patch(a,b,c={}){var d=this;return _asyncToGenerator(function*(){try{const f=yield kitsuCore.serialise.apply(d,[a,b,'PATCH']),g=d.plural(d.resCase(a))+'/'+b.id;var e=yield d.axios.patch(g,f,{headers:Object.assign(d.headers,c)});const h=e.data;return h}catch(a){throw kitsuCore.error(a)}})()}post(a,b,c={}){var d=this;return _asyncToGenerator(function*(){try{const f=d.plural(d.resCase(a));var e=yield d.axios.post(f,(yield kitsuCore.serialise.apply(d,[a,b])),{headers:Object.assign(d.headers,c)});const g=e.data;return g}catch(a){throw kitsuCore.error(a)}})()}remove(a,b,c={}){var d=this;return _asyncToGenerator(function*(){try{const f=d.plural(d.resCase(a))+'/'+b;var e=yield d.axios.delete(f,{data:yield kitsuCore.serialise.apply(d,[a,{id:b},'DELETE']),headers:Object.assign(d.headers,c)});const g=e.data;return g}catch(a){throw kitsuCore.error(a)}})()}self(a={},b={}){var c=this;return _asyncToGenerator(function*(){try{const d=yield c.get('users',Object.assign({filter:{self:!0}},a),b);return d.data[0]}catch(a){throw kitsuCore.error(a)}})()}}module.exports=Kitsu; | ||
'use strict';function _interopDefault(a){return a&&'object'==typeof a&&'default'in a?a['default']:a}var _slicedToArray=_interopDefault(require('babel-runtime/helpers/slicedToArray')),_asyncToGenerator=_interopDefault(require('babel-runtime/helpers/asyncToGenerator')),axios=_interopDefault(require('axios')),kitsuCore=require('kitsu-core/node');class Kitsu{constructor(a={}){this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.camel=!1===a.camelCaseTypes?a=>a:kitsuCore.camel,this.resCase='none'===a.resourceCase?a=>a:'snake'===a.resourceCase?kitsuCore.snake:kitsuCore.kebab,this.plural=!1===a.pluralize?a=>a:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=axios.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}get(a,b={},c={}){var d=this;return _asyncToGenerator(function*(){try{var e=a.split('/'),f=_slicedToArray(e,3);let h=f[0],i=f[1],j=f[2],k=d.plural(d.resCase(h));i&&(k+=`/${i}`),j&&(k+=`/${d.resCase(j)}`);var g=yield d.axios.get(k,{params:b,paramsSerializer:function(a){return kitsuCore.query(a)},headers:Object.assign(d.headers,c)});const l=g.data;return kitsuCore.deserialise(l)}catch(a){throw kitsuCore.error(a)}})()}patch(a,b,c={}){var d=this;return _asyncToGenerator(function*(){try{const f=yield kitsuCore.serialise.apply(d,[a,b,'PATCH']),g=d.plural(d.resCase(a))+'/'+b.id;var e=yield d.axios.patch(g,f,{headers:Object.assign(d.headers,c)});const h=e.data;return h}catch(a){throw kitsuCore.error(a)}})()}post(a,b,c={}){var d=this;return _asyncToGenerator(function*(){try{const f=d.plural(d.resCase(a));var e=yield d.axios.post(f,(yield kitsuCore.serialise.apply(d,[a,b])),{headers:Object.assign(d.headers,c)});const g=e.data;return g}catch(a){throw kitsuCore.error(a)}})()}delete(a,b,c={}){var d=this;return _asyncToGenerator(function*(){try{const f=d.plural(d.resCase(a))+'/'+b;var e=yield d.axios.delete(f,{data:yield kitsuCore.serialise.apply(d,[a,{id:b},'DELETE']),headers:Object.assign(d.headers,c)});const g=e.data;return g}catch(a){throw kitsuCore.error(a)}})()}self(a={},b={}){var c=this;return _asyncToGenerator(function*(){try{const d=yield c.get('users',Object.assign({filter:{self:!0}},a),b);return d.data[0]}catch(a){throw kitsuCore.error(a)}})()}}module.exports=Kitsu; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"version": "5.1.1", | ||
"version": "5.2.0", | ||
"name": "kitsu", | ||
@@ -43,3 +43,3 @@ "description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs", | ||
"babel-runtime": "^6.26.0", | ||
"kitsu-core": "^5.1.1", | ||
"kitsu-core": "^5.2.0", | ||
"pluralize": "^7.0.0" | ||
@@ -46,0 +46,0 @@ }, |
@@ -174,9 +174,23 @@ # Kitsu | ||
- [Kitsu](#kitsu) | ||
- [Parameters](#parameters) | ||
- [Examples](#examples) | ||
- [delete](#delete) | ||
- [Parameters](#parameters-1) | ||
- [Examples](#examples-1) | ||
- [get](#get) | ||
- [Parameters](#parameters-2) | ||
- [Examples](#examples-2) | ||
- [headers](#headers) | ||
- [Examples](#examples-3) | ||
- [patch](#patch) | ||
- [Parameters](#parameters-3) | ||
- [Examples](#examples-4) | ||
- [plural](#plural) | ||
- [Examples](#examples-5) | ||
- [post](#post) | ||
- [remove](#remove) | ||
- [Parameters](#parameters-4) | ||
- [Examples](#examples-6) | ||
- [self](#self) | ||
- [Parameters](#parameters-5) | ||
- [Examples](#examples-7) | ||
@@ -187,3 +201,3 @@ ### Kitsu | ||
**Parameters** | ||
#### Parameters | ||
@@ -198,3 +212,3 @@ - `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`) | ||
**Examples** | ||
#### Examples | ||
@@ -226,2 +240,22 @@ _Using with Kitsu.io's API_ | ||
#### delete | ||
Remove a resource (alias `remove`) | ||
##### Parameters | ||
- `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to remove data from | ||
- `id` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))** Resource ID to remove | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
##### Examples | ||
_Remove a user's post_ | ||
```javascript | ||
api.delete('posts', 123) | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
#### get | ||
@@ -231,3 +265,3 @@ | ||
**Parameters** | ||
##### Parameters | ||
@@ -245,3 +279,3 @@ - `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to fetch data from | ||
**Examples** | ||
##### Examples | ||
@@ -336,3 +370,3 @@ _Getting a resource with JSON:API parameters_ | ||
**Examples** | ||
##### Examples | ||
@@ -363,3 +397,3 @@ _Get all headers_ | ||
**Parameters** | ||
##### Parameters | ||
@@ -370,3 +404,3 @@ - `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to update data in | ||
**Examples** | ||
##### Examples | ||
@@ -391,3 +425,3 @@ _Update a post_ | ||
**Examples** | ||
##### Examples | ||
@@ -406,3 +440,3 @@ _Adding an uncountable pluralization rule_ | ||
**Parameters** | ||
##### Parameters | ||
@@ -413,3 +447,3 @@ - `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to create a resource under | ||
**Examples** | ||
##### Examples | ||
@@ -434,22 +468,2 @@ _Create a post on a user's profile feed_ | ||
#### remove | ||
Remove a resource | ||
**Parameters** | ||
- `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to remove data from | ||
- `id` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))** Resource ID to remove | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
**Examples** | ||
_Remove a user's post_ | ||
```javascript | ||
api.remove('posts', 123) | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
#### self | ||
@@ -461,3 +475,3 @@ | ||
**Parameters** | ||
##### Parameters | ||
@@ -469,3 +483,3 @@ - `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-API request queries (optional, default `{}`) | ||
**Examples** | ||
##### Examples | ||
@@ -472,0 +486,0 @@ _Get the authenticated user's resource_ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
3
556
127822
10
50
Updatedkitsu-core@^5.2.0