diff options
Diffstat (limited to 'shared/extra-utils/bulk')
-rw-r--r-- | shared/extra-utils/bulk/bulk-command.ts | 20 | ||||
-rw-r--r-- | shared/extra-utils/bulk/bulk.ts | 25 | ||||
-rw-r--r-- | shared/extra-utils/bulk/index.ts | 1 |
3 files changed, 21 insertions, 25 deletions
diff --git a/shared/extra-utils/bulk/bulk-command.ts b/shared/extra-utils/bulk/bulk-command.ts new file mode 100644 index 000000000..b5c5673ce --- /dev/null +++ b/shared/extra-utils/bulk/bulk-command.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import { BulkRemoveCommentsOfBody, HttpStatusCode } from '@shared/models' | ||
2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
3 | |||
4 | export class BulkCommand extends AbstractCommand { | ||
5 | |||
6 | removeCommentsOf (options: OverrideCommandOptions & { | ||
7 | attributes: BulkRemoveCommentsOfBody | ||
8 | }) { | ||
9 | const { attributes } = options | ||
10 | |||
11 | return this.postBodyRequest({ | ||
12 | ...options, | ||
13 | |||
14 | path: '/api/v1/bulk/remove-comments-of', | ||
15 | fields: attributes, | ||
16 | implicitToken: true, | ||
17 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
18 | }) | ||
19 | } | ||
20 | } | ||
diff --git a/shared/extra-utils/bulk/bulk.ts b/shared/extra-utils/bulk/bulk.ts deleted file mode 100644 index b6f437b8b..000000000 --- a/shared/extra-utils/bulk/bulk.ts +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | import { BulkRemoveCommentsOfBody } from "@shared/models/bulk/bulk-remove-comments-of-body.model" | ||
2 | import { makePostBodyRequest } from "../requests/requests" | ||
3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
4 | |||
5 | function bulkRemoveCommentsOf (options: { | ||
6 | url: string | ||
7 | token: string | ||
8 | attributes: BulkRemoveCommentsOfBody | ||
9 | expectedStatus?: number | ||
10 | }) { | ||
11 | const { url, token, attributes, expectedStatus } = options | ||
12 | const path = '/api/v1/bulk/remove-comments-of' | ||
13 | |||
14 | return makePostBodyRequest({ | ||
15 | url, | ||
16 | path, | ||
17 | token, | ||
18 | fields: attributes, | ||
19 | statusCodeExpected: expectedStatus || HttpStatusCode.NO_CONTENT_204 | ||
20 | }) | ||
21 | } | ||
22 | |||
23 | export { | ||
24 | bulkRemoveCommentsOf | ||
25 | } | ||
diff --git a/shared/extra-utils/bulk/index.ts b/shared/extra-utils/bulk/index.ts new file mode 100644 index 000000000..391597243 --- /dev/null +++ b/shared/extra-utils/bulk/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './bulk-command' | |||