diff options
Diffstat (limited to 'packages/server-commands')
-rw-r--r-- | packages/server-commands/src/server/server.ts | 3 | ||||
-rw-r--r-- | packages/server-commands/src/videos/chapters-command.ts | 38 | ||||
-rw-r--r-- | packages/server-commands/src/videos/index.ts | 1 |
3 files changed, 42 insertions, 0 deletions
diff --git a/packages/server-commands/src/server/server.ts b/packages/server-commands/src/server/server.ts index 57a897c17..3911a6fad 100644 --- a/packages/server-commands/src/server/server.ts +++ b/packages/server-commands/src/server/server.ts | |||
@@ -30,6 +30,7 @@ import { | |||
30 | ChangeOwnershipCommand, | 30 | ChangeOwnershipCommand, |
31 | ChannelsCommand, | 31 | ChannelsCommand, |
32 | ChannelSyncsCommand, | 32 | ChannelSyncsCommand, |
33 | ChaptersCommand, | ||
33 | CommentsCommand, | 34 | CommentsCommand, |
34 | HistoryCommand, | 35 | HistoryCommand, |
35 | ImportsCommand, | 36 | ImportsCommand, |
@@ -152,6 +153,7 @@ export class PeerTubeServer { | |||
152 | videoPasswords?: VideoPasswordsCommand | 153 | videoPasswords?: VideoPasswordsCommand |
153 | 154 | ||
154 | storyboard?: StoryboardCommand | 155 | storyboard?: StoryboardCommand |
156 | chapters?: ChaptersCommand | ||
155 | 157 | ||
156 | runners?: RunnersCommand | 158 | runners?: RunnersCommand |
157 | runnerRegistrationTokens?: RunnerRegistrationTokensCommand | 159 | runnerRegistrationTokens?: RunnerRegistrationTokensCommand |
@@ -442,6 +444,7 @@ export class PeerTubeServer { | |||
442 | this.registrations = new RegistrationsCommand(this) | 444 | this.registrations = new RegistrationsCommand(this) |
443 | 445 | ||
444 | this.storyboard = new StoryboardCommand(this) | 446 | this.storyboard = new StoryboardCommand(this) |
447 | this.chapters = new ChaptersCommand(this) | ||
445 | 448 | ||
446 | this.runners = new RunnersCommand(this) | 449 | this.runners = new RunnersCommand(this) |
447 | this.runnerRegistrationTokens = new RunnerRegistrationTokensCommand(this) | 450 | this.runnerRegistrationTokens = new RunnerRegistrationTokensCommand(this) |
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' |