summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/reactions.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/reactions.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/reactions.go')
-rw-r--r--vendor/github.com/nlopes/slack/reactions.go56
1 files changed, 28 insertions, 28 deletions
diff --git a/vendor/github.com/nlopes/slack/reactions.go b/vendor/github.com/nlopes/slack/reactions.go
index 9da59241..5eabde63 100644
--- a/vendor/github.com/nlopes/slack/reactions.go
+++ b/vendor/github.com/nlopes/slack/reactions.go
@@ -136,31 +136,30 @@ func (api *Client) AddReaction(name string, item ItemRef) error {
// AddReactionContext adds a reaction emoji to a message, file or file comment with a custom context.
func (api *Client) AddReactionContext(ctx context.Context, name string, item ItemRef) error {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
if name != "" {
values.Set("name", name)
}
if item.Channel != "" {
- values.Set("channel", string(item.Channel))
+ values.Set("channel", item.Channel)
}
if item.Timestamp != "" {
- values.Set("timestamp", string(item.Timestamp))
+ values.Set("timestamp", item.Timestamp)
}
if item.File != "" {
- values.Set("file", string(item.File))
+ values.Set("file", item.File)
}
if item.Comment != "" {
- values.Set("file_comment", string(item.Comment))
+ values.Set("file_comment", item.Comment)
}
+
response := &SlackResponse{}
- if err := post(ctx, "reactions.add", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "reactions.add", values, response, api.debug); err != nil {
return err
}
- if !response.Ok {
- return errors.New(response.Error)
- }
- return nil
+
+ return response.Err()
}
// RemoveReaction removes a reaction emoji from a message, file or file comment.
@@ -171,31 +170,30 @@ func (api *Client) RemoveReaction(name string, item ItemRef) error {
// RemoveReactionContext removes a reaction emoji from a message, file or file comment with a custom context.
func (api *Client) RemoveReactionContext(ctx context.Context, name string, item ItemRef) error {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
if name != "" {
values.Set("name", name)
}
if item.Channel != "" {
- values.Set("channel", string(item.Channel))
+ values.Set("channel", item.Channel)
}
if item.Timestamp != "" {
- values.Set("timestamp", string(item.Timestamp))
+ values.Set("timestamp", item.Timestamp)
}
if item.File != "" {
- values.Set("file", string(item.File))
+ values.Set("file", item.File)
}
if item.Comment != "" {
- values.Set("file_comment", string(item.Comment))
+ values.Set("file_comment", item.Comment)
}
+
response := &SlackResponse{}
- if err := post(ctx, "reactions.remove", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "reactions.remove", values, response, api.debug); err != nil {
return err
}
- if !response.Ok {
- return errors.New(response.Error)
- }
- return nil
+
+ return response.Err()
}
// GetReactions returns details about the reactions on an item.
@@ -206,25 +204,26 @@ func (api *Client) GetReactions(item ItemRef, params GetReactionsParameters) ([]
// GetReactionsContext returns details about the reactions on an item with a custom context
func (api *Client) GetReactionsContext(ctx context.Context, item ItemRef, params GetReactionsParameters) ([]ItemReaction, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
if item.Channel != "" {
- values.Set("channel", string(item.Channel))
+ values.Set("channel", item.Channel)
}
if item.Timestamp != "" {
- values.Set("timestamp", string(item.Timestamp))
+ values.Set("timestamp", item.Timestamp)
}
if item.File != "" {
- values.Set("file", string(item.File))
+ values.Set("file", item.File)
}
if item.Comment != "" {
- values.Set("file_comment", string(item.Comment))
+ values.Set("file_comment", item.Comment)
}
if params.Full != DEFAULT_REACTIONS_FULL {
values.Set("full", strconv.FormatBool(params.Full))
}
+
response := &getReactionsResponseFull{}
- if err := post(ctx, "reactions.get", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "reactions.get", values, response, api.debug); err != nil {
return nil, err
}
if !response.Ok {
@@ -241,7 +240,7 @@ func (api *Client) ListReactions(params ListReactionsParameters) ([]ReactedItem,
// ListReactionsContext returns information about the items a user reacted to with a custom context.
func (api *Client) ListReactionsContext(ctx context.Context, params ListReactionsParameters) ([]ReactedItem, *Paging, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
if params.User != DEFAULT_REACTIONS_USER {
values.Add("user", params.User)
@@ -255,8 +254,9 @@ func (api *Client) ListReactionsContext(ctx context.Context, params ListReaction
if params.Full != DEFAULT_REACTIONS_FULL {
values.Add("full", strconv.FormatBool(params.Full))
}
+
response := &listReactionsResponseFull{}
- err := post(ctx, "reactions.list", values, response, api.debug)
+ err := postSlackMethod(ctx, api.httpclient, "reactions.list", values, response, api.debug)
if err != nil {
return nil, nil, err
}