Documentation
¶
Index ¶
- Variables
- func Prepare(config map[t.Channel]c.SMSConfig)
- func Register(ch t.Channel, v Vendor)
- type Montnets
- func (m Montnets) GetBalance() (string, error)
- func (m Montnets) MultiXSend(contexts []*mo.SMSContext) ([]*mo.SMSContext, error)
- func (m Montnets) Name() Name
- func (m Montnets) Reply() ([]*mo.Reply, error)
- func (m Montnets) Send(contexts []*mo.SMSContext) ([]*mo.SMSContext, error)
- func (m Montnets) Status() ([]*mo.DeliveryStatus, error)
- type Name
- type Vendor
- type Yunpian
- func (y Yunpian) GetBalance() (string, error)
- func (y Yunpian) MultiXSend(contexts []*m.SMSContext) ([]*m.SMSContext, error)
- func (y Yunpian) Name() Name
- func (y Yunpian) Reply() ([]*m.Reply, error)
- func (y Yunpian) Send(contexts []*m.SMSContext) error
- func (y Yunpian) Status() ([]*m.DeliveryStatus, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotInProduction = errors.New("not in production") ErrSendSMSFailed = errors.New("send sms failed") ErrGetStatusFailed = errors.New("get status failed") ErrGetReplyFailed = errors.New("get reply failed") ErrQueryBalanceFailed = errors.New("query balance failed") ErrVendorNotFound = errors.New("vendor not found") )
View Source
var (
NameMontnets = Name("montnets")
)
View Source
var (
NameYunpian = Name("yunpian")
)
Functions ¶
Types ¶
type Montnets ¶
type Montnets struct {
Username string
Password string
SendEndpoint string
MultiXSendPoint string
StatusEndpoint string
BalanceEndpoint string
}
func NewMontnets ¶
func (Montnets) GetBalance ¶
func (Montnets) MultiXSend ¶
func (m Montnets) MultiXSend(contexts []*mo.SMSContext) ([]*mo.SMSContext, error)
func (Montnets) Send ¶
func (m Montnets) Send(contexts []*mo.SMSContext) ([]*mo.SMSContext, error)
Send sms to given phone number with content
type Vendor ¶
type Vendor interface {
Name() Name
Send(contexts []*m.SMSContext) ([]*m.SMSContext, error)
MultiXSend(contexts []*m.SMSContext) ([]*m.SMSContext, error)
Status() ([]*m.DeliveryStatus, error)
Reply() ([]*m.Reply, error)
GetBalance() (string, error)
}
Vendor represents a SMS vendor, it can preforms two behaviors, send sms and check delivery status and pull reply.
func GetByChannel ¶
GetByChannel return a registered SMS vendor for given channel
type Yunpian ¶
type Yunpian struct {
APIKey string
SendEndpoint string
MultiSendEndpoint string
StatusEndpoint string
ReplyEndpoint string
}
func NewYunpian ¶
func (Yunpian) GetBalance ¶
func (Yunpian) MultiXSend ¶
func (y Yunpian) MultiXSend(contexts []*m.SMSContext) ([]*m.SMSContext, error)
Click to show internal directories.
Click to hide internal directories.