summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/dialog_text.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-03-01 20:59:19 +0100
committerGitHub <noreply@github.com>2020-03-01 20:59:19 +0100
commit250b3bb5795240d5ebdab5416ab99dbc41be734b (patch)
tree11e44ec2e7e37cd7eb0deaf0a7843fe6bf3c0e40 /vendor/github.com/slack-go/slack/dialog_text.go
parente9edbfc051afc643d91fc04bc7fb3fe70039c213 (diff)
downloadmatterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.tar.gz
matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.tar.bz2
matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.zip
Use upstream slack-go/slack again (#1018)
Diffstat (limited to 'vendor/github.com/slack-go/slack/dialog_text.go')
-rw-r--r--vendor/github.com/slack-go/slack/dialog_text.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/dialog_text.go b/vendor/github.com/slack-go/slack/dialog_text.go
new file mode 100644
index 00000000..da06bd6d
--- /dev/null
+++ b/vendor/github.com/slack-go/slack/dialog_text.go
@@ -0,0 +1,59 @@
+package slack
+
+// TextInputSubtype Accepts email, number, tel, or url. In some form factors, optimized input is provided for this subtype.
+type TextInputSubtype string
+
+// TextInputOption handle to extra inputs options.
+type TextInputOption func(*TextInputElement)
+
+const (
+ // InputSubtypeEmail email keyboard
+ InputSubtypeEmail TextInputSubtype = "email"
+ // InputSubtypeNumber numeric keyboard
+ InputSubtypeNumber TextInputSubtype = "number"
+ // InputSubtypeTel Phone keyboard
+ InputSubtypeTel TextInputSubtype = "tel"
+ // InputSubtypeURL Phone keyboard
+ InputSubtypeURL TextInputSubtype = "url"
+)
+
+// TextInputElement subtype of DialogInput
+// https://api.slack.com/dialogs#option_element_attributes#text_element_attributes
+type TextInputElement struct {
+ DialogInput
+ MaxLength int `json:"max_length,omitempty"`
+ MinLength int `json:"min_length,omitempty"`
+ Hint string `json:"hint,omitempty"`
+ Subtype TextInputSubtype `json:"subtype"`
+ Value string `json:"value"`
+}
+
+// NewTextInput constructor for a `text` input
+func NewTextInput(name, label, text string, options ...TextInputOption) *TextInputElement {
+ t := &TextInputElement{
+ DialogInput: DialogInput{
+ Type: InputTypeText,
+ Name: name,
+ Label: label,
+ },
+ Value: text,
+ }
+
+ for _, opt := range options {
+ opt(t)
+ }
+
+ return t
+}
+
+// NewTextAreaInput constructor for a `textarea` input
+func NewTextAreaInput(name, label, text string) *TextInputElement {
+ return &TextInputElement{
+ DialogInput: DialogInput{
+ Type: InputTypeTextArea,
+ Name: name,
+ Label: label,
+ },
+ Value: text,
+ }
+}