mirror of https://github.com/Chocobozzz/PeerTube
34 lines
847 B
TypeScript
34 lines
847 B
TypeScript
import { CustomPage, HttpStatusCode } from '@shared/models'
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
|
|
|
export class CustomPagesCommand extends AbstractCommand {
|
|
|
|
getInstanceHomepage (options: OverrideCommandOptions = {}) {
|
|
const path = '/api/v1/custom-pages/homepage/instance'
|
|
|
|
return this.getRequestBody<CustomPage>({
|
|
...options,
|
|
|
|
path,
|
|
implicitToken: false,
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
})
|
|
}
|
|
|
|
updateInstanceHomepage (options: OverrideCommandOptions & {
|
|
content: string
|
|
}) {
|
|
const { content } = options
|
|
const path = '/api/v1/custom-pages/homepage/instance'
|
|
|
|
return this.putBodyRequest({
|
|
...options,
|
|
|
|
path,
|
|
fields: { content },
|
|
implicitToken: true,
|
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
|
})
|
|
}
|
|
}
|