summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/block_file.go
blob: ac4453f79e1b2c7bd163c7d6f7c6016360fad980 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package slack

// FileBlock defines data that is used to display a remote file.
//
// More Information: https://api.slack.com/reference/block-kit/blocks#file
type FileBlock struct {
	Type       MessageBlockType `json:"type"`
	BlockID    string           `json:"block_id,omitempty"`
	ExternalID string           `json:"external_id"`
	Source     string           `json:"source"`
}

// BlockType returns the type of the block
func (s FileBlock) BlockType() MessageBlockType {
	return s.Type
}

// NewFileBlock returns a new instance of a file block
func NewFileBlock(blockID string, externalID string, source string) *FileBlock {
	return &FileBlock{
		Type:       MBTFile,
		BlockID:    blockID,
		ExternalID: externalID,
		Source:     source,
	}
}