summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/admin.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-08-10 00:38:19 +0200
committerWim <wim@42.be>2018-08-10 00:38:19 +0200
commit68aeb93afa0dd4a5067fcefff9db0a70644d7128 (patch)
treefdd80104c029ba57cb27d54850a3aa7020fedfba /vendor/github.com/nlopes/slack/admin.go
parent51062863a5c34d81e296cf15c61140911037cf3b (diff)
downloadmatterbridge-msglm-68aeb93afa0dd4a5067fcefff9db0a70644d7128.tar.gz
matterbridge-msglm-68aeb93afa0dd4a5067fcefff9db0a70644d7128.tar.bz2
matterbridge-msglm-68aeb93afa0dd4a5067fcefff9db0a70644d7128.zip
Update nlopes/slack vendor
Diffstat (limited to 'vendor/github.com/nlopes/slack/admin.go')
-rw-r--r--vendor/github.com/nlopes/slack/admin.go38
1 files changed, 20 insertions, 18 deletions
diff --git a/vendor/github.com/nlopes/slack/admin.go b/vendor/github.com/nlopes/slack/admin.go
index 478c4f40..a2aa7e5c 100644
--- a/vendor/github.com/nlopes/slack/admin.go
+++ b/vendor/github.com/nlopes/slack/admin.go
@@ -12,9 +12,9 @@ type adminResponse struct {
Error string `json:"error"`
}
-func adminRequest(ctx context.Context, method string, teamName string, values url.Values, debug bool) (*adminResponse, error) {
+func adminRequest(ctx context.Context, client HTTPRequester, method string, teamName string, values url.Values, debug bool) (*adminResponse, error) {
adminResponse := &adminResponse{}
- err := parseAdminResponse(ctx, method, teamName, values, adminResponse, debug)
+ err := parseAdminResponse(ctx, client, method, teamName, values, adminResponse, debug)
if err != nil {
return nil, err
}
@@ -35,12 +35,12 @@ func (api *Client) DisableUser(teamName string, uid string) error {
func (api *Client) DisableUserContext(ctx context.Context, teamName string, uid string) error {
values := url.Values{
"user": {uid},
- "token": {api.config.token},
+ "token": {api.token},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "setInactive", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "setInactive", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to disable user with id '%s': %s", uid, err)
}
@@ -61,12 +61,13 @@ func (api *Client) InviteGuestContext(ctx context.Context, teamName, channel, fi
"first_name": {firstName},
"last_name": {lastName},
"ultra_restricted": {"1"},
- "token": {api.config.token},
+ "token": {api.token},
+ "resend": {"true"},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "invite", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "invite", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to invite single-channel guest: %s", err)
}
@@ -87,12 +88,13 @@ func (api *Client) InviteRestrictedContext(ctx context.Context, teamName, channe
"first_name": {firstName},
"last_name": {lastName},
"restricted": {"1"},
- "token": {api.config.token},
+ "token": {api.token},
+ "resend": {"true"},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "invite", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "invite", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to restricted account: %s", err)
}
@@ -111,12 +113,12 @@ func (api *Client) InviteToTeamContext(ctx context.Context, teamName, firstName,
"email": {emailAddress},
"first_name": {firstName},
"last_name": {lastName},
- "token": {api.config.token},
+ "token": {api.token},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "invite", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "invite", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to invite to team: %s", err)
}
@@ -133,12 +135,12 @@ func (api *Client) SetRegular(teamName, user string) error {
func (api *Client) SetRegularContext(ctx context.Context, teamName, user string) error {
values := url.Values{
"user": {user},
- "token": {api.config.token},
+ "token": {api.token},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "setRegular", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "setRegular", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to change the user (%s) to a regular user: %s", user, err)
}
@@ -155,12 +157,12 @@ func (api *Client) SendSSOBindingEmail(teamName, user string) error {
func (api *Client) SendSSOBindingEmailContext(ctx context.Context, teamName, user string) error {
values := url.Values{
"user": {user},
- "token": {api.config.token},
+ "token": {api.token},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "sendSSOBind", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "sendSSOBind", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to send SSO binding email for user (%s): %s", user, err)
}
@@ -178,12 +180,12 @@ func (api *Client) SetUltraRestrictedContext(ctx context.Context, teamName, uid,
values := url.Values{
"user": {uid},
"channel": {channel},
- "token": {api.config.token},
+ "token": {api.token},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "setUltraRestricted", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "setUltraRestricted", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to ultra-restrict account: %s", err)
}
@@ -200,12 +202,12 @@ func (api *Client) SetRestricted(teamName, uid string) error {
func (api *Client) SetRestrictedContext(ctx context.Context, teamName, uid string) error {
values := url.Values{
"user": {uid},
- "token": {api.config.token},
+ "token": {api.token},
"set_active": {"true"},
"_attempts": {"1"},
}
- _, err := adminRequest(ctx, "setRestricted", teamName, values, api.debug)
+ _, err := adminRequest(ctx, api.httpclient, "setRestricted", teamName, values, api.debug)
if err != nil {
return fmt.Errorf("Failed to restrict account: %s", err)
}