2019-04-10 15:26:33 +02:00
|
|
|
import { makeGetRequest } from '../requests/requests'
|
|
|
|
import { LogLevel } from '../../models/server/log-level.type'
|
2020-12-07 14:32:36 +01:00
|
|
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
2019-04-10 15:26:33 +02:00
|
|
|
|
|
|
|
function getLogs (url: string, accessToken: string, startDate: Date, endDate?: Date, level?: LogLevel) {
|
|
|
|
const path = '/api/v1/server/logs'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token: accessToken,
|
|
|
|
query: { startDate, endDate, level },
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.OK_200
|
2019-04-10 15:26:33 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-12-11 14:14:01 +01:00
|
|
|
function getAuditLogs (url: string, accessToken: string, startDate: Date, endDate?: Date) {
|
|
|
|
const path = '/api/v1/server/audit-logs'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token: accessToken,
|
|
|
|
query: { startDate, endDate },
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.OK_200
|
2019-12-11 14:14:01 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-04-10 15:26:33 +02:00
|
|
|
export {
|
2019-12-11 14:14:01 +01:00
|
|
|
getLogs,
|
|
|
|
getAuditLogs
|
2019-04-10 15:26:33 +02:00
|
|
|
}
|