1 import * as request from 'supertest'
2 import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model'
3 import { makeDeleteRequest, makePutBodyRequest, makeGetRequest } from '../requests/requests'
4 import { VideoAbuseState, VideoAbusePredefinedReasonsString } from '@shared/models'
5 import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type'
7 function reportVideoAbuse (
10 videoId: number | string,
12 predefinedReasons?: VideoAbusePredefinedReasonsString[],
17 const path = '/api/v1/videos/' + videoId + '/abuse'
21 .set('Accept', 'application/json')
22 .set('Authorization', 'Bearer ' + token)
23 .send({ reason, predefinedReasons, startAt, endAt })
24 .expect(specialStatus)
27 function getVideoAbusesList (options: {
31 predefinedReason?: VideoAbusePredefinedReasonsString
33 state?: VideoAbuseState
34 videoIs?: VideoAbuseVideoIs
35 searchReporter?: string
36 searchReportee?: string
38 searchVideoChannel?: string
53 const path = '/api/v1/videos/abuse'
68 return makeGetRequest({
73 statusCodeExpected: 200
77 function updateVideoAbuse (
80 videoId: string | number,
82 body: VideoAbuseUpdate,
83 statusCodeExpected = 204
85 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
87 return makePutBodyRequest({
96 function deleteVideoAbuse (url: string, token: string, videoId: string | number, videoAbuseId: number, statusCodeExpected = 204) {
97 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
99 return makeDeleteRequest({
107 // ---------------------------------------------------------------------------