mattermost

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package mattermost implents a Mattermost client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	WebhookURL string
	User       string
	Channel    string
}

Client provides functions for interacting with the Mattermost API (to send messages).

func New

func New(url string) *Client

New creates a new Mattermost client.

func (*Client) Send

func (c *Client) Send(ctx context.Context, msg Message) error

Send a message.

type Message

type Message struct {
	Text        string         `json:"text,omitempty"`
	Username    string         `json:"username,omitempty"`
	IconURL     string         `json:"icon_url,omitempty"`
	IconEmoji   string         `json:"icon_emoji,omitempty"`
	Channel     string         `json:"channel,omitempty"`
	Props       map[string]any `json:"props,omitempty"`
	Attachments []any          `json:"attachments,omitempty"`
}

Message is the request body for a Mattermost message.

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier sends notifications to a Mattermost webhook.

func NewNotifier

func NewNotifier(
	cfg cfgmodel.NotificationTargetConfig,
	logger *slog.Logger,
	client *Client,
) *Notifier

NewNotifier creates a new MattermostNotifier.

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, message string) error

Notify sends a notification to the Mattermost webhook.

Jump to

Keyboard shortcuts

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