1 import { makeDeleteRequest, makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'
2 import { VideoRedundanciesTarget } from '@shared/models'
4 function updateRedundancy (url: string, accessToken: string, host: string, redundancyAllowed: boolean, expectedStatus = 204) {
5 const path = '/api/v1/server/redundancy/' + host
7 return makePutBodyRequest({
11 fields: { redundancyAllowed },
12 statusCodeExpected: expectedStatus
16 function listVideoRedundancies (options: {
19 target: VideoRedundanciesTarget
23 statusCodeExpected?: number
25 const path = '/api/v1/server/redundancy/videos'
27 const { url, accessToken, target, statusCodeExpected, start, count, sort } = options
29 return makeGetRequest({
39 statusCodeExpected: statusCodeExpected || 200
43 function addVideoRedundancy (options: {
48 const path = '/api/v1/server/redundancy/videos'
49 const { url, accessToken, videoId } = options
51 return makePostBodyRequest({
56 statusCodeExpected: 204
60 function removeVideoRedundancy (options: {
65 const { url, accessToken, redundancyId } = options
66 const path = '/api/v1/server/redundancy/videos/' + redundancyId
68 return makeDeleteRequest({
72 statusCodeExpected: 204
78 listVideoRedundancies,