Skip to content

Commit de730f2

Browse files
committed
chore(release): update documentation
1 parent 113e60f commit de730f2

3 files changed

Lines changed: 62 additions & 23 deletions

File tree

packages/kitsu-core/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ kitsuCore.camel(...)
116116

117117
### deattribute
118118

119-
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub")
119+
[packages/kitsu-core/src/deattribute/index.js:29-51](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/deattribute/index.js#L29-L51 "Source code on GitHub")
120120

121121
Hoists attributes to be top-level
122122

@@ -160,7 +160,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
160160

161161
### deserialise
162162

163-
[packages/kitsu-core/src/deserialise/index.js:57-72](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/deserialise/index.js#L57-L72 "Source code on GitHub")
163+
[packages/kitsu-core/src/deserialise/index.js:57-72](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/deserialise/index.js#L57-L72 "Source code on GitHub")
164164

165165
Deserialises a JSON-API response
166166

@@ -212,7 +212,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
212212

213213
### error
214214

215-
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub")
215+
[packages/kitsu-core/src/error/index.js:27-33](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/error/index.js#L27-L33 "Source code on GitHub")
216216

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

@@ -249,7 +249,7 @@ error({
249249

250250
### filterIncludes
251251

252-
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub")
252+
[packages/kitsu-core/src/filterIncludes/index.js:33-46](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/filterIncludes/index.js#L33-L46 "Source code on GitHub")
253253

254254
Filters includes for the specific relationship requested
255255

@@ -288,7 +288,7 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
288288

289289
### linkRelationships
290290

291-
[packages/kitsu-core/src/linkRelationships/index.js:97-117](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/linkRelationships/index.js#L97-L117 "Source code on GitHub")
291+
[packages/kitsu-core/src/linkRelationships/index.js:97-117](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/linkRelationships/index.js#L97-L117 "Source code on GitHub")
292292

293293
Links relationships to included data
294294

@@ -326,7 +326,7 @@ Returns **any** Parsed data
326326

327327
### query
328328

329-
[packages/kitsu-core/src/query/index.js:33-44](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/query/index.js#L33-L44 "Source code on GitHub")
329+
[packages/kitsu-core/src/query/index.js:33-44](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/query/index.js#L33-L44 "Source code on GitHub")
330330

331331
Constructs a URL query string for JSON:API parameters
332332

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

355355
### serialise
356356

357-
[packages/kitsu-core/src/serialise/index.js:191-202](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/serialise/index.js#L191-L202 "Source code on GitHub")
357+
[packages/kitsu-core/src/serialise/index.js:191-202](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/serialise/index.js#L191-L202 "Source code on GitHub")
358358

359359
Serialises an object into a JSON-API structure
360360

@@ -400,7 +400,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
400400

401401
### splitModel
402402

403-
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub")
403+
[packages/kitsu-core/src/splitModel/index.js:29-39](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/splitModel/index.js#L29-L39 "Source code on GitHub")
404404

405405
Split model name from the model's resource URL
406406

@@ -443,7 +443,7 @@ Returns **\[[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference
443443

444444
### camel
445445

446-
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")
446+
[packages/kitsu-core/src/camel/index.js:14-14](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/camel/index.js#L14-L14 "Source code on GitHub")
447447

448448
Converts kebab-case and snake_case into camelCase
449449

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

472472
### kebab
473473

474-
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")
474+
[packages/kitsu-core/src/kebab/index.js:11-11](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/kebab/index.js#L11-L11 "Source code on GitHub")
475475

476476
Converts camelCase into kebab-case
477477

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

490490
### snake
491491

492-
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")
492+
[packages/kitsu-core/src/snake/index.js:11-11](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu-core/src/snake/index.js#L11-L11 "Source code on GitHub")
493493

494494
Converts camelCase into snake_case
495495

packages/kitsu/README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ If you're working with [Kitsu.io]'s API, their [API docs][kitsu.io api docs] lis
213213

214214
### Kitsu
215215

216-
[packages/kitsu/src/index.js:30-447](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L30-L447 "Source code on GitHub")
216+
[packages/kitsu/src/index.js:30-459](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L30-L459 "Source code on GitHub")
217217

218218
Creates a new `kitsu` instance
219219

@@ -260,7 +260,7 @@ const api = new Kitsu({
260260

261261
#### plural
262262

263-
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub")
263+
[packages/kitsu/src/index.js:52-53](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L52-L53 "Source code on GitHub")
264264

265265
- **See: <https://www.npmjs.com/package/pluralize> for documentation
266266
**
@@ -282,7 +282,7 @@ api.plural.plural('paper') //=> 'paper'
282282

283283
#### headers
284284

285-
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub")
285+
[packages/kitsu/src/index.js:67-67](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L67-L67 "Source code on GitHub")
286286

287287
Get the current headers or add additional headers
288288

@@ -313,7 +313,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
313313

314314
#### interceptors
315315

316-
[packages/kitsu/src/index.js:112-112](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L112-L112 "Source code on GitHub")
316+
[packages/kitsu/src/index.js:112-112](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L112-L112 "Source code on GitHub")
317317

318318
- **See: <https://github.com/axios/axios#interceptors> for documentation
319319
**
@@ -364,7 +364,7 @@ api.interceptors.request.eject(myInterceptor)
364364

365365
#### get
366366

367-
[packages/kitsu/src/index.js:185-204](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L185-L204 "Source code on GitHub")
367+
[packages/kitsu/src/index.js:185-204](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L185-L204 "Source code on GitHub")
368368

369369
Fetch resources (alias `fetch`)
370370

@@ -476,7 +476,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
476476

477477
#### patch
478478

479-
[packages/kitsu/src/index.js:225-245](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L225-L245 "Source code on GitHub")
479+
[packages/kitsu/src/index.js:237-257](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L237-L257 "Source code on GitHub")
480480

481481
Update a resource (alias `update`)
482482

@@ -488,7 +488,7 @@ Update a resource (alias `update`)
488488

489489
##### Examples
490490

491-
Update a post
491+
Update a resource
492492

493493

494494
```javascript
@@ -498,6 +498,33 @@ api.update('posts', {
498498
})
499499
```
500500

501+
Update a resource with relationships
502+
503+
504+
```javascript
505+
api.update('posts', {
506+
content: 'Hello World',
507+
uploads: {
508+
id: '167585',
509+
type: 'uploads'
510+
}
511+
})
512+
```
513+
514+
Clear to-one relationships from a resource
515+
516+
517+
```javascript
518+
api.update('posts/1/relationships/uploads', null)
519+
```
520+
521+
Clear to-many relationships from a resource
522+
523+
524+
```javascript
525+
api.update('posts/1/relationships/uploads', [])
526+
```
527+
501528
Update multiple resources (API must support the Bulk Extension)
502529

503530

@@ -512,7 +539,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
512539

513540
#### post
514541

515-
[packages/kitsu/src/index.js:273-292](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L273-L292 "Source code on GitHub")
542+
[packages/kitsu/src/index.js:285-304](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L285-L304 "Source code on GitHub")
516543

517544
Create a new resource (alias `create`)
518545

@@ -555,7 +582,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
555582

556583
#### delete
557584

558-
[packages/kitsu/src/index.js:307-336](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L307-L336 "Source code on GitHub")
585+
[packages/kitsu/src/index.js:319-348](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L319-L348 "Source code on GitHub")
559586

560587
Remove a resource (alias `remove`)
561588

@@ -585,7 +612,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
585612

586613
#### self
587614

588-
[packages/kitsu/src/index.js:358-365](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L358-L365 "Source code on GitHub")
615+
[packages/kitsu/src/index.js:370-377](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L370-L377 "Source code on GitHub")
589616

590617
Get the authenticated user's data
591618

@@ -622,7 +649,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
622649

623650
#### request
624651

625-
[packages/kitsu/src/index.js:426-446](https://github.com/wopian/kitsu/blob/ee2c35eb17e8d0a151f70d6e49222520794f866c/packages/kitsu/src/index.js#L426-L446 "Source code on GitHub")
652+
[packages/kitsu/src/index.js:438-458](https://github.com/wopian/kitsu/blob/113e60fa60d3029df81c36741703748635470cd6/packages/kitsu/src/index.js#L438-L458 "Source code on GitHub")
626653

627654
Send arbitrary requests
628655

packages/kitsu/types/index.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,23 @@ export default class Kitsu {
178178
* @param {Object|Object[]} body Data to send in the request
179179
* @param {Object} [headers] Additional headers to send with the request
180180
* @returns {Object|Object[]} JSON-parsed response
181-
* @example <caption>Update a post</caption>
181+
* @example <caption>Update a resource</caption>
182182
* api.update('posts', {
183183
* id: '1',
184184
* content: 'Goodbye World'
185185
* })
186+
* @example <caption>Update a resource with relationships</caption>
187+
* api.update('posts', {
188+
* content: 'Hello World',
189+
* uploads: {
190+
* id: '167585',
191+
* type: 'uploads'
192+
* }
193+
* })
194+
* @example <caption>Clear to-one relationships from a resource</caption>
195+
* api.update('posts/1/relationships/uploads', null)
196+
* @example <caption>Clear to-many relationships from a resource</caption>
197+
* api.update('posts/1/relationships/uploads', [])
186198
* @example <caption>Update multiple resources (API must support the Bulk Extension)</caption>
187199
* api.update('posts', [
188200
* { id: '1', content: 'Hello World' },

0 commit comments

Comments
 (0)