Documentation ¶
Index ¶
- Constants
- type AndroidNotice
- type Audience
- type CallbackReply
- type CallbackReq
- type Client
- type IOSNotice
- type Message
- type Notice
- type Option
- type Payload
- func (p *Payload) SetAudience(ad *Audience)
- func (p *Payload) SetCallbackReq(cb *CallbackReq)
- func (p *Payload) SetMessage(m *Message)
- func (p *Payload) SetNotice(notice *Notice)
- func (p *Payload) SetOptions(o *Option)
- func (p *Payload) SetPlatform(plat *Platform)
- func (p *Payload) ToBytes() ([]byte, error)
- type Platform
- type PushResponse
- type WinPhoneNotice
Constants ¶
View Source
const ( // CallbackTypeReceive 送达才回执 CallbackTypeReceive = callbackType(1) // CallbackTypeClick 点击才回执 CallbackTypeClick = callbackType(2) // CallbackTypeAll 送达和点击都回执 CallbackTypeAll = callbackType(3) // StatusSwitchOn 回执时候通知栏开关状态:开 StatusSwitchOn = int(1) // StatusSwitchOff 回执时候通知栏开关状态:关 StatusSwitchOff = int(2) )
View Source
const ( // ErrRetry 需要重试 ErrRetry = int(1030) // ErrInternal 服务方内部错误 ErrInternal = int(1000) )
View Source
const ( // AndroidAlertTypeAll 全开 AndroidAlertTypeAll = -1 // AndroidAlertTypeNone 全关 AndroidAlertTypeNone = 0 // AndroidAlertTypeSound 开声音 AndroidAlertTypeSound = 1 // AndroidAlertTypeVibrate 开振动 AndroidAlertTypeVibrate = 2 // AndroidAlertTypeLight 开呼吸灯 AndroidAlertTypeLight = 4 // AndroidStyleDefault 默认通知栏样式 AndroidStyleDefault = 0 // AndroidStyleBigTxt big_text 字段大文本的形式展示 AndroidStyleBigTxt = 1 // AndroidStyleInbox inbox 字段 json 的每个 key 对应的 value 会被当作文本条目逐条展示 AndroidStyleInbox = 2 // AndroidStylePic big_pic_path 字段的图片URL展示成图片 AndroidStylePic = 3 )
View Source
const ( // PlatformIOS . PlatformIOS = "ios" // PlatformAndroid . PlatformAndroid = "android" // PlatformWinphone . PlatformWinphone = "winphone" // PlatformAll . PlatformAll = "all" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndroidNotice ¶
type AndroidNotice struct { Alert string `json:"alert"` Title string `json:"title,omitempty"` AlertType int `json:"alert_type"` BuilderID int `json:"builder_id,omitempty"` Style int `json:"style,omitempty"` BigPicPath string `json:"big_pic_path,omitempty"` Extras map[string]interface{} `json:"extras,omitempty"` }
AndroidNotice .
func (*AndroidNotice) SetPic ¶
func (an *AndroidNotice) SetPic(pic string)
SetPic sets Android notice pic.
type Audience ¶
type Audience struct { Object interface{} // contains filtered or unexported fields }
Audience .
type CallbackReply ¶
type CallbackReply struct { // Token device token Token string `json:"registration_id"` // Platform android or ios Platform string `json:"platform"` // Time 消息送达或点击的秒级时间戳 Time int64 `json:"sent_time"` // Switch 通知栏消息开关 Switch bool `json:"notification_state"` // Type 送达或点击 Type callbackType `json:"callback_type"` // Channel 下发通道 Channel int `json:"channel"` // Params 自定义参数 Params map[string]string `json:"params"` }
CallbackReply 消息回执接收体
type CallbackReq ¶
type CallbackReq struct { // URL 接受回执数据的URL URL string `json:"url"` // Type 需要的回执类型 Type callbackType `json:"type"` // Params 携带的自定义参数 Params map[string]string `json:"params"` }
CallbackReq 消息回执请求体
func (*CallbackReq) SetParam ¶
func (cb *CallbackReq) SetParam(m map[string]string)
SetParam 设置自定义参数
type IOSNotice ¶
type IOSNotice struct { Alert interface{} `json:"alert"` Sound string `json:"sound,omitempty"` Badge string `json:"badge,omitempty"` ContentAvailable bool `json:"content-available,omitempty"` MutableContent bool `json:"mutable-content,omitempty"` Category string `json:"category,omitempty"` Extras map[string]interface{} `json:"extras,omitempty"` }
IOSNotice .
type Message ¶
type Message struct { Content string `json:"msg_content"` Title string `json:"title,omitempty"` ContentType string `json:"content_type,omitempty"` Extras map[string]interface{} `json:"extras,omitempty"` }
Message .
type Notice ¶
type Notice struct { Alert string `json:"alert,omitempty"` Android *AndroidNotice `json:"android,omitempty"` IOS *IOSNotice `json:"ios,omitempty"` WINPhone *WinPhoneNotice `json:"winphone,omitempty"` }
Notice .
func (*Notice) SetAndroidNotice ¶
func (n *Notice) SetAndroidNotice(an *AndroidNotice)
SetAndroidNotice .
func (*Notice) SetWinPhoneNotice ¶
func (n *Notice) SetWinPhoneNotice(wn *WinPhoneNotice)
SetWinPhoneNotice .
type Option ¶
type Option struct { SendNo int `json:"sendno,omitempty"` TimeLive int `json:"time_to_live,omitempty"` ApnsProduction bool `json:"apns_production"` OverrideMsgID int64 `json:"override_msg_id,omitempty"` BigPushDuration int `json:"big_push_duration,omitempty"` ReturnInvalidToken bool `json:"return_invalid_rid,omitempty"` // 是否同步返回无效的token }
Option .
func (*Option) SetBigPushDuration ¶
SetBigPushDuration .
func (*Option) SetReturnInvalidToken ¶
SetReturnInvalidToken .
type Payload ¶
type Payload struct { Platform interface{} `json:"platform"` Audience interface{} `json:"audience"` Notification interface{} `json:"notification,omitempty"` Message interface{} `json:"message,omitempty"` Options *Option `json:"options,omitempty"` Callback *CallbackReq `json:"callback,omitempty"` }
Payload .
type Platform ¶
type Platform struct { OS interface{} // contains filtered or unexported fields }
Platform .
type PushResponse ¶
type PushResponse struct { SendNo interface{} `json:"sendno,omitempty"` MsgID interface{} `json:"msg_id,omitempty"` IllegalTokens []string `json:"illegal_rids,omitempty"` Retry bool // 是否需要重试请求 Error struct { Code int `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` }
PushResponse .
Click to show internal directories.
Click to hide internal directories.