notifiers

package
v0.12.6-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderTypeSlack = "slack"
	ProviderTypeLark  = "lark"
)

Variables

This section is empty.

Functions

func NewSlackConfig added in v0.7.6

func NewSlackConfig(config *Config) (*slack.Config, error)

Types

type Client

type Client interface {
	Notify(context.Context, []domain.Notification) []error
}

func NewClient

func NewClient(config *Config, logger log.Logger) (Client, error)

type Config

type Config struct {
	Provider     string `mapstructure:"provider" validate:"omitempty,oneof=slack lark"`
	Name         string `mapstructure:"name"`
	ClientID     string `mapstructure:"client_id,omitempty"`
	ClientSecret string `mapstructure:"client_secret,omitempty"`
	Criteria     string `mapstructure:"criteria"`

	// slack
	AccessToken string      `mapstructure:"access_token" validate:"required_without=SlackConfig"`
	SlackConfig SlackConfig `mapstructure:"slack_config" validate:"required_without=AccessToken,dive"`
	// custom messages
	Messages domain.NotificationMessages
}

type NotifyManager added in v0.12.2

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

func NewMultiClient added in v0.12.2

func NewMultiClient(notifiers *[]Config, logger log.Logger) (*NotifyManager, error)

func (*NotifyManager) Notify added in v0.12.2

func (m *NotifyManager) Notify(ctx context.Context, notification []domain.Notification) []error

type SlackConfig added in v0.7.6

type SlackConfig map[string]interface{}

SlackConfig is a map of workspace name to config

func (SlackConfig) Decode added in v0.7.6

func (c SlackConfig) Decode(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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