File size: 1,196 Bytes
4327358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { ApiProperty } from '@nestjs/swagger';

import { GroupId, GroupInfo, GroupParticipant } from './groups.dto';

/**
 * Happens when you join or are added to a group.
 */
export class GroupV2JoinEvent {
  @ApiProperty({
    description: 'Unix timestamp',
    example: 1666943582,
  })
  timestamp: number;

  group: GroupInfo;

  _data: any;
}

/**
 * Happens when you leave or are removed from a group.
 */
export class GroupV2LeaveEvent {
  @ApiProperty({
    description: 'Unix timestamp',
    example: 1666943582,
  })
  timestamp: number;

  group: GroupId;

  _data: any;
}

export class GroupV2UpdateEvent {
  @ApiProperty({
    description: 'Unix timestamp',
    example: 1666943582,
  })
  timestamp: number;

  group: Partial<GroupInfo>;

  _data: any;
}

export enum GroupParticipantType {
  JOIN = 'join',
  LEAVE = 'leave',
  PROMOTE = 'promote',
  DEMOTE = 'demote',
}

export class GroupV2ParticipantsEvent {
  group: GroupId;

  @ApiProperty({
    description: 'Type of the event',
  })
  type: GroupParticipantType;

  @ApiProperty({
    description: 'Unix timestamp',
    example: 1666943582,
  })
  timestamp: number;

  participants: GroupParticipant[];

  _data: any;
}