diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
commit | a24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch) | |
tree | a54b0f6c921ba83a6e909cd0ced325b2d4b8863c /shared/extra-utils/bulk | |
parent | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff) | |
parent | c63830f15403ac4e750829f27d8bbbdc9a59282c (diff) | |
download | PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip |
Merge branch 'next' into develop
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' | |||