| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package pinpoint |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "context" |
||
| 5 | |||
| 6 | SDK "github.com/aws/aws-sdk-go-v2/service/pinpoint" |
||
| 7 | |||
| 8 | "github.com/evalphobia/aws-sdk-go-v2-wrapper/errors" |
||
| 9 | "github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
||
| 10 | ) |
||
| 11 | |||
| 12 | // GetSegments executes `GetSegments` operation. |
||
| 13 | func (svc *Pinpoint) GetSegments(ctx context.Context, r GetSegmentsRequest) (*GetSegmentsResult, error) { |
||
| 14 | out, err := svc.RawGetSegments(ctx, r.ToInput()) |
||
| 15 | if err != nil { |
||
| 16 | err = svc.errWrap(errors.ErrorData{ |
||
| 17 | Err: err, |
||
| 18 | AWSOperation: "GetSegments", |
||
| 19 | }) |
||
| 20 | svc.Errorf(err.Error()) |
||
|
|
|||
| 21 | return nil, err |
||
| 22 | } |
||
| 23 | return NewGetSegmentsResult(out), nil |
||
| 24 | } |
||
| 25 | |||
| 26 | // GetSegmentsRequest has parameters for `GetSegments` operation. |
||
| 27 | type GetSegmentsRequest struct { |
||
| 28 | ApplicationID string |
||
| 29 | PageSize string |
||
| 30 | Token string |
||
| 31 | } |
||
| 32 | |||
| 33 | func (r GetSegmentsRequest) ToInput() *SDK.GetSegmentsInput { |
||
| 34 | in := &SDK.GetSegmentsInput{} |
||
| 35 | if r.ApplicationID != "" { |
||
| 36 | in.ApplicationId = pointers.String(r.ApplicationID) |
||
| 37 | } |
||
| 38 | if r.PageSize != "" { |
||
| 39 | in.PageSize = pointers.String(r.PageSize) |
||
| 40 | } |
||
| 41 | if r.Token != "" { |
||
| 42 | in.Token = pointers.String(r.Token) |
||
| 43 | } |
||
| 44 | return in |
||
| 45 | } |
||
| 46 | |||
| 47 | type GetSegmentsResult struct { |
||
| 48 | SegmentsResponse |
||
| 49 | } |
||
| 50 | |||
| 51 | func NewGetSegmentsResult(o *SDK.GetSegmentsResponse) *GetSegmentsResult { |
||
| 52 | result := &GetSegmentsResult{} |
||
| 53 | if o == nil { |
||
| 54 | return result |
||
| 55 | } |
||
| 56 | |||
| 57 | result.SegmentsResponse = newSegmentsResponse(o.SegmentsResponse) |
||
| 58 | return result |
||
| 59 | } |
||
| 60 |