Skip to content

Commit

Permalink
Merge pull request #838 from 2nick/get_self_profile
Browse files Browse the repository at this point in the history
Make possible to get authorized user's profile providing empty userID to GetUserProfileContext
  • Loading branch information
kanata2 authored Mar 16, 2021
2 parents ce718af + dfd3b28 commit 93fe17c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion users.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,13 @@ type getUserProfileResponse struct {

// GetUserProfileContext retrieves a user's profile information with a context.
func (api *Client) GetUserProfileContext(ctx context.Context, userID string, includeLabels bool) (*UserProfile, error) {
values := url.Values{"token": {api.token}, "user": {userID}}
values := url.Values{"token": {api.token}}
if includeLabels {
values.Add("include_labels", "true")
}
if userID != "" {
values.Add("user", userID)
}
resp := &getUserProfileResponse{}

err := api.postMethod(ctx, "users.profile.get", values, &resp)
Expand Down

0 comments on commit 93fe17c

Please sign in to comment.