aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/videos/captions-command.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands/videos/captions-command.ts')
-rw-r--r--shared/server-commands/videos/captions-command.ts67
1 files changed, 0 insertions, 67 deletions
diff --git a/shared/server-commands/videos/captions-command.ts b/shared/server-commands/videos/captions-command.ts
deleted file mode 100644
index a26fcb57d..000000000
--- a/shared/server-commands/videos/captions-command.ts
+++ /dev/null
@@ -1,67 +0,0 @@
1import { buildAbsoluteFixturePath } from '@shared/core-utils'
2import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared'
4
5export class CaptionsCommand extends AbstractCommand {
6
7 add (options: OverrideCommandOptions & {
8 videoId: string | number
9 language: string
10 fixture: string
11 mimeType?: string
12 }) {
13 const { videoId, language, fixture, mimeType } = options
14
15 const path = '/api/v1/videos/' + videoId + '/captions/' + language
16
17 const captionfile = buildAbsoluteFixturePath(fixture)
18 const captionfileAttach = mimeType
19 ? [ captionfile, { contentType: mimeType } ]
20 : captionfile
21
22 return this.putUploadRequest({
23 ...options,
24
25 path,
26 fields: {},
27 attaches: {
28 captionfile: captionfileAttach
29 },
30 implicitToken: true,
31 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
32 })
33 }
34
35 list (options: OverrideCommandOptions & {
36 videoId: string | number
37 videoPassword?: string
38 }) {
39 const { videoId, videoPassword } = options
40 const path = '/api/v1/videos/' + videoId + '/captions'
41
42 return this.getRequestBody<ResultList<VideoCaption>>({
43 ...options,
44
45 path,
46 headers: this.buildVideoPasswordHeader(videoPassword),
47 implicitToken: false,
48 defaultExpectedStatus: HttpStatusCode.OK_200
49 })
50 }
51
52 delete (options: OverrideCommandOptions & {
53 videoId: string | number
54 language: string
55 }) {
56 const { videoId, language } = options
57 const path = '/api/v1/videos/' + videoId + '/captions/' + language
58
59 return this.deleteRequest({
60 ...options,
61
62 path,
63 implicitToken: true,
64 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
65 })
66 }
67}