diff options
author | Wim <wim@42.be> | 2021-02-01 21:29:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 21:29:04 +0100 |
commit | 0452be0cb383ff560e340b643b60a35c6e228639 (patch) | |
tree | 41b91af43c2e321d6498a6b56594b1d0c71c516e /vendor/github.com/slack-go/slack/socket_mode.go | |
parent | 1624f107739b8ed7b142732430e5295764388de2 (diff) | |
download | matterbridge-msglm-0452be0cb383ff560e340b643b60a35c6e228639.tar.gz matterbridge-msglm-0452be0cb383ff560e340b643b60a35c6e228639.tar.bz2 matterbridge-msglm-0452be0cb383ff560e340b643b60a35c6e228639.zip |
Update vendor (#1384)
Diffstat (limited to 'vendor/github.com/slack-go/slack/socket_mode.go')
-rw-r--r-- | vendor/github.com/slack-go/slack/socket_mode.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/socket_mode.go b/vendor/github.com/slack-go/slack/socket_mode.go new file mode 100644 index 00000000..69e40d99 --- /dev/null +++ b/vendor/github.com/slack-go/slack/socket_mode.go @@ -0,0 +1,34 @@ +package slack + +import ( + "context" +) + +// SocketModeConnection contains various details about the SocketMode connection. +// It is returned by an "apps.connections.open" API call. +type SocketModeConnection struct { + URL string `json:"url,omitempty"` + Data map[string]interface{} `json:"-"` +} + +type openResponseFull struct { + SlackResponse + SocketModeConnection +} + +// StartSocketModeContext calls the "apps.connections.open" endpoint and returns the provided URL and the full Info block with a custom context. +// +// To have a fully managed Socket Mode connection, use `socketmode.New()`, and call `Run()` on it. +func (api *Client) StartSocketModeContext(ctx context.Context) (info *SocketModeConnection, websocketURL string, err error) { + response := &openResponseFull{} + err = postJSON(ctx, api.httpclient, api.endpoint+"apps.connections.open", api.appLevelToken, nil, response, api) + if err != nil { + return nil, "", err + } + + if response.Err() == nil { + api.Debugln("Using URL:", response.SocketModeConnection.URL) + } + + return &response.SocketModeConnection, response.SocketModeConnection.URL, response.Err() +} |