summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/stars.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/stars.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/stars.go')
-rw-r--r--vendor/github.com/nlopes/slack/stars.go39
1 files changed, 19 insertions, 20 deletions
diff --git a/vendor/github.com/nlopes/slack/stars.go b/vendor/github.com/nlopes/slack/stars.go
index cf4a4a11..c1e2f6cb 100644
--- a/vendor/github.com/nlopes/slack/stars.go
+++ b/vendor/github.com/nlopes/slack/stars.go
@@ -45,25 +45,24 @@ func (api *Client) AddStar(channel string, item ItemRef) error {
func (api *Client) AddStarContext(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, "stars.add", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "stars.add", values, response, api.debug); err != nil {
return err
}
- if !response.Ok {
- return errors.New(response.Error)
- }
- return nil
+
+ return response.Err()
}
// RemoveStar removes a starred item from a channel
@@ -75,25 +74,24 @@ func (api *Client) RemoveStar(channel string, item ItemRef) error {
func (api *Client) RemoveStarContext(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, "stars.remove", values, response, api.debug); err != nil {
+ if err := postSlackMethod(ctx, api.httpclient, "stars.remove", values, response, api.debug); err != nil {
return err
}
- if !response.Ok {
- return errors.New(response.Error)
- }
- return nil
+
+ return response.Err()
}
// ListStars returns information about the stars a user added
@@ -104,7 +102,7 @@ func (api *Client) ListStars(params StarsParameters) ([]Item, *Paging, error) {
// ListStarsContext returns information about the stars a user added with a custom context
func (api *Client) ListStarsContext(ctx context.Context, params StarsParameters) ([]Item, *Paging, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
if params.User != DEFAULT_STARS_USER {
values.Add("user", params.User)
@@ -115,8 +113,9 @@ func (api *Client) ListStarsContext(ctx context.Context, params StarsParameters)
if params.Page != DEFAULT_STARS_PAGE {
values.Add("page", strconv.Itoa(params.Page))
}
+
response := &listResponseFull{}
- err := post(ctx, "stars.list", values, response, api.debug)
+ err := postSlackMethod(ctx, api.httpclient, "stars.list", values, response, api.debug)
if err != nil {
return nil, nil, err
}