X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fbulk%2Fbulk.ts;h=a58fb3fbba7781d9b88cebbc12006b209e6e4606;hb=e8bd7ce7ccafe3e064b03978e9b512c1a4cc99e6;hp=d6798ceb762c24ac7182c04fe463afb4710b9a15;hpb=cdd8f7790c759664fe4d0962efa550cf1a8e37eb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/bulk/bulk.ts b/shared/extra-utils/bulk/bulk.ts index d6798ceb7..a58fb3fbb 100644 --- a/shared/extra-utils/bulk/bulk.ts +++ b/shared/extra-utils/bulk/bulk.ts @@ -1,24 +1,20 @@ -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' +import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { AbstractCommand, OverrideCommandOptions } from '../shared' - return makePostBodyRequest({ - url, - path, - token, - fields: attributes, - statusCodeExpected: expectedStatus || 204 - }) -} +export class BulkCommand extends AbstractCommand { + + removeCommentsOf (options: OverrideCommandOptions & { + attributes: BulkRemoveCommentsOfBody + }) { + const { attributes } = options -export { - bulkRemoveCommentsOf + return this.postBodyRequest({ + ...options, + path: '/api/v1/bulk/remove-comments-of', + fields: attributes, + defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + } }