summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/users.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/slack-go/slack/users.go')
-rw-r--r--vendor/github.com/slack-go/slack/users.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/vendor/github.com/slack-go/slack/users.go b/vendor/github.com/slack-go/slack/users.go
index 82657d76..3696e37f 100644
--- a/vendor/github.com/slack-go/slack/users.go
+++ b/vendor/github.com/slack-go/slack/users.go
@@ -482,7 +482,7 @@ func (api *Client) SetUserPhotoContext(ctx context.Context, image string, params
values.Add("crop_w", strconv.Itoa(params.CropW))
}
- err = postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"users.setPhoto", image, "image", values, response, api)
+ err = postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"users.setPhoto", image, "image", api.token, values, response, api)
if err != nil {
return err
}
@@ -632,9 +632,15 @@ func (api *Client) UnsetUserCustomStatusContext(ctx context.Context) error {
return api.SetUserCustomStatusContext(ctx, "", "", 0)
}
+// GetUserProfileParameters are the parameters required to get user profile
+type GetUserProfileParameters struct {
+ UserID string
+ IncludeLabels bool
+}
+
// GetUserProfile retrieves a user's profile information.
-func (api *Client) GetUserProfile(userID string, includeLabels bool) (*UserProfile, error) {
- return api.GetUserProfileContext(context.Background(), userID, includeLabels)
+func (api *Client) GetUserProfile(params *GetUserProfileParameters) (*UserProfile, error) {
+ return api.GetUserProfileContext(context.Background(), params)
}
type getUserProfileResponse struct {
@@ -643,13 +649,14 @@ 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) {
+func (api *Client) GetUserProfileContext(ctx context.Context, params *GetUserProfileParameters) (*UserProfile, error) {
values := url.Values{"token": {api.token}}
- if includeLabels {
- values.Add("include_labels", "true")
+
+ if params.UserID != "" {
+ values.Add("user", params.UserID)
}
- if userID != "" {
- values.Add("user", userID)
+ if params.IncludeLabels {
+ values.Add("include_labels", "true")
}
resp := &getUserProfileResponse{}