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