Documentation ¶
Overview ¶
Package sms 七牛云短信服务 SDK 官网地址: http://www.qiniu.com/products/sms 开发者文档: https://developer.qiniu.com/sms
Index ¶
- Variables
- type AuditStatus
- type Manager
- func (m *Manager) CreateSignature(args SignatureRequest) (ret SignatureResponse, err error)
- func (m *Manager) CreateTemplate(args TemplateRequest) (ret TemplateResponse, err error)
- func (m *Manager) DeleteSignature(id string) (err error)
- func (m *Manager) DeleteTemplate(id string) (err error)
- func (m *Manager) QuerySignature(args QuerySignatureRequest) (pagination SignaturePagination, err error)
- func (m *Manager) QueryTemplate(args QueryTemplateRequest) (pagination TemplatePagination, err error)
- func (m *Manager) SendMessage(args MessagesRequest) (ret MessagesResponse, err error)
- func (m *Manager) UpdateSignature(id string, args SignatureRequest) (err error)
- func (m *Manager) UpdateTemplate(id string, args TemplateRequest) (err error)
- type MessagesRequest
- type MessagesResponse
- type QuerySignatureRequest
- type QueryTemplateRequest
- type Signature
- type SignaturePagination
- type SignatureRequest
- type SignatureResponse
- type SignatureSrcType
- type Template
- type TemplatePagination
- type TemplateRequest
- type TemplateResponse
- type TemplateType
Constants ¶
This section is empty.
Variables ¶
var (
// Host 为 Qiniu SMS Server API 服务域名
Host = "https://sms.qiniuapi.com"
)
Functions ¶
This section is empty.
Types ¶
type AuditStatus ¶
type AuditStatus string
AuditStatus 审核状态
const ( // AuditStatusPassed 通过 AuditStatusPassed AuditStatus = "passed" // AuditStatusReject 未通过 AuditStatusReject AuditStatus = "rejected" // AuditStatusReviewing 审核中 AuditStatusReviewing AuditStatus = "reviewing" )
func (AuditStatus) String ¶
func (a AuditStatus) String() string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 提供了 Qiniu SMS Server API 相关功能
func NewManager ¶
func NewManager(mac *auth.Credentials) (manager *Manager)
NewManager 用来构建一个新的 Manager
func (*Manager) CreateSignature ¶
func (m *Manager) CreateSignature(args SignatureRequest) (ret SignatureResponse, err error)
CreateSignature 创建签名
func (*Manager) CreateTemplate ¶
func (m *Manager) CreateTemplate(args TemplateRequest) (ret TemplateResponse, err error)
CreateTemplate 创建模板
func (*Manager) DeleteSignature ¶
DeleteSignature 删除签名
func (*Manager) DeleteTemplate ¶
DeleteTemplate 删除模板
func (*Manager) QuerySignature ¶
func (m *Manager) QuerySignature(args QuerySignatureRequest) (pagination SignaturePagination, err error)
QuerySignature 查询签名
func (*Manager) QueryTemplate ¶
func (m *Manager) QueryTemplate(args QueryTemplateRequest) (pagination TemplatePagination, err error)
QueryTemplate 查询模板
func (*Manager) SendMessage ¶
func (m *Manager) SendMessage(args MessagesRequest) (ret MessagesResponse, err error)
SendMessage 发送短信
func (*Manager) UpdateSignature ¶
func (m *Manager) UpdateSignature(id string, args SignatureRequest) (err error)
UpdateSignature 更新签名
func (*Manager) UpdateTemplate ¶
func (m *Manager) UpdateTemplate(id string, args TemplateRequest) (err error)
UpdateTemplate 更新模板
type MessagesRequest ¶
type MessagesRequest struct { SignatureID string `json:"signature_id"` TemplateID string `json:"template_id"` Mobiles []string `json:"mobiles"` Parameters map[string]interface{} `json:"parameters"` }
MessagesRequest 短信消息
type MessagesResponse ¶
type MessagesResponse struct {
JobID string `json:"job_id"`
}
MessagesResponse 发送短信响应
type QuerySignatureRequest ¶
type QuerySignatureRequest struct { AuditStatus AuditStatus `json:"audit_status"` // 审核状态 Page int `json:"page"` // 页码,默认为 1 PageSize int `json:"page_size"` // 分页大小,默认为 20 }
QuerySignatureRequest 查询签名参数
type QueryTemplateRequest ¶
type QueryTemplateRequest struct { AuditStatus AuditStatus `json:"audit_status"` // 审核状态 Page int `json:"page"` // 页码,默认为 1 PageSize int `json:"page_size"` // 分页大小,默认为 20 }
QueryTemplateRequest 查询模板参数
type Signature ¶
type Signature struct { ID string `json:"id"` Source SignatureSrcType `json:"source"` Signature string `json:"signature"` AuditStatus AuditStatus `json:"audit_status"` RejectReason string `json:"reject_reason,omitempty"` Description string `json:"description"` UpdatedAt uint64 `json:"updated_at"` CreatedAt uint64 `json:"created_at"` }
Signature 签名
type SignaturePagination ¶
type SignaturePagination struct { Page int `json:"page"` // 页码,默认为 1 PageSize int `json:"page_size"` // 分页大小,默认为 20 Total int `json:"total"` // 总记录条数 Items []Signature `json:"items"` // 签名 }
SignaturePagination 签名分页
type SignatureRequest ¶
type SignatureRequest struct { Signature string `json:"signature"` Source SignatureSrcType `json:"source"` Pic string `json:"pic"` Description string `json:"decription"` }
SignatureRequest 创建签名请求参数
type SignatureResponse ¶
type SignatureResponse struct {
SignatureID string `json:"signature_id"`
}
SignatureResponse 签名响应
type SignatureSrcType ¶
type SignatureSrcType string
SignatureSrcType 签名类型
const ( // EnterprisesAndInstitutions 企事业单位的全称或简称 EnterprisesAndInstitutions SignatureSrcType = "enterprises_and_institutions" // Website 工信部备案网站的全称或简称 Website SignatureSrcType = "website" // APP APP应用的全称或简称 APP SignatureSrcType = "app" // PublicNumberOrSmallProgram 公众号或小程序的全称或简称 PublicNumberOrSmallProgram SignatureSrcType = "public_number_or_small_program" // StoreName 电商平台店铺名的全称或简称 StoreName SignatureSrcType = "store_name" // TradeName 商标名的全称或简称 TradeName SignatureSrcType = "trade_name" )
func (SignatureSrcType) String ¶
func (s SignatureSrcType) String() string
type Template ¶
type Template struct { ID string `json:"id"` Name string `json:"name"` Type TemplateType `json:"type"` Template string `json:"template"` Description string `json:"description"` AuditStatus AuditStatus `json:"audit_status"` RejectReason string `json:"reject_reason"` UpdatedAt uint64 `json:"updated_at"` CreatedAt uint64 `json:"created_at"` }
Template 模板
type TemplatePagination ¶
type TemplatePagination struct { Page int `json:"page"` // 页码,默认为 1 PageSize int `json:"page_size"` // 分页大小,默认为 20 Total int `json:"total"` // 总记录条数 Items []Template `json:"items"` // 模板 }
TemplatePagination 模板分页
type TemplateRequest ¶
type TemplateRequest struct { UID uint32 `json:"uid"` Name string `json:"name"` Type TemplateType `json:"type"` Template string `json:"template"` Description string `json:"description"` }
TemplateRequest 创建模板请求参数
type TemplateResponse ¶
type TemplateResponse struct {
TemplateID string `json:"template_id"`
}
TemplateResponse 模板响应
type TemplateType ¶
type TemplateType string
TemplateType 模版类型
const ( // NotificationType 通知类短信 NotificationType TemplateType = "notification" // VerificationType 验证码短信 VerificationType TemplateType = "verification" // MarketingType 营销类短信 MarketingType TemplateType = "marketing" // VoiceType 语音短信 VoiceType TemplateType = "voice" )