| Conditions | 3 |
| Total Lines | 24 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package pinpoint |
||
| 9 | func (svc *Pinpoint) XUpdateEndpointEmail(ctx context.Context, appID, endpointID, userID, email string, attrs ...map[string][]string) error { |
||
| 10 | req := UpdateEndpointRequest{ |
||
| 11 | ApplicationID: appID, |
||
| 12 | EndpointID: endpointID, |
||
| 13 | EndpointRequest: EndpointRequest{ |
||
| 14 | Address: email, |
||
| 15 | ChannelType: ChannelTypeEmail, |
||
| 16 | User: EndpointUser{ |
||
| 17 | UserID: userID, |
||
| 18 | }, |
||
| 19 | }, |
||
| 20 | } |
||
| 21 | |||
| 22 | attrSize := len(attrs) |
||
| 23 | switch { |
||
| 24 | case attrSize >= 2: |
||
| 25 | req.EndpointRequest.Attributes = attrs[0] |
||
| 26 | req.EndpointRequest.User.UserAttributes = attrs[1] |
||
| 27 | case attrSize == 1: |
||
| 28 | req.EndpointRequest.Attributes = attrs[0] |
||
| 29 | } |
||
| 30 | |||
| 31 | _, err := svc.UpdateEndpoint(ctx, req) |
||
| 32 | return err |
||
| 33 | } |
||
| 34 |