aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/extra-utils/server/debug.ts
blob: f196812b710b431e2e6283346d0f06d0b2aced1f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
                                                                          
                                                                        
                                                 











                                                











                                                                                


                                                                              

                  
 
import { makeGetRequest, makePostBodyRequest } from '../requests/requests'
import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
import { SendDebugCommand } from '@shared/models'

function getDebug (url: string, token: string) {
  const path = '/api/v1/server/debug'

  return makeGetRequest({
    url,
    path,
    token,
    statusCodeExpected: HttpStatusCode.OK_200
  })
}

function sendDebugCommand (url: string, token: string, body: SendDebugCommand) {
  const path = '/api/v1/server/debug/run-command'

  return makePostBodyRequest({
    url,
    path,
    token,
    fields: body,
    statusCodeExpected: HttpStatusCode.NO_CONTENT_204
  })
}

// ---------------------------------------------------------------------------

export {
  getDebug,
  sendDebugCommand
}