gw api client: add GetCurrentUser

This commit is contained in:
Simone Gotti 2019-04-03 15:06:02 +02:00
parent 9d559d49d7
commit bb21520133
1 changed files with 8 additions and 2 deletions

View File

@ -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
}