PeerTube/shared/extra-utils/custom-pages/custom-pages.ts

31 lines
857 B
TypeScript
Raw Normal View History

2021-07-06 07:55:05 +00:00
import { CustomPage } from '@shared/models'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2021-07-06 07:55:05 +00:00
import { AbstractCommand, OverrideCommandOptions } from '../shared'
2021-07-06 07:55:05 +00:00
export class CustomPagesCommand extends AbstractCommand {
2021-07-06 07:55:05 +00:00
getInstanceHomepage (options: OverrideCommandOptions = {}) {
const path = '/api/v1/custom-pages/homepage/instance'
2021-07-06 07:55:05 +00:00
return this.getRequestBody<CustomPage>({
...options,
path,
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
2021-07-06 07:55:05 +00:00
updateInstanceHomepage (options: OverrideCommandOptions & {
content: string
}) {
const { content } = options
const path = '/api/v1/custom-pages/homepage/instance'
2021-07-06 07:55:05 +00:00
return this.putBodyRequest({
...options,
path,
fields: { content },
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
})
}
}