forked from MyPureCloud/platform-client-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendagentlessoutboundmessagerequest.go
130 lines (83 loc) · 4.45 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
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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"fmt"
"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.
ToAddressMessengerType *string `json:"toAddressMessengerType,omitempty"`
// TextBody - The text of the message to send. This field is required in the case of SMS messenger type. Maximum character counts are: SMS - 765 characters, other channels - 2000 characters.
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"`
// 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"`
}
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"`
UseExistingActiveConversation *bool `json:"useExistingActiveConversation,omitempty"`
*Alias
}{
FromAddress: o.FromAddress,
ToAddress: o.ToAddress,
ToAddressMessengerType: o.ToAddressMessengerType,
TextBody: o.TextBody,
MessagingTemplate: o.MessagingTemplate,
UseExistingActiveConversation: o.UseExistingActiveConversation,
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)
}
if UseExistingActiveConversation, ok := SendagentlessoutboundmessagerequestMap["useExistingActiveConversation"].(bool); ok {
o.UseExistingActiveConversation = &UseExistingActiveConversation
}
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))
str = strings.Replace(str, strconv.Quote(*NullString()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullInt()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullFloat32()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullFloat64()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", NullTime().Format("2006-01-02T15:04:05Z07:00")), "null", -1)
return str
}