summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/reminders.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-19 23:40:00 +0200
committerGitHub <noreply@github.com>2020-10-19 23:40:00 +0200
commit075a84427f6332aab707d283ad770d69f8816032 (patch)
tree0ff9f56a057919f3fe968e57f6f0b1c0d1f85078 /vendor/github.com/slack-go/slack/reminders.go
parent950f2759bd2b20aa0bdedc3dc9a74d0dafb606d8 (diff)
downloadmatterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.gz
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.bz2
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.zip
Update vendor (#1265)
Diffstat (limited to 'vendor/github.com/slack-go/slack/reminders.go')
-rw-r--r--vendor/github.com/slack-go/slack/reminders.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/reminders.go b/vendor/github.com/slack-go/slack/reminders.go
index 9b905387..de1170a6 100644
--- a/vendor/github.com/slack-go/slack/reminders.go
+++ b/vendor/github.com/slack-go/slack/reminders.go
@@ -21,6 +21,11 @@ type reminderResp struct {
Reminder Reminder `json:"reminder"`
}
+type remindersResp struct {
+ SlackResponse
+ Reminders []Reminder `json:"reminders"`
+}
+
func (api *Client) doReminder(ctx context.Context, path string, values url.Values) (*Reminder, error) {
response := &reminderResp{}
if err := api.postMethod(ctx, path, values, response); err != nil {
@@ -29,6 +34,31 @@ func (api *Client) doReminder(ctx context.Context, path string, values url.Value
return &response.Reminder, response.Err()
}
+func (api *Client) doReminders(ctx context.Context, path string, values url.Values) ([]*Reminder, error) {
+ response := &remindersResp{}
+ if err := api.postMethod(ctx, path, values, response); err != nil {
+ return nil, err
+ }
+
+ // create an array of pointers to reminders
+ var reminders = make([]*Reminder, 0, len(response.Reminders))
+ for _, reminder := range response.Reminders {
+ reminders = append(reminders, &reminder)
+ }
+
+ return reminders, response.Err()
+}
+
+// ListReminders lists all the reminders created by or for the authenticated user
+//
+// See https://api.slack.com/methods/reminders.list
+func (api *Client) ListReminders() ([]*Reminder, error) {
+ values := url.Values{
+ "token": {api.token},
+ }
+ return api.doReminders(context.Background(), "reminders.list", values)
+}
+
// AddChannelReminder adds a reminder for a channel.
//
// See https://api.slack.com/methods/reminders.add (NOTE: the ability to set