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 getAdminAbusesList (options: {
66 predefinedReason?: AbusePredefinedReasonsString
70 videoIs?: AbuseVideoIs
71 searchReporter?: string
72 searchReportee?: string
74 searchVideoChannel?: string
93 const path = '/api/v1/abuses'
104 sort: sort || 'createdAt',
111 return makeGetRequest({
116 statusCodeExpected: 200
120 function getUserAbusesList (options: {
142 const path = '/api/v1/users/me/abuses'
150 sort: sort || 'createdAt'
153 return makeGetRequest({
158 statusCodeExpected: 200
162 function updateAbuse (
167 statusCodeExpected = 204
169 const path = '/api/v1/abuses/' + abuseId
171 return makePutBodyRequest({
180 function deleteAbuse (url: string, token: string, abuseId: number, statusCodeExpected = 204) {
181 const path = '/api/v1/abuses/' + abuseId
183 return makeDeleteRequest({
191 function listAbuseMessages (url: string, token: string, abuseId: number, statusCodeExpected = 200) {
192 const path = '/api/v1/abuses/' + abuseId + '/messages'
194 return makeGetRequest({
202 function deleteAbuseMessage (url: string, token: string, abuseId: number, messageId: number, statusCodeExpected = 204) {
203 const path = '/api/v1/abuses/' + abuseId + '/messages/' + messageId
205 return makeDeleteRequest({
213 function addAbuseMessage (url: string, token: string, abuseId: number, message: string, statusCodeExpected = 200) {
214 const path = '/api/v1/abuses/' + abuseId + '/messages'
216 return makePostBodyRequest({
225 // ---------------------------------------------------------------------------