aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/logs/logs.ts
blob: c494c1f1eb785767fcdb0b974e51361ee6b83dbf (plain) (blame)
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
import { makeGetRequest } from '../requests/requests'
import { LogLevel } from '../../models/server/log-level.type'

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: 200
  })
}

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: 200
  })
}

export {
  getLogs,
  getAuditLogs
}