Skip to content

Commit

Permalink
chore(release): update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wopian committed Feb 28, 2023
1 parent feedef8 commit 69e0238
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
25 changes: 13 additions & 12 deletions packages/kitsu-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ All code released under [MIT]

### camel

[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")

Converts kebab-case and snake\_case into camelCase

Expand All @@ -163,7 +163,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

### deattribute

[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub")
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub")

Hoists attributes to be top-level

Expand Down Expand Up @@ -205,7 +205,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/

### deserialise

[packages/kitsu-core/src/deserialise/index.js:62-77](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/deserialise/index.js#L62-L77 "Source code on GitHub")
[packages/kitsu-core/src/deserialise/index.js:62-77](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/deserialise/index.js#L62-L77 "Source code on GitHub")

Deserialises a JSON-API response

Expand Down Expand Up @@ -255,7 +255,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

### error

[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub")
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub")

Uniform error handling for Axios, JSON:API and internal package errors. Mutated Error object is rethrown to the caller.

Expand Down Expand Up @@ -292,7 +292,7 @@ error({

### filterIncludes

[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub")
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub")

Filters includes for the specific relationship requested

Expand Down Expand Up @@ -332,7 +332,7 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl

### kebab

[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")

Converts camelCase into kebab-case

Expand All @@ -350,7 +350,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

### linkRelationships

[packages/kitsu-core/src/linkRelationships/index.js:144-164](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/linkRelationships/index.js#L144-L164 "Source code on GitHub")
[packages/kitsu-core/src/linkRelationships/index.js:144-164](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/linkRelationships/index.js#L144-L164 "Source code on GitHub")

Links relationships to included data

Expand Down Expand Up @@ -390,7 +390,7 @@ Returns **any** Parsed data

### isDeepEqual

[packages/kitsu-core/src/deepEqual/index.js:18-42](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/deepEqual/index.js#L18-L42 "Source code on GitHub")
[packages/kitsu-core/src/deepEqual/index.js:18-42](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/deepEqual/index.js#L18-L42 "Source code on GitHub")

Compare two objects equality

Expand Down Expand Up @@ -419,14 +419,15 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/

### query

[packages/kitsu-core/src/query/index.js:34-43](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/query/index.js#L34-L43 "Source code on GitHub")
[packages/kitsu-core/src/query/index.js:55-64](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/query/index.js#L55-L64 "Source code on GitHub")

Constructs a URL query string for JSON:API parameters

#### Parameters

* `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Parameters to parse
* `prefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Prefix for nested parameters - used internally (optional, default `null`)
* `traditional` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Use the traditional (default) or modern param serializer. Set to false if your server is running Ruby on Rails or other modern web frameworks (optional, default `true`)

#### Examples

Expand All @@ -447,7 +448,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

### serialise

[packages/kitsu-core/src/serialise/index.js:213-224](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/serialise/index.js#L213-L224 "Source code on GitHub")
[packages/kitsu-core/src/serialise/index.js:213-224](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/serialise/index.js#L213-L224 "Source code on GitHub")

Serialises an object into a JSON-API structure

Expand Down Expand Up @@ -492,7 +493,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

### snake

[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")

Converts camelCase into snake\_case

Expand All @@ -510,7 +511,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

### splitModel

[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub")
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub")

Split model name from the model's resource URL

Expand Down
12 changes: 11 additions & 1 deletion packages/kitsu-core/types/query/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
/**
* Formats key names to correct array syntax
*
* @param {string} [param] Parameter name to parse
*
* @returns {string} Key name in nested query-param format with optional array style suffix
* @private
*/
export function paramKeyName(param?: string): string;
/**
* Constructs a URL query string for JSON:API parameters
*
* @param {Object} [params] Parameters to parse
* @param {string} [prefix] Prefix for nested parameters - used internally
* @param {boolean} [traditional=true] Use the traditional (default) or modern param serializer. Set to false if your server is running Ruby on Rails or other modern web frameworks
* @returns {string} URL query string
*
* @example
Expand All @@ -17,4 +27,4 @@
* })
* // filter%5Bslug%5D=cowboy-bebop&filter%5Btitle%5D%5Bvalue%5D=foo&sort=-id
*/
export function query(params?: any, prefix?: string): string;
export function query(params?: any, prefix?: string, traditional?: boolean): string;
21 changes: 11 additions & 10 deletions packages/kitsu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ All code released under [MIT]

### Kitsu

[packages/kitsu/src/index.js:30-529](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L30-L529 "Source code on GitHub")
[packages/kitsu/src/index.js:31-535](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L31-L535 "Source code on GitHub")

Creates a new `kitsu` instance

Expand All @@ -251,6 +251,7 @@ Creates a new `kitsu` instance

* `options.baseURL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Set the API endpoint (optional, default `https://kitsu.io/api/edge`)
* `options.headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Additional headers to send with the requests
* `options.query` **(`"traditional"` | `"modern"` | [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Query serializer function to use. This will impact the way keys are serialized when passing arrays as query parameters. 'modern' is recommended for new projects. (optional, default `traditional`)
* `options.camelCaseTypes` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If enabled, `type` will be converted to camelCase from kebab-casae or snake\_case (optional, default `true`)
* `options.resourceCase` **(`"kebab"` | `"snake"` | `"none"`)** Case to convert camelCase to. `kebab` - `/library-entries`; `snake` - /library\_entries`; `none`-`/libraryEntries\` (optional, default `kebab`)
* `options.pluralize` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If enabled, `/user` will become `/users` in the URL request and `type` will be pluralized in POST, PATCH and DELETE requests (optional, default `true`)
Expand Down Expand Up @@ -286,7 +287,7 @@ const api = new Kitsu({

#### plural

[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub")
[packages/kitsu/src/index.js:58-59](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L58-L59 "Source code on GitHub")

* **See**: <https://www.npmjs.com/package/pluralize> for documentation
* **See**: [Kitsu](#kitsu) constructor options for disabling pluralization
Expand All @@ -305,7 +306,7 @@ api.plural.plural('paper') //=> 'paper'

#### headers

[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub")
[packages/kitsu/src/index.js:73-73](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L73-L73 "Source code on GitHub")

Get the current headers or add additional headers

Expand Down Expand Up @@ -333,7 +334,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G

#### interceptors

[packages/kitsu/src/index.js:113-113](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L113-L113 "Source code on GitHub")
[packages/kitsu/src/index.js:119-119](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L119-L119 "Source code on GitHub")

* **See**: <https://github.com/axios/axios#interceptors> for documentation

Expand Down Expand Up @@ -380,7 +381,7 @@ api.interceptors.request.eject(myInterceptor)

#### get

[packages/kitsu/src/index.js:211-240](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L211-L240 "Source code on GitHub")
[packages/kitsu/src/index.js:217-246](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L217-L246 "Source code on GitHub")

Fetch resources (alias `fetch`)

Expand Down Expand Up @@ -517,7 +518,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
#### patch
[packages/kitsu/src/index.js:276-304](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L276-L304 "Source code on GitHub")
[packages/kitsu/src/index.js:282-310](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L282-L310 "Source code on GitHub")
Update a resource (alias `update`)
Expand Down Expand Up @@ -579,7 +580,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
#### post
[packages/kitsu/src/index.js:338-364](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L338-L364 "Source code on GitHub")
[packages/kitsu/src/index.js:344-370](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L344-L370 "Source code on GitHub")
Create a new resource (alias `create`)
Expand Down Expand Up @@ -627,7 +628,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
#### delete
[packages/kitsu/src/index.js:384-418](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L384-L418 "Source code on GitHub")
[packages/kitsu/src/index.js:390-424](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L390-L424 "Source code on GitHub")
Remove a resource (alias `remove`)
Expand Down Expand Up @@ -665,7 +666,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
#### self
[packages/kitsu/src/index.js:442-451](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L442-L451 "Source code on GitHub")
[packages/kitsu/src/index.js:448-457](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L448-L457 "Source code on GitHub")
Get the authenticated user's data
Expand Down Expand Up @@ -703,7 +704,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
#### request
[packages/kitsu/src/index.js:506-528](https://github.com/wopian/kitsu/blob/16cd20d74bf028deaed7a219c590f24a85adc752/packages/kitsu/src/index.js#L506-L528 "Source code on GitHub")
[packages/kitsu/src/index.js:512-534](https://github.com/wopian/kitsu/blob/feedef8ad5594ee55351dda1136c097c8667a4cd/packages/kitsu/src/index.js#L512-L534 "Source code on GitHub")
Send arbitrary requests
Expand Down
2 changes: 2 additions & 0 deletions packages/kitsu/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @param {Object} [options] Options
* @param {string} [options.baseURL=https://kitsu.io/api/edge] Set the API endpoint
* @param {Object} [options.headers] Additional headers to send with the requests
* @param {'traditional'|'modern'|Function} [options.query=traditional] Query serializer function to use. This will impact the way keys are serialized when passing arrays as query parameters. 'modern' is recommended for new projects.
* @param {boolean} [options.camelCaseTypes=true] If enabled, `type` will be converted to camelCase from kebab-casae or snake_case
* @param {'kebab'|'snake'|'none'} [options.resourceCase=kebab] Case to convert camelCase to. `kebab` - `/library-entries`; `snake` - /library_entries`; `none` - `/libraryEntries`
* @param {boolean} [options.pluralize=true] If enabled, `/user` will become `/users` in the URL request and `type` will be pluralized in POST, PATCH and DELETE requests
Expand All @@ -25,6 +26,7 @@
*/
export default class Kitsu {
constructor(options?: {});
query: any;
camel: (s: any) => any;
resCase: (s: any) => any;
plural: any;
Expand Down

0 comments on commit 69e0238

Please sign in to comment.