summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/dialog.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-09-07 22:46:58 +0200
committerGitHub <noreply@github.com>2019-09-07 22:46:58 +0200
commita3bee01e0af3394c19360b98fd2db1b647f49299 (patch)
treeffc5778361d55d592a718354a37c9251e75fc7f6 /vendor/github.com/nlopes/slack/dialog.go
parent1dc93ec4f001edd01daccbe408767d4878be25a3 (diff)
downloadmatterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.tar.gz
matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.tar.bz2
matterbridge-msglm-a3bee01e0af3394c19360b98fd2db1b647f49299.zip
Update dependencies (#886)
Diffstat (limited to 'vendor/github.com/nlopes/slack/dialog.go')
-rw-r--r--vendor/github.com/nlopes/slack/dialog.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/github.com/nlopes/slack/dialog.go b/vendor/github.com/nlopes/slack/dialog.go
index 7b9e3814..376cd9e6 100644
--- a/vendor/github.com/nlopes/slack/dialog.go
+++ b/vendor/github.com/nlopes/slack/dialog.go
@@ -3,7 +3,7 @@ package slack
import (
"context"
"encoding/json"
- "errors"
+ "strings"
)
// InputType is the type of the dialog input type
@@ -25,6 +25,7 @@ type DialogInput struct {
Name string `json:"name"`
Placeholder string `json:"placeholder"`
Optional bool `json:"optional"`
+ Hint string `json:"hint"`
}
// DialogTrigger ...
@@ -89,7 +90,7 @@ func (api *Client) OpenDialog(triggerID string, dialog Dialog) (err error) {
// EXPERIMENTAL: dialog functionality is currently experimental, api is not considered stable.
func (api *Client) OpenDialogContext(ctx context.Context, triggerID string, dialog Dialog) (err error) {
if triggerID == "" {
- return errors.New("received empty parameters")
+ return ErrParametersMissing
}
req := DialogTrigger{
@@ -103,10 +104,15 @@ func (api *Client) OpenDialogContext(ctx context.Context, triggerID string, dial
}
response := &DialogOpenResponse{}
- endpoint := APIURL + "dialog.open"
+ endpoint := api.endpoint + "dialog.open"
if err := postJSON(ctx, api.httpclient, endpoint, api.token, encoded, response, api); err != nil {
return err
}
+ if len(response.DialogResponseMetadata.Messages) > 0 {
+ response.Ok = false
+ response.Error += "\n" + strings.Join(response.DialogResponseMetadata.Messages, "\n")
+ }
+
return response.Err()
}