aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/extra-utils/custom-pages/custom-pages-command.ts
blob: a062c9774fb14e593d28295c1827d3d81fe6f72c (plain) (tree)
1
2
3
4
5
6
7
8
9
                                           
                                                                        
                                                                   
 
                                                         
 

                                                              
 





                                                  
 




                                                             
 






                                                          
 
import { CustomPage } from '@shared/models'
import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
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,
      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 },
      defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
    })
  }
}