diff options
author | Wim <wim@42.be> | 2020-03-01 20:59:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-01 20:59:19 +0100 |
commit | 250b3bb5795240d5ebdab5416ab99dbc41be734b (patch) | |
tree | 11e44ec2e7e37cd7eb0deaf0a7843fe6bf3c0e40 /vendor/github.com/nlopes/slack/block.go | |
parent | e9edbfc051afc643d91fc04bc7fb3fe70039c213 (diff) | |
download | matterbridge-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/nlopes/slack/block.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/block.go | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/vendor/github.com/nlopes/slack/block.go b/vendor/github.com/nlopes/slack/block.go deleted file mode 100644 index 502b1135..00000000 --- a/vendor/github.com/nlopes/slack/block.go +++ /dev/null @@ -1,72 +0,0 @@ -package slack - -// @NOTE: Blocks are in beta and subject to change. - -// More Information: https://api.slack.com/block-kit - -// MessageBlockType defines a named string type to define each block type -// as a constant for use within the package. -type MessageBlockType string - -const ( - MBTSection MessageBlockType = "section" - MBTDivider MessageBlockType = "divider" - MBTImage MessageBlockType = "image" - MBTAction MessageBlockType = "actions" - MBTContext MessageBlockType = "context" -) - -// Block defines an interface all block types should implement -// to ensure consistency between blocks. -type Block interface { - BlockType() MessageBlockType -} - -// Blocks is a convenience struct defined to allow dynamic unmarshalling of -// the "blocks" value in Slack's JSON response, which varies depending on block type -type Blocks struct { - BlockSet []Block `json:"blocks,omitempty"` -} - -// BlockAction is the action callback sent when a block is interacted with -type BlockAction struct { - ActionID string `json:"action_id"` - BlockID string `json:"block_id"` - Type actionType `json:"type"` - Text TextBlockObject `json:"text"` - Value string `json:"value"` - ActionTs string `json:"action_ts"` - SelectedOption OptionBlockObject `json:"selected_option"` - SelectedOptions []OptionBlockObject `json:"selected_options"` - SelectedUser string `json:"selected_user"` - SelectedChannel string `json:"selected_channel"` - SelectedConversation string `json:"selected_conversation"` - SelectedDate string `json:"selected_date"` - InitialOption OptionBlockObject `json:"initial_option"` - InitialUser string `json:"initial_user"` - InitialChannel string `json:"initial_channel"` - InitialConversation string `json:"initial_conversation"` - InitialDate string `json:"initial_date"` -} - -// actionType returns the type of the action -func (b BlockAction) actionType() actionType { - return b.Type -} - -// NewBlockMessage creates a new Message that contains one or more blocks to be displayed -func NewBlockMessage(blocks ...Block) Message { - return Message{ - Msg: Msg{ - Blocks: Blocks{ - BlockSet: blocks, - }, - }, - } -} - -// AddBlockMessage appends a block to the end of the existing list of blocks -func AddBlockMessage(message Message, newBlk Block) Message { - message.Msg.Blocks.BlockSet = append(message.Msg.Blocks.BlockSet, newBlk) - return message -} |