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 GPSPointDimension struct { |
|
|
|
|
9
|
|
|
CoordinatesLatitude float64 |
10
|
|
|
CoordinatesLongitude float64 |
11
|
|
|
|
12
|
|
|
// optional |
13
|
|
|
RangeInKilometers float64 |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
func newGPSPointDimension(o *SDK.GPSPointDimension) GPSPointDimension { |
17
|
|
|
result := GPSPointDimension{} |
18
|
|
|
if o == nil { |
19
|
|
|
return result |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
if v := o.Coordinates; v != nil { |
23
|
|
|
if v.Latitude != nil { |
24
|
|
|
result.CoordinatesLatitude = *v.Latitude |
25
|
|
|
} |
26
|
|
|
if v.Longitude != nil { |
27
|
|
|
result.CoordinatesLongitude = *v.Longitude |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
if o.RangeInKilometers != nil { |
32
|
|
|
result.RangeInKilometers = *o.RangeInKilometers |
33
|
|
|
} |
34
|
|
|
return result |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
func (r GPSPointDimension) ToSDK() *SDK.GPSPointDimension { |
|
|
|
|
38
|
|
|
o := SDK.GPSPointDimension{} |
39
|
|
|
|
40
|
|
|
o.Coordinates = &SDK.GPSCoordinates{ |
41
|
|
|
Latitude: pointers.Float64(r.CoordinatesLatitude), |
42
|
|
|
Longitude: pointers.Float64(r.CoordinatesLongitude), |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if r.RangeInKilometers != 0 { |
46
|
|
|
o.RangeInKilometers = pointers.Float64(r.RangeInKilometers) |
47
|
|
|
} |
48
|
|
|
return &o |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
type SegmentBehaviors struct { |
|
|
|
|
52
|
|
|
RecencyDuration Duration |
53
|
|
|
RecencyType RecencyType |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
func newSegmentBehaviors(o *SDK.SegmentBehaviors) SegmentBehaviors { |
57
|
|
|
result := SegmentBehaviors{} |
58
|
|
|
if o == nil { |
59
|
|
|
return result |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
if o.Recency != nil { |
63
|
|
|
result.RecencyDuration = Duration(o.Recency.Duration) |
64
|
|
|
result.RecencyType = RecencyType(o.Recency.RecencyType) |
65
|
|
|
} |
66
|
|
|
return result |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
func (r SegmentBehaviors) ToSDK() *SDK.SegmentBehaviors { |
|
|
|
|
70
|
|
|
o := SDK.SegmentBehaviors{} |
71
|
|
|
|
72
|
|
|
o.Recency.Duration = SDK.Duration(r.RecencyDuration) |
73
|
|
|
o.Recency.RecencyType = SDK.RecencyType(r.RecencyType) |
74
|
|
|
return &o |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
type SegmentDemographics struct { |
|
|
|
|
78
|
|
|
AppVersion SetDimension |
79
|
|
|
Channel SetDimension |
80
|
|
|
DeviceType SetDimension |
81
|
|
|
Make SetDimension |
82
|
|
|
Model SetDimension |
83
|
|
|
Platform SetDimension |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
func newSegmentDemographics(o *SDK.SegmentDemographics) SegmentDemographics { |
87
|
|
|
result := SegmentDemographics{} |
88
|
|
|
if o == nil { |
89
|
|
|
return result |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
result.AppVersion = newSetDimension(o.AppVersion) |
93
|
|
|
result.Channel = newSetDimension(o.Channel) |
94
|
|
|
result.DeviceType = newSetDimension(o.DeviceType) |
95
|
|
|
result.Make = newSetDimension(o.Make) |
96
|
|
|
result.Model = newSetDimension(o.Model) |
97
|
|
|
result.Platform = newSetDimension(o.Platform) |
98
|
|
|
return result |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
func (r SegmentDemographics) ToSDK() *SDK.SegmentDemographics { |
|
|
|
|
102
|
|
|
o := SDK.SegmentDemographics{} |
103
|
|
|
|
104
|
|
|
o.AppVersion = r.AppVersion.ToSDK() |
105
|
|
|
o.Channel = r.Channel.ToSDK() |
106
|
|
|
o.DeviceType = r.DeviceType.ToSDK() |
107
|
|
|
o.Make = r.Make.ToSDK() |
108
|
|
|
o.Model = r.Model.ToSDK() |
109
|
|
|
o.Platform = r.Platform.ToSDK() |
110
|
|
|
return &o |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
type SegmentDimensions struct { |
|
|
|
|
114
|
|
|
Attributes map[string]AttributeDimension |
115
|
|
|
Behavior SegmentBehaviors |
116
|
|
|
Demographic SegmentDemographics |
117
|
|
|
Location SegmentLocation |
118
|
|
|
Metrics map[string]MetricDimension |
119
|
|
|
UserAttributes map[string]AttributeDimension |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
func newSegmentDimensions(o *SDK.SegmentDimensions) SegmentDimensions { |
123
|
|
|
result := SegmentDimensions{} |
124
|
|
|
if o == nil { |
125
|
|
|
return result |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
result.Attributes = newAttributeDimensionMap(o.Attributes) |
129
|
|
|
result.Behavior = newSegmentBehaviors(o.Behavior) |
130
|
|
|
result.Demographic = newSegmentDemographics(o.Demographic) |
131
|
|
|
result.Location = newSegmentLocation(o.Location) |
132
|
|
|
result.Metrics = newMetricDimensionMap(o.Metrics) |
133
|
|
|
result.UserAttributes = newAttributeDimensionMap(o.UserAttributes) |
134
|
|
|
return result |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
func (r SegmentDimensions) ToSDK() SDK.SegmentDimensions { |
|
|
|
|
138
|
|
|
o := SDK.SegmentDimensions{} |
139
|
|
|
|
140
|
|
|
o.Attributes = attributeDimensionMapToSDK(r.Attributes) |
141
|
|
|
o.Behavior = r.Behavior.ToSDK() |
142
|
|
|
o.Demographic = r.Demographic.ToSDK() |
143
|
|
|
o.Location = r.Location.ToSDK() |
144
|
|
|
o.Metrics = metricDimensionMapToSDK(r.Metrics) |
145
|
|
|
o.UserAttributes = attributeDimensionMapToSDK(r.UserAttributes) |
146
|
|
|
return o |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
type SegmentImportResource struct { |
|
|
|
|
150
|
|
|
Format Format |
151
|
|
|
RoleARN string |
152
|
|
|
S3URL string |
153
|
|
|
Size int64 |
154
|
|
|
|
155
|
|
|
// optional |
156
|
|
|
ChannelCounts map[string]int64 |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
func newSegmentImportResource(o *SDK.SegmentImportResource) SegmentImportResource { |
160
|
|
|
result := SegmentImportResource{} |
161
|
|
|
if o == nil { |
162
|
|
|
return result |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
result.Format = Format(o.Format) |
166
|
|
|
|
167
|
|
|
if o.RoleArn != nil { |
168
|
|
|
result.RoleARN = *o.RoleArn |
169
|
|
|
} |
170
|
|
|
if o.S3Url != nil { |
171
|
|
|
result.S3URL = *o.S3Url |
172
|
|
|
} |
173
|
|
|
if o.Size != nil { |
174
|
|
|
result.Size = *o.Size |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
result.ChannelCounts = o.ChannelCounts |
178
|
|
|
return result |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
type SegmentGroup struct { |
|
|
|
|
182
|
|
|
Dimensions []SegmentDimensions |
183
|
|
|
SourceSegments []SegmentReference |
184
|
|
|
SourceType SourceType |
185
|
|
|
Type Type |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
func newSegmentGroup(o *SDK.SegmentGroup) SegmentGroup { |
189
|
|
|
result := SegmentGroup{} |
190
|
|
|
if o == nil { |
191
|
|
|
return result |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
if len(o.Dimensions) != 0 { |
195
|
|
|
list := make([]SegmentDimensions, len(o.Dimensions)) |
196
|
|
|
for i, v := range o.Dimensions { |
197
|
|
|
list[i] = newSegmentDimensions(&v) |
198
|
|
|
} |
199
|
|
|
result.Dimensions = list |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
if len(o.SourceSegments) != 0 { |
203
|
|
|
list := make([]SegmentReference, len(o.SourceSegments)) |
204
|
|
|
for i, v := range o.SourceSegments { |
205
|
|
|
list[i] = newSegmentReference(&v) |
206
|
|
|
} |
207
|
|
|
result.SourceSegments = list |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
result.SourceType = SourceType(o.SourceType) |
211
|
|
|
result.Type = Type(o.Type) |
212
|
|
|
return result |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
func (r SegmentGroup) ToSDK() SDK.SegmentGroup { |
|
|
|
|
216
|
|
|
o := SDK.SegmentGroup{} |
217
|
|
|
|
218
|
|
|
if len(r.Dimensions) != 0 { |
219
|
|
|
list := make([]SDK.SegmentDimensions, len(r.Dimensions)) |
220
|
|
|
for i, v := range r.Dimensions { |
221
|
|
|
list[i] = v.ToSDK() |
222
|
|
|
} |
223
|
|
|
o.Dimensions = list |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
if len(r.SourceSegments) != 0 { |
227
|
|
|
list := make([]SDK.SegmentReference, len(r.SourceSegments)) |
228
|
|
|
for i, v := range r.SourceSegments { |
229
|
|
|
list[i] = v.ToSDK() |
230
|
|
|
} |
231
|
|
|
o.SourceSegments = list |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
o.SourceType = SDK.SourceType(r.SourceType) |
235
|
|
|
o.Type = SDK.Type(r.Type) |
236
|
|
|
return o |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
type SegmentGroupList struct { |
|
|
|
|
240
|
|
|
Groups []SegmentGroup |
241
|
|
|
Include Include |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
func newSegmentGroupList(o *SDK.SegmentGroupList) SegmentGroupList { |
245
|
|
|
result := SegmentGroupList{} |
246
|
|
|
if o == nil { |
247
|
|
|
return result |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
if len(o.Groups) != 0 { |
251
|
|
|
list := make([]SegmentGroup, len(o.Groups)) |
252
|
|
|
for i, v := range o.Groups { |
253
|
|
|
list[i] = newSegmentGroup(&v) |
254
|
|
|
} |
255
|
|
|
result.Groups = list |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
result.Include = Include(o.Include) |
259
|
|
|
return result |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
func (r SegmentGroupList) ToSDK() *SDK.SegmentGroupList { |
|
|
|
|
263
|
|
|
o := SDK.SegmentGroupList{} |
264
|
|
|
|
265
|
|
|
if len(r.Groups) != 0 { |
266
|
|
|
list := make([]SDK.SegmentGroup, len(r.Groups)) |
267
|
|
|
for i, v := range r.Groups { |
268
|
|
|
list[i] = v.ToSDK() |
269
|
|
|
} |
270
|
|
|
o.Groups = list |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
o.Include = SDK.Include(r.Include) |
274
|
|
|
return &o |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
type SegmentLocation struct { |
|
|
|
|
278
|
|
|
Country SetDimension |
279
|
|
|
GPSPoint GPSPointDimension |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
func newSegmentLocation(o *SDK.SegmentLocation) SegmentLocation { |
283
|
|
|
result := SegmentLocation{} |
284
|
|
|
if o == nil { |
285
|
|
|
return result |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
result.Country = newSetDimension(o.Country) |
289
|
|
|
result.GPSPoint = newGPSPointDimension(o.GPSPoint) |
290
|
|
|
return result |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
func (r SegmentLocation) ToSDK() *SDK.SegmentLocation { |
|
|
|
|
294
|
|
|
o := SDK.SegmentLocation{} |
295
|
|
|
|
296
|
|
|
o.Country = r.Country.ToSDK() |
297
|
|
|
o.GPSPoint = r.GPSPoint.ToSDK() |
298
|
|
|
return &o |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
type SegmentReference struct { |
|
|
|
|
302
|
|
|
ID string |
303
|
|
|
|
304
|
|
|
// optional |
305
|
|
|
Version int64 |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
func newSegmentReference(o *SDK.SegmentReference) SegmentReference { |
309
|
|
|
result := SegmentReference{} |
310
|
|
|
if o == nil { |
311
|
|
|
return result |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
if o.Id != nil { |
315
|
|
|
result.ID = *o.Id |
316
|
|
|
} |
317
|
|
|
if o.Version != nil { |
318
|
|
|
result.Version = *o.Version |
319
|
|
|
} |
320
|
|
|
return result |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
func (r SegmentReference) ToSDK() SDK.SegmentReference { |
|
|
|
|
324
|
|
|
o := SDK.SegmentReference{} |
325
|
|
|
|
326
|
|
|
if r.ID != "" { |
327
|
|
|
o.Id = pointers.String(r.ID) |
328
|
|
|
} |
329
|
|
|
if r.Version != 0 { |
330
|
|
|
o.Version = pointers.Long64(r.Version) |
331
|
|
|
} |
332
|
|
|
return o |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
type SegmentResponse struct { |
|
|
|
|
336
|
|
|
ApplicationID string |
337
|
|
|
ARN string |
338
|
|
|
CreationDate string |
339
|
|
|
ID string |
340
|
|
|
SegmentType SegmentType |
341
|
|
|
|
342
|
|
|
// optional |
343
|
|
|
Dimensions SegmentDimensions |
344
|
|
|
ImportDefinition SegmentImportResource |
345
|
|
|
LastModifiedDate string |
346
|
|
|
Name string |
347
|
|
|
SegmentGroups SegmentGroupList |
348
|
|
|
Tags map[string]string |
349
|
|
|
Version int64 |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
func newSegmentResponse(o *SDK.SegmentResponse) SegmentResponse { |
353
|
|
|
result := SegmentResponse{} |
354
|
|
|
if o == nil { |
355
|
|
|
return result |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
if o.ApplicationId != nil { |
359
|
|
|
result.ApplicationID = *o.ApplicationId |
360
|
|
|
} |
361
|
|
|
if o.Arn != nil { |
362
|
|
|
result.ARN = *o.Arn |
363
|
|
|
} |
364
|
|
|
if o.CreationDate != nil { |
365
|
|
|
result.CreationDate = *o.CreationDate |
366
|
|
|
} |
367
|
|
|
if o.Id != nil { |
368
|
|
|
result.ID = *o.Id |
369
|
|
|
} |
370
|
|
|
result.SegmentType = SegmentType(o.SegmentType) |
371
|
|
|
|
372
|
|
|
result.Dimensions = newSegmentDimensions(o.Dimensions) |
373
|
|
|
result.ImportDefinition = newSegmentImportResource(o.ImportDefinition) |
374
|
|
|
|
375
|
|
|
if o.LastModifiedDate != nil { |
376
|
|
|
result.LastModifiedDate = *o.LastModifiedDate |
377
|
|
|
} |
378
|
|
|
if o.Name != nil { |
379
|
|
|
result.Name = *o.Name |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
result.SegmentGroups = newSegmentGroupList(o.SegmentGroups) |
383
|
|
|
result.Tags = o.Tags |
384
|
|
|
|
385
|
|
|
if o.Version != nil { |
386
|
|
|
result.Version = *o.Version |
387
|
|
|
} |
388
|
|
|
return result |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
type SegmentsResponse struct { |
|
|
|
|
392
|
|
|
Item []SegmentResponse |
393
|
|
|
NextToken string |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
func newSegmentsResponse(o *SDK.SegmentsResponse) SegmentsResponse { |
397
|
|
|
result := SegmentsResponse{} |
398
|
|
|
if o == nil { |
399
|
|
|
return result |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
if len(o.Item) != 0 { |
403
|
|
|
list := make([]SegmentResponse, len(o.Item)) |
404
|
|
|
for i, v := range o.Item { |
405
|
|
|
list[i] = newSegmentResponse(&v) |
406
|
|
|
} |
407
|
|
|
result.Item = list |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
if o.NextToken != nil { |
411
|
|
|
result.NextToken = *o.NextToken |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
return result |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
type WriteSegmentRequest struct { |
|
|
|
|
418
|
|
|
Dimensions SegmentDimensions |
419
|
|
|
Name string |
420
|
|
|
SegmentGroups SegmentGroupList |
421
|
|
|
Tags map[string]string |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
func (r WriteSegmentRequest) ToSDK() *SDK.WriteSegmentRequest { |
|
|
|
|
425
|
|
|
o := SDK.WriteSegmentRequest{} |
426
|
|
|
|
427
|
|
|
vv := r.Dimensions.ToSDK() |
428
|
|
|
o.Dimensions = &vv |
429
|
|
|
|
430
|
|
|
if r.Name != "" { |
431
|
|
|
o.Name = pointers.String(r.Name) |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
o.SegmentGroups = r.SegmentGroups.ToSDK() |
435
|
|
|
o.Tags = r.Tags |
436
|
|
|
return &o |
437
|
|
|
} |
438
|
|
|
|