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