blob: eaf21ce08614644dfa93b7541dbdf68b05735951 (
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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
// Copyright (c) 2021 Tulir Asokan
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package types
import (
"time"
)
type GroupMemberAddMode string
const (
GroupMemberAddModeAdmin GroupMemberAddMode = "admin_add"
)
// GroupInfo contains basic information about a group chat on WhatsApp.
type GroupInfo struct {
JID JID
OwnerJID JID
GroupName
GroupTopic
GroupLocked
GroupAnnounce
GroupEphemeral
GroupParent
GroupLinkedParent
GroupIsDefaultSub
GroupCreated time.Time
ParticipantVersionID string
Participants []GroupParticipant
MemberAddMode GroupMemberAddMode
}
type GroupParent struct {
IsParent bool
DefaultMembershipApprovalMode string // request_required
}
type GroupLinkedParent struct {
LinkedParentJID JID
}
type GroupIsDefaultSub struct {
IsDefaultSubGroup bool
}
// GroupName contains the name of a group along with metadata of who set it and when.
type GroupName struct {
Name string
NameSetAt time.Time
NameSetBy JID
}
// GroupTopic contains the topic (description) of a group along with metadata of who set it and when.
type GroupTopic struct {
Topic string
TopicID string
TopicSetAt time.Time
TopicSetBy JID
TopicDeleted bool
}
// GroupLocked specifies whether the group info can only be edited by admins.
type GroupLocked struct {
IsLocked bool
}
// GroupAnnounce specifies whether only admins can send messages in the group.
type GroupAnnounce struct {
IsAnnounce bool
AnnounceVersionID string
}
// GroupParticipant contains info about a participant of a WhatsApp group chat.
type GroupParticipant struct {
JID JID
IsAdmin bool
IsSuperAdmin bool
// When creating groups, adding some participants may fail.
// In such cases, the error code will be here.
Error int
AddRequest *GroupParticipantAddRequest
}
type GroupParticipantAddRequest struct {
Code string
Expiration time.Time
}
// GroupEphemeral contains the group's disappearing messages settings.
type GroupEphemeral struct {
IsEphemeral bool
DisappearingTimer uint32
}
type GroupDelete struct {
Deleted bool
DeleteReason string
}
type GroupLinkChangeType string
const (
GroupLinkChangeTypeParent GroupLinkChangeType = "parent_group"
GroupLinkChangeTypeSub GroupLinkChangeType = "sub_group"
GroupLinkChangeTypeSibling GroupLinkChangeType = "sibling_group"
)
type GroupUnlinkReason string
const (
GroupUnlinkReasonDefault GroupUnlinkReason = "unlink_group"
GroupUnlinkReasonDelete GroupUnlinkReason = "delete_parent"
)
type GroupLinkTarget struct {
JID JID
GroupName
GroupIsDefaultSub
}
type GroupLinkChange struct {
Type GroupLinkChangeType
UnlinkReason GroupUnlinkReason
Group GroupLinkTarget
}
|