From 359dcb03a65732ddb911fce991c181aabbd322cb Mon Sep 17 00:00:00 2001 From: Brainslug Date: Fri, 19 Sep 2025 21:32:35 +0200 Subject: [PATCH] Added the `updateCommentsBatch` function to the SDK (#25866) * added missing updateCommentsBatch * do the changeset --- .changeset/early-owls-return.md | 5 +++++ sdk/src/rest/commands/update/comments.ts | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .changeset/early-owls-return.md diff --git a/.changeset/early-owls-return.md b/.changeset/early-owls-return.md new file mode 100644 index 0000000000..ca8c52906b --- /dev/null +++ b/.changeset/early-owls-return.md @@ -0,0 +1,5 @@ +--- +'@directus/sdk': patch +--- + +Added the updateCommentsBatch function to the SDK diff --git a/sdk/src/rest/commands/update/comments.ts b/sdk/src/rest/commands/update/comments.ts index 924d874f7b..38f18f8d2e 100644 --- a/sdk/src/rest/commands/update/comments.ts +++ b/sdk/src/rest/commands/update/comments.ts @@ -1,5 +1,5 @@ import type { DirectusComment } from '../../../schema/comment.js'; -import type { ApplyQueryFields, Query } from '../../../types/index.js'; +import type { ApplyQueryFields, Query, NestedPartial } from '../../../types/index.js'; import type { RestCommand } from '../../types.js'; import { throwIfEmpty } from '../../utils/index.js'; @@ -44,6 +44,24 @@ export const updateComments = }; }; +/** + * Update multiple comments as batch. + * @param items + * @param query + * @returns Returns the comment objects for the updated comments. + */ +export const updateCommentsBatch = + >>( + items: NestedPartial>[], + query?: TQuery, + ): RestCommand[], Schema> => + () => ({ + path: `/comments`, + params: query ?? {}, + body: JSON.stringify(items), + method: 'PATCH', + }); + /** * Update an existing comment. * @param key