1
0
Fork 0
peertube/shared/server-commands/custom-pages/custom-pages-command.ts

34 lines
847 B
TypeScript
Raw Normal View History

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