1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
import { ClientLogCreate, HttpStatusCode, ServerLogLevel } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class LogsCommand extends AbstractCommand {
createLogClient (options: OverrideCommandOptions & { payload: ClientLogCreate }) {
const path = '/api/v1/server/logs/client'
return this.postBodyRequest({
...options,
path,
fields: options.payload,
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
})
}
getLogs (options: OverrideCommandOptions & {
startDate: Date
endDate?: Date
level?: ServerLogLevel
tagsOneOf?: string[]
}) {
const { startDate, endDate, tagsOneOf, level } = options
const path = '/api/v1/server/logs'
return this.getRequestBody<any[]>({
...options,
path,
query: { startDate, endDate, level, tagsOneOf },
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
getAuditLogs (options: OverrideCommandOptions & {
startDate: Date
endDate?: Date
}) {
const { startDate, endDate } = options
const path = '/api/v1/server/audit-logs'
return this.getRequestBody({
...options,
path,
query: { startDate, endDate },
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
}
|