summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/apps.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/apps.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/apps.go')
-rw-r--r--vendor/github.com/slack-go/slack/apps.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/apps.go b/vendor/github.com/slack-go/slack/apps.go
new file mode 100644
index 00000000..cb26ad8e
--- /dev/null
+++ b/vendor/github.com/slack-go/slack/apps.go
@@ -0,0 +1,43 @@
+package slack
+
+import (
+ "context"
+ "encoding/json"
+)
+
+type listEventAuthorizationsResponse struct {
+ SlackResponse
+ Authorizations []EventAuthorization `json:"authorizations"`
+}
+
+type EventAuthorization struct {
+ EnterpriseID string `json:"enterprise_id"`
+ TeamID string `json:"team_id"`
+ UserID string `json:"user_id"`
+ IsBot bool `json:"is_bot"`
+ IsEnterpriseInstall bool `json:"is_enterprise_install"`
+}
+
+func (api *Client) ListEventAuthorizations(eventContext string) ([]EventAuthorization, error) {
+ return api.ListEventAuthorizationsContext(context.Background(), eventContext)
+}
+
+// ListEventAuthorizationsContext lists authed users and teams for the given event_context. You must provide an app-level token to the client using OptionAppLevelToken. More info: https://api.slack.com/methods/apps.event.authorizations.list
+func (api *Client) ListEventAuthorizationsContext(ctx context.Context, eventContext string) ([]EventAuthorization, error) {
+ resp := &listEventAuthorizationsResponse{}
+
+ request, _ := json.Marshal(map[string]string{
+ "event_context": eventContext,
+ })
+
+ err := postJSON(ctx, api.httpclient, api.endpoint+"apps.event.authorizations.list", api.appLevelToken, request, &resp, api)
+
+ if err != nil {
+ return nil, err
+ }
+ if !resp.Ok {
+ return nil, resp.Err()
+ }
+
+ return resp.Authorizations, nil
+}