jpush

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JPUSH_PARAMS_COUNT = 3 //两个参数(appkey+secret+is_prod)
)

Variables

View Source
var JPUSH_ALIASES_URL = "https://device.jpush.cn/v3/aliases"
View Source
var JPUSH_DEVICES_URL = "https://device.jpush.cn/v3/devices"
View Source
var JPUSH_PUSHAPI_URL = "https://api.jpush.cn/v3/push"

Functions

func New

func New(args ...interface{}) push.IPush

创建极光推送接口对象 args[0] => appkey 极光访问账号(string) args[1] => secret 极光账号密码(string) args[2] => is_prod 是否正式环境(bool) New(appkey, secret, is_prod)

Types

type Android

type Android struct {
	Alert     string      `json:"alert"`
	Title     string      `json:"title"`
	BuilderId int         `json:"builder_id"`
	Extras    interface{} `json:"extras"`
}

type Audience

type Audience struct {
	Tag   []string `json:"tag,omitempty"`             //接收者的TAG标签
	Alias []string `json:"alias,omitempty"`           //接收者的别名
	RegId []string `json:"registration_id,omitempty"` //接收者设备注册ID
}

type Content

type Content struct {
	Platform     []string     `json:"platform"` //需要推送的平台
	Audience     Audience     `json:"audience"` //需要推送的接受者
	Notification Notification `json:"notification"`
	Options      Options      `json:"options"`
}

type CorrectResp

type CorrectResp struct {
	SendNo string `json:"sendno"`
	MsgId  int64  `json:"msg_id"`
}

type Error

type Error struct {
	Message string `json:"message"`
	Code    int32  `json:"code"`
}

type Extras

type Extras struct {
	Url     string `json:"url"`
	Type    int32  `json:"type"`
	Content string `json:"content"`
	Sound   string `json:"sound"` //新增声音文件
}

自定义字段,选填

type IOS

type IOS struct {
	Alert  string      `json:"alert"`
	Extras interface{} `json:"extras"`
	Sound  string      `json:"sound"`
	Badge  string      `json:"badge"`
}

type IncorrectResp

type IncorrectResp struct {
	Error Error `json:"error"`
	MsgId int64 `json:"msg_id"`
}

type JPush

type JPush struct {
	// contains filtered or unexported fields
}

func (*JPush) Debug

func (j *JPush) Debug(enable bool)

开启关闭调试日志

func (*JPush) PushNotification

func (j *JPush) PushNotification(msg *push.Notification) (MsgID string, err error)

APP消息推送: 推送到极光服务器 platforms 指定平台,空切片内部自动转为所有平台

type Notification

type Notification struct {
	Android Android `json:"android"`
	IOS     IOS     `json:"ios"`
}

type Options

type Options struct {
	TimeToLive     int  `json:"time_to_live"`    //接收者的TAG标签
	ApnsProduction bool `json:"apns_production"` //接收者的别名
}

type Register

type Register struct {
	Mobile string `json:"mobile"`
	Alias  string `json:"alias"`
}

新增注册

Jump to

Keyboard shortcuts

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