sms

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HuaweiMaxPhoneNums = 200
	DefaultUrl         = "https://rtcsms.cn-north-1.myhuaweicloud.com:10743/sms/batchSendSms/v1"
)
View Source
const (
	DefaultSendTimeout = time.Second * 5
	DefaultTemplate    = `{{ template "nm.default.text" . }}`
)

Variables

This section is empty.

Functions

func NewSmsNotifier

func NewSmsNotifier(logger log.Logger, receivers []config.Receiver, notifierCfg *config.Config) notifier.Notifier

func Register

func Register(name string, p ProviderFactory)

Types

type AliyunNotifier

type AliyunNotifier struct {
	SignName        string
	NotifierCfg     *config.Config
	TemplateCode    string
	AccessKeyId     *v2beta2.Credential
	AccessKeySecret *v2beta2.Credential
	PhoneNums       string
}

func (*AliyunNotifier) MakeRequest

func (a *AliyunNotifier) MakeRequest(ctx context.Context, messages string) error

type HuaweiNotifier added in v1.3.0

type HuaweiNotifier struct {
	Signature     string
	NotifierCfg   *config.Config
	TemplateId    string
	AppKey        *v2beta2.Credential
	AppSecret     *v2beta2.Credential
	PhoneNums     string
	Sender        string
	TemplateParas string
	Url           string
}

func (*HuaweiNotifier) MakeRequest added in v1.3.0

func (h *HuaweiNotifier) MakeRequest(ctx context.Context, messages string) error

type HuaweiResponse added in v1.3.0

type HuaweiResponse struct {
	Code        string `json:"code,omitempty"`
	Description string `json:"description,omitempty"`
}

type Notifier

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

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, data template.Data) []error

type Provider

type Provider interface {
	MakeRequest(ctx context.Context, messages string) error
}

func NewAliyunProvider

func NewAliyunProvider(c *config.Config, providers *v2beta2.Providers, phoneNumbers []string) Provider

func NewHuaweiProvider added in v1.3.0

func NewHuaweiProvider(c *config.Config, providers *v2beta2.Providers, phoneNumbers []string) Provider

func NewTencentProvider

func NewTencentProvider(c *config.Config, providers *v2beta2.Providers, phoneNumbers []string) Provider

type ProviderFactory

type ProviderFactory func(c *config.Config, providers *v2beta2.Providers, phoneNumbers []string) Provider

func GetProviderFunc

func GetProviderFunc(name string) (ProviderFactory, error)

type TencentNotifier

type TencentNotifier struct {
	Sign        string
	NotifierCfg *config.Config
	TemplateID  string
	SecretId    *v2beta2.Credential
	SecretKey   *v2beta2.Credential
	PhoneNums   []string
	SmsSdkAppid string
}

func (*TencentNotifier) MakeRequest

func (t *TencentNotifier) MakeRequest(ctx context.Context, messages string) error

Jump to

Keyboard shortcuts

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