| 1 | package slack |
| 2 | |
| 3 | // FileBlock defines data that is used to display a remote file. |
| 4 | // |
| 5 | // More Information: https://api.slack.com/reference/block-kit/blocks#file |
| 6 | type FileBlock struct { |
| 7 | Type MessageBlockType `json:"type"` |
| 8 | BlockID string `json:"block_id,omitempty"` |
| 9 | ExternalID string `json:"external_id"` |
| 10 | Source string `json:"source"` |
| 11 | } |
| 12 | |
| 13 | // BlockType returns the type of the block |
| 14 | func (s FileBlock) BlockType() MessageBlockType { |
| 15 | return s.Type |
| 16 | } |
| 17 | |
| 18 | // NewFileBlock returns a new instance of a file block |
| 19 | func NewFileBlock(blockID string, externalID string, source string) *FileBlock { |
| 20 | return &FileBlock{ |
| 21 | Type: MBTFile, |
| 22 | BlockID: blockID, |
| 23 | ExternalID: externalID, |
| 24 | Source: source, |
| 25 | } |
| 26 | } |