summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/pins.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/pins.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/pins.go')
-rw-r--r--vendor/github.com/nlopes/slack/pins.go39
1 files changed, 19 insertions, 20 deletions
diff --git a/vendor/github.com/nlopes/slack/pins.go b/vendor/github.com/nlopes/slack/pins.go
index a20f8f73..34863f17 100644
--- a/vendor/github.com/nlopes/slack/pins.go
+++ b/vendor/github.com/nlopes/slack/pins.go
@@ -21,25 +21,24 @@ func (api *Client) AddPin(channel string, item ItemRef) error {
func (api *Client) AddPinContext(ctx context.Context, channel string, item ItemRef) error {
values := url.Values{
"channel": {channel},
- "token": {api.config.token},
+ "token": {api.token},
}
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, "pins.add", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "pins.add", values, response, api.debug); err != nil {
return err
}
- if !response.Ok {
- return errors.New(response.Error)
- }
- return nil
+
+ return response.Err()
}
// RemovePin un-pins an item from a channel
@@ -51,25 +50,24 @@ func (api *Client) RemovePin(channel string, item ItemRef) error {
func (api *Client) RemovePinContext(ctx context.Context, channel string, item ItemRef) error {
values := url.Values{
"channel": {channel},
- "token": {api.config.token},
+ "token": {api.token},
}
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, "pins.remove", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "pins.remove", values, response, api.debug); err != nil {
return err
}
- if !response.Ok {
- return errors.New(response.Error)
- }
- return nil
+
+ return response.Err()
}
// ListPins returns information about the items a user reacted to.
@@ -81,10 +79,11 @@ func (api *Client) ListPins(channel string) ([]Item, *Paging, error) {
func (api *Client) ListPinsContext(ctx context.Context, channel string) ([]Item, *Paging, error) {
values := url.Values{
"channel": {channel},
- "token": {api.config.token},
+ "token": {api.token},
}
+
response := &listPinsResponseFull{}
- err := post(ctx, "pins.list", values, response, api.debug)
+ err := postSlackMethod(ctx, api.httpclient, "pins.list", values, response, api.debug)
if err != nil {
return nil, nil, err
}