Total Lines | 54 |
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 | // GetApps executes `GetApps` operation. |
||
13 | func (svc *Pinpoint) GetApps(ctx context.Context, r GetAppsRequest) (*GetAppsResult, error) { |
||
14 | out, err := svc.RawGetApps(ctx, r.ToInput()) |
||
15 | if err != nil { |
||
16 | err = svc.errWrap(errors.ErrorData{ |
||
17 | Err: err, |
||
18 | AWSOperation: "GetApps", |
||
19 | }) |
||
20 | svc.Errorf(err.Error()) |
||
|
|||
21 | return nil, err |
||
22 | } |
||
23 | return NewGetAppsResult(out), nil |
||
24 | } |
||
25 | |||
26 | // GetAppsRequest has parameters for `GetApps` operation. |
||
27 | type GetAppsRequest struct { |
||
28 | PageSize string |
||
29 | Token string |
||
30 | } |
||
31 | |||
32 | func (r GetAppsRequest) ToInput() *SDK.GetAppsInput { |
||
33 | in := &SDK.GetAppsInput{} |
||
34 | if r.PageSize != "" { |
||
35 | in.PageSize = pointers.String(r.PageSize) |
||
36 | } |
||
37 | if r.Token != "" { |
||
38 | in.Token = pointers.String(r.Token) |
||
39 | } |
||
40 | return in |
||
41 | } |
||
42 | |||
43 | type GetAppsResult struct { |
||
44 | ApplicationsResponse |
||
45 | } |
||
46 | |||
47 | func NewGetAppsResult(o *SDK.GetAppsResponse) *GetAppsResult { |
||
48 | result := &GetAppsResult{} |
||
49 | if o == nil { |
||
50 | return result |
||
51 | } |
||
52 | |||
53 | result.ApplicationsResponse = newApplicationsResponse(o.ApplicationsResponse) |
||
54 | return result |
||
55 | } |
||
56 |