Skip to content

Commit 113e60f

Browse files
committed
docs(kitsu): add clearing of to-one/to-many relationships to api.patch examples
1 parent dd4bc43 commit 113e60f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

packages/kitsu/src/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,23 @@ export default class Kitsu {
211211
* @param {Object|Object[]} body Data to send in the request
212212
* @param {Object} [headers] Additional headers to send with the request
213213
* @returns {Object|Object[]} JSON-parsed response
214-
* @example <caption>Update a post</caption>
214+
* @example <caption>Update a resource</caption>
215215
* api.update('posts', {
216216
* id: '1',
217217
* content: 'Goodbye World'
218218
* })
219+
* @example <caption>Update a resource with relationships</caption>
220+
* api.update('posts', {
221+
* content: 'Hello World',
222+
* uploads: {
223+
* id: '167585',
224+
* type: 'uploads'
225+
* }
226+
* })
227+
* @example <caption>Clear to-one relationships from a resource</caption>
228+
* api.update('posts/1/relationships/uploads', null)
229+
* @example <caption>Clear to-many relationships from a resource</caption>
230+
* api.update('posts/1/relationships/uploads', [])
219231
* @example <caption>Update multiple resources (API must support the Bulk Extension)</caption>
220232
* api.update('posts', [
221233
* { id: '1', content: 'Hello World' },

0 commit comments

Comments
 (0)