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/block_element.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/block_element.go')
-rw-r--r-- | vendor/github.com/slack-go/slack/block_element.go | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/vendor/github.com/slack-go/slack/block_element.go b/vendor/github.com/slack-go/slack/block_element.go index 91b6adc4..4157016c 100644 --- a/vendor/github.com/slack-go/slack/block_element.go +++ b/vendor/github.com/slack-go/slack/block_element.go @@ -8,6 +8,7 @@ const ( METButton MessageElementType = "button" METOverflow MessageElementType = "overflow" METDatepicker MessageElementType = "datepicker" + METTimepicker MessageElementType = "timepicker" METPlainTextInput MessageElementType = "plain_text_input" METRadioButtons MessageElementType = "radio_buttons" @@ -44,6 +45,7 @@ type Accessory struct { ButtonElement *ButtonBlockElement OverflowElement *OverflowBlockElement DatePickerElement *DatePickerBlockElement + TimePickerElement *TimePickerBlockElement PlainTextInputElement *PlainTextInputBlockElement RadioButtonsElement *RadioButtonsBlockElement SelectElement *SelectBlockElement @@ -63,6 +65,8 @@ func NewAccessory(element BlockElement) *Accessory { return &Accessory{OverflowElement: element.(*OverflowBlockElement)} case *DatePickerBlockElement: return &Accessory{DatePickerElement: element.(*DatePickerBlockElement)} + case *TimePickerBlockElement: + return &Accessory{TimePickerElement: element.(*TimePickerBlockElement)} case *PlainTextInputBlockElement: return &Accessory{PlainTextInputElement: element.(*PlainTextInputBlockElement)} case *RadioButtonsBlockElement: @@ -127,10 +131,12 @@ func NewImageBlockElement(imageURL, altText string) *ImageBlockElement { } } +// Style is a style of Button element +// https://api.slack.com/reference/block-kit/block-elements#button__fields type Style string const ( - StyleDefault Style = "default" + StyleDefault Style = "" StylePrimary Style = "primary" StyleDanger Style = "danger" ) @@ -155,7 +161,7 @@ func (s ButtonBlockElement) ElementType() MessageElementType { return s.Type } -// WithStyling adds styling to the button object and returns the modified ButtonBlockElement +// WithStyle adds styling to the button object and returns the modified ButtonBlockElement func (s *ButtonBlockElement) WithStyle(style Style) *ButtonBlockElement { s.Style = style return s @@ -350,6 +356,32 @@ func NewDatePickerBlockElement(actionID string) *DatePickerBlockElement { } } +// TimePickerBlockElement defines an element which lets users easily select a +// time from nice UI. Time picker elements can be used inside of +// section and actions blocks. +// +// More Information: https://api.slack.com/reference/messaging/block-elements#timepicker +type TimePickerBlockElement struct { + Type MessageElementType `json:"type"` + ActionID string `json:"action_id,omitempty"` + Placeholder *TextBlockObject `json:"placeholder,omitempty"` + InitialTime string `json:"initial_time,omitempty"` + Confirm *ConfirmationBlockObject `json:"confirm,omitempty"` +} + +// ElementType returns the type of the Element +func (s TimePickerBlockElement) ElementType() MessageElementType { + return s.Type +} + +// NewTimePickerBlockElement returns an instance of a date picker element +func NewTimePickerBlockElement(actionID string) *TimePickerBlockElement { + return &TimePickerBlockElement{ + Type: METTimepicker, + ActionID: actionID, + } +} + // PlainTextInputBlockElement creates a field where a user can enter freeform // data. // Plain-text input elements are currently only available in modals. |