]>
Commit | Line | Data |
---|---|---|
c55e3d72 | 1 | import { HttpStatusCode, LogLevel } from '@shared/models' |
a92ddacb C |
2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
3 | ||
4 | export class LogsCommand extends AbstractCommand { | |
5 | ||
6 | getLogs (options: OverrideCommandOptions & { | |
7 | startDate: Date | |
8 | endDate?: Date | |
9 | level?: LogLevel | |
64553e88 | 10 | tagsOneOf?: string[] |
a92ddacb | 11 | }) { |
64553e88 | 12 | const { startDate, endDate, tagsOneOf, level } = options |
a92ddacb C |
13 | const path = '/api/v1/server/logs' |
14 | ||
64553e88 | 15 | return this.getRequestBody<any[]>({ |
a92ddacb C |
16 | ...options, |
17 | ||
18 | path, | |
64553e88 | 19 | query: { startDate, endDate, level, tagsOneOf }, |
a1637fa1 | 20 | implicitToken: true, |
a92ddacb C |
21 | defaultExpectedStatus: HttpStatusCode.OK_200 |
22 | }) | |
23 | } | |
24 | ||
25 | getAuditLogs (options: OverrideCommandOptions & { | |
26 | startDate: Date | |
27 | endDate?: Date | |
28 | }) { | |
29 | const { startDate, endDate } = options | |
30 | ||
31 | const path = '/api/v1/server/audit-logs' | |
32 | ||
33 | return this.getRequestBody({ | |
34 | ...options, | |
35 | ||
36 | path, | |
37 | query: { startDate, endDate }, | |
a1637fa1 | 38 | implicitToken: true, |
a92ddacb C |
39 | defaultExpectedStatus: HttpStatusCode.OK_200 |
40 | }) | |
41 | } | |
42 | ||
43 | } |