1 import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
2 import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 export class RedundancyCommand extends AbstractCommand {
6 updateRedundancy (options: OverrideCommandOptions & {
8 redundancyAllowed: boolean
10 const { host, redundancyAllowed } = options
11 const path = '/api/v1/server/redundancy/' + host
13 return this.putBodyRequest({
17 fields: { redundancyAllowed },
19 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
23 listVideos (options: OverrideCommandOptions & {
24 target: VideoRedundanciesTarget
29 const path = '/api/v1/server/redundancy/videos'
31 const { target, start, count, sort } = options
33 return this.getRequestBody<ResultList<VideoRedundancy>>({
46 defaultExpectedStatus: HttpStatusCode.OK_200
50 addVideo (options: OverrideCommandOptions & {
53 const path = '/api/v1/server/redundancy/videos'
54 const { videoId } = options
56 return this.postBodyRequest({
62 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
66 removeVideo (options: OverrideCommandOptions & {
69 const { redundancyId } = options
70 const path = '/api/v1/server/redundancy/videos/' + redundancyId
72 return this.deleteRequest({
77 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204