2 import { AbuseFilter, AbusePredefinedReasonsString, AbuseState, AbuseUpdate, AbuseVideoIs } from '@shared/models'
3 import { makeDeleteRequest, makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'
5 function reportAbuse (options: {
15 predefinedReasons?: AbusePredefinedReasonsString[]
20 statusCodeExpected?: number
22 const path = '/api/v1/abuses'
24 const video = options.videoId ? {
26 startAt: options.startAt,
30 const comment = options.commentId ? {
34 const account = options.accountId ? {
43 reason: options.reason,
44 predefinedReasons: options.predefinedReasons
47 return makePostBodyRequest({
53 statusCodeExpected: options.statusCodeExpected || 200
57 function getAbusesList (options: {
61 predefinedReason?: AbusePredefinedReasonsString
65 videoIs?: AbuseVideoIs
66 searchReporter?: string
67 searchReportee?: string
69 searchVideoChannel?: string
85 const path = '/api/v1/abuses'
101 return makeGetRequest({
106 statusCodeExpected: 200
110 function updateAbuse (
115 statusCodeExpected = 204
117 const path = '/api/v1/abuses/' + abuseId
119 return makePutBodyRequest({
128 function deleteAbuse (url: string, token: string, abuseId: number, statusCodeExpected = 204) {
129 const path = '/api/v1/abuses/' + abuseId
131 return makeDeleteRequest({
139 // ---------------------------------------------------------------------------