Documentation
¶
Index ¶
- func MdHeaderFormatter(msg string) string
- func MessageToPlaintext(msg Message, newlineFormatter func(in string) string) string
- func NewlineFormatter(msg string) string
- func NoFormatting(msg string) string
- func RenderMessage(mdFormatter MDFormatter, msg Message) string
- type Base
- type Body
- type Button
- type ButtonStyle
- type Buttons
- type MDFormatter
- type Message
- type MessageType
- type MultiSelect
- type OptionItem
- type Section
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MdHeaderFormatter ¶
MdHeaderFormatter adds Markdown header formatting.
func MessageToPlaintext ¶
MessageToPlaintext returns interactive message as a plaintext.
func NewlineFormatter ¶
NewlineFormatter adds new line formatting.
func NoFormatting ¶
NoFormatting does not apply any formatting.
func RenderMessage ¶
func RenderMessage(mdFormatter MDFormatter, msg Message) string
RenderMessage returns interactive message as a plaintext with Markdown syntax.
Types ¶
type Button ¶
type Button struct {
Description string
Name string
Command string
URL string
Style ButtonStyle
}
Button holds definition of action button.
type ButtonStyle ¶
type ButtonStyle string
ButtonStyle is a style of Button element.
const ( ButtonStyleDefault ButtonStyle = "" ButtonStylePrimary ButtonStyle = "primary" ButtonStyleDanger ButtonStyle = "danger" )
Represents a general button styles.
type Buttons ¶
type Buttons []Button
Buttons holds definition of interactive buttons.
func (*Buttons) AtLeastOneButtonHasDescription ¶
AtLeastOneButtonHasDescription returns true if there is at least one button with description associated with it.
type MDFormatter ¶
type MDFormatter struct {
// contains filtered or unexported fields
}
MDFormatter represents the capability of Markdown Formatter
func DefaultMDFormatter ¶
func DefaultMDFormatter() MDFormatter
DefaultMDFormatter is for initializing built-in Markdown formatter
func NewMDFormatter ¶
func NewMDFormatter(newlineFormatter, headerFormatter func(msg string) string) MDFormatter
NewMDFormatter is for initializing custom Markdown formatter
type Message ¶
type Message struct {
Type MessageType
Base
Sections []Section
OnlyVisibleForYou bool
}
Message represents a generic message with interactive buttons.
func Help ¶
func Help(platform config.CommPlatformIntegration, clusterName, botName string) Message
Help represent a help message with interactive sections.
func (*Message) HasSections ¶
HasSections returns true if message has interactive sections.
type MessageType ¶
type MessageType string
MessageType defines the message type.
const ( // Default defines a message that should be displayed in default mode supported by communicator. Default MessageType = "" // Popup defines a message that should be displayed to the user as popup (if possible). Popup MessageType = "form" )
type MultiSelect ¶
type MultiSelect struct {
Name string
Description Body
Command string
// Options holds all available options
Options []OptionItem
// InitialOptions hold already pre-selected options. MUST be a sub-set of Options.
InitialOptions []OptionItem
}
MultiSelect holds multi select related fields.
func (*MultiSelect) AreOptionsDefined ¶
func (m *MultiSelect) AreOptionsDefined() bool
AreOptionsDefined returns true if some options are available.
type OptionItem ¶
OptionItem defines an option model.
type Section ¶
type Section struct {
Base
Buttons Buttons
MultiSelect MultiSelect
}
Section holds section related fields.