From 444c0a0e017824fb4ce526281a22c4abe0a13c50 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 May 2020 16:56:15 +0200 Subject: Add ability to bulk delete comments --- shared/extra-utils/bulk/bulk.ts | 24 ++++++++++++++++++++++++ shared/extra-utils/index.ts | 1 + 2 files changed, 25 insertions(+) create mode 100644 shared/extra-utils/bulk/bulk.ts (limited to 'shared/extra-utils') diff --git a/shared/extra-utils/bulk/bulk.ts b/shared/extra-utils/bulk/bulk.ts new file mode 100644 index 000000000..d6798ceb7 --- /dev/null +++ b/shared/extra-utils/bulk/bulk.ts @@ -0,0 +1,24 @@ +import { BulkRemoveCommentsOfBody } from "@shared/models/bulk/bulk-remove-comments-of-body.model" +import { makePostBodyRequest } from "../requests/requests" + +function bulkRemoveCommentsOf (options: { + url: string + token: string + attributes: BulkRemoveCommentsOfBody + expectedStatus?: number +}) { + const { url, token, attributes, expectedStatus } = options + const path = '/api/v1/bulk/remove-comments-of' + + return makePostBodyRequest({ + url, + path, + token, + fields: attributes, + statusCodeExpected: expectedStatus || 204 + }) +} + +export { + bulkRemoveCommentsOf +} diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index d3f010b20..2ac0c6338 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts @@ -1,4 +1,5 @@ export * from './server/activitypub' +export * from './bulk/bulk' export * from './cli/cli' export * from './server/clients' export * from './server/config' -- cgit v1.2.3