2 import { ResultList, VideoChangeOwnership } from '@shared/models'
3 import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
4 import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 export class ChangeOwnershipCommand extends AbstractCommand {
8 create (options: OverrideCommandOptions & {
9 videoId: number | string
12 const { videoId, username } = options
13 const path = '/api/v1/videos/' + videoId + '/give-ownership'
15 return this.postBodyRequest({
21 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
25 list (options: OverrideCommandOptions = {}) {
26 const path = '/api/v1/videos/ownership'
28 return this.getRequestBody<ResultList<VideoChangeOwnership>>({
32 query: { sort: '-createdAt' },
34 defaultExpectedStatus: HttpStatusCode.OK_200
38 accept (options: OverrideCommandOptions & {
42 const { ownershipId, channelId } = options
43 const path = '/api/v1/videos/ownership/' + ownershipId + '/accept'
45 return this.postBodyRequest({
49 fields: { channelId },
51 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
55 refuse (options: OverrideCommandOptions & {
58 const { ownershipId } = options
59 const path = '/api/v1/videos/ownership/' + ownershipId + '/refuse'
61 return this.postBodyRequest({
66 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204