jpush

package
v0.0.0-...-a619a86 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JPUSH_VALIDATE = "https://api.jpush.cn/v3/push/validate"
	JPUSH_URL      = "https://api.jpush.cn/v3/push"
	BASE64         = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
)

Variables

This section is empty.

Functions

func Init

func Init(key, secret string)

func Send

func Send(push *JPush) (err error)

func SendTest

func SendTest(push *JPush) (err error)

Types

type AndroidNotice

type AndroidNotice struct {
	Alert     string `json:"alert"`
	Title     string `json:"title,omitempty"`
	BuilderId int    `json:"builder_id,omitempty"`
	Extras    M      `json:"extras,omitempty"`
}

type IOSNotice

type IOSNotice struct {
	Alert            string `json:"alert"`
	Sound            string `json:"sound,omitempty"`
	Badge            int    `json:"badge,omitempty"`
	ContentAvailable bool   `json:"Content-available,omitempty"`
	Category         string `json:"category,omitempty"`
	Extras           M      `json:"extras,omitempty"`
}

type JPush

type JPush struct {
	Platform     interface{} `json:"platform"`
	Audience     interface{} `json:"audience"`
	Notification interface{} `json:"notification,omitempty"`
	Message      interface{} `json:"message,omitempty"`
	Options      *Option     `json:"options,omitempty"`
}

func NewJPush

func NewJPush() *JPush

func (*JPush) Send

func (p *JPush) Send() error

func (*JPush) SendTest

func (p *JPush) SendTest() error

func (*JPush) SetAllNotice

func (p *JPush) SetAllNotice(alert string, ext M) *JPush

func (*JPush) SetAudience

func (p *JPush) SetAudience(tag, tag_and, alias, id []string) *JPush

func (*JPush) SetAudienceAll

func (p *JPush) SetAudienceAll() *JPush

func (*JPush) SetMessage

func (p *JPush) SetMessage(content, title, content_type string, extras M) *JPush

func (*JPush) SetNotification

func (p *JPush) SetNotification(alert string, android *AndroidNotice, ios *IOSNotice, win *WinPhoneNotice) *JPush

func (*JPush) SetPlatform

func (p *JPush) SetPlatform(android, ios, winphone bool) *JPush

func (*JPush) SetPlatformAll

func (p *JPush) SetPlatformAll() *JPush

type Message

type Message struct {
	Content     string `json:"msg_content"`
	Title       string `json:"title,omitempty"`
	ContentType string `json:"content_type,omitempty"`
	Extras      M      `json:"extras,omitempty"`
}

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"`
}

func NewNotice

func NewNotice(alert string, ext M) *Notice

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"`
}

type WinPhoneNotice

type WinPhoneNotice struct {
	Alert    string `json:"alert"`
	Title    string `json:"title,omitempty"`
	OpenPage string `json:"_open_page,omitempty"`
	Extras   M      `json:"extras,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL