PeerTube/shared/extra-utils/server/stats-command.ts

27 lines
654 B
TypeScript
Raw Normal View History

2021-07-07 11:07:12 +02:00
import { ServerStats } from '@shared/models'
2021-07-16 10:42:24 +02:00
import { HttpStatusCode } from '@shared/models'
2021-07-07 11:07:12 +02:00
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class StatsCommand extends AbstractCommand {
get (options: OverrideCommandOptions & {
useCache?: boolean // default false
} = {}) {
const { useCache = false } = options
const path = '/api/v1/server/stats'
const query = {
t: useCache ? undefined : new Date().getTime()
}
return this.getRequestBody<ServerStats>({
...options,
path,
query,
implicitToken: false,
2021-07-07 11:07:12 +02:00
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
}