2021-07-16 10:42:24 +02:00
|
|
|
import { HttpStatusCode } from '@shared/models'
|
2021-07-06 10:34:29 +02:00
|
|
|
import { LogLevel } from '../../models/server/log-level.type'
|
|
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
|
|
|
|
|
|
|
export class LogsCommand extends AbstractCommand {
|
|
|
|
|
|
|
|
getLogs (options: OverrideCommandOptions & {
|
|
|
|
startDate: Date
|
|
|
|
endDate?: Date
|
|
|
|
level?: LogLevel
|
|
|
|
}) {
|
|
|
|
const { startDate, endDate, level } = options
|
|
|
|
const path = '/api/v1/server/logs'
|
|
|
|
|
|
|
|
return this.getRequestBody({
|
|
|
|
...options,
|
|
|
|
|
|
|
|
path,
|
|
|
|
query: { startDate, endDate, level },
|
2021-07-08 10:55:16 +02:00
|
|
|
implicitToken: true,
|
2021-07-06 10:34:29 +02:00
|
|
|
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 },
|
2021-07-08 10:55:16 +02:00
|
|
|
implicitToken: true,
|
2021-07-06 10:34:29 +02:00
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|