notifiers

package
v0.12.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 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 ConfigMultiClient

type ConfigMultiClient struct {
	Notifiers map[string]Config `mapstructure:"configs"`
	// custom messages
	Messages domain.NotificationMessages
}

type MultiConfig

type MultiConfig map[string]interface{}

LarkConfig is a map of workspace name to config

func (MultiConfig) Decode

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

type NOTIFIERSS

type NOTIFIERSS struct {
	Notifier1 Config `mapstructure:"lark"`
	Notifier2 Config `mapstructure:"slack"`
}

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