mattermost

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJSONPayload

func CreateJSONPayload(config *Config, message string, params *types.Params) ([]byte, error)

CreateJSONPayload for usage with the mattermost service

Types

type Config

type Config struct {
	standard.EnumlessConfig
	UserName string `url:"user" optional:"" desc:"Override webhook user"`
	Icon     string `` /* 126-byte string literal not displayed */
	Title    string `key:"title" default:"" desc:"Notification title, optionally set by the sender (not used)"`
	Channel  string `url:"path2" optional:"" desc:"Override webhook channel"`
	Host     string `url:"host,port" desc:"Mattermost server host"`
	Token    string `url:"path1" desc:"Webhook token"`
}

Config object holding all information

func CreateConfigFromURL added in v0.6.0

func CreateConfigFromURL(serviceURL *url.URL) (*Config, error)

CreateConfigFromURL to use within the mattermost service

func (*Config) GetURL

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) SetURL

func (config *Config) SetURL(url *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

type ErrorMessage

type ErrorMessage string

ErrorMessage for error events within the mattermost service

const (
	// Scheme is the identifying part of this service's configuration URL
	Scheme = "mattermost"
	// NotEnoughArguments provided in the service URL
	NotEnoughArguments ErrorMessage = "the apiURL does not include enough arguments, either provide 1 or 3 arguments (they may be empty)"
)

type JSON

type JSON struct {
	Text      string `json:"text"`
	UserName  string `json:"username,omitempty"`
	Channel   string `json:"channel,omitempty"`
	IconEmoji string `json:"icon_emoji,omitempty"`
	IconURL   string `json:"icon_url,omitempty"`
}

JSON payload for mattermost notifications

func (*JSON) SetIcon added in v0.6.0

func (j *JSON) SetIcon(icon string)

SetIcon sets the appropriate icon field in the payload based on whether the input is a URL or not

type Service

type Service struct {
	standard.Standard
	// contains filtered or unexported fields
}

Service sends notifications to a pre-configured channel or user

func (*Service) Initialize

func (service *Service) Initialize(configURL *url.URL, logger types.StdLogger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to Mattermost

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL