File size: 1,431 Bytes
b62a170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { ApiProperty } from '@nestjs/swagger';

import { WAHASessionStatus } from './enums.dto';
import { ChatIdProperty } from './properties.dto';
import { WebhookConfig } from './webhooks.config.dto';

/**
 * Queries
 */
export class ListSessionsQuery {
  @ApiProperty({
    example: false,
    required: false,
    description:
      'Return all sessions, including those that are in the STOPPED state.',
  })
  all: boolean;
}

/**
 * Requests
 */
export class ProxyConfig {
  @ApiProperty({
    example: 'localhost:3128',
  })
  server: string;

  @ApiProperty({
    example: null,
  })
  username?: string;

  @ApiProperty({
    example: null,
  })
  password?: string;
}

export class SessionConfig {
  webhooks?: WebhookConfig[];

  @ApiProperty({
    example: null,
  })
  proxy?: ProxyConfig;

  debug: boolean = false;
}

export class SessionStartRequest {
  name = 'default';
  config?: SessionConfig;
}

export class SessionStopRequest {
  name = 'default';
  @ApiProperty({
    example: false,
    required: false,
    description: 'Stop and logout from the session.',
  })
  logout = false;
}

export class SessionLogoutRequest {
  name = 'default';
}

export class SessionDTO {
  name = 'default';
  status: WAHASessionStatus;
  config?: SessionConfig;
}

export class MeInfo {
  @ChatIdProperty()
  id: string;

  pushName: string;
}

export class SessionInfo extends SessionDTO {
  me?: MeInfo;
  engine?: any;
}