Documentation
¶
Index ¶
- type Client
- type Config
- type FailedInfo
- type HttpProfile
- type Message
- func (msg *Message) WithAppId(appId string) *Message
- func (msg *Message) WithExtendCode(extendCode string) *Message
- func (msg *Message) WithSenderId(senderId string) *Message
- func (msg *Message) WithSessionContext(sessionContext string) *Message
- func (msg *Message) WithSignName(sign string) *Message
- func (msg *Message) WithTemplate(id string, params ...int) *Message
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithConfig ¶ added in v1.3.0
NewClientWithConfig 实例化一个认证客户端,入参需要传入腾讯云账户密钥对secretId,secretKey
type Config ¶
type Config struct {
SecretId string `mapstructure:"secret_id" json:"secret_id"`
SecretKey string `mapstructure:"secret_key" json:"secret_key"`
// Region 地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量
Region string `mapstructure:"region" json:"region"`
// HttpProfile 客户端配置对象,可以指定超时时间等配置
HttpProfile *HttpProfile `mapstructure:"http_profile" json:"http_profile"`
/* SignMethod SDK默认用TC3-HMAC-SHA256进行签名,非必要请不要修改这个字段 */
SignMethod string `mapstructure:"sign_method" json:"sign_method"`
}
type FailedInfo ¶
FailedInfo 发送失败的短信信息
type HttpProfile ¶
type HttpProfile struct {
/*
ReqMethod
SDK默认使用POST方法。
* 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求 */
ReqMethod string `mapstructure:"req_method" json:"req_method"`
/*
ReqTimeout
SDK有默认的超时时间,非必要请不要进行调整
* 如有需要请在代码中查阅以获取最新的默认值 */
ReqTimeout int `mapstructure:"req_timeout" json:"req_timeout"`
/*
Endpoint
SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务
* 则必须手动指定域名,例如sms的上海金融区域名: sms.ap-shanghai-fsi.tencentcloudapi.com */
Endpoint string `mapstructure:"endpoint" json:"endpoint"`
}
type Message ¶
type Message struct {
//SmsSdkAppId 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666
SmsSdkAppId string `mapstructure:"sms_sdk_app_id" json:"sms_sdk_app_id"`
// SignName 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看
SignName string `mapstructure:"sign_name" json:"sign_name"`
// TemplateId 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查
TemplateId string `mapstructure:"template_id" json:"template_id"`
// TemplateParamSet 模板参数: 若无模板参数,则设置为空
TemplateParamSet []string `mapstructure:"template_param_set" json:"template_param_set"`
// ExtendCode 短信码号扩展号: 默认未开通,如需开通请联系 [sms helper]
ExtendCode string `mapstructure:"extend_code" json:"extend_code"`
// SessionContext 用户的 session 内容: 可以携带用户侧 ID 等上下文信息,server 会原样返回
SessionContext string `mapstructure:"session_context" json:"session_context"`
// SenderId 国际/港澳台短信 SenderId: 国内短信填空,默认未开通,如需开通请联系 [sms helper]
SenderId string `mapstructure:"sender_id" json:"sender_id"`
}
func NewMessage ¶
func NewMessage() *Message
func (*Message) WithExtendCode ¶
func (*Message) WithSenderId ¶
func (*Message) WithSessionContext ¶
func (*Message) WithSignName ¶
type Option ¶ added in v1.3.0
type Option func(config *Config)
func WithHttpProfile ¶ added in v1.3.0
func WithHttpProfile(httpProfile HttpProfile) Option
func WithRegion ¶ added in v1.3.0
func WithSecretId ¶ added in v1.3.0
func WithSecretKey ¶ added in v1.3.0
func WithSignMethod ¶ added in v1.3.0
Click to show internal directories.
Click to hide internal directories.