PeerTube/shared/server-commands/custom-pages/custom-pages-command.ts

34 lines
847 B
TypeScript
Raw Normal View History

2021-07-16 14:27:30 +02:00
import { CustomPage, HttpStatusCode } from '@shared/models'
2021-07-06 09:55:05 +02:00
import { AbstractCommand, OverrideCommandOptions } from '../shared'
2021-07-06 09:55:05 +02:00
export class CustomPagesCommand extends AbstractCommand {
2021-07-06 09:55:05 +02:00
getInstanceHomepage (options: OverrideCommandOptions = {}) {
const path = '/api/v1/custom-pages/homepage/instance'
2021-07-06 09:55:05 +02:00
return this.getRequestBody<CustomPage>({
...options,
2021-07-06 09:55:05 +02:00
path,
implicitToken: false,
2021-07-06 09:55:05 +02:00
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
2021-07-06 09:55:05 +02:00
updateInstanceHomepage (options: OverrideCommandOptions & {
content: string
}) {
const { content } = options
const path = '/api/v1/custom-pages/homepage/instance'
2021-07-06 09:55:05 +02:00
return this.putBodyRequest({
...options,
2021-07-06 09:55:05 +02:00
path,
fields: { content },
implicitToken: true,
2021-07-06 09:55:05 +02:00
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
})
}
}