summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/users.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-11 23:07:00 +0200
committerGitHub <noreply@github.com>2020-10-11 23:07:00 +0200
commit2d98df61221e23b3be557d7b1931ee3d510ac32d (patch)
tree7898a2d3c2b3003bae97d50541443072046666f3 /vendor/github.com/slack-go/slack/users.go
parent219a5453f9edaa87aa7aa4b9d5f9c3de9c75b38f (diff)
downloadmatterbridge-msglm-2d98df61221e23b3be557d7b1931ee3d510ac32d.tar.gz
matterbridge-msglm-2d98df61221e23b3be557d7b1931ee3d510ac32d.tar.bz2
matterbridge-msglm-2d98df61221e23b3be557d7b1931ee3d510ac32d.zip
Update vendor (#1257)
Diffstat (limited to 'vendor/github.com/slack-go/slack/users.go')
-rw-r--r--vendor/github.com/slack-go/slack/users.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/users.go b/vendor/github.com/slack-go/slack/users.go
index 364958e8..cdef4242 100644
--- a/vendor/github.com/slack-go/slack/users.go
+++ b/vendor/github.com/slack-go/slack/users.go
@@ -509,6 +509,41 @@ func (api *Client) DeleteUserPhotoContext(ctx context.Context) (err error) {
return response.Err()
}
+// SetUserRealName changes the currently authenticated user's realName
+//
+// For more information see SetUserRealNameContextWithUser
+func (api *Client) SetUserRealName(realName string) error {
+ return api.SetUserRealNameContextWithUser(context.Background(), realName, realName)
+}
+
+// SetUserRealNameContextWithUser will set a real name for the provided user with a custom context
+func (api *Client) SetUserRealNameContextWithUser(ctx context.Context, user, realName string) error {
+ profile, err := json.Marshal(
+ &struct {
+ RealName string `json:"real_name"`
+ }{
+ RealName: realName,
+ },
+ )
+
+ if err != nil {
+ return err
+ }
+
+ values := url.Values{
+ "user": {user},
+ "token": {api.token},
+ "profile": {string(profile)},
+ }
+
+ response := &userResponseFull{}
+ if err = api.postMethod(ctx, "users.profile.set", values, response); err != nil {
+ return err
+ }
+
+ return response.Err()
+}
+
// SetUserCustomStatus will set a custom status and emoji for the currently
// authenticated user. If statusEmoji is "" and statusText is not, the Slack API
// will automatically set it to ":speech_balloon:". Otherwise, if both are ""