2 import { HttpStatusCode, ResultList, VideoBlacklist, VideoBlacklistType } from '@shared/models'
3 import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 export class BlacklistCommand extends AbstractCommand {
7 add (options: OverrideCommandOptions & {
8 videoId: number | string
12 const { videoId, reason, unfederate } = options
13 const path = '/api/v1/videos/' + videoId + '/blacklist'
15 return this.postBodyRequest({
19 fields: { reason, unfederate },
21 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
25 update (options: OverrideCommandOptions & {
26 videoId: number | string
29 const { videoId, reason } = options
30 const path = '/api/v1/videos/' + videoId + '/blacklist'
32 return this.putBodyRequest({
38 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
42 remove (options: OverrideCommandOptions & {
43 videoId: number | string
45 const { videoId } = options
46 const path = '/api/v1/videos/' + videoId + '/blacklist'
48 return this.deleteRequest({
53 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
57 list (options: OverrideCommandOptions & {
59 type?: VideoBlacklistType
61 const { sort, type } = options
62 const path = '/api/v1/videos/blacklist/'
64 const query = { sort, type }
66 return this.getRequestBody<ResultList<VideoBlacklist>>({
72 defaultExpectedStatus: HttpStatusCode.OK_200