]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/server-commands/logs/logs-command.ts
Use private ACL for private videos in s3
[github/Chocobozzz/PeerTube.git] / shared / server-commands / logs / logs-command.ts
CommitLineData
42b40636 1import { ClientLogCreate, HttpStatusCode, ServerLogLevel } from '@shared/models'
a92ddacb
C
2import { AbstractCommand, OverrideCommandOptions } from '../shared'
3
4export class LogsCommand extends AbstractCommand {
5
42b40636
C
6 createLogClient (options: OverrideCommandOptions & { payload: ClientLogCreate }) {
7 const path = '/api/v1/server/logs/client'
8
9 return this.postBodyRequest({
10 ...options,
11
12 path,
13 fields: options.payload,
14 implicitToken: true,
15 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
16 })
17 }
18
a92ddacb
C
19 getLogs (options: OverrideCommandOptions & {
20 startDate: Date
21 endDate?: Date
42b40636 22 level?: ServerLogLevel
64553e88 23 tagsOneOf?: string[]
a92ddacb 24 }) {
64553e88 25 const { startDate, endDate, tagsOneOf, level } = options
a92ddacb
C
26 const path = '/api/v1/server/logs'
27
64553e88 28 return this.getRequestBody<any[]>({
a92ddacb
C
29 ...options,
30
31 path,
64553e88 32 query: { startDate, endDate, level, tagsOneOf },
a1637fa1 33 implicitToken: true,
a92ddacb
C
34 defaultExpectedStatus: HttpStatusCode.OK_200
35 })
36 }
37
38 getAuditLogs (options: OverrideCommandOptions & {
39 startDate: Date
40 endDate?: Date
41 }) {
42 const { startDate, endDate } = options
43
44 const path = '/api/v1/server/audit-logs'
45
46 return this.getRequestBody({
47 ...options,
48
49 path,
50 query: { startDate, endDate },
a1637fa1 51 implicitToken: true,
a92ddacb
C
52 defaultExpectedStatus: HttpStatusCode.OK_200
53 })
54 }
55
56}