Skip to content

Commit

Permalink
Add api.BasicCardWithButtonsInSeparateMsg type
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Apr 25, 2024
1 parent d4a164f commit 460dcd0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/api/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ type MessageType string
const (
// DefaultMessage defines a message that should be displayed in default mode supported by communicator.
DefaultMessage MessageType = ""
// BasicCardWithButtonsInSeparateMessage defines a message that should be displayed in plaintext mode supported by the communicator,
// with the buttons sent in a separate interactive message.
//
// It's an ALPHA feature currently available only for the Teams platform. It might be renamed or removed in the future.
BasicCardWithButtonsInSeparateMsg = "basicCardWithButtonsInSeparateMessage"
// BaseBodyWithFilterMessage defines a message that should be displayed in plaintext mode supported by communicator.
// In this form the built-in filter is supported.
// NOTE: only BaseBody is preserved. All other properties are ignored even if set.
Expand Down Expand Up @@ -66,8 +71,7 @@ type Message struct {
}

func (msg *Message) IsEmpty() bool {
var emptyBase Body
if msg.BaseBody != emptyBase {
if msg.HasBaseBody() {
return false
}
if msg.HasInputs() {
Expand All @@ -83,6 +87,12 @@ func (msg *Message) IsEmpty() bool {
return true
}

// HasBaseBody returns true if message has base body defined.
func (msg *Message) HasBaseBody() bool {
var emptyBase Body
return msg.BaseBody != emptyBase
}

// HasSections returns true if message has interactive sections.
func (msg *Message) HasSections() bool {
return len(msg.Sections) != 0
Expand Down

0 comments on commit 460dcd0

Please sign in to comment.