From bb2152013368a03b047a73b4c4e6ef7818283920 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 3 Apr 2019 15:06:02 +0200 Subject: [PATCH] gw api client: add GetCurrentUser --- internal/services/gateway/api/client.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/services/gateway/api/client.go b/internal/services/gateway/api/client.go index ca35f9d..6de7541 100644 --- a/internal/services/gateway/api/client.go +++ b/internal/services/gateway/api/client.go @@ -211,8 +211,14 @@ func (c *Client) ReconfigProject(ctx context.Context, projectRef string) (*http. return c.getResponse(ctx, "POST", fmt.Sprintf("/projects/%s/reconfig", url.PathEscape(projectRef)), nil, jsonContent, nil) } -func (c *Client) GetUser(ctx context.Context, userID string) (*types.User, *http.Response, error) { - user := new(types.User) +func (c *Client) GetCurrentUser(ctx context.Context) (*UserResponse, *http.Response, error) { + user := new(UserResponse) + resp, err := c.getParsedResponse(ctx, "GET", "/user", nil, jsonContent, nil, user) + return user, resp, err +} + +func (c *Client) GetUser(ctx context.Context, userID string) (*UserResponse, *http.Response, error) { + user := new(UserResponse) resp, err := c.getParsedResponse(ctx, "GET", fmt.Sprintf("/user/%s", userID), nil, jsonContent, nil, user) return user, resp, err }