notification

package
v0.0.0-...-7ae1feb Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package notification provides build completion notification capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildNotification

type BuildNotification struct {
	JobID       string    `json:"job_id"`
	PackageName string    `json:"package_name"`
	Version     string    `json:"version"`
	Status      string    `json:"status"` // success, failed
	StartTime   time.Time `json:"start_time"`
	EndTime     time.Time `json:"end_time"`
	Duration    string    `json:"duration"`
	BuildLog    string    `json:"build_log,omitempty"`
	Error       string    `json:"error,omitempty"`
	ArtifactURL string    `json:"artifact_url,omitempty"`
}

BuildNotification represents a build completion notification.

type Config

type Config struct {
	Email    *EmailConfig    `json:"email,omitempty"`
	Webhook  *WebhookConfig  `json:"webhook,omitempty"`
	IRC      *IRCConfig      `json:"irc,omitempty"`
	Slack    *SlackConfig    `json:"slack,omitempty"`
	Telegram *TelegramConfig `json:"telegram,omitempty"`
}

Config represents notification configuration.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads notification configuration from a file.

type EmailConfig

type EmailConfig struct {
	Enabled  bool     `json:"enabled"`
	SMTPHost string   `json:"smtp_host"`
	SMTPPort int      `json:"smtp_port"`
	Username string   `json:"username"`
	Password string   `json:"password"`
	From     string   `json:"from"`
	To       []string `json:"to"`
	Subject  string   `json:"subject"`
}

EmailConfig represents email notification configuration.

type IRCConfig

type IRCConfig struct {
	Enabled  bool     `json:"enabled"`
	Server   string   `json:"server"`
	Port     int      `json:"port"`
	Nick     string   `json:"nick"`
	Channels []string `json:"channels"`
	UseTLS   bool     `json:"use_tls"`
}

IRCConfig represents IRC notification configuration.

type Notifier

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

Notifier handles sending notifications.

func NewNotifier

func NewNotifier(config *Config) *Notifier

NewNotifier creates a new notification handler.

func (*Notifier) Notify

func (n *Notifier) Notify(notification *BuildNotification) error

Notify sends notification through all enabled channels.

type SlackConfig

type SlackConfig struct {
	Enabled    bool   `json:"enabled"`
	WebhookURL string `json:"webhook_url"`
	Channel    string `json:"channel,omitempty"`
	Username   string `json:"username,omitempty"`
	IconEmoji  string `json:"icon_emoji,omitempty"`
}

SlackConfig represents Slack notification configuration.

type TelegramConfig

type TelegramConfig struct {
	Enabled  bool   `json:"enabled"`
	BotToken string `json:"bot_token"`
	ChatID   string `json:"chat_id"`
}

TelegramConfig represents Telegram notification configuration.

type WebhookConfig

type WebhookConfig struct {
	Enabled bool              `json:"enabled"`
	URL     string            `json:"url"`
	Method  string            `json:"method"` // POST, PUT
	Headers map[string]string `json:"headers,omitempty"`
	Timeout int               `json:"timeout"` // seconds
}

WebhookConfig represents webhook notification configuration.

Jump to

Keyboard shortcuts

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