diff options
Diffstat (limited to 'vendor/github.com/slack-go/slack/users.go')
-rw-r--r-- | vendor/github.com/slack-go/slack/users.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/users.go b/vendor/github.com/slack-go/slack/users.go index 6001e0fa..364958e8 100644 --- a/vendor/github.com/slack-go/slack/users.go +++ b/vendor/github.com/slack-go/slack/users.go @@ -5,6 +5,7 @@ import ( "encoding/json" "net/url" "strconv" + "strings" "time" ) @@ -184,6 +185,7 @@ type TeamIdentity struct { type userResponseFull struct { Members []User `json:"members,omitempty"` User `json:"user,omitempty"` + Users []User `json:"users,omitempty"` UserPresence SlackResponse Metadata ResponseMetadata `json:"response_metadata"` @@ -252,6 +254,26 @@ func (api *Client) GetUserInfoContext(ctx context.Context, user string) (*User, return &response.User, nil } +// GetUsersInfo will retrieve the complete multi-users information +func (api *Client) GetUsersInfo(users ...string) (*[]User, error) { + return api.GetUsersInfoContext(context.Background(), users...) +} + +// GetUsersInfoContext will retrieve the complete multi-users information with a custom context +func (api *Client) GetUsersInfoContext(ctx context.Context, users ...string) (*[]User, error) { + values := url.Values{ + "token": {api.token}, + "users": {strings.Join(users, ",")}, + "include_locale": {strconv.FormatBool(true)}, + } + + response, err := api.userRequest(ctx, "users.info", values) + if err != nil { + return nil, err + } + return &response.Users, nil +} + // GetUsersOption options for the GetUsers method call. type GetUsersOption func(*UserPagination) |