1
|
|
|
package pinpoint |
2
|
|
|
|
3
|
|
|
import ( |
4
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/pinpoint" |
5
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
6
|
|
|
) |
7
|
|
|
|
8
|
|
|
type AndroidPushNotificationTemplate struct { |
|
|
|
|
9
|
|
|
Action Action |
10
|
|
|
Body string |
11
|
|
|
ImageIconURL string |
12
|
|
|
ImageURL string |
13
|
|
|
RawContent string |
14
|
|
|
SmallImageIconURL string |
15
|
|
|
Sound string |
16
|
|
|
Title string |
17
|
|
|
URL string |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
func (r AndroidPushNotificationTemplate) ToSDK() *SDK.AndroidPushNotificationTemplate { |
|
|
|
|
21
|
|
|
o := SDK.AndroidPushNotificationTemplate{} |
22
|
|
|
|
23
|
|
|
o.Action = SDK.Action(r.Action) |
24
|
|
|
|
25
|
|
|
if r.Body != "" { |
26
|
|
|
o.Body = pointers.String(r.Body) |
27
|
|
|
} |
28
|
|
|
if r.ImageIconURL != "" { |
29
|
|
|
o.ImageIconUrl = pointers.String(r.ImageIconURL) |
30
|
|
|
} |
31
|
|
|
if r.ImageURL != "" { |
32
|
|
|
o.ImageUrl = pointers.String(r.ImageURL) |
33
|
|
|
} |
34
|
|
|
if r.RawContent != "" { |
35
|
|
|
o.RawContent = pointers.String(r.RawContent) |
36
|
|
|
} |
37
|
|
|
if r.SmallImageIconURL != "" { |
38
|
|
|
o.SmallImageIconUrl = pointers.String(r.SmallImageIconURL) |
39
|
|
|
} |
40
|
|
|
if r.Sound != "" { |
41
|
|
|
o.Sound = pointers.String(r.Sound) |
42
|
|
|
} |
43
|
|
|
if r.Title != "" { |
44
|
|
|
o.Title = pointers.String(r.Title) |
45
|
|
|
} |
46
|
|
|
if r.URL != "" { |
47
|
|
|
o.Url = pointers.String(r.URL) |
48
|
|
|
} |
49
|
|
|
return &o |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
type APNsPushNotificationTemplate struct { |
|
|
|
|
53
|
|
|
Action Action |
54
|
|
|
Body string |
55
|
|
|
MediaURL string |
56
|
|
|
RawContent string |
57
|
|
|
Sound string |
58
|
|
|
Title string |
59
|
|
|
URL string |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
func (r APNsPushNotificationTemplate) ToSDK() *SDK.APNSPushNotificationTemplate { |
|
|
|
|
63
|
|
|
o := SDK.APNSPushNotificationTemplate{} |
64
|
|
|
|
65
|
|
|
o.Action = SDK.Action(r.Action) |
66
|
|
|
|
67
|
|
|
if r.Body != "" { |
68
|
|
|
o.Body = pointers.String(r.Body) |
69
|
|
|
} |
70
|
|
|
if r.MediaURL != "" { |
71
|
|
|
o.MediaUrl = pointers.String(r.MediaURL) |
72
|
|
|
} |
73
|
|
|
if r.RawContent != "" { |
74
|
|
|
o.RawContent = pointers.String(r.RawContent) |
75
|
|
|
} |
76
|
|
|
if r.Sound != "" { |
77
|
|
|
o.Sound = pointers.String(r.Sound) |
78
|
|
|
} |
79
|
|
|
if r.Title != "" { |
80
|
|
|
o.Title = pointers.String(r.Title) |
81
|
|
|
} |
82
|
|
|
if r.URL != "" { |
83
|
|
|
o.Url = pointers.String(r.URL) |
84
|
|
|
} |
85
|
|
|
return &o |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
type CreateTemplateMessageBody struct { |
|
|
|
|
89
|
|
|
ARN string |
90
|
|
|
Message string |
91
|
|
|
RequestID string |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
func newCreateTemplateMessageBody(o *SDK.CreateTemplateMessageBody) CreateTemplateMessageBody { |
95
|
|
|
result := CreateTemplateMessageBody{} |
96
|
|
|
if o == nil { |
97
|
|
|
return result |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
if o.Arn != nil { |
101
|
|
|
result.ARN = *o.Arn |
102
|
|
|
} |
103
|
|
|
if o.Message != nil { |
104
|
|
|
result.Message = *o.Message |
105
|
|
|
} |
106
|
|
|
if o.RequestID != nil { |
107
|
|
|
result.RequestID = *o.RequestID |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
return result |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
type DefaultPushNotificationTemplate struct { |
|
|
|
|
114
|
|
|
Action Action |
115
|
|
|
Body string |
116
|
|
|
Sound string |
117
|
|
|
Title string |
118
|
|
|
URL string |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
func (r DefaultPushNotificationTemplate) ToSDK() *SDK.DefaultPushNotificationTemplate { |
|
|
|
|
122
|
|
|
o := SDK.DefaultPushNotificationTemplate{} |
123
|
|
|
|
124
|
|
|
o.Action = SDK.Action(r.Action) |
125
|
|
|
|
126
|
|
|
if r.Body != "" { |
127
|
|
|
o.Body = pointers.String(r.Body) |
128
|
|
|
} |
129
|
|
|
if r.Sound != "" { |
130
|
|
|
o.Sound = pointers.String(r.Sound) |
131
|
|
|
} |
132
|
|
|
if r.Title != "" { |
133
|
|
|
o.Title = pointers.String(r.Title) |
134
|
|
|
} |
135
|
|
|
if r.URL != "" { |
136
|
|
|
o.Url = pointers.String(r.URL) |
137
|
|
|
} |
138
|
|
|
return &o |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
type EmailTemplateRequest struct { |
|
|
|
|
142
|
|
|
DefaultSubstitutions string |
143
|
|
|
HTMLPart string |
144
|
|
|
RecommenderID string |
145
|
|
|
Subject string |
146
|
|
|
Tags map[string]string |
147
|
|
|
TemplateDescription string |
148
|
|
|
TextPart string |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
func (r EmailTemplateRequest) ToSDK() *SDK.EmailTemplateRequest { |
|
|
|
|
152
|
|
|
o := SDK.EmailTemplateRequest{} |
153
|
|
|
|
154
|
|
|
if r.DefaultSubstitutions != "" { |
155
|
|
|
o.DefaultSubstitutions = pointers.String(r.DefaultSubstitutions) |
156
|
|
|
} |
157
|
|
|
if r.HTMLPart != "" { |
158
|
|
|
o.HtmlPart = pointers.String(r.HTMLPart) |
159
|
|
|
} |
160
|
|
|
if r.RecommenderID != "" { |
161
|
|
|
o.RecommenderId = pointers.String(r.RecommenderID) |
162
|
|
|
} |
163
|
|
|
if r.Subject != "" { |
164
|
|
|
o.Subject = pointers.String(r.Subject) |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
o.Tags = r.Tags |
168
|
|
|
|
169
|
|
|
if r.TemplateDescription != "" { |
170
|
|
|
o.TemplateDescription = pointers.String(r.TemplateDescription) |
171
|
|
|
} |
172
|
|
|
if r.TextPart != "" { |
173
|
|
|
o.TextPart = pointers.String(r.TextPart) |
174
|
|
|
} |
175
|
|
|
return &o |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
type PushNotificationTemplateRequest struct { |
|
|
|
|
179
|
|
|
ADM AndroidPushNotificationTemplate |
180
|
|
|
APNS APNsPushNotificationTemplate |
181
|
|
|
Baidu AndroidPushNotificationTemplate |
182
|
|
|
Default DefaultPushNotificationTemplate |
183
|
|
|
DefaultSubstitutions string |
184
|
|
|
GCM AndroidPushNotificationTemplate |
185
|
|
|
RecommenderID string |
186
|
|
|
Tags map[string]string |
187
|
|
|
TemplateDescription string |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
func (r PushNotificationTemplateRequest) ToSDK() *SDK.PushNotificationTemplateRequest { |
|
|
|
|
191
|
|
|
o := SDK.PushNotificationTemplateRequest{} |
192
|
|
|
|
193
|
|
|
if r.ADM.Body != "" { |
194
|
|
|
o.ADM = r.ADM.ToSDK() |
195
|
|
|
} |
196
|
|
|
if r.APNS.Body != "" { |
197
|
|
|
o.APNS = r.APNS.ToSDK() |
198
|
|
|
} |
199
|
|
|
if r.Baidu.Body != "" { |
200
|
|
|
o.Baidu = r.Baidu.ToSDK() |
201
|
|
|
} |
202
|
|
|
if r.Default.Body != "" { |
203
|
|
|
o.Default = r.Default.ToSDK() |
204
|
|
|
} |
205
|
|
|
if r.DefaultSubstitutions != "" { |
206
|
|
|
o.DefaultSubstitutions = pointers.String(r.DefaultSubstitutions) |
207
|
|
|
} |
208
|
|
|
if r.GCM.Body != "" { |
209
|
|
|
o.GCM = r.GCM.ToSDK() |
210
|
|
|
} |
211
|
|
|
if r.RecommenderID != "" { |
212
|
|
|
o.RecommenderId = pointers.String(r.RecommenderID) |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
o.Tags = r.Tags |
216
|
|
|
|
217
|
|
|
if r.TemplateDescription != "" { |
218
|
|
|
o.TemplateDescription = pointers.String(r.TemplateDescription) |
219
|
|
|
} |
220
|
|
|
return &o |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
type MessageBody struct { |
|
|
|
|
224
|
|
|
Message string |
225
|
|
|
RequestID string |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
func newMessageBody(o *SDK.MessageBody) MessageBody { |
229
|
|
|
result := MessageBody{} |
230
|
|
|
if o == nil { |
231
|
|
|
return result |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
if o.Message != nil { |
235
|
|
|
result.Message = *o.Message |
236
|
|
|
} |
237
|
|
|
if o.RequestID != nil { |
238
|
|
|
result.RequestID = *o.RequestID |
239
|
|
|
} |
240
|
|
|
return result |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
type TemplateResponse struct { |
|
|
|
|
244
|
|
|
CreationDate string |
245
|
|
|
LastModifiedDate string |
246
|
|
|
TemplateName string |
247
|
|
|
TemplateType TemplateType |
248
|
|
|
|
249
|
|
|
ARN string |
250
|
|
|
DefaultSubstitutions string |
251
|
|
|
Tags map[string]string |
252
|
|
|
TemplateDescription string |
253
|
|
|
Version string |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
func newTemplateResponse(o *SDK.TemplateResponse) TemplateResponse { |
257
|
|
|
result := TemplateResponse{} |
258
|
|
|
if o == nil { |
259
|
|
|
return result |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
if o.CreationDate != nil { |
263
|
|
|
result.CreationDate = *o.CreationDate |
264
|
|
|
} |
265
|
|
|
if o.LastModifiedDate != nil { |
266
|
|
|
result.LastModifiedDate = *o.LastModifiedDate |
267
|
|
|
} |
268
|
|
|
if o.TemplateName != nil { |
269
|
|
|
result.TemplateName = *o.TemplateName |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
result.TemplateType = TemplateType(o.TemplateType) |
273
|
|
|
|
274
|
|
|
if o.Arn != nil { |
275
|
|
|
result.ARN = *o.Arn |
276
|
|
|
} |
277
|
|
|
if o.DefaultSubstitutions != nil { |
278
|
|
|
result.DefaultSubstitutions = *o.DefaultSubstitutions |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
result.Tags = o.Tags |
282
|
|
|
|
283
|
|
|
if o.TemplateDescription != nil { |
284
|
|
|
result.TemplateDescription = *o.TemplateDescription |
285
|
|
|
} |
286
|
|
|
if o.Version != nil { |
287
|
|
|
result.Version = *o.Version |
288
|
|
|
} |
289
|
|
|
return result |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
type TemplatesResponse struct { |
|
|
|
|
293
|
|
|
Item []TemplateResponse |
294
|
|
|
|
295
|
|
|
// optional |
296
|
|
|
NextToken string |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
func newTemplatesResponse(o *SDK.TemplatesResponse) TemplatesResponse { |
300
|
|
|
result := TemplatesResponse{} |
301
|
|
|
if o == nil { |
302
|
|
|
return result |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
if len(o.Item) != 0 { |
306
|
|
|
list := make([]TemplateResponse, len(o.Item)) |
307
|
|
|
for i, v := range o.Item { |
308
|
|
|
v := v |
309
|
|
|
list[i] = newTemplateResponse(&v) |
310
|
|
|
} |
311
|
|
|
result.Item = list |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
if o.NextToken != nil { |
315
|
|
|
result.NextToken = *o.NextToken |
316
|
|
|
} |
317
|
|
|
return result |
318
|
|
|
} |
319
|
|
|
|