| 1 | package slack |
| 2 | |
| 3 | // ActionBlock defines data that is used to hold interactive elements. |
| 4 | // |
| 5 | // More Information: https://api.slack.com/reference/messaging/blocks#actions |
| 6 | type ActionBlock struct { |
| 7 | Type MessageBlockType `json:"type"` |
| 8 | BlockID string `json:"block_id,omitempty"` |
| 9 | Elements *BlockElements `json:"elements"` |
| 10 | } |
| 11 | |
| 12 | // BlockType returns the type of the block |
| 13 | func (s ActionBlock) BlockType() MessageBlockType { |
| 14 | return s.Type |
| 15 | } |
| 16 | |
| 17 | // NewActionBlock returns a new instance of an Action Block |
| 18 | func NewActionBlock(blockID string, elements ...BlockElement) *ActionBlock { |
| 19 | return &ActionBlock{ |
| 20 | Type: MBTAction, |
| 21 | BlockID: blockID, |
| 22 | Elements: &BlockElements{ |
| 23 | ElementSet: elements, |
| 24 | }, |
| 25 | } |
| 26 | } |