2021-07-06 09:55:05 +02:00
|
|
|
import { CustomPage } from '@shared/models'
|
2021-07-06 10:22:37 +02:00
|
|
|
import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
|
2021-07-06 09:55:05 +02:00
|
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
2021-05-27 15:59:55 +02:00
|
|
|
|
2021-07-06 09:55:05 +02:00
|
|
|
export class CustomPagesCommand extends AbstractCommand {
|
2021-05-27 15:59:55 +02:00
|
|
|
|
2021-07-06 09:55:05 +02:00
|
|
|
getInstanceHomepage (options: OverrideCommandOptions = {}) {
|
|
|
|
const path = '/api/v1/custom-pages/homepage/instance'
|
2021-05-27 15:59:55 +02:00
|
|
|
|
2021-07-06 09:55:05 +02:00
|
|
|
return this.getRequestBody<CustomPage>({
|
|
|
|
...options,
|
2021-07-08 10:55:16 +02:00
|
|
|
|
2021-07-06 09:55:05 +02:00
|
|
|
path,
|
2021-07-08 10:55:16 +02:00
|
|
|
implicitToken: false,
|
2021-07-06 09:55:05 +02:00
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
|
|
})
|
|
|
|
}
|
2021-05-27 15:59:55 +02:00
|
|
|
|
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-05-27 15:59:55 +02:00
|
|
|
|
2021-07-06 09:55:05 +02:00
|
|
|
return this.putBodyRequest({
|
|
|
|
...options,
|
2021-07-08 10:55:16 +02:00
|
|
|
|
2021-07-06 09:55:05 +02:00
|
|
|
path,
|
|
|
|
fields: { content },
|
2021-07-08 10:55:16 +02:00
|
|
|
implicitToken: true,
|
2021-07-06 09:55:05 +02:00
|
|
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
|
|
|
})
|
|
|
|
}
|
2021-05-27 15:59:55 +02:00
|
|
|
}
|