aboutsummaryrefslogblamecommitdiffhomepage
path: root/packages/server-commands/src/custom-pages/custom-pages-command.ts
blob: 412f3f7638c3ac72b046ba2a95c9e7f5611221e1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                                                            
 
                                                         
 

                                                              
 

                                            
 
           
                           


                                                  
 




                                                             
 

                                
 

                          
                          


                                                          
 
import { CustomPage, HttpStatusCode } from '@peertube/peertube-models'
import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'

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
    })
  }
}