aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/server-commands/src/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-08-28 10:55:04 +0200
committerChocobozzz <me@florianbigard.com>2023-08-28 16:17:31 +0200
commit77b70702d2193d78bf6fbd07f0fc7335e34957f8 (patch)
tree1a0aed540054286c9a8b10c4890cc0f718e00458 /packages/server-commands/src/videos
parent7113f32a87bd6b2868154fed20bde1a1633c190e (diff)
downloadPeerTube-77b70702d2193d78bf6fbd07f0fc7335e34957f8.tar.gz
PeerTube-77b70702d2193d78bf6fbd07f0fc7335e34957f8.tar.zst
PeerTube-77b70702d2193d78bf6fbd07f0fc7335e34957f8.zip
Add video chapters support
Diffstat (limited to 'packages/server-commands/src/videos')
-rw-r--r--packages/server-commands/src/videos/chapters-command.ts38
-rw-r--r--packages/server-commands/src/videos/index.ts1
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 @@
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}
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'
3export * from './change-ownership-command.js' 3export * from './change-ownership-command.js'
4export * from './channels.js' 4export * from './channels.js'
5export * from './channels-command.js' 5export * from './channels-command.js'
6export * from './chapters-command.js'
6export * from './channel-syncs-command.js' 7export * from './channel-syncs-command.js'
7export * from './comments-command.js' 8export * from './comments-command.js'
8export * from './history-command.js' 9export * from './history-command.js'