Documentation
¶
Index ¶
Constants ¶
View Source
const ( // all audiences, all platforms ALL = "all" PLATFORM_IOS = "ios" PLATFORM_ANDROID = "android" PLATFORM_WP = "winphone" IosNotificationMaxSize = 2000 MaxTimeToLive = 10 * 24 * 60 * 60 // 10 天 MaxBigPushDuration = 1400 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndroidNotification ¶
type AndroidNotification struct { Title string `json:"title,omitempty"` BuilderId int `json:"builder_id,omitempty"` UriActivity string `json:"uri_activity"` UriAction string `json:"uri_action"` Sound string `json:"sound"` Intent struct { Url string `json:"url"` } `json:"intent"` // contains filtered or unexported fields }
Android 平台上的通知。
func NewAndroidNotification ¶
func NewAndroidNotification(alert string) *AndroidNotification
type Audience ¶
type Audience struct {
// contains filtered or unexported fields
}
推送设备对象,表示一条推送可以被推送到哪些设备列表。 确认推送设备对象,JPush 提供了多种方式,比如:别名、标签、注册ID、分群、广播等。
func NewAudience ¶
func NewAudience() *Audience
func (*Audience) SetRegistrationId ¶
type IosNotification ¶
type IosNotification struct { Sound string `json:"sound,omitempty"` Badge int `json:"badge,omitempty"` ContentAvailable bool `json:"content-available,omitempty"` Category string `json:"category,omitempty"` // contains filtered or unexported fields }
iOS 平台上 APNs 通知。
func NewIosNotification ¶
func NewIosNotification(alert string) *IosNotification
func (*IosNotification) AddExtra ¶
func (nc *IosNotification) AddExtra(key string, value interface{})
func (*IosNotification) Validate ¶
func (in *IosNotification) Validate() error
APNs 协议定义通知长度为 2048 字节。 JPush 因为需要重新组包,并且考虑一点安全冗余, 要求"iOS":{ } 及大括号内的总体长度不超过:2000 个字节。
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"` }
应用内消息。或者称作:自定义消息,透传消息。 此部分内容不会展示到通知栏上,JPush SDK 收到消息内容后透传给 App。 收到消息后 App 需要自行处理。
func NewMessage ¶
type Notification ¶
type Notification struct { Alert string `json:"alert,omitempty"` Android *AndroidNotification `json:"android,omitempty"` Ios *IosNotification `json:"ios,omitempty"` Winphone *WinphoneNotification `json:"winphone,omitempty"` }
“通知”对象,是一条推送的实体内容对象之一(另一个是“消息”)
func NewNotification ¶
func NewNotification(alert string) *Notification
func (*Notification) Validate ¶
func (n *Notification) Validate() error
type Options ¶
type Options struct { SendNo int `json:"sendno,omitempty"` TimeToLive int `json:"time_to_live,omitempty"` OverrideMsgId int64 `json:"override_msg_id,omitempty"` ApnsProduction bool `json:"apns_production"` BigPushDuration int `json:"big_push_duration,omitempty"` }
推送可选项。
func NewOptions ¶
func NewOptions() *Options
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
func NewPlatform ¶
func NewPlatform() *Platform
type PushObject ¶
type PushObject struct { Platform *Platform `json:"platform"` Audience *Audience `json:"audience"` Notification *Notification `json:"notification"` Message *Message `json:"message"` Options *Options `json:"options"` }
一个推送对象,表示一条推送相关的所有信息。
func NewPushObject ¶
func NewPushObject() *PushObject
func (*PushObject) MarshalJSON ¶
func (po *PushObject) MarshalJSON() ([]byte, error)
实现 Marshaler interface
func (*PushObject) Validate ¶
func (po *PushObject) Validate() error
type PushResult ¶
type PushResult struct { common.ResponseBase // 成功时 msg_id 是 string 类型。。。 // 失败时 msg_id 是 int 类型。。。 MsgId interface{} `json:"msg_id"` SendNo string `json:"sendno"` }
func (*PushResult) FromResponse ¶
func (pr *PushResult) FromResponse(resp *http.Response) error
成功: {"sendno":"18", "msg_id":"1828256757"} 失败: {"msg_id": 1035959738, "error": {"message": "app_key does not exist", "code": 1008}}
func (*PushResult) String ¶
func (pr *PushResult) String() string
type WinphoneNotification ¶
type WinphoneNotification struct { Title string `json:"title,omitempty"` OpenPage string `json:"_open_page,omitempty"` // contains filtered or unexported fields }
Windows Phone 平台上的通知。
func NewWinphoneNotification ¶
func NewWinphoneNotification(alert string) *WinphoneNotification
Click to show internal directories.
Click to hide internal directories.