1 import * as request from 'supertest'
2 import { VideoBlacklistType } from '../../models/videos'
3 import { makeGetRequest } from '..'
4 import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
6 function addVideoToBlacklist (
9 videoId: number | string,
12 specialStatus = HttpStatusCode.NO_CONTENT_204
14 const path = '/api/v1/videos/' + videoId + '/blacklist'
18 .send({ reason, unfederate })
19 .set('Accept', 'application/json')
20 .set('Authorization', 'Bearer ' + token)
21 .expect(specialStatus)
24 function updateVideoBlacklist (
29 specialStatus = HttpStatusCode.NO_CONTENT_204
31 const path = '/api/v1/videos/' + videoId + '/blacklist'
36 .set('Accept', 'application/json')
37 .set('Authorization', 'Bearer ' + token)
38 .expect(specialStatus)
41 function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = HttpStatusCode.NO_CONTENT_204) {
42 const path = '/api/v1/videos/' + videoId + '/blacklist'
46 .set('Accept', 'application/json')
47 .set('Authorization', 'Bearer ' + token)
48 .expect(specialStatus)
51 function getBlacklistedVideosList (parameters: {
55 type?: VideoBlacklistType
56 specialStatus?: HttpStatusCode
58 const { url, token, sort, type, specialStatus = HttpStatusCode.OK_200 } = parameters
59 const path = '/api/v1/videos/blacklist/'
61 const query = { sort, type }
63 return makeGetRequest({
68 statusCodeExpected: specialStatus
72 // ---------------------------------------------------------------------------
76 removeVideoFromBlacklist,
77 getBlacklistedVideosList,