Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyURL = errors.New("URL must not empty") ErrEmptyChannel = errors.New("Channel must not empty") )
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { // Required text summary of the attachment that is shown by clients that understand attachments // but choose not to show them. Fallback string `json:"fallback"` // Optional text that should appear within the attachment. Text string `json:"text"` // Optional text that should appear above the formatted data. Pretext string `json:"pretext"` // Can either be one of 'good', 'warning', 'danger', or any hex color code. Color string `json:"color"` Fields []*Field `json:"fields"` }
Attachment contains message formatting info.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client keeps config and underlying http client. store config value not pointer for immutability.
func (*Client) SendPayload ¶
type Config ¶
type Config struct { // WebhookURL URL string // Channel to which post messages Channel string // Username by whom message is posted Username string // Emoji representing user IconEmoji string // Timeout used by http.Client Timeout time.Duration // flag whether dump response Dump bool }
func (*Config) SetDefualts ¶
func (cfg *Config) SetDefualts()
type Field ¶
type Field struct { // Required Field Title. Title string `json:"title"` // Text value of the field. Value string `json:"value"` // Optional flag indicating whether the `value` is short enough to be displayed // side-by-side with other values. Short bool `json:"short"` }
Field which is used in Attachment is displayed in message table.
type Payload ¶
type Payload struct { Text string `json:"text"` Channel string `json:"channel"` Username string `json:"username,omitempty"` IconEmoji string `json:"icon_emoji,omitempty"` Attachments []*Attachment `json:"attachments,omitempty"` }
Payload represent POST request body. it is intended to encode json.
Click to show internal directories.
Click to hide internal directories.