Update vendor (#1414)

This commit is contained in:
Wim
2021-03-20 22:40:23 +01:00
committed by GitHub
parent 3a8857c8c9
commit ee5d9b43b5
187 changed files with 6746 additions and 1611 deletions

View File

@@ -2,6 +2,7 @@ package slack
import (
"encoding/json"
"errors"
)
// Block Objects are also known as Composition Objects
@@ -135,6 +136,20 @@ func (s TextBlockObject) MixedElementType() MixedElementType {
return MixedElementText
}
// Validate checks if TextBlockObject has valid values
func (s TextBlockObject) Validate() error {
if s.Type != "plain_text" && s.Type != "mrkdwn" {
return errors.New("type must be either of plain_text or mrkdwn")
}
// https://github.com/slack-go/slack/issues/881
if s.Type == "mrkdwn" && s.Emoji {
return errors.New("emoji cannot be true in mrkdown")
}
return nil
}
// NewTextBlockObject returns an instance of a new Text Block Object
func NewTextBlockObject(elementType, text string, emoji, verbatim bool) *TextBlockObject {
return &TextBlockObject{