diff options
Diffstat (limited to 'shared/server-commands/videos/imports-command.ts')
-rw-r--r-- | shared/server-commands/videos/imports-command.ts | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/shared/server-commands/videos/imports-command.ts b/shared/server-commands/videos/imports-command.ts deleted file mode 100644 index e307a79be..000000000 --- a/shared/server-commands/videos/imports-command.ts +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | |||
2 | import { HttpStatusCode, ResultList } from '@shared/models' | ||
3 | import { VideoImport, VideoImportCreate } from '../../models/videos' | ||
4 | import { unwrapBody } from '../requests' | ||
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
6 | |||
7 | export class ImportsCommand extends AbstractCommand { | ||
8 | |||
9 | importVideo (options: OverrideCommandOptions & { | ||
10 | attributes: (VideoImportCreate | { torrentfile?: string, previewfile?: string, thumbnailfile?: string }) | ||
11 | }) { | ||
12 | const { attributes } = options | ||
13 | const path = '/api/v1/videos/imports' | ||
14 | |||
15 | let attaches: any = {} | ||
16 | if (attributes.torrentfile) attaches = { torrentfile: attributes.torrentfile } | ||
17 | if (attributes.thumbnailfile) attaches = { thumbnailfile: attributes.thumbnailfile } | ||
18 | if (attributes.previewfile) attaches = { previewfile: attributes.previewfile } | ||
19 | |||
20 | return unwrapBody<VideoImport>(this.postUploadRequest({ | ||
21 | ...options, | ||
22 | |||
23 | path, | ||
24 | attaches, | ||
25 | fields: options.attributes, | ||
26 | implicitToken: true, | ||
27 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
28 | })) | ||
29 | } | ||
30 | |||
31 | delete (options: OverrideCommandOptions & { | ||
32 | importId: number | ||
33 | }) { | ||
34 | const path = '/api/v1/videos/imports/' + options.importId | ||
35 | |||
36 | return this.deleteRequest({ | ||
37 | ...options, | ||
38 | |||
39 | path, | ||
40 | implicitToken: true, | ||
41 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
42 | }) | ||
43 | } | ||
44 | |||
45 | cancel (options: OverrideCommandOptions & { | ||
46 | importId: number | ||
47 | }) { | ||
48 | const path = '/api/v1/videos/imports/' + options.importId + '/cancel' | ||
49 | |||
50 | return this.postBodyRequest({ | ||
51 | ...options, | ||
52 | |||
53 | path, | ||
54 | implicitToken: true, | ||
55 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
56 | }) | ||
57 | } | ||
58 | |||
59 | getMyVideoImports (options: OverrideCommandOptions & { | ||
60 | sort?: string | ||
61 | targetUrl?: string | ||
62 | videoChannelSyncId?: number | ||
63 | search?: string | ||
64 | } = {}) { | ||
65 | const { sort, targetUrl, videoChannelSyncId, search } = options | ||
66 | const path = '/api/v1/users/me/videos/imports' | ||
67 | |||
68 | return this.getRequestBody<ResultList<VideoImport>>({ | ||
69 | ...options, | ||
70 | |||
71 | path, | ||
72 | query: { sort, targetUrl, videoChannelSyncId, search }, | ||
73 | implicitToken: true, | ||
74 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
75 | }) | ||
76 | } | ||
77 | } | ||