aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils/videos/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-15 15:26:15 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:25:52 +0200
commit94565d52bb2883e09f16d1363170ac9c0dccb7a1 (patch)
tree3dcd20cd7b5a5cca80bce32b655cdbfaddf7aa59 /shared/utils/videos/video-blacklist.ts
parent4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14 (diff)
downloadPeerTube-94565d52bb2883e09f16d1363170ac9c0dccb7a1.tar.gz
PeerTube-94565d52bb2883e09f16d1363170ac9c0dccb7a1.tar.zst
PeerTube-94565d52bb2883e09f16d1363170ac9c0dccb7a1.zip
Shared utils -> extra-utils
Because they need dev dependencies
Diffstat (limited to 'shared/utils/videos/video-blacklist.ts')
-rw-r--r--shared/utils/videos/video-blacklist.ts72
1 files changed, 0 insertions, 72 deletions
diff --git a/shared/utils/videos/video-blacklist.ts b/shared/utils/videos/video-blacklist.ts
deleted file mode 100644
index e25a292fc..000000000
--- a/shared/utils/videos/video-blacklist.ts
+++ /dev/null
@@ -1,72 +0,0 @@
1import * as request from 'supertest'
2import { VideoBlacklistType } from '../../models/videos'
3import { makeGetRequest } from '..'
4
5function addVideoToBlacklist (
6 url: string,
7 token: string,
8 videoId: number | string,
9 reason?: string,
10 unfederate?: boolean,
11 specialStatus = 204
12) {
13 const path = '/api/v1/videos/' + videoId + '/blacklist'
14
15 return request(url)
16 .post(path)
17 .send({ reason, unfederate })
18 .set('Accept', 'application/json')
19 .set('Authorization', 'Bearer ' + token)
20 .expect(specialStatus)
21}
22
23function updateVideoBlacklist (url: string, token: string, videoId: number, reason?: string, specialStatus = 204) {
24 const path = '/api/v1/videos/' + videoId + '/blacklist'
25
26 return request(url)
27 .put(path)
28 .send({ reason })
29 .set('Accept', 'application/json')
30 .set('Authorization', 'Bearer ' + token)
31 .expect(specialStatus)
32}
33
34function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = 204) {
35 const path = '/api/v1/videos/' + videoId + '/blacklist'
36
37 return request(url)
38 .delete(path)
39 .set('Accept', 'application/json')
40 .set('Authorization', 'Bearer ' + token)
41 .expect(specialStatus)
42}
43
44function getBlacklistedVideosList (parameters: {
45 url: string,
46 token: string,
47 sort?: string,
48 type?: VideoBlacklistType,
49 specialStatus?: number
50}) {
51 let { url, token, sort, type, specialStatus = 200 } = parameters
52 const path = '/api/v1/videos/blacklist/'
53
54 const query = { sort, type }
55
56 return makeGetRequest({
57 url,
58 path,
59 query,
60 token,
61 statusCodeExpected: specialStatus
62 })
63}
64
65// ---------------------------------------------------------------------------
66
67export {
68 addVideoToBlacklist,
69 removeVideoFromBlacklist,
70 getBlacklistedVideosList,
71 updateVideoBlacklist
72}