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 + .../bulk/bulk-remove-comments-of-body.model.ts | 4 ++++ 3 files changed, 29 insertions(+) create mode 100644 shared/extra-utils/bulk/bulk.ts create mode 100644 shared/models/bulk/bulk-remove-comments-of-body.model.ts (limited to 'shared') 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' diff --git a/shared/models/bulk/bulk-remove-comments-of-body.model.ts b/shared/models/bulk/bulk-remove-comments-of-body.model.ts new file mode 100644 index 000000000..31e018c2a --- /dev/null +++ b/shared/models/bulk/bulk-remove-comments-of-body.model.ts @@ -0,0 +1,4 @@ +export interface BulkRemoveCommentsOfBody { + accountName: string + scope: 'my-videos' | 'instance' +} -- cgit v1.2.3