summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nlopes/slack')
-rw-r--r--vendor/github.com/nlopes/slack/block_conv.go4
-rw-r--r--vendor/github.com/nlopes/slack/block_element.go14
-rw-r--r--vendor/github.com/nlopes/slack/block_unknown.go14
-rw-r--r--vendor/github.com/nlopes/slack/go.mod2
4 files changed, 31 insertions, 3 deletions
diff --git a/vendor/github.com/nlopes/slack/block_conv.go b/vendor/github.com/nlopes/slack/block_conv.go
index 619867ea..b9e61a95 100644
--- a/vendor/github.com/nlopes/slack/block_conv.go
+++ b/vendor/github.com/nlopes/slack/block_conv.go
@@ -61,7 +61,7 @@ func (b *Blocks) UnmarshalJSON(data []byte) error {
case "section":
block = &SectionBlock{}
default:
- return errors.New("unsupported block type")
+ block = &UnknownBlock{}
}
err = json.Unmarshal(r, block)
@@ -127,7 +127,7 @@ func (b *BlockElements) UnmarshalJSON(data []byte) error {
case "static_select", "external_select", "users_select", "conversations_select", "channels_select":
blockElement = &SelectBlockElement{}
default:
- return errors.New("unsupported block element type")
+ blockElement = &UnknownBlockElement{}
}
err = json.Unmarshal(r, blockElement)
diff --git a/vendor/github.com/nlopes/slack/block_element.go b/vendor/github.com/nlopes/slack/block_element.go
index c62ba99c..5b1b4b01 100644
--- a/vendor/github.com/nlopes/slack/block_element.go
+++ b/vendor/github.com/nlopes/slack/block_element.go
@@ -62,6 +62,20 @@ type BlockElements struct {
ElementSet []BlockElement `json:"elements,omitempty"`
}
+// UnknownBlockElement any block element that this library does not directly support.
+// See the "Rich Elements" section at the following URL:
+// https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less
+// New block element types may be introduced by Slack at any time; this is a catch-all for any such block elements.
+type UnknownBlockElement struct {
+ Type MessageElementType `json:"type"`
+ Elements BlockElements
+}
+
+// ElementType returns the type of the Element
+func (s UnknownBlockElement) ElementType() MessageElementType {
+ return s.Type
+}
+
// ImageBlockElement An element to insert an image - this element can be used
// in section and context blocks only. If you want a block with only an image
// in it, you're looking for the image block.
diff --git a/vendor/github.com/nlopes/slack/block_unknown.go b/vendor/github.com/nlopes/slack/block_unknown.go
new file mode 100644
index 00000000..b5ce1e47
--- /dev/null
+++ b/vendor/github.com/nlopes/slack/block_unknown.go
@@ -0,0 +1,14 @@
+package slack
+
+// UnknownBlock represents a block type that is not yet known. This block type exists to prevent Slack from introducing
+// new and unknown block types that break this library.
+type UnknownBlock struct {
+ Type MessageBlockType `json:"type"`
+ BlockID string `json:"block_id,omitempty"`
+ Elements BlockElements `json:"elements"`
+}
+
+// BlockType returns the type of the block
+func (b UnknownBlock) BlockType() MessageBlockType {
+ return b.Type
+}
diff --git a/vendor/github.com/nlopes/slack/go.mod b/vendor/github.com/nlopes/slack/go.mod
index 87256eb1..a97bf381 100644
--- a/vendor/github.com/nlopes/slack/go.mod
+++ b/vendor/github.com/nlopes/slack/go.mod
@@ -1,4 +1,4 @@
-module github.com/nlopes/slack
+module github.com/matterbridge/slack
require (
github.com/davecgh/go-spew v1.1.1 // indirect