aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/video-blacklist.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/videos/video-blacklist.ts')
-rw-r--r--shared/extra-utils/videos/video-blacklist.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/shared/extra-utils/videos/video-blacklist.ts b/shared/extra-utils/videos/video-blacklist.ts
index ba139ef95..aa1548537 100644
--- a/shared/extra-utils/videos/video-blacklist.ts
+++ b/shared/extra-utils/videos/video-blacklist.ts
@@ -1,6 +1,7 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { VideoBlacklistType } from '../../models/videos' 2import { VideoBlacklistType } from '../../models/videos'
3import { makeGetRequest } from '..' 3import { makeGetRequest } from '..'
4import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
4 5
5function addVideoToBlacklist ( 6function addVideoToBlacklist (
6 url: string, 7 url: string,
@@ -8,7 +9,7 @@ function addVideoToBlacklist (
8 videoId: number | string, 9 videoId: number | string,
9 reason?: string, 10 reason?: string,
10 unfederate?: boolean, 11 unfederate?: boolean,
11 specialStatus = 204 12 specialStatus = HttpStatusCode.NO_CONTENT_204
12) { 13) {
13 const path = '/api/v1/videos/' + videoId + '/blacklist' 14 const path = '/api/v1/videos/' + videoId + '/blacklist'
14 15
@@ -20,7 +21,13 @@ function addVideoToBlacklist (
20 .expect(specialStatus) 21 .expect(specialStatus)
21} 22}
22 23
23function updateVideoBlacklist (url: string, token: string, videoId: number, reason?: string, specialStatus = 204) { 24function updateVideoBlacklist (
25 url: string,
26 token: string,
27 videoId: number,
28 reason?: string,
29 specialStatus = HttpStatusCode.NO_CONTENT_204
30) {
24 const path = '/api/v1/videos/' + videoId + '/blacklist' 31 const path = '/api/v1/videos/' + videoId + '/blacklist'
25 32
26 return request(url) 33 return request(url)
@@ -31,7 +38,7 @@ function updateVideoBlacklist (url: string, token: string, videoId: number, reas
31 .expect(specialStatus) 38 .expect(specialStatus)
32} 39}
33 40
34function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = 204) { 41function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = HttpStatusCode.NO_CONTENT_204) {
35 const path = '/api/v1/videos/' + videoId + '/blacklist' 42 const path = '/api/v1/videos/' + videoId + '/blacklist'
36 43
37 return request(url) 44 return request(url)
@@ -46,9 +53,9 @@ function getBlacklistedVideosList (parameters: {
46 token: string 53 token: string
47 sort?: string 54 sort?: string
48 type?: VideoBlacklistType 55 type?: VideoBlacklistType
49 specialStatus?: number 56 specialStatus?: HttpStatusCode
50}) { 57}) {
51 const { url, token, sort, type, specialStatus = 200 } = parameters 58 const { url, token, sort, type, specialStatus = HttpStatusCode.OK_200 } = parameters
52 const path = '/api/v1/videos/blacklist/' 59 const path = '/api/v1/videos/blacklist/'
53 60
54 const query = { sort, type } 61 const query = { sort, type }