]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/server-commands/custom-pages/custom-pages-command.ts
shared/ typescript types dir server-commands
[github/Chocobozzz/PeerTube.git] / shared / server-commands / custom-pages / custom-pages-command.ts
CommitLineData
4c7e60bc 1import { CustomPage, HttpStatusCode } from '@shared/models'
e8bd7ce7 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
2539932e 3
e8bd7ce7 4export class CustomPagesCommand extends AbstractCommand {
2539932e 5
e8bd7ce7
C
6 getInstanceHomepage (options: OverrideCommandOptions = {}) {
7 const path = '/api/v1/custom-pages/homepage/instance'
2539932e 8
e8bd7ce7
C
9 return this.getRequestBody<CustomPage>({
10 ...options,
a1637fa1 11
e8bd7ce7 12 path,
a1637fa1 13 implicitToken: false,
e8bd7ce7
C
14 defaultExpectedStatus: HttpStatusCode.OK_200
15 })
16 }
2539932e 17
e8bd7ce7
C
18 updateInstanceHomepage (options: OverrideCommandOptions & {
19 content: string
20 }) {
21 const { content } = options
22 const path = '/api/v1/custom-pages/homepage/instance'
2539932e 23
e8bd7ce7
C
24 return this.putBodyRequest({
25 ...options,
a1637fa1 26
e8bd7ce7
C
27 path,
28 fields: { content },
a1637fa1 29 implicitToken: true,
e8bd7ce7
C
30 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
31 })
32 }
2539932e 33}