]>
Commit | Line | Data |
---|---|---|
fd8710b8 C |
1 | import { makeGetRequest } from '../requests/requests' |
2 | import { LogLevel } from '../../models/server/log-level.type' | |
2d53be02 | 3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
fd8710b8 | 4 | |
fd8710b8 C |
5 | function getLogs (url: string, accessToken: string, startDate: Date, endDate?: Date, level?: LogLevel) { |
6 | const path = '/api/v1/server/logs' | |
7 | ||
8 | return makeGetRequest({ | |
9 | url, | |
10 | path, | |
11 | token: accessToken, | |
12 | query: { startDate, endDate, level }, | |
2d53be02 | 13 | statusCodeExpected: HttpStatusCode.OK_200 |
fd8710b8 C |
14 | }) |
15 | } | |
16 | ||
566c125d C |
17 | function getAuditLogs (url: string, accessToken: string, startDate: Date, endDate?: Date) { |
18 | const path = '/api/v1/server/audit-logs' | |
19 | ||
20 | return makeGetRequest({ | |
21 | url, | |
22 | path, | |
23 | token: accessToken, | |
24 | query: { startDate, endDate }, | |
2d53be02 | 25 | statusCodeExpected: HttpStatusCode.OK_200 |
566c125d C |
26 | }) |
27 | } | |
28 | ||
fd8710b8 | 29 | export { |
566c125d C |
30 | getLogs, |
31 | getAuditLogs | |
fd8710b8 | 32 | } |