notificationchannelservice

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMailChannelLimitReached = errors.New("mail channel limit reached")
	ErrListMailChannels        = errors.New("failed to list mail channels")
	ErrGetMailChannel          = errors.New("unable to get notification channel id and type")
)
View Source
var (
	ErrCreateMailClient      = errors.New("failed to create mail client")
	ErrMailServerUnreachable = errors.New("mail server is unreachable")
	ErrCreatingMailMessage   = errors.New("failed to create mail message")
	ErrSendingEmail          = errors.New("failed to send mail")
)
View Source
var (
	ErrMattermostChannelLimitReached = errors.New("Mattermost channel limit reached.")
	ErrListMattermostChannels        = errors.New("failed to list mattermost channels")
	ErrMattermostChannelNameExists   = errors.New("Mattermost channel name already exists.")
	ErrMattermostMassageDelivery     = errors.New("mattermost message could not be send")
)
View Source
var (
	ErrTeamsChannelLimitReached = errors.New("Teams channel limit reached.")
	ErrListTeamsChannels        = errors.New("failed to list teams channels")
	ErrTeamsChannelNameExists   = errors.New("Teams channel name already exists.")
	ErrTeamsMessageDelivery     = errors.New("teams message could not be send")
)

Functions

This section is empty.

Types

type MailChannelService

type MailChannelService interface {
	CreateMailChannel(
		c context.Context,
		channel maildto.MailNotificationChannelRequest,
	) (maildto.MailNotificationChannelResponse, error)
	CheckNotificationChannelConnectivity(
		ctx context.Context,
		mailServer models.NotificationChannel,
	) error
	CheckNotificationChannelEntityConnectivity(
		ctx context.Context,
		id string,
		mailServer models.NotificationChannel,
	) error
}

func NewMailChannelService

func NewMailChannelService(
	notificationChannelService NotificationChannelService,
	mailService MailService,
	emailLimit int,
) MailChannelService

type MailService

type MailService interface {
	// SendMail sends an HTML email
	SendMail(
		ctx context.Context,
		mailServer models.NotificationChannel,
		receiver string,
		subject string,
		body string,
	) error

	// ConnectionCheck checks connection for host, port and TLS settings
	ConnectionCheck(ctx context.Context, mailServer models.NotificationChannel) error
}

func NewMailService

func NewMailService() MailService

type MattermostChannelService

type MattermostChannelService interface {
	SendMattermostTestMessage(webhookUrl string) error
	CreateMattermostChannel(
		ctx context.Context,
		channel mattermostdto.MattermostNotificationChannelRequest,
	) (mattermostdto.MattermostNotificationChannelResponse, error)
	UpdateMattermostChannel(
		ctx context.Context,
		id string,
		channel mattermostdto.MattermostNotificationChannelRequest,
	) (mattermostdto.MattermostNotificationChannelResponse, error)
}

func NewMattermostChannelService

func NewMattermostChannelService(
	notificationChannelService NotificationChannelService,
	mattermostChannelLimit int,
	mattermostService *MattermostService,
) MattermostChannelService

type MattermostService added in v0.14.0

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

func NewMattermostService added in v0.14.0

func NewMattermostService(transport *http.Client) *MattermostService

func (*MattermostService) SendMessage added in v0.14.0

func (m *MattermostService) SendMessage(webhookUrl string, message string) error

SendMessage sends a message to the given Mattermost webhook URL. The message has to be in Markdown format. For details see: https://docs.mattermost.com/end-user-guide/collaborate/format-messages.html#use-markdown

type NotificationChannelService

type NotificationChannelService interface {
	CreateNotificationChannel(
		ctx context.Context,
		channelIn models.NotificationChannel,
	) (models.NotificationChannel, error)
	GetNotificationChannelByIdAndType(
		ctx context.Context,
		id string,
		channelType models.ChannelType,
	) (models.NotificationChannel, error)
	UpdateNotificationChannel(
		ctx context.Context,
		id string,
		channelIn models.NotificationChannel,
	) (models.NotificationChannel, error)
	DeleteNotificationChannel(ctx context.Context, id string) error
	ListNotificationChannelsByType(
		ctx context.Context,
		channelType models.ChannelType,
	) ([]models.NotificationChannel, error)
}

type TeamsChannelService

type TeamsChannelService interface {
	SendTeamsTestMessage(webhookUrl string) error
	CreateTeamsChannel(
		ctx context.Context,
		channel teamsdto.TeamsNotificationChannelRequest,
	) (teamsdto.TeamsNotificationChannelResponse, error)
	UpdateTeamsChannel(
		ctx context.Context,
		id string,
		channel teamsdto.TeamsNotificationChannelRequest,
	) (teamsdto.TeamsNotificationChannelResponse, error)
}

func NewTeamsChannelService

func NewTeamsChannelService(
	notificationChannelService NotificationChannelService,
	teamsChannelLimit int,
	teamsService *TeamsService,
) TeamsChannelService

type TeamsService added in v0.14.0

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

func NewTeamsService added in v0.14.0

func NewTeamsService(transport *http.Client) *TeamsService

func (*TeamsService) SendMessage added in v0.14.0

func (s *TeamsService) SendMessage(webhookUrl string, message string) error

SendMessage sends a message to the given MS Teams webhook URL. The message has to be in markdown format. For details see: https://learn.microsoft.com/en-us/adaptive-cards/authoring-cards/text-features#markdown-commonmark-subset

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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