diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-05 14:57:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:16 +0200 |
commit | a6a79eae0d8564099b6957e76d7a18528d9ef124 (patch) | |
tree | b29a6eedbe5c9246e4cd651e51d26145ff10e517 /shared/extra-utils/bulk/bulk.ts | |
parent | cf21b2cbef61929177b9c09b5e017c3b7eb8535d (diff) | |
download | PeerTube-a6a79eae0d8564099b6957e76d7a18528d9ef124.tar.gz PeerTube-a6a79eae0d8564099b6957e76d7a18528d9ef124.tar.zst PeerTube-a6a79eae0d8564099b6957e76d7a18528d9ef124.zip |
Introduce bulk command
Diffstat (limited to 'shared/extra-utils/bulk/bulk.ts')
-rw-r--r-- | shared/extra-utils/bulk/bulk.ts | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/shared/extra-utils/bulk/bulk.ts b/shared/extra-utils/bulk/bulk.ts index b6f437b8b..c102383e3 100644 --- a/shared/extra-utils/bulk/bulk.ts +++ b/shared/extra-utils/bulk/bulk.ts | |||
@@ -1,25 +1,24 @@ | |||
1 | import { BulkRemoveCommentsOfBody } from "@shared/models/bulk/bulk-remove-comments-of-body.model" | 1 | |
2 | import { makePostBodyRequest } from "../requests/requests" | 2 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' |
3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
4 | import { AbstractCommand, CommonCommandOptions } from '../shared' | ||
5 | |||
6 | class BulkCommand extends AbstractCommand { | ||
4 | 7 | ||
5 | function bulkRemoveCommentsOf (options: { | 8 | removeCommentsOf (options: CommonCommandOptions & { |
6 | url: string | 9 | attributes: BulkRemoveCommentsOfBody |
7 | token: string | 10 | }) { |
8 | attributes: BulkRemoveCommentsOfBody | 11 | const { attributes } = options |
9 | expectedStatus?: number | ||
10 | }) { | ||
11 | const { url, token, attributes, expectedStatus } = options | ||
12 | const path = '/api/v1/bulk/remove-comments-of' | ||
13 | 12 | ||
14 | return makePostBodyRequest({ | 13 | return this.postBodyRequest({ |
15 | url, | 14 | ...options, |
16 | path, | 15 | path: '/api/v1/bulk/remove-comments-of', |
17 | token, | 16 | fields: attributes, |
18 | fields: attributes, | 17 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 |
19 | statusCodeExpected: expectedStatus || HttpStatusCode.NO_CONTENT_204 | 18 | }) |
20 | }) | 19 | } |
21 | } | 20 | } |
22 | 21 | ||
23 | export { | 22 | export { |
24 | bulkRemoveCommentsOf | 23 | BulkCommand |
25 | } | 24 | } |