1
0
Fork 0
peertube/shared/extra-utils/logs/logs.ts

33 lines
839 B
TypeScript
Raw Normal View History

2019-04-10 09:26:33 -04:00
import { makeGetRequest } from '../requests/requests'
import { LogLevel } from '../../models/server/log-level.type'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2019-04-10 09:26:33 -04: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 },
statusCodeExpected: HttpStatusCode.OK_200
2019-04-10 09:26:33 -04:00
})
}
2019-12-11 08:14:01 -05: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 },
statusCodeExpected: HttpStatusCode.OK_200
2019-12-11 08:14:01 -05:00
})
}
2019-04-10 09:26:33 -04:00
export {
2019-12-11 08:14:01 -05:00
getLogs,
getAuditLogs
2019-04-10 09:26:33 -04:00
}