Documentation ¶
Index ¶
- Variables
- type Client
- type Email
- type Http
- type Notifier
- type Notify
- func NewEmailNotify(to string, maxRetry int, data interface{}) *Notify
- func NewHttpNotify(url string, headers map[string]string, maxRetry int, data interface{}) *Notify
- func NewJWTNotify(url string, scheme string, token string, maxRetry int, data interface{}) *Notify
- func NewNotify(notifyType NotifyType, maxRetry int, notifier interface{}, data interface{}) *Notify
- func NewSimpleJWTNotify(url string, scheme string, token string) *Notify
- func NewSimpleNotify(notifyType NotifyType, notifier interface{}, data interface{}) *Notify
- func NewSmsNotify(to string, maxRetry int, data interface{}) *Notify
- func NewVoiceNotify(to string, maxRetry int, data interface{}) *Notify
- type NotifyType
- type Request
- type Response
- type Sms
- type Voice
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorNotSupportNotify = &gox.CodeError{ErrorCode: 102, Message: "不支持的通知类型"}
ErrorNotSupportNotify 不支持的通知类型
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { class100.Client // Endpoint 地址 Endpoint string `default:"https://qingniao.class100.com" json:"endpoint"` }
Client 青鸟客户端
type Email ¶
type Email struct { // Subject 标题 Subject string `json:"subject" validate:"required"` // CCs 抄送人员列表 CCs []string `json:"ccs" validate:"dive,email"` // BCCs 密送人员列表 BCCs []string `json:"bccs" validate:"dive,email"` // To 需要发送的手机号 To string `json:"to" validate:"required,email"` }
Email 邮件通知
type Http ¶
type Http struct { // Url 通信地址 Url string `json:"url" validate:"required"` // Headers 请求头 Headers map[string]string `json:"headers"` }
Http Http通知
type Notifier ¶
type Notifier interface { // Notify 发送通知 Notify(data interface{}) (err error) }
Notifier
type Notify ¶
type Notify struct { // Type 通知类型 Type NotifyType `default:"http" json:"type" validate:"required,oneof=http voice sms email"` // MaxRetry 最大重试次数 MaxRetry int `default:"6" json:"maxRetry" validate:"omitempty,min=1,max=100"` // Notifier 真正的通知者 Notifier interface{} `json:"notifier" validate:"required"` // Data 数据 Data interface{} `json:"data"` }
Notify 回调通知
func NewEmailNotify ¶
NewEmailNotify 创建新的邮件通知
func NewHttpNotify ¶
NewHttpNotify 创建新的Http通知
func NewJWTNotify ¶
NewJWTNotify 创建新的JWT通知
func NewNotify ¶
func NewNotify(notifyType NotifyType, maxRetry int, notifier interface{}, data interface{}) *Notify
NewNotify 创建一个新的通知
func NewSimpleJWTNotify ¶
NewSimpleJWTNotify 创建简单JWT通知
func NewSimpleNotify ¶
func NewSimpleNotify(notifyType NotifyType, notifier interface{}, data interface{}) *Notify
NewSimpleNotify 创建简单的通知
func NewSmsNotify ¶
NewSmsNotify 创建新的短信通知
func NewVoiceNotify ¶
NewVoiceNotify 创建新的语音通知
func (*Notify) UnmarshalJSON ¶
type NotifyType ¶
type NotifyType string
NotifyType 通知类型
const ( // NotifyTypeHttp Http通知 NotifyTypeHttp NotifyType = "http" // NotifyTypeVoice 语音通知 NotifyTypeVoice NotifyType = "voice" // NotifyTypeSMS 短信通知 NotifyTypeSms NotifyType = "sms" // NotifyTypeEmail 邮件通知 NotifyTypeEmail NotifyType = "email" )
type Request ¶
type Request struct { class100.Request // Notify 请求 Notify *Notify `json:"notify" validate:"required,structonly"` }
Request 青鸟请求
Click to show internal directories.
Click to hide internal directories.