Skip to content

Commit

Permalink
Add api.BasicCardWithButtonsInSeparateMsg type (#1436)
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok authored Apr 26, 2024
1 parent d4a164f commit c3c1bbe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/api/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ 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.
// This feature is currently available only for the Teams platform.
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 +70,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 +86,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 c3c1bbe

Please sign in to comment.