-
Notifications
You must be signed in to change notification settings - Fork 12
/
recordingmessagingmessage.go
200 lines (133 loc) · 5.81 KB
/
recordingmessagingmessage.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
package platformclientv2
import (
"time"
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Recordingmessagingmessage
type Recordingmessagingmessage struct {
// From - The message sender session id.
From *string `json:"from,omitempty"`
// FromUser - The user who sent this message.
FromUser *User `json:"fromUser,omitempty"`
// FromExternalContact - The PureCloud external contact sender details.
FromExternalContact *Externalcontact `json:"fromExternalContact,omitempty"`
// To - The message recipient.
To *string `json:"to,omitempty"`
// Timestamp - The time when the message was sent. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
Timestamp *time.Time `json:"timestamp,omitempty"`
// Id - A globally unique identifier for this communication.
Id *string `json:"id,omitempty"`
// MessageText - The content of this message.
MessageText *string `json:"messageText,omitempty"`
// MessageMediaAttachments - List of media objects attached with this message.
MessageMediaAttachments *[]Messagemediaattachment `json:"messageMediaAttachments,omitempty"`
// MessageStickerAttachments - List of message stickers attached with this message.
MessageStickerAttachments *[]Messagestickerattachment `json:"messageStickerAttachments,omitempty"`
// QuickReplies - List of quick reply options offered with this message.
QuickReplies *[]Quickreply `json:"quickReplies,omitempty"`
// ButtonResponse - Button Response selected by user for this message.
ButtonResponse *Buttonresponse `json:"buttonResponse,omitempty"`
// Story - Ephemeral story content.
Story *Recordingcontentstory `json:"story,omitempty"`
}
func (o *Recordingmessagingmessage) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Recordingmessagingmessage
Timestamp := new(string)
if o.Timestamp != nil {
*Timestamp = timeutil.Strftime(o.Timestamp, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
Timestamp = nil
}
return json.Marshal(&struct {
From *string `json:"from,omitempty"`
FromUser *User `json:"fromUser,omitempty"`
FromExternalContact *Externalcontact `json:"fromExternalContact,omitempty"`
To *string `json:"to,omitempty"`
Timestamp *string `json:"timestamp,omitempty"`
Id *string `json:"id,omitempty"`
MessageText *string `json:"messageText,omitempty"`
MessageMediaAttachments *[]Messagemediaattachment `json:"messageMediaAttachments,omitempty"`
MessageStickerAttachments *[]Messagestickerattachment `json:"messageStickerAttachments,omitempty"`
QuickReplies *[]Quickreply `json:"quickReplies,omitempty"`
ButtonResponse *Buttonresponse `json:"buttonResponse,omitempty"`
Story *Recordingcontentstory `json:"story,omitempty"`
*Alias
}{
From: o.From,
FromUser: o.FromUser,
FromExternalContact: o.FromExternalContact,
To: o.To,
Timestamp: Timestamp,
Id: o.Id,
MessageText: o.MessageText,
MessageMediaAttachments: o.MessageMediaAttachments,
MessageStickerAttachments: o.MessageStickerAttachments,
QuickReplies: o.QuickReplies,
ButtonResponse: o.ButtonResponse,
Story: o.Story,
Alias: (*Alias)(o),
})
}
func (o *Recordingmessagingmessage) UnmarshalJSON(b []byte) error {
var RecordingmessagingmessageMap map[string]interface{}
err := json.Unmarshal(b, &RecordingmessagingmessageMap)
if err != nil {
return err
}
if From, ok := RecordingmessagingmessageMap["from"].(string); ok {
o.From = &From
}
if FromUser, ok := RecordingmessagingmessageMap["fromUser"].(map[string]interface{}); ok {
FromUserString, _ := json.Marshal(FromUser)
json.Unmarshal(FromUserString, &o.FromUser)
}
if FromExternalContact, ok := RecordingmessagingmessageMap["fromExternalContact"].(map[string]interface{}); ok {
FromExternalContactString, _ := json.Marshal(FromExternalContact)
json.Unmarshal(FromExternalContactString, &o.FromExternalContact)
}
if To, ok := RecordingmessagingmessageMap["to"].(string); ok {
o.To = &To
}
if timestampString, ok := RecordingmessagingmessageMap["timestamp"].(string); ok {
Timestamp, _ := time.Parse("2006-01-02T15:04:05.999999Z", timestampString)
o.Timestamp = &Timestamp
}
if Id, ok := RecordingmessagingmessageMap["id"].(string); ok {
o.Id = &Id
}
if MessageText, ok := RecordingmessagingmessageMap["messageText"].(string); ok {
o.MessageText = &MessageText
}
if MessageMediaAttachments, ok := RecordingmessagingmessageMap["messageMediaAttachments"].([]interface{}); ok {
MessageMediaAttachmentsString, _ := json.Marshal(MessageMediaAttachments)
json.Unmarshal(MessageMediaAttachmentsString, &o.MessageMediaAttachments)
}
if MessageStickerAttachments, ok := RecordingmessagingmessageMap["messageStickerAttachments"].([]interface{}); ok {
MessageStickerAttachmentsString, _ := json.Marshal(MessageStickerAttachments)
json.Unmarshal(MessageStickerAttachmentsString, &o.MessageStickerAttachments)
}
if QuickReplies, ok := RecordingmessagingmessageMap["quickReplies"].([]interface{}); ok {
QuickRepliesString, _ := json.Marshal(QuickReplies)
json.Unmarshal(QuickRepliesString, &o.QuickReplies)
}
if ButtonResponse, ok := RecordingmessagingmessageMap["buttonResponse"].(map[string]interface{}); ok {
ButtonResponseString, _ := json.Marshal(ButtonResponse)
json.Unmarshal(ButtonResponseString, &o.ButtonResponse)
}
if Story, ok := RecordingmessagingmessageMap["story"].(map[string]interface{}); ok {
StoryString, _ := json.Marshal(Story)
json.Unmarshal(StoryString, &o.Story)
}
return nil
}
// String returns a JSON representation of the model
func (o *Recordingmessagingmessage) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}