summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/block_conv.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-03-28 23:50:47 +0100
committerGitHub <noreply@github.com>2020-03-28 23:50:47 +0100
commit092ca1cd678c44fa078bba11d4d219e61498342a (patch)
tree33be668a72610bfa9825817eb84017fdad8b362a /vendor/github.com/slack-go/slack/block_conv.go
parent0df253964123537b91e5a7364c83cc52f0e88df4 (diff)
downloadmatterbridge-msglm-092ca1cd678c44fa078bba11d4d219e61498342a.tar.gz
matterbridge-msglm-092ca1cd678c44fa078bba11d4d219e61498342a.tar.bz2
matterbridge-msglm-092ca1cd678c44fa078bba11d4d219e61498342a.zip
Update vendor slack-go/slack (#1068)
Diffstat (limited to 'vendor/github.com/slack-go/slack/block_conv.go')
-rw-r--r--vendor/github.com/slack-go/slack/block_conv.go45
1 files changed, 37 insertions, 8 deletions
diff --git a/vendor/github.com/slack-go/slack/block_conv.go b/vendor/github.com/slack-go/slack/block_conv.go
index ce48ce19..43c0c96b 100644
--- a/vendor/github.com/slack-go/slack/block_conv.go
+++ b/vendor/github.com/slack-go/slack/block_conv.go
@@ -56,20 +56,16 @@ func (b *Blocks) UnmarshalJSON(data []byte) error {
block = &ContextBlock{}
case "divider":
block = &DividerBlock{}
+ case "file":
+ block = &FileBlock{}
case "image":
block = &ImageBlock{}
case "input":
block = &InputBlock{}
case "section":
block = &SectionBlock{}
- case "rich_text":
- // for now ignore the (complex) content of rich_text blocks until we can fully support it
- continue
- case "file":
- // for now ignore the file blocks until we can fully support it
- continue
default:
- return errors.New("unsupported block type")
+ block = &UnknownBlock{}
}
err = json.Unmarshal(r, block)
@@ -253,12 +249,36 @@ func (a *Accessory) UnmarshalJSON(data []byte) error {
return err
}
a.DatePickerElement = element.(*DatePickerBlockElement)
- case "static_select":
+ case "plain_text_input":
+ element, err := unmarshalBlockElement(r, &PlainTextInputBlockElement{})
+ if err != nil {
+ return err
+ }
+ a.PlainTextInputElement = element.(*PlainTextInputBlockElement)
+ case "radio_buttons":
+ element, err := unmarshalBlockElement(r, &RadioButtonsBlockElement{})
+ if err != nil {
+ return err
+ }
+ a.RadioButtonsElement = element.(*RadioButtonsBlockElement)
+ case "static_select", "external_select", "users_select", "conversations_select", "channels_select":
element, err := unmarshalBlockElement(r, &SelectBlockElement{})
if err != nil {
return err
}
a.SelectElement = element.(*SelectBlockElement)
+ case "multi_static_select", "multi_external_select", "multi_users_select", "multi_conversations_select", "multi_channels_select":
+ element, err := unmarshalBlockElement(r, &MultiSelectBlockElement{})
+ if err != nil {
+ return err
+ }
+ a.MultiSelectElement = element.(*MultiSelectBlockElement)
+ default:
+ element, err := unmarshalBlockElement(r, &UnknownBlockElement{})
+ if err != nil {
+ return err
+ }
+ a.UnknownElement = element.(*UnknownBlockElement)
}
return nil
@@ -285,9 +305,18 @@ func toBlockElement(element *Accessory) BlockElement {
if element.DatePickerElement != nil {
return element.DatePickerElement
}
+ if element.PlainTextInputElement != nil {
+ return element.PlainTextInputElement
+ }
+ if element.RadioButtonsElement != nil {
+ return element.RadioButtonsElement
+ }
if element.SelectElement != nil {
return element.SelectElement
}
+ if element.MultiSelectElement != nil {
+ return element.MultiSelectElement
+ }
return nil
}