Comparing version 8.0.2 to 8.0.3
@@ -6,2 +6,19 @@ # Change Log | ||
## [8.0.3](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v8.0.2...v8.0.3) (2020-01-07) | ||
### Chores | ||
* **release:** update documentation ([65f0559](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/65f0559)) | ||
* improve TypeScript declarations ([#355](https://github.com/wopian/kitsu/tree/master/packages/kitsu/issues/355)) ([934c79e](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/934c79e)) | ||
### Documentation Changes | ||
* remove appveyor badge [skip ci] ([b481f95](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/b481f95)) | ||
## [8.0.2](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v8.0.1...v8.0.2) (2019-12-24) | ||
@@ -8,0 +25,0 @@ |
185
index.d.ts
@@ -1,17 +0,172 @@ | ||
export default Kitsu; | ||
declare class Kitsu { | ||
constructor(...args: any[]); | ||
delete(...args: any[]): void; | ||
get(...args: any[]): void; | ||
patch(...args: any[]): void; | ||
post(...args: any[]): void; | ||
self(...args: any[]): void; | ||
declare module 'kitsu' { | ||
/** | ||
* Creates a new `kitsu` instance | ||
* | ||
* @param {Object} options Options | ||
* @param {string} options.baseURL Set the API endpoint (default `https://kitsu.io/api/edge`) | ||
* @param {Object} options.headers Additional headers to send with requests | ||
* @param {boolean} options.camelCaseTypes If true, the `type` value will be camelCased, e.g `library-entries` and `library_entries` become `libraryEntries` (default `true`) | ||
* @param {string} options.resourceCase `kebab`, `snake` or `none`. If `kebab`, `/libraryEntries` will become `/library-entries`. If `snake`, `/libraryEntries` will become `/library_entries`, If `none`, `/libraryEntries` will be unchanged (default `kebab`) | ||
* @param {boolean} options.pluralize If `true`, `/user` will become `/users` in the URL request and `type` will be pluralized in post, patch and delete requests - `user` -> `users` (default `true`) | ||
* @param {number} options.timeout Set the request timeout in milliseconds (default `30000`) | ||
* @param {Object} options.axiosOptions Additional options for the axios instance | ||
* @example <caption>Using with Kitsu.io's API</caption> | ||
* const api = new Kitsu() | ||
* @example <caption>Using another API server</caption> | ||
* const api = new Kitsu({ | ||
* baseURL: 'https://api.example.org/2' | ||
* }) | ||
* @example <caption>Setting headers</caption> | ||
* const api = new Kitsu({ | ||
* headers: { | ||
* 'User-Agent': 'MyApp/1.0.0 (github.com/username/repo)', | ||
* Authorization: 'Bearer 1234567890' | ||
* } | ||
* }) | ||
*/ | ||
export default class Kitsu { | ||
constructor(options?: {}); | ||
/** | ||
* Fetch resources (alias `fetch`) | ||
* | ||
* @memberof Kitsu | ||
* @param {string} model Model to fetch data from | ||
* @param {Object} params JSON-API request queries | ||
* @param {Object} params.page [JSON:API Pagination](http://jsonapi.org/format/#fetching-pagination) | ||
* @param {number} params.page.limit Number of resources to return in request (Max `20` for Kitsu.io except on `libraryEntries` which has a max of `500`) | ||
* @param {number} params.page.offset Number of resources to offset the dataset by | ||
* @param {Object} params.fields Return a sparse fieldset with only the included attributes/relationships - [JSON:API Sparse Fieldsets](http://jsonapi.org/format/#fetching-sparse-fieldsets) | ||
* @param {Object} params.filter Filter dataset by attribute values - [JSON:API Filtering](http://jsonapi.org/format/#fetching-filtering) | ||
* @param {string} params.sort Sort dataset by one or more comma separated attributes (prepend `-` for descending order) - [JSON:API Sorting](http://jsonapi.org/format/#fetching-sorting) | ||
* @param {string} params.include Include relationship data - [JSON:API Includes](http://jsonapi.org/format/#fetching-includes) | ||
* @param {Object} headers Additional headers to send with request | ||
* @returns {Object} JSON-parsed response | ||
* @example <caption>Getting a resource with JSON:API parameters</caption> | ||
* api.get('users', { | ||
* fields: { | ||
* users: 'name,birthday' | ||
* }, | ||
* filter: { | ||
* name: 'wopian' | ||
* } | ||
* }) | ||
* @example <caption>Getting a collection of resources with their relationships</caption> | ||
* api.get('anime', { | ||
* include: 'categories' | ||
* }) | ||
* @example <caption>Getting a single resource by ID (method one)</caption> | ||
* api.get('anime/2', { | ||
* include: 'categories' | ||
* }) | ||
* @example <caption>Getting a single resource by ID (method two)</caption> | ||
* api.get('anime', { | ||
* include: 'categories', | ||
* filter: { id: '2' } | ||
* }) | ||
* @example <caption>Getting a resource's relationship data only</caption> | ||
* api.get('anime/2/categories') | ||
* @example <caption>Handling errors (async/await)</caption> | ||
* try { | ||
* const { data } = await api.get('anime') | ||
* } catch (err) { | ||
* // Array of JSON:API errors: http://jsonapi.org/format/#error-objects | ||
* if (err.errors) err.errors.forEach(error => { ... }) | ||
* // Error type (Error, TypeError etc.) | ||
* err.name | ||
* // Error message | ||
* err.message | ||
* // Axios request parameters | ||
* err.config | ||
* // Axios response parameters | ||
* err.response | ||
* } | ||
* @example <caption>Handling errors (Promises)</caption> | ||
* api.get('anime') | ||
* .then(({ data }) => { ... }) | ||
* .catch(err => { | ||
* // Array of JSON:API errors: http://jsonapi.org/format/#error-objects | ||
* if (err.errors) err.errors.forEach(error => { ... }) | ||
* // Error type (Error, TypeError etc.) | ||
* err.name | ||
* // Error message | ||
* err.message | ||
* // Axios request parameters | ||
* err.config | ||
* // Axios response parameters | ||
* err.response | ||
* }) | ||
*/ | ||
get(model: any, params?: {}, headers?: {}): Promise<any>; | ||
/** | ||
* Update a resource (alias `update`) | ||
* | ||
* @memberof Kitsu | ||
* @param {string} model Model to update data in | ||
* @param {Object} body Data to send in the request | ||
* @param {Object} headers Additional headers to send with request | ||
* @returns {Object} JSON-parsed response | ||
* @example <caption>Update a post</caption> | ||
* api.update('posts', { | ||
* id: '12345678', | ||
* content: 'Goodbye World' | ||
* }) | ||
*/ | ||
patch(model: any, body: any, headers?: {}): Promise<any>; | ||
/** | ||
* Create a new resource (alias `create`) | ||
* | ||
* @memberof Kitsu | ||
* @param {string} model Model to create a resource under | ||
* @param {Object} body Data to send in the request | ||
* @param {Object} headers Additional headers to send with request | ||
* @returns {Object} JSON-parsed response | ||
* @example <caption>Create a post on a user's profile feed</caption> | ||
* api.create('posts', { | ||
* content: 'Hello World', | ||
* targetUser: { | ||
* id: '42603', | ||
* type: 'users' | ||
* }, | ||
* user: { | ||
* id: '42603', | ||
* type: 'users' | ||
* } | ||
* }) | ||
*/ | ||
post(model: any, body: any, headers?: {}): Promise<any>; | ||
/** | ||
* Remove a resource (alias `remove`) | ||
* | ||
* @memberof Kitsu | ||
* @param {string} model Model to remove data from | ||
* @param {string|number} id Resource ID to remove | ||
* @param {Object} headers Additional headers to send with request | ||
* @returns {Object} JSON-parsed response | ||
* @example <caption>Remove a user's post</caption> | ||
* api.delete('posts', 123) | ||
*/ | ||
delete(model: any, id: any, headers?: {}): Promise<any>; | ||
/** | ||
* Get the authenticated user's data | ||
* | ||
* **Note** Requires the JSON:API server to support `filter[self]=true` | ||
* | ||
* @memberof Kitsu | ||
* @param {Object} params JSON-API request queries | ||
* @param {Object} params.fields Return a sparse fieldset with only the included attributes/relationships - [JSON:API Sparse Fieldsets](http://jsonapi.org/format/#fetching-sparse-fieldsets) | ||
* @param {string} params.include Include relationship data - [JSON:API Includes](http://jsonapi.org/format/#fetching-includes) | ||
* @param {Object} headers Additional headers to send with request | ||
* @returns {Object} JSON-parsed response | ||
* @example <caption>Get the authenticated user's resource</caption> | ||
* api.self() | ||
* @example <caption>Using JSON:API parameters</caption> | ||
* api.self({ | ||
* fields: { | ||
* users: 'name,birthday' | ||
* } | ||
* }) | ||
*/ | ||
self(params?: {}, headers?: {}): Promise<any>; | ||
} | ||
} | ||
{ | ||
"version": "8.0.2", | ||
"version": "8.0.3", | ||
"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.2", | ||
"kitsu-core": "^8.0.3", | ||
"pluralize": "^8.0.0" | ||
@@ -64,3 +64,3 @@ }, | ||
], | ||
"gitHead": "cb3b7ef45b0456f4e4c912c4d89e63b0c300ef75", | ||
"gitHead": "af9ec4faf8b2cdcdc21fd58ede25903e9a1a4e2e", | ||
"devDependencies": { | ||
@@ -67,0 +67,0 @@ "@size-limit/preset-small-lib": "~2.2.1" |
@@ -12,3 +12,2 @@ <h1 align=center>Kitsu</h1> | ||
<a href=https://travis-ci.org/wopian/kitsu><img alt=travis src=https://flat.badgen.net/travis/wopian/kitsu></a> | ||
<a href=https://ci.appveyor.com/project/wopian/kitsu><img alt=appveyor src=https://flat.badgen.net/appveyor/ci/wopian/kitsu></a> | ||
<a href="https://packagephobia.now.sh/result?p=kitsu"><img alt=packagephobia src=https://flat.badgen.net/packagephobia/install/kitsu></a> | ||
@@ -198,3 +197,3 @@ <a href=https://github.com/wopian/kitsu/graphs/contributors><img alt=contributors src=https://flat.badgen.net/github/contributors/wopian/kitsu></a> | ||
[packages/kitsu/src/index.js:30-324](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L30-L324 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:30-324](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L30-L324 "Source code on GitHub") | ||
@@ -246,3 +245,3 @@ Creates a new `kitsu` instance | ||
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub") | ||
@@ -267,3 +266,3 @@ - **See: <https://www.npmjs.com/package/pluralize> for documentation** | ||
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub") | ||
@@ -299,3 +298,3 @@ Get the current headers or add additional headers | ||
[packages/kitsu/src/index.js:111-111](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L111-L111 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:111-111](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L111-L111 "Source code on GitHub") | ||
@@ -348,3 +347,3 @@ Axios Interceptors (alias of `axios.interceptors`) | ||
[packages/kitsu/src/index.js:184-203](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L184-L203 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:184-203](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L184-L203 "Source code on GitHub") | ||
@@ -461,3 +460,3 @@ Fetch resources (alias `fetch`) | ||
[packages/kitsu/src/index.js:219-233](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L219-L233 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:219-233](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L219-L233 "Source code on GitHub") | ||
@@ -488,3 +487,3 @@ Update a resource (alias `update`) | ||
[packages/kitsu/src/index.js:256-269](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L256-L269 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:256-269](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L256-L269 "Source code on GitHub") | ||
@@ -522,3 +521,3 @@ Create a new resource (alias `create`) | ||
[packages/kitsu/src/index.js:282-294](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L282-L294 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:282-294](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L282-L294 "Source code on GitHub") | ||
@@ -546,3 +545,3 @@ Remove a resource (alias `remove`) | ||
[packages/kitsu/src/index.js:316-323](https://github.com/wopian/kitsu/blob/61ee773e566bba2530e283290e2f60f2ec6161e3/packages/kitsu/src/index.js#L316-L323 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:316-323](https://github.com/wopian/kitsu/blob/934c79e98f6b53e781e502d4f9cc57a3d804fd49/packages/kitsu/src/index.js#L316-L323 "Source code on GitHub") | ||
@@ -549,0 +548,0 @@ Get the authenticated user's data |
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
83961
190
602
Updatedkitsu-core@^8.0.3