2 import { ResultList } from '@shared/models'
3 import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
4 import { VideoBlacklist, VideoBlacklistType } from '../../models/videos'
5 import { AbstractCommand, OverrideCommandOptions } from '../shared'
7 export class BlacklistCommand extends AbstractCommand {
9 add (options: OverrideCommandOptions & {
10 videoId: number | string
14 const { videoId, reason, unfederate } = options
15 const path = '/api/v1/videos/' + videoId + '/blacklist'
17 return this.postBodyRequest({
21 fields: { reason, unfederate },
23 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
27 update (options: OverrideCommandOptions & {
28 videoId: number | string
31 const { videoId, reason } = options
32 const path = '/api/v1/videos/' + videoId + '/blacklist'
34 return this.putBodyRequest({
40 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
44 remove (options: OverrideCommandOptions & {
45 videoId: number | string
47 const { videoId } = options
48 const path = '/api/v1/videos/' + videoId + '/blacklist'
50 return this.deleteRequest({
55 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
59 list (options: OverrideCommandOptions & {
61 type?: VideoBlacklistType
63 const { sort, type } = options
64 const path = '/api/v1/videos/blacklist/'
66 const query = { sort, type }
68 return this.getRequestBody<ResultList<VideoBlacklist>>({
74 defaultExpectedStatus: HttpStatusCode.OK_200