-
Notifications
You must be signed in to change notification settings - Fork 12
/
sendagentlessoutboundmessagerequest.go
100 lines (70 loc) · 3.4 KB
/
sendagentlessoutboundmessagerequest.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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Sendagentlessoutboundmessagerequest
type Sendagentlessoutboundmessagerequest struct {
// FromAddress - The messaging address of the sender of the message. For an SMS messenger type, this must be a currently provisioned SMS phone number. For a WhatsApp messenger type use the provisioned WhatsApp integration’s ID
FromAddress *string `json:"fromAddress,omitempty"`
// ToAddress - The messaging address of the recipient of the message. For an SMS messenger type, the phone number address must be in E.164 format. E.g. +13175555555 or +34234234234.
ToAddress *string `json:"toAddress,omitempty"`
// ToAddressMessengerType - The recipient messaging address messenger type. Currently SMS and Open are the only supported types. WhatsApp will be supported in a future release
ToAddressMessengerType *string `json:"toAddressMessengerType,omitempty"`
// TextBody - The text of the message to send. This field is required in the case of SMS messenger type
TextBody *string `json:"textBody,omitempty"`
// MessagingTemplate - The messaging template to use in the case of WhatsApp messenger type. This field is required when using WhatsApp messenger type
MessagingTemplate *Messagingtemplaterequest `json:"messagingTemplate,omitempty"`
}
func (o *Sendagentlessoutboundmessagerequest) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Sendagentlessoutboundmessagerequest
return json.Marshal(&struct {
FromAddress *string `json:"fromAddress,omitempty"`
ToAddress *string `json:"toAddress,omitempty"`
ToAddressMessengerType *string `json:"toAddressMessengerType,omitempty"`
TextBody *string `json:"textBody,omitempty"`
MessagingTemplate *Messagingtemplaterequest `json:"messagingTemplate,omitempty"`
*Alias
}{
FromAddress: o.FromAddress,
ToAddress: o.ToAddress,
ToAddressMessengerType: o.ToAddressMessengerType,
TextBody: o.TextBody,
MessagingTemplate: o.MessagingTemplate,
Alias: (*Alias)(o),
})
}
func (o *Sendagentlessoutboundmessagerequest) UnmarshalJSON(b []byte) error {
var SendagentlessoutboundmessagerequestMap map[string]interface{}
err := json.Unmarshal(b, &SendagentlessoutboundmessagerequestMap)
if err != nil {
return err
}
if FromAddress, ok := SendagentlessoutboundmessagerequestMap["fromAddress"].(string); ok {
o.FromAddress = &FromAddress
}
if ToAddress, ok := SendagentlessoutboundmessagerequestMap["toAddress"].(string); ok {
o.ToAddress = &ToAddress
}
if ToAddressMessengerType, ok := SendagentlessoutboundmessagerequestMap["toAddressMessengerType"].(string); ok {
o.ToAddressMessengerType = &ToAddressMessengerType
}
if TextBody, ok := SendagentlessoutboundmessagerequestMap["textBody"].(string); ok {
o.TextBody = &TextBody
}
if MessagingTemplate, ok := SendagentlessoutboundmessagerequestMap["messagingTemplate"].(map[string]interface{}); ok {
MessagingTemplateString, _ := json.Marshal(MessagingTemplate)
json.Unmarshal(MessagingTemplateString, &o.MessagingTemplate)
}
return nil
}
// String returns a JSON representation of the model
func (o *Sendagentlessoutboundmessagerequest) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}