]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/videos/imports-command.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / shared / server-commands / videos / imports-command.ts
index e4944694d9e95e2af2c6eacbeac9f9068a7f486a..c931ac481c2e7179841a53131194c0bc45105a44 100644 (file)
@@ -26,20 +26,46 @@ 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
   } = {}) {
-    const { sort } = options
+    const { sort, targetUrl } = options
     const path = '/api/v1/users/me/videos/imports'
 
-    const query = {}
-    if (sort) query['sort'] = sort
-
     return this.getRequestBody<ResultList<VideoImport>>({
       ...options,
 
       path,
-      query: { sort },
+      query: { sort, targetUrl },
       implicitToken: true,
       defaultExpectedStatus: HttpStatusCode.OK_200
     })