sms

package
v0.0.0-...-71f1c81 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpDebugEnable bool = false

Functions

This section is empty.

Types

type ErrorMessage

type ErrorMessage struct {
	HttpCode  int     `json"-"`
	Model     *string `json:"Model,omitempty"`
	RequestId *string `json:"RequestId,omitempty"`
	Message   *string `json:"Message,omitempty"`
	Code      *string `json:"Code,omitempty"`
}

短信服务器返回的错误信息

func (*ErrorMessage) Error

func (e *ErrorMessage) Error() string

func (*ErrorMessage) GetCode

func (e *ErrorMessage) GetCode() string

func (*ErrorMessage) GetHttpCode

func (e *ErrorMessage) GetHttpCode() int

func (*ErrorMessage) GetMessage

func (e *ErrorMessage) GetMessage() string

func (*ErrorMessage) GetModel

func (e *ErrorMessage) GetModel() string

func (*ErrorMessage) GetRequestId

func (e *ErrorMessage) GetRequestId() string

func (*ErrorMessage) SetHttpCode

func (e *ErrorMessage) SetHttpCode(code int)

type SMSClient

type SMSClient struct {
	// SMS服务的地址,默认为(https://sms.aliyuncs.com
	EndPoint string
	// 访问SMS服务的accessid,通过官方网站申请或通过管理员获取
	AccessId string
	// 访问SMS服务的accesskey,通过官方网站申请或通过管理员获取
	AccessKey string
	// 连接池中每个连接的Socket超时,单位为秒,可以为int或float。默认值为50
	SocketTimeout int

	// 其他参数
	Param SmsParam
	// contains filtered or unexported fields
}

func New

func New(accessid, accesskey string) (c *SMSClient)

创建一个短信发送客户端

func (*SMSClient) SendMulti

func (c *SMSClient) SendMulti(PhoneNumbers []string, signname, templatecode, TemplateParam string) (e *ErrorMessage, err error)

发送给多个手机号, 最多100个

func (*SMSClient) SendOne

func (c *SMSClient) SendOne(PhoneNumbers, signname, templatecode, TemplateParam string) (e *ErrorMessage, err error)

发送给一个手机号

func (*SMSClient) SetAccessId

func (c *SMSClient) SetAccessId(accessid string)

设置短信服务的accessid,通过官方网站申请或通过管理员获取

func (*SMSClient) SetAccessKey

func (c *SMSClient) SetAccessKey(accesskey string)

设置短信服务的accesskey,通过官方网站申请或通过管理员获取

func (*SMSClient) SetEndPoint

func (c *SMSClient) SetEndPoint(end_point string)

设置短信服务器

func (*SMSClient) SetSocketTimeout

func (c *SMSClient) SetSocketTimeout(sockettimeout int)

设置短信服务的Socket超时,单位为秒,可以为int或float。默认值为50

type SmsParam

type SmsParam struct {
	Action           string
	SignName         string
	TemplateCode     string
	PhoneNumbers     string
	TemplateParam    string
	Format           string
	Version          string
	AccessKeyId      string
	SignatureMethod  string
	Timestamp        string
	SignatureVersion string
	SignatureNonce   string
	RegionId         string
}

func (*SmsParam) GetAccessKeyId

func (this *SmsParam) GetAccessKeyId() string

func (*SmsParam) GetAction

func (this *SmsParam) GetAction() string

func (*SmsParam) GetFormat

func (this *SmsParam) GetFormat() string

func (*SmsParam) GetPhoneNumbers

func (this *SmsParam) GetPhoneNumbers() string

func (*SmsParam) GetRegionId

func (this *SmsParam) GetRegionId() string

func (*SmsParam) GetSignName

func (this *SmsParam) GetSignName() string

func (*SmsParam) GetSignatureMethod

func (this *SmsParam) GetSignatureMethod() string

func (*SmsParam) GetSignatureNonce

func (this *SmsParam) GetSignatureNonce() string

func (*SmsParam) GetSignatureVersion

func (this *SmsParam) GetSignatureVersion() string

func (*SmsParam) GetTemplateCode

func (this *SmsParam) GetTemplateCode() string

func (*SmsParam) GetTemplateParam

func (this *SmsParam) GetTemplateParam() string

func (*SmsParam) GetTimestamp

func (this *SmsParam) GetTimestamp() string

func (*SmsParam) GetVersion

func (this *SmsParam) GetVersion() string

func (*SmsParam) SetAccessKeyId

func (this *SmsParam) SetAccessKeyId(accesskeyid string)

func (*SmsParam) SetAction

func (this *SmsParam) SetAction(action string)

func (*SmsParam) SetFormat

func (this *SmsParam) SetFormat(format string)

func (*SmsParam) SetPhoneNumbers

func (this *SmsParam) SetPhoneNumbers(PhoneNumbers string)

func (*SmsParam) SetRegionId

func (this *SmsParam) SetRegionId(regionid string)

func (*SmsParam) SetSignName

func (this *SmsParam) SetSignName(signname string)

func (*SmsParam) SetSignatureMethod

func (this *SmsParam) SetSignatureMethod(signaturemethod string)

func (*SmsParam) SetSignatureNonce

func (this *SmsParam) SetSignatureNonce(signaturenonce string)

func (*SmsParam) SetSignatureVersion

func (this *SmsParam) SetSignatureVersion(signatureversion string)

func (*SmsParam) SetTemplateCode

func (this *SmsParam) SetTemplateCode(templatecode string)

func (*SmsParam) SetTemplateParam

func (this *SmsParam) SetTemplateParam(TemplateParam string)

func (*SmsParam) SetTimestamp

func (this *SmsParam) SetTimestamp(timestamp string)

func (*SmsParam) SetVersion

func (this *SmsParam) SetVersion(version string)

Jump to

Keyboard shortcuts

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