-
Notifications
You must be signed in to change notification settings - Fork 12
/
webchatmemberinfo.go
215 lines (141 loc) · 5.34 KB
/
webchatmemberinfo.go
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
package platformclientv2
import (
"time"
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Webchatmemberinfo
type Webchatmemberinfo struct {
// Id - The communicationId of this member.
Id *string `json:"id,omitempty"`
// DisplayName - The display name of the member.
DisplayName *string `json:"displayName,omitempty"`
// FirstName - The first name of the member.
FirstName *string `json:"firstName,omitempty"`
// LastName - The last name of the member.
LastName *string `json:"lastName,omitempty"`
// Email - The email address of the member.
Email *string `json:"email,omitempty"`
// PhoneNumber - The phone number of the member.
PhoneNumber *string `json:"phoneNumber,omitempty"`
// AvatarImageUrl - The url to the avatar image of the member.
AvatarImageUrl *string `json:"avatarImageUrl,omitempty"`
// Role - The role of the member, one of [agent, customer, acd, workflow]
Role *string `json:"role,omitempty"`
// JoinDate - The time the member joined the conversation. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
JoinDate *time.Time `json:"joinDate,omitempty"`
// LeaveDate - The time the member left the conversation, or null if the member is still active in the conversation. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
LeaveDate *time.Time `json:"leaveDate,omitempty"`
// AuthenticatedGuest - If true, the guest member is an authenticated guest.
AuthenticatedGuest *bool `json:"authenticatedGuest,omitempty"`
// CustomFields - Any custom fields of information pertaining to this member.
CustomFields *map[string]string `json:"customFields,omitempty"`
// State - The connection state of this member.
State *string `json:"state,omitempty"`
}
func (o *Webchatmemberinfo) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Webchatmemberinfo
JoinDate := new(string)
if o.JoinDate != nil {
*JoinDate = timeutil.Strftime(o.JoinDate, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
JoinDate = nil
}
LeaveDate := new(string)
if o.LeaveDate != nil {
*LeaveDate = timeutil.Strftime(o.LeaveDate, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
LeaveDate = nil
}
return json.Marshal(&struct {
Id *string `json:"id,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
FirstName *string `json:"firstName,omitempty"`
LastName *string `json:"lastName,omitempty"`
Email *string `json:"email,omitempty"`
PhoneNumber *string `json:"phoneNumber,omitempty"`
AvatarImageUrl *string `json:"avatarImageUrl,omitempty"`
Role *string `json:"role,omitempty"`
JoinDate *string `json:"joinDate,omitempty"`
LeaveDate *string `json:"leaveDate,omitempty"`
AuthenticatedGuest *bool `json:"authenticatedGuest,omitempty"`
CustomFields *map[string]string `json:"customFields,omitempty"`
State *string `json:"state,omitempty"`
*Alias
}{
Id: o.Id,
DisplayName: o.DisplayName,
FirstName: o.FirstName,
LastName: o.LastName,
Email: o.Email,
PhoneNumber: o.PhoneNumber,
AvatarImageUrl: o.AvatarImageUrl,
Role: o.Role,
JoinDate: JoinDate,
LeaveDate: LeaveDate,
AuthenticatedGuest: o.AuthenticatedGuest,
CustomFields: o.CustomFields,
State: o.State,
Alias: (*Alias)(o),
})
}
func (o *Webchatmemberinfo) UnmarshalJSON(b []byte) error {
var WebchatmemberinfoMap map[string]interface{}
err := json.Unmarshal(b, &WebchatmemberinfoMap)
if err != nil {
return err
}
if Id, ok := WebchatmemberinfoMap["id"].(string); ok {
o.Id = &Id
}
if DisplayName, ok := WebchatmemberinfoMap["displayName"].(string); ok {
o.DisplayName = &DisplayName
}
if FirstName, ok := WebchatmemberinfoMap["firstName"].(string); ok {
o.FirstName = &FirstName
}
if LastName, ok := WebchatmemberinfoMap["lastName"].(string); ok {
o.LastName = &LastName
}
if Email, ok := WebchatmemberinfoMap["email"].(string); ok {
o.Email = &Email
}
if PhoneNumber, ok := WebchatmemberinfoMap["phoneNumber"].(string); ok {
o.PhoneNumber = &PhoneNumber
}
if AvatarImageUrl, ok := WebchatmemberinfoMap["avatarImageUrl"].(string); ok {
o.AvatarImageUrl = &AvatarImageUrl
}
if Role, ok := WebchatmemberinfoMap["role"].(string); ok {
o.Role = &Role
}
if joinDateString, ok := WebchatmemberinfoMap["joinDate"].(string); ok {
JoinDate, _ := time.Parse("2006-01-02T15:04:05.999999Z", joinDateString)
o.JoinDate = &JoinDate
}
if leaveDateString, ok := WebchatmemberinfoMap["leaveDate"].(string); ok {
LeaveDate, _ := time.Parse("2006-01-02T15:04:05.999999Z", leaveDateString)
o.LeaveDate = &LeaveDate
}
if AuthenticatedGuest, ok := WebchatmemberinfoMap["authenticatedGuest"].(bool); ok {
o.AuthenticatedGuest = &AuthenticatedGuest
}
if CustomFields, ok := WebchatmemberinfoMap["customFields"].(map[string]interface{}); ok {
CustomFieldsString, _ := json.Marshal(CustomFields)
json.Unmarshal(CustomFieldsString, &o.CustomFields)
}
if State, ok := WebchatmemberinfoMap["state"].(string); ok {
o.State = &State
}
return nil
}
// String returns a JSON representation of the model
func (o *Webchatmemberinfo) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}