Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api.BasicCardWithButtonsInSeparateMsg type #1436

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
mszostok marked this conversation as resolved.
Show resolved Hide resolved
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
Loading