forked from infobip/infobip-api-go-client
/
model.go
230 lines (200 loc) · 5.8 KB
/
model.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
package sms
//This is a generated file and is not intended for modification!
import (
"errors"
"fmt"
"net/url"
"strings"
"github.com/infobip/infobip-api-go-client/pkg"
)
var (
//reference imported packages just in case auto-generated code doesn't
_ = errors.New
_ = url.Parse
_ = strings.Replace
_ = fmt.Sprint
_ = infobip.NewApiKeyCredentials
)
type Status struct {
GroupID int32 `json:"groupId,omitempty"`
GroupName string `json:"groupName,omitempty"`
ID int32 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Action string `json:"action,omitempty"`
}
type SMSResponseDetails struct {
To string `json:"to,omitempty"`
Status *Status `json:"status,omitempty"`
SMSCount int32 `json:"smsCount,omitempty"`
MessageID string `json:"messageId,omitempty"`
}
type SMSAdvancedTextualRequest struct {
Tracking *Tracking `json:"tracking,omitempty"`
Messages []Message `json:"messages,omitempty"`
BulkID string `json:"bulkId,omitempty"`
}
type DeliveryTimeWindow struct {
From *DeliveryTime `json:"from,omitempty"`
To *DeliveryTime `json:"to,omitempty"`
Days []DeliveryDay `json:"days,omitempty"`
}
type Destination struct {
To string `json:"to,omitempty"`
MessageID string `json:"messageId,omitempty"`
}
type Message struct {
From string `json:"from,omitempty"`
To []string `json:"to,omitempty"`
Destinations []Destination `json:"destinations,omitempty"`
Text string `json:"text,omitempty"`
Binary *BinaryContent `json:"binary,omitempty"`
Flash bool `json:"flash,omitempty"`
Language *Language `json:"language,omitempty"`
Transliteration string `json:"transliteration,omitempty"`
Notify bool `json:"notify,omitempty"`
IntermediateReport bool `json:"intermediateReport,omitempty"`
NotifyURL string `json:"notifyUrl,omitempty"`
NotifyContentType string `json:"notifyContentType,omitempty"`
CallbackData string `json:"callbackData,omitempty"`
ValidityPeriod int64 `json:"validityPeriod,omitempty"`
SendAt *infobip.Time `json:"sendAt,omitempty"`
DeliveryTimeWindow *DeliveryTimeWindow `json:"deliveryTimeWindow,omitempty"`
CampaignID string `json:"campaignId,omitempty"`
OperatorClientID string `json:"operatorClientId,omitempty"`
Regional *RegionalOptions `json:"regional,omitempty"`
}
type Language struct {
SingleShift bool `json:"singleShift,omitempty"`
LockingShift bool `json:"lockingShift,omitempty"`
LanguageCode string `json:"languageCode,omitempty"`
}
type RegionalOptions struct {
IndiaDLT *IndiaDLTOptions `json:"indiaDlt,omitempty"`
}
type IndiaDLTOptions struct {
ContentTemplateID string `json:"contentTemplateId,omitempty"`
PrincipalEntityID string `json:"principalEntityId,omitempty"`
}
type Error struct {
GroupID int32 `json:"groupId,omitempty"`
GroupName string `json:"groupName,omitempty"`
ID int32 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Permanent bool `json:"permanent,omitempty"`
}
type GetSentSMSDeliveryReportsQuery struct {
BulkID string
MessageID string
Limit int32
}
func (query GetSentSMSDeliveryReportsQuery) Query() url.Values {
q := make(url.Values)
if query.BulkID != "" {
q.Set("bulkId", query.BulkID)
}
if query.MessageID != "" {
q.Set("messageId", query.MessageID)
}
if query.Limit != 0 {
q.Set("limit", fmt.Sprint(query.Limit))
}
return q
}
type DeliveryDay int
const (
DD_MONDAY DeliveryDay = iota
DD_TUESDAY
DD_WEDNESDAY
DD_THURSDAY
DD_FRIDAY
DD_SATURDAY
DD_SUNDAY
)
var DeliveryDayValues = []DeliveryDay{
DD_MONDAY, DD_TUESDAY, DD_WEDNESDAY, DD_THURSDAY, DD_FRIDAY, DD_SATURDAY, DD_SUNDAY,
}
func (val DeliveryDay) String() string {
names := []string{
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY",
}
if val < DD_MONDAY || val > DD_SUNDAY {
return "Unknown"
}
return names[val]
}
func (val DeliveryDay) MarshalJSON() ([]byte, error) {
return []byte(`"` + val.String() + `"`), nil
}
func (val *DeliveryDay) UnmarshalJSON(data []byte) error {
s := strings.Trim(string(data), `"`)
switch s {
case "MONDAY":
*val = DD_MONDAY
case "TUESDAY":
*val = DD_TUESDAY
case "WEDNESDAY":
*val = DD_WEDNESDAY
case "THURSDAY":
*val = DD_THURSDAY
case "FRIDAY":
*val = DD_FRIDAY
case "SATURDAY":
*val = DD_SATURDAY
case "SUNDAY":
*val = DD_SUNDAY
default:
return errors.New("Unknown DeliveryDay value " + s)
}
return nil
}
type BinaryContent struct {
Hex string `json:"hex,omitempty"`
DataCoding int32 `json:"dataCoding,omitempty"`
EsmClass int32 `json:"esmClass,omitempty"`
}
type SMSReportResponse struct {
Results []SMSReport `json:"results,omitempty"`
}
type Tracking struct {
Track string `json:"track,omitempty"`
ProcessKey string `json:"processKey,omitempty"`
Type string `json:"type,omitempty"`
BaseURL string `json:"baseUrl,omitempty"`
}
type SMSResponse struct {
BulkID string `json:"bulkId,omitempty"`
TrackingProcessKey string `json:"trackingProcessKey,omitempty"`
Messages []SMSResponseDetails `json:"messages,omitempty"`
}
type SMSReport struct {
BulkID string `json:"bulkId,omitempty"`
MessageID string `json:"messageId,omitempty"`
To string `json:"to,omitempty"`
From string `json:"from,omitempty"`
Text string `json:"text,omitempty"`
SentAt *infobip.Time `json:"sentAt,omitempty"`
DoneAt *infobip.Time `json:"doneAt,omitempty"`
SMSCount int32 `json:"smsCount,omitempty"`
MccMnc string `json:"mccMnc,omitempty"`
Price *Price `json:"price,omitempty"`
Status *Status `json:"status,omitempty"`
Error *Error `json:"error,omitempty"`
CallbackData string `json:"callbackData,omitempty"`
}
type DeliveryTime struct {
Hour int32 `json:"hour,omitempty"`
Minute int32 `json:"minute,omitempty"`
}
type Price struct {
PricePerMessage float64 `json:"pricePerMessage,omitempty"`
PricePerLookup float64 `json:"pricePerLookup,omitempty"`
Currency string `json:"currency,omitempty"`
}