custom-pages-command.ts 847 B

123456789101112131415161718192021222324252627282930313233
  1. import { CustomPage, HttpStatusCode } from '@shared/models'
  2. import { AbstractCommand, OverrideCommandOptions } from '../shared'
  3. export class CustomPagesCommand extends AbstractCommand {
  4. getInstanceHomepage (options: OverrideCommandOptions = {}) {
  5. const path = '/api/v1/custom-pages/homepage/instance'
  6. return this.getRequestBody<CustomPage>({
  7. ...options,
  8. path,
  9. implicitToken: false,
  10. defaultExpectedStatus: HttpStatusCode.OK_200
  11. })
  12. }
  13. updateInstanceHomepage (options: OverrideCommandOptions & {
  14. content: string
  15. }) {
  16. const { content } = options
  17. const path = '/api/v1/custom-pages/homepage/instance'
  18. return this.putBodyRequest({
  19. ...options,
  20. path,
  21. fields: { content },
  22. implicitToken: true,
  23. defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
  24. })
  25. }
  26. }