Added the updateCommentsBatch function to the SDK (#25866)

* added missing updateCommentsBatch

* do the changeset
This commit is contained in:
Brainslug
2025-09-19 21:32:35 +02:00
committed by GitHub
parent f118b89dee
commit 359dcb03a6
2 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'@directus/sdk': patch
---
Added the updateCommentsBatch function to the SDK

View File

@@ -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 =
<Schema, const TQuery extends Query<Schema, DirectusComment<Schema>>>(
items: NestedPartial<DirectusComment<Schema>>[],
query?: TQuery,
): RestCommand<UpdateCommentOutput<Schema, TQuery>[], Schema> =>
() => ({
path: `/comments`,
params: query ?? {},
body: JSON.stringify(items),
method: 'PATCH',
});
/**
* Update an existing comment.
* @param key