summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/usergroups.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nlopes/slack/usergroups.go')
-rw-r--r--vendor/github.com/nlopes/slack/usergroups.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/vendor/github.com/nlopes/slack/usergroups.go b/vendor/github.com/nlopes/slack/usergroups.go
index 9e145272..f3206591 100644
--- a/vendor/github.com/nlopes/slack/usergroups.go
+++ b/vendor/github.com/nlopes/slack/usergroups.go
@@ -40,9 +40,9 @@ type userGroupResponseFull struct {
SlackResponse
}
-func userGroupRequest(ctx context.Context, client httpClient, path string, values url.Values, d debug) (*userGroupResponseFull, error) {
+func (api *Client) userGroupRequest(ctx context.Context, path string, values url.Values) (*userGroupResponseFull, error) {
response := &userGroupResponseFull{}
- err := postSlackMethod(ctx, client, path, values, response, d)
+ err := api.postMethod(ctx, path, values, response)
if err != nil {
return nil, err
}
@@ -74,7 +74,7 @@ func (api *Client) CreateUserGroupContext(ctx context.Context, userGroup UserGro
values["channels"] = []string{strings.Join(userGroup.Prefs.Channels, ",")}
}
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.create", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.create", values)
if err != nil {
return UserGroup{}, err
}
@@ -93,7 +93,7 @@ func (api *Client) DisableUserGroupContext(ctx context.Context, userGroup string
"usergroup": {userGroup},
}
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.disable", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.disable", values)
if err != nil {
return UserGroup{}, err
}
@@ -112,7 +112,7 @@ func (api *Client) EnableUserGroupContext(ctx context.Context, userGroup string)
"usergroup": {userGroup},
}
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.enable", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.enable", values)
if err != nil {
return UserGroup{}, err
}
@@ -176,7 +176,7 @@ func (api *Client) GetUserGroupsContext(ctx context.Context, options ...GetUserG
values.Add("include_users", "true")
}
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.list", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.list", values)
if err != nil {
return nil, err
}
@@ -206,8 +206,12 @@ func (api *Client) UpdateUserGroupContext(ctx context.Context, userGroup UserGro
if userGroup.Description != "" {
values["description"] = []string{userGroup.Description}
}
+
+ if len(userGroup.Prefs.Channels) > 0 {
+ values["channels"] = []string{strings.Join(userGroup.Prefs.Channels, ",")}
+ }
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.update", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.update", values)
if err != nil {
return UserGroup{}, err
}
@@ -226,7 +230,7 @@ func (api *Client) GetUserGroupMembersContext(ctx context.Context, userGroup str
"usergroup": {userGroup},
}
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.users.list", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.users.list", values)
if err != nil {
return []string{}, err
}
@@ -246,7 +250,7 @@ func (api *Client) UpdateUserGroupMembersContext(ctx context.Context, userGroup
"users": {members},
}
- response, err := userGroupRequest(ctx, api.httpclient, "usergroups.users.update", values, api)
+ response, err := api.userGroupRequest(ctx, "usergroups.users.update", values)
if err != nil {
return UserGroup{}, err
}