diff options
Diffstat (limited to 'packages/server-commands/src/videos')
-rw-r--r-- | packages/server-commands/src/videos/chapters-command.ts | 38 | ||||
-rw-r--r-- | packages/server-commands/src/videos/index.ts | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/packages/server-commands/src/videos/chapters-command.ts b/packages/server-commands/src/videos/chapters-command.ts new file mode 100644 index 000000000..8a75c7fae --- /dev/null +++ b/packages/server-commands/src/videos/chapters-command.ts | |||
@@ -0,0 +1,38 @@ | |||
1 | import { | ||
2 | HttpStatusCode, VideoChapterUpdate, VideoChapters | ||
3 | } from '@peertube/peertube-models' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js' | ||
5 | |||
6 | export class ChaptersCommand extends AbstractCommand { | ||
7 | |||
8 | list (options: OverrideCommandOptions & { | ||
9 | videoId: string | number | ||
10 | }) { | ||
11 | const path = '/api/v1/videos/' + options.videoId + '/chapters' | ||
12 | |||
13 | return this.getRequestBody<VideoChapters>({ | ||
14 | ...options, | ||
15 | |||
16 | path, | ||
17 | implicitToken: true, | ||
18 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
19 | }) | ||
20 | } | ||
21 | |||
22 | update (options: OverrideCommandOptions & VideoChapterUpdate & { | ||
23 | videoId: number | string | ||
24 | }) { | ||
25 | const path = '/api/v1/videos/' + options.videoId + '/chapters' | ||
26 | |||
27 | return this.putBodyRequest({ | ||
28 | ...options, | ||
29 | |||
30 | path, | ||
31 | fields: { | ||
32 | chapters: options.chapters | ||
33 | }, | ||
34 | implicitToken: true, | ||
35 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
36 | }) | ||
37 | } | ||
38 | } | ||
diff --git a/packages/server-commands/src/videos/index.ts b/packages/server-commands/src/videos/index.ts index 970026d51..8d193e24c 100644 --- a/packages/server-commands/src/videos/index.ts +++ b/packages/server-commands/src/videos/index.ts | |||
@@ -3,6 +3,7 @@ export * from './captions-command.js' | |||
3 | export * from './change-ownership-command.js' | 3 | export * from './change-ownership-command.js' |
4 | export * from './channels.js' | 4 | export * from './channels.js' |
5 | export * from './channels-command.js' | 5 | export * from './channels-command.js' |
6 | export * from './chapters-command.js' | ||
6 | export * from './channel-syncs-command.js' | 7 | export * from './channel-syncs-command.js' |
7 | export * from './comments-command.js' | 8 | export * from './comments-command.js' |
8 | export * from './history-command.js' | 9 | export * from './history-command.js' |