-
Notifications
You must be signed in to change notification settings - Fork 12
/
sendagentlessoutboundmessageresponse.go
183 lines (121 loc) · 5.18 KB
/
sendagentlessoutboundmessageresponse.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
package platformclientv2
import (
"time"
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Sendagentlessoutboundmessageresponse
type Sendagentlessoutboundmessageresponse struct {
// Id - The globally unique identifier for the object.
Id *string `json:"id,omitempty"`
// ConversationId - The identifier of the conversation.
ConversationId *string `json:"conversationId,omitempty"`
// FromAddress - The sender of the message.
FromAddress *string `json:"fromAddress,omitempty"`
// ToAddress - The recipient of the message.
ToAddress *string `json:"toAddress,omitempty"`
// MessengerType - Type of messenger.
MessengerType *string `json:"messengerType,omitempty"`
// TextBody - The body of the text message.
TextBody *string `json:"textBody,omitempty"`
// MessagingTemplate - The messaging template sent
MessagingTemplate *Messagingtemplaterequest `json:"messagingTemplate,omitempty"`
// UseExistingActiveConversation - Use an existing active conversation to send the agentless outbound message. Set this parameter to 'true' to use active conversation. Default value: false
UseExistingActiveConversation *bool `json:"useExistingActiveConversation,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"`
// SelfUri - The URI for this object
SelfUri *string `json:"selfUri,omitempty"`
// User - Details of the user created the job
User *Addressableentityref `json:"user,omitempty"`
}
func (o *Sendagentlessoutboundmessageresponse) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Sendagentlessoutboundmessageresponse
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 {
Id *string `json:"id,omitempty"`
ConversationId *string `json:"conversationId,omitempty"`
FromAddress *string `json:"fromAddress,omitempty"`
ToAddress *string `json:"toAddress,omitempty"`
MessengerType *string `json:"messengerType,omitempty"`
TextBody *string `json:"textBody,omitempty"`
MessagingTemplate *Messagingtemplaterequest `json:"messagingTemplate,omitempty"`
UseExistingActiveConversation *bool `json:"useExistingActiveConversation,omitempty"`
Timestamp *string `json:"timestamp,omitempty"`
SelfUri *string `json:"selfUri,omitempty"`
User *Addressableentityref `json:"user,omitempty"`
*Alias
}{
Id: o.Id,
ConversationId: o.ConversationId,
FromAddress: o.FromAddress,
ToAddress: o.ToAddress,
MessengerType: o.MessengerType,
TextBody: o.TextBody,
MessagingTemplate: o.MessagingTemplate,
UseExistingActiveConversation: o.UseExistingActiveConversation,
Timestamp: Timestamp,
SelfUri: o.SelfUri,
User: o.User,
Alias: (*Alias)(o),
})
}
func (o *Sendagentlessoutboundmessageresponse) UnmarshalJSON(b []byte) error {
var SendagentlessoutboundmessageresponseMap map[string]interface{}
err := json.Unmarshal(b, &SendagentlessoutboundmessageresponseMap)
if err != nil {
return err
}
if Id, ok := SendagentlessoutboundmessageresponseMap["id"].(string); ok {
o.Id = &Id
}
if ConversationId, ok := SendagentlessoutboundmessageresponseMap["conversationId"].(string); ok {
o.ConversationId = &ConversationId
}
if FromAddress, ok := SendagentlessoutboundmessageresponseMap["fromAddress"].(string); ok {
o.FromAddress = &FromAddress
}
if ToAddress, ok := SendagentlessoutboundmessageresponseMap["toAddress"].(string); ok {
o.ToAddress = &ToAddress
}
if MessengerType, ok := SendagentlessoutboundmessageresponseMap["messengerType"].(string); ok {
o.MessengerType = &MessengerType
}
if TextBody, ok := SendagentlessoutboundmessageresponseMap["textBody"].(string); ok {
o.TextBody = &TextBody
}
if MessagingTemplate, ok := SendagentlessoutboundmessageresponseMap["messagingTemplate"].(map[string]interface{}); ok {
MessagingTemplateString, _ := json.Marshal(MessagingTemplate)
json.Unmarshal(MessagingTemplateString, &o.MessagingTemplate)
}
if UseExistingActiveConversation, ok := SendagentlessoutboundmessageresponseMap["useExistingActiveConversation"].(bool); ok {
o.UseExistingActiveConversation = &UseExistingActiveConversation
}
if timestampString, ok := SendagentlessoutboundmessageresponseMap["timestamp"].(string); ok {
Timestamp, _ := time.Parse("2006-01-02T15:04:05.999999Z", timestampString)
o.Timestamp = &Timestamp
}
if SelfUri, ok := SendagentlessoutboundmessageresponseMap["selfUri"].(string); ok {
o.SelfUri = &SelfUri
}
if User, ok := SendagentlessoutboundmessageresponseMap["user"].(map[string]interface{}); ok {
UserString, _ := json.Marshal(User)
json.Unmarshal(UserString, &o.User)
}
return nil
}
// String returns a JSON representation of the model
func (o *Sendagentlessoutboundmessageresponse) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}