aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/server-commands/src/videos/chapters-command.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server-commands/src/videos/chapters-command.ts')
-rw-r--r--packages/server-commands/src/videos/chapters-command.ts38
1 files changed, 38 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 @@
1import {
2 HttpStatusCode, VideoChapterUpdate, VideoChapters
3} from '@peertube/peertube-models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'
5
6export 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}