X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fvideos%2Fimports-command.ts;h=07d810ec1f49e10c452b156c6962e78168e78bc4;hb=508c1b1e9f3b26752a961e945b7fa59b72b30827;hp=e4944694d9e95e2af2c6eacbeac9f9068a7f486a;hpb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/videos/imports-command.ts b/shared/server-commands/videos/imports-command.ts index e4944694d..07d810ec1 100644 --- a/shared/server-commands/videos/imports-command.ts +++ b/shared/server-commands/videos/imports-command.ts @@ -26,20 +26,48 @@ export class ImportsCommand extends AbstractCommand { })) } + delete (options: OverrideCommandOptions & { + importId: number + }) { + const path = '/api/v1/videos/imports/' + options.importId + + return this.deleteRequest({ + ...options, + + path, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + } + + cancel (options: OverrideCommandOptions & { + importId: number + }) { + const path = '/api/v1/videos/imports/' + options.importId + '/cancel' + + return this.postBodyRequest({ + ...options, + + path, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + } + getMyVideoImports (options: OverrideCommandOptions & { sort?: string + targetUrl?: string + videoChannelSyncId?: number + search?: string } = {}) { - const { sort } = options + const { sort, targetUrl, videoChannelSyncId, search } = options const path = '/api/v1/users/me/videos/imports' - const query = {} - if (sort) query['sort'] = sort - return this.getRequestBody>({ ...options, path, - query: { sort }, + query: { sort, targetUrl, videoChannelSyncId, search }, implicitToken: true, defaultExpectedStatus: HttpStatusCode.OK_200 })