2 import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models'
3 import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 export class ChangeOwnershipCommand extends AbstractCommand {
7 create (options: OverrideCommandOptions & {
8 videoId: number | string
11 const { videoId, username } = options
12 const path = '/api/v1/videos/' + videoId + '/give-ownership'
14 return this.postBodyRequest({
20 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
24 list (options: OverrideCommandOptions = {}) {
25 const path = '/api/v1/videos/ownership'
27 return this.getRequestBody<ResultList<VideoChangeOwnership>>({
31 query: { sort: '-createdAt' },
33 defaultExpectedStatus: HttpStatusCode.OK_200
37 accept (options: OverrideCommandOptions & {
41 const { ownershipId, channelId } = options
42 const path = '/api/v1/videos/ownership/' + ownershipId + '/accept'
44 return this.postBodyRequest({
48 fields: { channelId },
50 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
54 refuse (options: OverrideCommandOptions & {
57 const { ownershipId } = options
58 const path = '/api/v1/videos/ownership/' + ownershipId + '/refuse'
60 return this.postBodyRequest({
65 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204