gw api client: add GetCurrentUser
This commit is contained in:
parent
9d559d49d7
commit
bb21520133
|
@ -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)
|
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) {
|
func (c *Client) GetCurrentUser(ctx context.Context) (*UserResponse, *http.Response, error) {
|
||||||
user := new(types.User)
|
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)
|
resp, err := c.getParsedResponse(ctx, "GET", fmt.Sprintf("/user/%s", userID), nil, jsonContent, nil, user)
|
||||||
return user, resp, err
|
return user, resp, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue