aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/custom-pages/custom-pages-command.ts
blob: 6042233d4054d24dac5198dd25155f124c9a5231 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { CustomPage } from '@shared/models'
import { HttpStatusCode } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'

export class CustomPagesCommand extends AbstractCommand {

  getInstanceHomepage (options: OverrideCommandOptions = {}) {
    const path = '/api/v1/custom-pages/homepage/instance'

    return this.getRequestBody<CustomPage>({
      ...options,

      path,
      implicitToken: false,
      defaultExpectedStatus: HttpStatusCode.OK_200
    })
  }

  updateInstanceHomepage (options: OverrideCommandOptions & {
    content: string
  }) {
    const { content } = options
    const path = '/api/v1/custom-pages/homepage/instance'

    return this.putBodyRequest({
      ...options,

      path,
      fields: { content },
      implicitToken: true,
      defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
    })
  }
}