mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
shared/ typescript types dir server-commands
This commit is contained in:
parent
6b5f72beda
commit
bf54587a3e
242 changed files with 228 additions and 172 deletions
25
shared/server-commands/server/stats-command.ts
Normal file
25
shared/server-commands/server/stats-command.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { HttpStatusCode, ServerStats } from '@shared/models'
|
||||
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,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue