-
Notifications
You must be signed in to change notification settings - Fork 12
/
voicemailmessage.go
317 lines (206 loc) · 9.11 KB
/
voicemailmessage.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
package platformclientv2
import (
"time"
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Voicemailmessage
type Voicemailmessage struct {
// Id - The globally unique identifier for the object.
Id *string `json:"id,omitempty"`
// Conversation - The conversation that the voicemail message is associated with
Conversation *Conversation `json:"conversation,omitempty"`
// Read - Whether the voicemail message is marked as read
Read *bool `json:"read,omitempty"`
// AudioRecordingDurationSeconds - The voicemail message's audio recording duration in seconds
AudioRecordingDurationSeconds *int `json:"audioRecordingDurationSeconds,omitempty"`
// AudioRecordingSizeBytes - The voicemail message's audio recording size in bytes
AudioRecordingSizeBytes *int `json:"audioRecordingSizeBytes,omitempty"`
// CreatedDate - The date the voicemail message was created. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
CreatedDate *time.Time `json:"createdDate,omitempty"`
// ModifiedDate - The date the voicemail message was last modified. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
ModifiedDate *time.Time `json:"modifiedDate,omitempty"`
// DeletedDate - The date the voicemail message deleted property was set to true. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
DeletedDate *time.Time `json:"deletedDate,omitempty"`
// CallerAddress - The caller address
CallerAddress *string `json:"callerAddress,omitempty"`
// CallerName - Optionally the name of the caller that left the voicemail message if the caller was a known user
CallerName *string `json:"callerName,omitempty"`
// CallerUser - Optionally the user that left the voicemail message if the caller was a known user
CallerUser *User `json:"callerUser,omitempty"`
// Deleted - Whether the voicemail message has been marked as deleted
Deleted *bool `json:"deleted,omitempty"`
// Note - An optional note
Note *string `json:"note,omitempty"`
// User - The user that the voicemail message belongs to or null which means the voicemail message belongs to a group or queue
User *User `json:"user,omitempty"`
// Group - The group that the voicemail message belongs to or null which means the voicemail message belongs to a user or queue
Group *Group `json:"group,omitempty"`
// Queue - The queue that the voicemail message belongs to or null which means the voicemail message belongs to a user or group
Queue *Queue `json:"queue,omitempty"`
// CopiedFrom - Represents where this voicemail message was copied from
CopiedFrom *Voicemailcopyrecord `json:"copiedFrom,omitempty"`
// CopiedTo - Represents where this voicemail has been copied to
CopiedTo *[]Voicemailcopyrecord `json:"copiedTo,omitempty"`
// DeleteRetentionPolicy - The retention policy for this voicemail when deleted is set to true
DeleteRetentionPolicy *Voicemailretentionpolicy `json:"deleteRetentionPolicy,omitempty"`
// SelfUri - The URI for this object
SelfUri *string `json:"selfUri,omitempty"`
}
func (o *Voicemailmessage) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Voicemailmessage
CreatedDate := new(string)
if o.CreatedDate != nil {
*CreatedDate = timeutil.Strftime(o.CreatedDate, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
CreatedDate = nil
}
ModifiedDate := new(string)
if o.ModifiedDate != nil {
*ModifiedDate = timeutil.Strftime(o.ModifiedDate, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
ModifiedDate = nil
}
DeletedDate := new(string)
if o.DeletedDate != nil {
*DeletedDate = timeutil.Strftime(o.DeletedDate, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
DeletedDate = nil
}
return json.Marshal(&struct {
Id *string `json:"id,omitempty"`
Conversation *Conversation `json:"conversation,omitempty"`
Read *bool `json:"read,omitempty"`
AudioRecordingDurationSeconds *int `json:"audioRecordingDurationSeconds,omitempty"`
AudioRecordingSizeBytes *int `json:"audioRecordingSizeBytes,omitempty"`
CreatedDate *string `json:"createdDate,omitempty"`
ModifiedDate *string `json:"modifiedDate,omitempty"`
DeletedDate *string `json:"deletedDate,omitempty"`
CallerAddress *string `json:"callerAddress,omitempty"`
CallerName *string `json:"callerName,omitempty"`
CallerUser *User `json:"callerUser,omitempty"`
Deleted *bool `json:"deleted,omitempty"`
Note *string `json:"note,omitempty"`
User *User `json:"user,omitempty"`
Group *Group `json:"group,omitempty"`
Queue *Queue `json:"queue,omitempty"`
CopiedFrom *Voicemailcopyrecord `json:"copiedFrom,omitempty"`
CopiedTo *[]Voicemailcopyrecord `json:"copiedTo,omitempty"`
DeleteRetentionPolicy *Voicemailretentionpolicy `json:"deleteRetentionPolicy,omitempty"`
SelfUri *string `json:"selfUri,omitempty"`
*Alias
}{
Id: o.Id,
Conversation: o.Conversation,
Read: o.Read,
AudioRecordingDurationSeconds: o.AudioRecordingDurationSeconds,
AudioRecordingSizeBytes: o.AudioRecordingSizeBytes,
CreatedDate: CreatedDate,
ModifiedDate: ModifiedDate,
DeletedDate: DeletedDate,
CallerAddress: o.CallerAddress,
CallerName: o.CallerName,
CallerUser: o.CallerUser,
Deleted: o.Deleted,
Note: o.Note,
User: o.User,
Group: o.Group,
Queue: o.Queue,
CopiedFrom: o.CopiedFrom,
CopiedTo: o.CopiedTo,
DeleteRetentionPolicy: o.DeleteRetentionPolicy,
SelfUri: o.SelfUri,
Alias: (*Alias)(o),
})
}
func (o *Voicemailmessage) UnmarshalJSON(b []byte) error {
var VoicemailmessageMap map[string]interface{}
err := json.Unmarshal(b, &VoicemailmessageMap)
if err != nil {
return err
}
if Id, ok := VoicemailmessageMap["id"].(string); ok {
o.Id = &Id
}
if Conversation, ok := VoicemailmessageMap["conversation"].(map[string]interface{}); ok {
ConversationString, _ := json.Marshal(Conversation)
json.Unmarshal(ConversationString, &o.Conversation)
}
if Read, ok := VoicemailmessageMap["read"].(bool); ok {
o.Read = &Read
}
if AudioRecordingDurationSeconds, ok := VoicemailmessageMap["audioRecordingDurationSeconds"].(float64); ok {
AudioRecordingDurationSecondsInt := int(AudioRecordingDurationSeconds)
o.AudioRecordingDurationSeconds = &AudioRecordingDurationSecondsInt
}
if AudioRecordingSizeBytes, ok := VoicemailmessageMap["audioRecordingSizeBytes"].(float64); ok {
AudioRecordingSizeBytesInt := int(AudioRecordingSizeBytes)
o.AudioRecordingSizeBytes = &AudioRecordingSizeBytesInt
}
if createdDateString, ok := VoicemailmessageMap["createdDate"].(string); ok {
CreatedDate, _ := time.Parse("2006-01-02T15:04:05.999999Z", createdDateString)
o.CreatedDate = &CreatedDate
}
if modifiedDateString, ok := VoicemailmessageMap["modifiedDate"].(string); ok {
ModifiedDate, _ := time.Parse("2006-01-02T15:04:05.999999Z", modifiedDateString)
o.ModifiedDate = &ModifiedDate
}
if deletedDateString, ok := VoicemailmessageMap["deletedDate"].(string); ok {
DeletedDate, _ := time.Parse("2006-01-02T15:04:05.999999Z", deletedDateString)
o.DeletedDate = &DeletedDate
}
if CallerAddress, ok := VoicemailmessageMap["callerAddress"].(string); ok {
o.CallerAddress = &CallerAddress
}
if CallerName, ok := VoicemailmessageMap["callerName"].(string); ok {
o.CallerName = &CallerName
}
if CallerUser, ok := VoicemailmessageMap["callerUser"].(map[string]interface{}); ok {
CallerUserString, _ := json.Marshal(CallerUser)
json.Unmarshal(CallerUserString, &o.CallerUser)
}
if Deleted, ok := VoicemailmessageMap["deleted"].(bool); ok {
o.Deleted = &Deleted
}
if Note, ok := VoicemailmessageMap["note"].(string); ok {
o.Note = &Note
}
if User, ok := VoicemailmessageMap["user"].(map[string]interface{}); ok {
UserString, _ := json.Marshal(User)
json.Unmarshal(UserString, &o.User)
}
if Group, ok := VoicemailmessageMap["group"].(map[string]interface{}); ok {
GroupString, _ := json.Marshal(Group)
json.Unmarshal(GroupString, &o.Group)
}
if Queue, ok := VoicemailmessageMap["queue"].(map[string]interface{}); ok {
QueueString, _ := json.Marshal(Queue)
json.Unmarshal(QueueString, &o.Queue)
}
if CopiedFrom, ok := VoicemailmessageMap["copiedFrom"].(map[string]interface{}); ok {
CopiedFromString, _ := json.Marshal(CopiedFrom)
json.Unmarshal(CopiedFromString, &o.CopiedFrom)
}
if CopiedTo, ok := VoicemailmessageMap["copiedTo"].([]interface{}); ok {
CopiedToString, _ := json.Marshal(CopiedTo)
json.Unmarshal(CopiedToString, &o.CopiedTo)
}
if DeleteRetentionPolicy, ok := VoicemailmessageMap["deleteRetentionPolicy"].(map[string]interface{}); ok {
DeleteRetentionPolicyString, _ := json.Marshal(DeleteRetentionPolicy)
json.Unmarshal(DeleteRetentionPolicyString, &o.DeleteRetentionPolicy)
}
if SelfUri, ok := VoicemailmessageMap["selfUri"].(string); ok {
o.SelfUri = &SelfUri
}
return nil
}
// String returns a JSON representation of the model
func (o *Voicemailmessage) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}