Add Result types to Go SDK and properly populate body/map fields (#358)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-15 01:08:21 -04:00
1 parent d8dc1ed0b2
commit a00ee7a948
61 files changed
+1888 -1099

No files matched your search

+4 -3
View File
@@ -8,7 +8,7 @@ import (
"github.com/hashicorp/boundary/api/authtokens"
)
func (c *Client) Authenticate(ctx context.Context, authMethodId string, credentials map[string]interface{}, opt ...Option) (*authtokens.AuthToken, *api.Error, error) {
func (c *Client) Authenticate(ctx context.Context, authMethodId string, credentials map[string]interface{}, opt ...Option) (*authtokens.AuthTokenReadResult, *api.Error, error) {
if c.client == nil {
return nil, nil, fmt.Errorf("nil client in Authenticate request")
}
@@ -29,8 +29,9 @@ func (c *Client) Authenticate(ctx context.Context, authMethodId string, credenti
return nil, nil, fmt.Errorf("error performing client request during Authenticate call: %w", err)
}
target := new(authtokens.AuthToken)
apiErr, err := resp.Decode(target)
target := new(authtokens.AuthTokenReadResult)
target.Item = new(authtokens.AuthToken)
apiErr, err := resp.Decode(target.Item)
if err != nil {
return nil, nil, fmt.Errorf("error decoding Authenticate response: %w", err)
}