2 import { HttpStatusCode, ResultList } from '@shared/models'
3 import { VideoBlacklist, VideoBlacklistType } from '../../models/videos'
4 import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 export class BlacklistCommand extends AbstractCommand {
8 add (options: OverrideCommandOptions & {
9 videoId: number | string
13 const { videoId, reason, unfederate } = options
14 const path = '/api/v1/videos/' + videoId + '/blacklist'
16 return this.postBodyRequest({
20 fields: { reason, unfederate },
22 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
26 update (options: OverrideCommandOptions & {
27 videoId: number | string
30 const { videoId, reason } = options
31 const path = '/api/v1/videos/' + videoId + '/blacklist'
33 return this.putBodyRequest({
39 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
43 remove (options: OverrideCommandOptions & {
44 videoId: number | string
46 const { videoId } = options
47 const path = '/api/v1/videos/' + videoId + '/blacklist'
49 return this.deleteRequest({
54 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
58 list (options: OverrideCommandOptions & {
60 type?: VideoBlacklistType
62 const { sort, type } = options
63 const path = '/api/v1/videos/blacklist/'
65 const query = { sort, type }
67 return this.getRequestBody<ResultList<VideoBlacklist>>({
73 defaultExpectedStatus: HttpStatusCode.OK_200