debug-command.ts 800 B

123456789101112131415161718192021222324252627282930313233
  1. import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models'
  2. import { AbstractCommand, OverrideCommandOptions } from '../shared'
  3. export class DebugCommand extends AbstractCommand {
  4. getDebug (options: OverrideCommandOptions = {}) {
  5. const path = '/api/v1/server/debug'
  6. return this.getRequestBody<Debug>({
  7. ...options,
  8. path,
  9. implicitToken: true,
  10. defaultExpectedStatus: HttpStatusCode.OK_200
  11. })
  12. }
  13. sendCommand (options: OverrideCommandOptions & {
  14. body: SendDebugCommand
  15. }) {
  16. const { body } = options
  17. const path = '/api/v1/server/debug/run-command'
  18. return this.postBodyRequest({
  19. ...options,
  20. path,
  21. fields: body,
  22. implicitToken: true,
  23. defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
  24. })
  25. }
  26. }