diff options
author | Patrick Connolly <patrick.c.connolly@gmail.com> | 2018-12-02 02:55:35 +0800 |
---|---|---|
committer | Wim <wim@42.be> | 2018-12-01 19:55:35 +0100 |
commit | e538a4d30459e9da1a021400b5de85894b4efabc (patch) | |
tree | ead4f82d5459fe0d3465f7e3656243cd613c07a6 /vendor/github.com/nlopes/slack/im.go | |
parent | f94c2b40a3e8eb45054bda1b71eb6fd3f9bc9e6d (diff) | |
download | matterbridge-msglm-e538a4d30459e9da1a021400b5de85894b4efabc.tar.gz matterbridge-msglm-e538a4d30459e9da1a021400b5de85894b4efabc.tar.bz2 matterbridge-msglm-e538a4d30459e9da1a021400b5de85894b4efabc.zip |
Update nlopes/slack to 4.1-dev (#595)
Diffstat (limited to 'vendor/github.com/nlopes/slack/im.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/im.go | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/vendor/github.com/nlopes/slack/im.go b/vendor/github.com/nlopes/slack/im.go index fa8b0959..10563d91 100644 --- a/vendor/github.com/nlopes/slack/im.go +++ b/vendor/github.com/nlopes/slack/im.go @@ -2,7 +2,6 @@ package slack import ( "context" - "errors" "net/url" "strconv" ) @@ -29,16 +28,14 @@ type IM struct { IsUserDeleted bool `json:"is_user_deleted"` } -func imRequest(ctx context.Context, client HTTPRequester, path string, values url.Values, debug bool) (*imResponseFull, error) { +func imRequest(ctx context.Context, client httpClient, path string, values url.Values, d debug) (*imResponseFull, error) { response := &imResponseFull{} - err := postSlackMethod(ctx, client, path, values, response, debug) + err := postSlackMethod(ctx, client, path, values, response, d) if err != nil { return nil, err } - if !response.Ok { - return nil, errors.New(response.Error) - } - return response, nil + + return response, response.Err() } // CloseIMChannel closes the direct message channel @@ -53,7 +50,7 @@ func (api *Client) CloseIMChannelContext(ctx context.Context, channel string) (b "channel": {channel}, } - response, err := imRequest(ctx, api.httpclient, "im.close", values, api.debug) + response, err := imRequest(ctx, api.httpclient, "im.close", values, api) if err != nil { return false, false, err } @@ -74,7 +71,7 @@ func (api *Client) OpenIMChannelContext(ctx context.Context, user string) (bool, "user": {user}, } - response, err := imRequest(ctx, api.httpclient, "im.open", values, api.debug) + response, err := imRequest(ctx, api.httpclient, "im.open", values, api) if err != nil { return false, false, "", err } @@ -94,7 +91,7 @@ func (api *Client) MarkIMChannelContext(ctx context.Context, channel, ts string) "ts": {ts}, } - _, err := imRequest(ctx, api.httpclient, "im.mark", values, api.debug) + _, err := imRequest(ctx, api.httpclient, "im.mark", values, api) return err } @@ -133,7 +130,7 @@ func (api *Client) GetIMHistoryContext(ctx context.Context, channel string, para } } - response, err := imRequest(ctx, api.httpclient, "im.history", values, api.debug) + response, err := imRequest(ctx, api.httpclient, "im.history", values, api) if err != nil { return nil, err } @@ -151,7 +148,7 @@ func (api *Client) GetIMChannelsContext(ctx context.Context) ([]IM, error) { "token": {api.token}, } - response, err := imRequest(ctx, api.httpclient, "im.list", values, api.debug) + response, err := imRequest(ctx, api.httpclient, "im.list", values, api) if err != nil { return nil, err } |