Documentation
¶
Index ¶
- Variables
- func RegisterDriver(driver string, factory DriverFactory)
- type AttemptResult
- type DriverFactory
- type Message
- type Middleware
- type Param
- type Payload
- type Provider
- type ProviderConfig
- type ProviderMessage
- type ProviderRequest
- type ProviderResult
- type Request
- type SendResult
- type Sender
- type SenderFunc
- type TemplateMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDriverRequired = errors.New("sms: driver is required") ErrUnknownDriver = errors.New("sms: unknown driver") )
Functions ¶
func RegisterDriver ¶
func RegisterDriver(driver string, factory DriverFactory)
Types ¶
type AttemptResult ¶
type AttemptResult struct {
Provider string
Success bool
Result *ProviderResult
Error error
}
type DriverFactory ¶
type DriverFactory func(name string, cfg ProviderConfig) (Provider, error)
type Message ¶
type Message interface {
Resolve(ctx context.Context, provider ProviderConfig) (Payload, error)
}
type Middleware ¶
type Provider ¶
type Provider interface {
Send(ctx context.Context, req ProviderRequest) (*ProviderResult, error)
Close() error
}
func NewProvider ¶
func NewProvider(name string, cfg ProviderConfig) (Provider, error)
type ProviderConfig ¶
type ProviderConfig struct {
Driver string `mapstructure:"driver" yaml:"driver"`
Account string `mapstructure:"account" yaml:"account"`
Password string `mapstructure:"password" yaml:"password"`
AppKey string `mapstructure:"app_key" yaml:"app_key"`
AppSecret string `mapstructure:"app_secret" yaml:"app_secret"`
AccessKeyID string `mapstructure:"access_key_id" yaml:"access_key_id"`
AccessKeySecret string `mapstructure:"access_key_secret" yaml:"access_key_secret"`
RegionID string `mapstructure:"region_id" yaml:"region_id"`
SignID string `mapstructure:"sign_id" yaml:"sign_id"`
SignName string `mapstructure:"sign_name" yaml:"sign_name"`
Sender string `mapstructure:"sender" yaml:"sender"`
MessagingServiceSID string `mapstructure:"messaging_service_sid" yaml:"messaging_service_sid"`
SmsSdkAppID string `mapstructure:"sms_sdk_app_id" yaml:"sms_sdk_app_id"`
Endpoint string `mapstructure:"endpoint" yaml:"endpoint"`
Timeout time.Duration `mapstructure:"timeout" yaml:"timeout"`
Name string `mapstructure:"-" yaml:"-"`
}
func (ProviderConfig) AccessKey ¶
func (c ProviderConfig) AccessKey() string
func (ProviderConfig) Clone ¶
func (c ProviderConfig) Clone() ProviderConfig
func (ProviderConfig) Region ¶
func (c ProviderConfig) Region() string
func (ProviderConfig) SecretKey ¶
func (c ProviderConfig) SecretKey() string
type ProviderMessage ¶
type ProviderRequest ¶
type ProviderRequest struct {
To []string
Message Message
Payload Payload
Provider ProviderConfig
}
type ProviderResult ¶
type SendResult ¶
type SendResult struct {
Provider string
Result *ProviderResult
Error error
Attempts []AttemptResult
}
type SenderFunc ¶
type SenderFunc func(ctx context.Context, req Request) (*SendResult, error)
func (SenderFunc) Send ¶
func (fn SenderFunc) Send(ctx context.Context, req Request) (*SendResult, error)
type TemplateMessage ¶
func (TemplateMessage) Resolve ¶
func (m TemplateMessage) Resolve(context.Context, ProviderConfig) (Payload, error)
Directories
¶
| Path | Synopsis |
|---|---|
|
driver
|
|
|
aliyun_global
Package aliyunglobal provides the optional Alibaba Cloud international SMS driver.
|
Package aliyunglobal provides the optional Alibaba Cloud international SMS driver. |
Click to show internal directories.
Click to hide internal directories.