Documentation ¶
Index ¶
- Constants
- type AliYunSMSClient
- func (c AliYunSMSClient) CreateAliYunSMSClientSender(signName string, template SmsTemplateInterface) (*AliYunSMSClientSender, error)
- func (c AliYunSMSClient) GetClient() *dysmsapi20170525.Client
- func (c AliYunSMSClient) QuerySingleSmsStatus(phoneNumber string, date string, bizId *string) (*query.AliYunSmsStatusQueryResponse, error)
- func (c AliYunSMSClient) QuerySmsStatus(phoneNumber string, date string, page uint, size uint, bizId *string) (*query.AliYunSmsStatusQueryResponse, error)
- type AliYunSMSClientCredential
- type AliYunSMSClientInterface
- type AliYunSMSClientSender
- type AliYunSMSClientSenderInterface
- type AliYunSMSOptionalConfig
- type SmsTemplateInterface
Constants ¶
const (
// AliYunSMSEndPointAddr 固定值. 短信服务统一使用以下公网服务地址作为Endpoint. 参见阿里云文档(https://help.aliyun.com/document_detail/101511.html)
AliYunSMSEndPointAddr = "dysmsapi.aliyuncs.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliYunSMSClient ¶
type AliYunSMSClient struct { AliYunSMSClientInterface // contains filtered or unexported fields }
AliYunSMSClient 阿里云短信服务用户
func (AliYunSMSClient) CreateAliYunSMSClientSender ¶
func (c AliYunSMSClient) CreateAliYunSMSClientSender(signName string, template SmsTemplateInterface) (*AliYunSMSClientSender, error)
CreateAliYunSMSClientSender 基于基础用户对象创建可发送短信的用户对象
func (AliYunSMSClient) GetClient ¶
func (c AliYunSMSClient) GetClient() *dysmsapi20170525.Client
GetClient 获取阿里云短信平台用户对象
func (AliYunSMSClient) QuerySingleSmsStatus ¶
func (c AliYunSMSClient) QuerySingleSmsStatus(phoneNumber string, date string, bizId *string) (*query.AliYunSmsStatusQueryResponse, error)
QuerySingleSmsStatus 查询单条短信的发送状态
phoneNumber: 国内短信:11位手机号码,例如1590000****. 国际/港澳台消息:国际区号+号码,例如8520000**** date: 短信发送日期,支持查询最近30天的记录,格式为yyyyMMdd, 例如20181225 bizId: 发送回执ID,即发送流水号
func (AliYunSMSClient) QuerySmsStatus ¶
func (c AliYunSMSClient) QuerySmsStatus(phoneNumber string, date string, page uint, size uint, bizId *string) (*query.AliYunSmsStatusQueryResponse, error)
QuerySmsStatus 查询短信状态
phoneNumber: 国内短信:11位手机号码,例如1590000****. 国际/港澳台消息:国际区号+号码,例如8520000**** date: 短信发送日期,支持查询最近30天的记录,格式为yyyyMMdd, 例如20181225。 page: 分页查看发送记录,指定发送记录的当前页码。 size: 分页查看发送记录,指定每页显示的短信记录数量。取值范围为1~50。 bizId: 发送回执ID,即发送流水号。
type AliYunSMSClientCredential ¶
AliYunSMSClientCredential 阿里云短信服务认证信息
func (AliYunSMSClientCredential) CreateAliYunSMSClient ¶
func (c AliYunSMSClientCredential) CreateAliYunSMSClient(optCfg *AliYunSMSOptionalConfig) (*AliYunSMSClient, error)
CreateAliYunSMSClient 基于认证信息创建用户对象
func (AliYunSMSClientCredential) CreateAliYunSMSClientSender ¶
func (c AliYunSMSClientCredential) CreateAliYunSMSClientSender(signName string, template SmsTemplateInterface, optCfg *AliYunSMSOptionalConfig) ( *AliYunSMSClientSender, error)
CreateAliYunSMSClientSender 基于认证信息创建可发送短信的用户对象
type AliYunSMSClientInterface ¶
type AliYunSMSClientInterface interface { // GetClient 获取阿里云短信平台用户对象 GetClient() *dysmsapi20170525.Client // QuerySmsStatus 查询短信的状态 QuerySmsStatus(phoneNumber string, date string, page uint, size uint, bizId *string) (*query.AliYunSmsStatusQueryResponse, error) // QuerySingleSmsStatus 查询单条短信的状态 QuerySingleSmsStatus(phoneNumber string, date string, bizId *string) (*query.AliYunSmsStatusQueryResponse, error) }
type AliYunSMSClientSender ¶
type AliYunSMSClientSender struct { AliYunSMSClientInterface AliYunSMSClientSenderInterface // contains filtered or unexported fields }
AliYunSMSClientSender 可发送短信的阿里云短信客户对象
func (AliYunSMSClientSender) QueryAliYunSmsSendApiPhoneNumberLimit ¶
func (s AliYunSMSClientSender) QueryAliYunSmsSendApiPhoneNumberLimit() int
QueryAliYunSmsSendApiPhoneNumberLimit 查询阿里云短信发送功能单次请求的手机号码数量上限
func (AliYunSMSClientSender) SendSms ¶
func (s AliYunSMSClientSender) SendSms(PhoneNumberList []string, UpExtendCode *string, OutId *string, rawTemplateParam interface{}) (*send.AliYunSmsSendResponse, error)
SendSms 发送短信 PhoneNumberList: 接收短信的手机号列表. 0 < len(PhoneNumberList) <= QueryAliYunSmsSendApiPhoneNumberLimit() UpExtendCode: 可选,未使用该字段则传nil. 上行短信扩展码, 上行短信, 指发送给通信服务提供商的短信, 用于定制某种服务、完成查询,或是办理某种业务等, 需要收费的, 按运营商普通短信资费进行扣费 OutId: 可选,未使用该字段则传nil. 外部流水扩展字段 rawTemplateParam: 原始模板参数. 函数内部调用AliYunSMSClientSender.template.GenerateTemplateParam(params interface{})将该参数格式化为Json格式的参数
type AliYunSMSClientSenderInterface ¶
type AliYunSMSClientSenderInterface interface { AliYunSMSClientInterface // QueryAliYunSmsSendApiPhoneNumberLimit 查询阿里云短信发送功能单次请求的手机号码数量上限 QueryAliYunSmsSendApiPhoneNumberLimit() int // SendSms 发送短信 SendSms(PhoneNumberList []string, UpExtendCode *string, OutId *string, params interface{}) (*send.AliYunSmsSendResponse, error) }
AliYunSMSClientSenderInterface AliYunSMSClientSender interface
type AliYunSMSOptionalConfig ¶
type AliYunSMSOptionalConfig struct { SecurityToken *string // security token Protocol *string // http protocol RegionId *string // region id HttpProxy *string // http proxy HttpsProxy *string // https proxy Socks5Proxy *string // socks5 proxy Socks5NetWork *string // socks5 network NoProxy *string // proxy white list Network *string // network for endpoint UserAgent *string // user agent Suffix *string // suffix for endpoint EndpointType *string // endpoint type OpenPlatformEndpoint *string // OpenPlatform endpoint SignatureAlgorithm *string // Signature Algorithm ReadTimeout *int // read timeout ConnectTimeout *int // connect timeout MaxIdleConns *int // max idle conns }
AliYunSMSOptionalConfig 阿里云短信服务可选配置项, 具体含义参照aliOpenApi.Config的定义或在线文档
type SmsTemplateInterface ¶
type SmsTemplateInterface interface { GetTemplateId() string // 获取模板ID GenerateTemplateParam(params interface{}) *string // 根据传入的结构体, 生成短信模板所需的参数 }
SmsTemplateInterface 短信模板接口