summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/block_conv.go
diff options
context:
space:
mode:
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
}