Backend (backend/go.mod): - github.com/go-pkgz/auth/v2 v2.1.2 → v2.1.4 - github.com/klauspost/compress v1.18.5 → v1.18.6 - github.com/redis/go-redis/v9 v9.18.0 → v9.19.0 - github.com/slack-go/slack v0.21.1 → v0.23.1 - golang.org/x/crypto v0.50.0 → v0.51.0 - golang.org/x/image v0.39.0 → v0.40.0 - golang.org/x/net v0.53.0 → v0.54.0 - golang.org/x/sys v0.43.0 → v0.44.0 - golang.org/x/text v0.36.0 → v0.37.0 Example (backend/_example/memory_store/go.mod): - golang.org/x/crypto v0.50.0 → v0.51.0 - golang.org/x/image v0.39.0 → v0.40.0 - golang.org/x/net v0.53.0 → v0.54.0 - golang.org/x/sys v0.43.0 → v0.44.0 Transitive cleanup: github.com/dgryski/go-rendezvous is no longer required after redis/go-redis bump and gets pruned by `go mod tidy`. `go mod tidy` + `go mod vendor` run on both modules. Both build with -race and full test suites pass.
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package slack
|
|
|
|
// CarouselBlock defines a block of type carousel that displays a scrollable
|
|
// list of cards. A carousel must contain between 1 and 10 cards.
|
|
//
|
|
// More Information: https://docs.slack.dev/reference/block-kit/blocks/carousel-block/
|
|
type CarouselBlock struct {
|
|
Type MessageBlockType `json:"type"`
|
|
BlockID string `json:"block_id,omitempty"`
|
|
Elements []*CardBlock `json:"elements"`
|
|
}
|
|
|
|
// BlockType returns the type of the block
|
|
func (s CarouselBlock) BlockType() MessageBlockType {
|
|
return s.Type
|
|
}
|
|
|
|
// ID returns the ID of the block
|
|
func (s CarouselBlock) ID() string {
|
|
return s.BlockID
|
|
}
|
|
|
|
// NewCarouselBlock returns a new instance of a carousel block containing the
|
|
// given cards.
|
|
func NewCarouselBlock(cards ...*CardBlock) *CarouselBlock {
|
|
return &CarouselBlock{
|
|
Type: MBTCarousel,
|
|
Elements: cards,
|
|
}
|
|
}
|
|
|
|
// WithBlockID sets the block ID for the CarouselBlock
|
|
func (s *CarouselBlock) WithBlockID(blockID string) *CarouselBlock {
|
|
s.BlockID = blockID
|
|
return s
|
|
}
|
|
|
|
// AddCard appends a card to the carousel
|
|
func (s *CarouselBlock) AddCard(card *CardBlock) *CarouselBlock {
|
|
s.Elements = append(s.Elements, card)
|
|
return s
|
|
}
|