mattermost

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 9 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"`
	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 (*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(serviceURL *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"`
}

JSON payload for mattermost notifications

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