jpush

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 14 Imported by: 0

README

JPush API Golang

概述

从 deaswang/jpush-api-golang 完善而来,十分感谢

这是 JPush REST API 的 Golang 版本封装开发包,不是由极光推送官方提供的,一般支持最新的 API 功能。

对应的 REST API 文档:https://docs.jiguang.cn/jpush/server/push/server_overview/

兼容版本

  • Golang 1.15

环境配置

go get github.com/ilam01/jpush-go

代码样例

代码样例在 jpush 中的 example 文件夹中,点击查看所有 example

这个样例演示了消息推送。

client := jpush.NewJPush(Appkey, masterSecret)
aud := &jpush.PushAudience{}
aud.SetAll(true)
req := &jpush.PushRequest{
    Platform: &jpush.Platform{Platforms: []string{"android", "ios"}},
    Audience: aud,
    Notification: &jpush.PushNotification{
        Alert: "test alert",
        Android: &jpush.NotificationAndroid{
            Alert:     "alert",
            Title:     "title",
            BuilderID: 0,
            Priority:  1,
            AlertType: 7,
        },
    },
    Options: &jpush.PushOptions{
        TimeToLive: 0,
    },
}
ret, err := client.Push(req)
if err != nil {
    fmt.Println(err.Error())
    return
}

HTTP 状态码

参考文档:http://docs.jiguang.cn/jpush/server/push/http_status_code/

Push v3 API 状态码 参考文档:http://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/

Report API 状态码 参考文档:http://docs.jiguang.cn/jpush/server/push/rest_api_v3_report/

Device API 状态码 参考文档:http://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/

Push Schedule API 状态码 参考文档:http://docs.jiguang.cn/jpush/server/push/rest_api_push_schedule/

Push File API 状态码 参考文档:https://docs.jiguang.cn/jpush/server/push/rest_api_v3_file/

Push Image API 状态码 参考文档:https://docs.jiguang.cn/jpush/server/push/rest_api_v3_image/

Release页面

有详细的版本发布记录与下载。

Documentation

Index

Constants

View Source
const (
	TypeAlias          = 1
	TypeRegistrationId = 2
)
View Source
const (
	DistributionJPush         = "jpush"          //值为 jpush 表示推送强制走极光通道下发;
	DistributionOSPush        = "ospush"         //值为 ospush 表示推送强制走厂商通道下发;
	DistributionFirstOSPush   = "first_ospush"   //值为 first_ospush 时表示推送优先走厂商通道下发,无效走极光通道下发;
	DistributionSecondaryPush = "secondary_push" //值为 secondary_push 表示推送优先走极光,极光不在线再走厂商,厂商作为辅助;【建议此种方式】

	DistributionFcm                 = "fcm"                //值为 fcm 表示推送强制走 fcm 通道下发;
	DistributionFcmPns              = "pns"                //值为 pns 表示推送强制走小米/华为/魅族/oppo/vivo 通道下发;
	DistributionFcmJPush            = "jpush"              //值为 jpush 表示推送强制走极光通道下发;
	DistributionFcmSecondaryFcmPush = "secondary_fcm_push" //值为 secondary_fcm_push 表示针对fcm+国内厂商组合类型用户,推送优先走极光,极光不在线再走fcm通道,fcm作为辅助;
	DistributionFcmSecondaryPnsPush = "secondary_pns_push" //值为 secondary_pns_push 表示针对fcm+国内厂商组合类型用户,推送优先走极光,极光不在线再走厂商通道,厂商作为辅助;
)
View Source
const ToDevice int32 = 1
View Source
const ToUser int32 = 2
View Source
const (
	VERSION = "1.0"
)

VERSION api client version

Variables

View Source
var ZONES = make(map[string]map[string]string)

ZONES define api url

Functions

This section is empty.

Types

type AdminAppRequest

type AdminAppRequest struct {
	AppName        string `json:"app_name"`
	AndroidPackage string `json:"android_package"`
	GroupName      string `json:"group_name"`
}

AdminAppRequest admin app request

type AdminAppResponse

type AdminAppResponse struct {
	ErrorResponse
	AppKey         string `json:"app_key"`
	AndroidPackage string `json:"android_package"`
	IsNewCreated   bool   `json:"is_new_created"`
}

AdminAppResponse new app response

type AdminCertificateRequest

type AdminCertificateRequest struct {
	DevCertificatePassword string `json:"devCertificatePassword,omitempty"`
	ProCertificatePassword string `json:"proCertificatePassword,omitempty"`
	DevCertificateFile     []byte `json:"devCertificateFile,omitempty"`
	ProCertificateFile     []byte `json:"proCertificateFile,omitempty"`
}

AdminCertificateRequest admin certificate

type AdminSuccessResponse

type AdminSuccessResponse struct {
	ErrorResponse
	Success string `json:"success"`
}

AdminSuccessResponse success response

type Audience

type Audience struct {
	Tag            []string `json:"tag,omitempty"`
	TagAnd         []string `json:"tag_and,omitempty"`
	TagNot         []string `json:"tag_not,omitempty"`
	Alias          []string `json:"alias,omitempty"`
	RegistrationID []string `json:"registration_id,omitempty"`
	Segment        []string `json:"segment,omitempty"`
	ABTest         []string `json:"abtest,omitempty"`
	File           *File    `json:"file,omitempty"`
}

Audience define Audience

type Callback

type Callback struct {
	Url    string        `json:"url,omitempty"`
	Params CallbackParam `json:"params,omitempty"`
	Type   string        `json:"type,omitempty"`
}

type CallbackParam

type CallbackParam struct {
	To        string `json:"to,omitempty"`
	ToType    int32  `json:"to_type,omitempty"`
	MessageId string `json:"message_id,omitempty"`
	Href      string `json:"href,omitempty"`
	Crowd     string `json:"crowd"`
}

type DefaultResponse

type DefaultResponse struct {
	ErrorResponse
}

DefaultResponse default null response

type DeviceAliasResponse

type DeviceAliasResponse struct {
	ErrorResponse
	RegistrationIDs []string `json:"registration_ids"`
}

DeviceAliasResponse get alias response

type DeviceModify

type DeviceModify struct {
	Add    []string `json:"add,omitempty"`
	Remove []string `json:"remove,omitempty"`
}

DeviceModify add and remove entry

type DeviceRegistrationIDRequest

type DeviceRegistrationIDRequest struct {
	Tags   *DeviceModify `json:"tags,omitempty"`
	Alias  string        `json:"alias,omitempty"`
	Mobile string        `json:"mobile,omitempty"`
}

DeviceRegistrationIDRequest modify device request

type DeviceRegistrationIDResponse

type DeviceRegistrationIDResponse struct {
	ErrorResponse
	Tags   []string `json:"tags"`
	Alias  string   `json:"alias"`
	Mobile string   `json:"mobile,omitempty"`
}

DeviceRegistrationIDResponse get registration id response

type DeviceStatusRequest

type DeviceStatusRequest struct {
	RegistrationIDs []string `json:"registration_ids,omitempty"`
}

DeviceStatusRequest get user status

type DeviceStatusResponse

type DeviceStatusResponse struct {
	ErrorResponse
	Online         bool   `json:"online"`
	LastOnlineTime string `json:"last_online_time,omitempty"`
}

DeviceStatusResponse get device status response

type DeviceTagsListResponse

type DeviceTagsListResponse struct {
	ErrorResponse
	Tags []string `json:"tags"`
}

DeviceTagsListResponse get tags list response

type DeviceTagsRegistrationIDResponse

type DeviceTagsRegistrationIDResponse struct {
	ErrorResponse
	Result bool `json:"result"`
}

DeviceTagsRegistrationIDResponse tags bind registration response

type DeviceTagsRequest

type DeviceTagsRequest struct {
	RegistrationIDs *DeviceModify `json:"registration_ids,omitempty"`
}

DeviceTagsRequest modify device named tag request

type ErrorMessage

type ErrorMessage struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorMessage error message response

func (ErrorMessage) Error

func (e ErrorMessage) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error ErrorMessage `json:"error"`
}

ErrorResponse error response from api

type Fcm

type Fcm struct {
	Distribution    string `json:"distribution,omitempty"`
	DistributionFcm string `json:"distribution_fcm,omitempty"`
}

type File

type File struct {
	FileId string `json:"file_id"`
}

File define file

type GetFilesResponse

type GetFilesResponse struct {
	TotalCount int    `json:"total_count"`
	Files      []file `json:"files"`
	ErrorResponse
}

type GroupPush

type GroupPush struct {
	JPush
}

GroupPush grouppush core struct

func NewGroupPush

func NewGroupPush(key, secret string) *GroupPush

NewGroupPush new grouppush object

func (*GroupPush) GroupPush

func (j *GroupPush) GroupPush(req *PushRequest) (map[string]PushResponse, error)

GroupPush group push POST /v3/grouppush

func (*GroupPush) SetAuthorization

func (j *GroupPush) SetAuthorization(key, secret string)

SetAuthorization set grouppush authorization

type Huawei

type Huawei struct {
	Fcm
	Importance         string `json:"importance,omitempty"`
	Inbox              string `json:"inbox,omitempty"`
	LargeIcon          string `json:"large_icon,omitempty"`
	OnlyUseVendorStyle bool   `json:"only_use_vendor_style,omitempty"`
	SmallIconURI       string `json:"small_icon_uri,omitempty"`
	Style              int64  `json:"style,omitempty"`
}

type IconSize

type IconSize int
const (
	BigPic IconSize = iota + 1
	LargeIcon
	SmallIcon
)

type ImagesByUrlsRequest

type ImagesByUrlsRequest struct {
	FcmImageURL     string   `json:"fcm_image_url,omitempty"`
	HuaweiImageURL  string   `json:"huawei_image_url,omitempty"`
	ImageType       IconSize `json:"image_type,omitempty"`
	ImageURL        string   `json:"image_url,omitempty"`
	JiguangImageURL string   `json:"jiguang_image_url,omitempty"`
	OppoImageURL    string   `json:"oppo_image_url,omitempty"`
	XiaomiImageURL  string   `json:"xiaomi_image_url,omitempty"`
}

type ImagesByUrlsResponse

type ImagesByUrlsResponse struct {
	FcmImageURL     string `json:"fcm_image_url,omitempty"`
	HuaweiImageURL  string `json:"huawei_image_url,omitempty"`
	JiguangImageURL string `json:"jiguang_image_url,omitempty"`
	MediaID         string `json:"media_id,omitempty"`
	OppoImageURL    string `json:"oppo_image_url,omitempty"`
	XiaomiImageURL  string `json:"xiaomi_image_url,omitempty"`
	ErrorResponse
}

type ImagesByUrlsUpdateRequest

type ImagesByUrlsUpdateRequest struct {
	FcmImageURL     string `json:"fcm_image_url,omitempty"`
	HuaweiImageURL  string `json:"huawei_image_url,omitempty"`
	JiguangImageURL string `json:"jiguang_image_url,omitempty"`
	OppoImageURL    string `json:"oppo_image_url,omitempty"`
	XiaomiImageURL  string `json:"xiaomi_image_url,omitempty"`
}

type JPush

type JPush struct {
	Zone string

	Quota     int // 当前 AppKey 一个时间窗口内可调用次数
	Remaining int // 当前时间窗口剩余的可用次数
	Reset     int // 距离时间窗口重置剩余的秒数
	// contains filtered or unexported fields
}

JPush jpush core struct

func NewJPush

func NewJPush(key, secret string) *JPush

NewJPush new jpush object

func (*JPush) AdminApp

func (j *JPush) AdminApp(req **AdminAppRequest) (*AdminAppResponse, error)

AdminApp admin app point POST /v1/admin/app

func (*JPush) AdminAppCert

func (j *JPush) AdminAppCert(appkey string, req *AdminCertificateRequest) (*AdminSuccessResponse, error)

AdminAppCert admin certificate POST /v1/app/{appKey}/certificate

func (*JPush) AdminAppDelete

func (j *JPush) AdminAppDelete(appkey string) (*AdminSuccessResponse, error)

AdminAppDelete delete app POST /v1/app/{appkey}/delete

func (*JPush) DeleteFiles

func (j *JPush) DeleteFiles(fileId string) (delete bool, err error)

func (*JPush) DeviceDeleteAlias

func (j *JPush) DeviceDeleteAlias(alias string, platforms []string) (*DefaultResponse, error)

DeviceDeleteAlias delete alias

func (*JPush) DeviceDeleteTags

func (j *JPush) DeviceDeleteTags(tag string, platforms []string) (*DefaultResponse, error)

DeviceDeleteTags delete tag

func (*JPush) DeviceGetAlias

func (j *JPush) DeviceGetAlias(alias string, platforms []string) (*DeviceAliasResponse, error)

DeviceGetAlias get device named alias

func (*JPush) DeviceGetRegistrationID

func (j *JPush) DeviceGetRegistrationID(registrationID string) (*DeviceRegistrationIDResponse, error)

DeviceGetRegistrationID get device info

func (*JPush) DeviceGetTags

func (j *JPush) DeviceGetTags() (*DeviceTagsListResponse, error)

DeviceGetTags get all tag list

func (*JPush) DeviceGetTagsRegistrationID

func (j *JPush) DeviceGetTagsRegistrationID(tag string, registrationID string) (*DeviceTagsRegistrationIDResponse, error)

DeviceGetTagsRegistrationID get device tag

func (*JPush) DevicePostRegistrationID

func (j *JPush) DevicePostRegistrationID(registrationID string, req *DeviceRegistrationIDRequest) (*DefaultResponse, error)

DevicePostRegistrationID modify device info

func (*JPush) DevicePostStatus

func (j *JPush) DevicePostStatus(req *DeviceStatusRequest) (map[string]DeviceStatusResponse, error)

DevicePostStatus get devices status

func (*JPush) DevicePostTags

func (j *JPush) DevicePostTags(tag string, req *DeviceTagsRequest) (*DefaultResponse, error)

DevicePostTags modify device tag

func (*JPush) GetFiles

func (j *JPush) GetFiles() (files *GetFilesResponse, err error)

func (*JPush) GetURL

func (j *JPush) GetURL(key string) string

GetURL get the api url address

func (*JPush) ImagesByFiles

func (j *JPush) ImagesByFiles(media string, req ImagesByUrlsUpdateRequest) (*ImagesByUrlsResponse, error)

ImagesByFiles 通过图片文件获取媒体id

func (*JPush) ImagesByUrls

func (j *JPush) ImagesByUrls(req ImagesByUrlsRequest) (*ImagesByUrlsResponse, error)

ImagesByUrls 通过图片地址获取媒体id

func (*JPush) Push

func (j *JPush) Push(req *PushRequest) (*PushResponse, error)

Push push notification or message to devices POST /v3/push

func (*JPush) PushGetCid

func (j *JPush) PushGetCid() (*PushCIDResponse, error)

PushGetCid get push by cid GET /v3/push/cid[?count=n[&type=xx]]

func (*JPush) PushGetCids

func (j *JPush) PushGetCids(count int, cidtype string) (*PushCIDResponse, error)

PushGetCids get push by cid GET /v3/push/cid[?count=n[&type=xx]]

func (*JPush) PushValidate

func (j *JPush) PushValidate(req *PushRequest) (*PushResponse, error)

PushValidate push validate, not real push POST /v3/push/validate

func (*JPush) ReportMessages

func (j *JPush) ReportMessages(msgIds []string) (*ReportMessagesResponse, error)

ReportMessages message stat GET /v3/messages Deprecated: it is old func

func (*JPush) ReportMessagesDetail

func (j *JPush) ReportMessagesDetail(msgIds []string) ([]ReportDetailResponse, error)

ReportMessagesDetail report messages detail GET /v3/messages/detail

func (*JPush) ReportReceived

func (j *JPush) ReportReceived(msgIds []string) ([]ReportReceivedResponse, error)

ReportReceived report received GET /v3/received Deprecated: it is old func

func (*JPush) ReportStatus

func (j *JPush) ReportStatus(req *ReportStatusRequest) (map[string]MessageStatus, error)

ReportStatus report push status POST /v3/status/message

func (*JPush) ReportUsers

func (j *JPush) ReportUsers(timeUnit string, start time.Time, duration int) (*ReportUsersResponse, error)

ReportUsers user stat GET /v3/users

func (*JPush) Schedule

func (j *JPush) Schedule(req *ScheduleRequest) (*ScheduleResponse, error)

Schedule create schedule POST /v3/schedules

func (*JPush) ScheduleDelete

func (j *JPush) ScheduleDelete(scheduleID string) (*DefaultResponse, error)

ScheduleDelete delete schedule DELETE /v3/schedules/{schedule_id}

func (*JPush) ScheduleGetCid

func (j *JPush) ScheduleGetCid() (*PushCIDResponse, error)

ScheduleGetCid get push by cid GET /v3/push/cid[?count=n[&type=xx]]

func (*JPush) ScheduleID

func (j *JPush) ScheduleID(scheduleID string) (*ScheduleResponse, error)

ScheduleID get schedule by id GET /v3/schedules/{schedule_id}

func (*JPush) ScheduleIDMsgs

func (j *JPush) ScheduleIDMsgs(scheduleID string) (*ScheduleMsgsResponse, error)

ScheduleIDMsgs get all msg ids by schedule id GET /v3/schedules/{schedule_id}/msg_ids

func (*JPush) SchedulePage

func (j *JPush) SchedulePage(page int) (*SchedulePageResponse, error)

SchedulePage get schedule list GET /v3/schedules?page=

func (*JPush) SchedulePut

func (j *JPush) SchedulePut(scheduleID string, req *ScheduleRequest) (*ScheduleResponse, error)

SchedulePut modify schedule PUT /v3/schedules/{schedule_id}

func (*JPush) SendFile

func (j *JPush) SendFile(filePath string, typeInt int) (fileId string, err error)

typeInt 1 别名 2 注册id 默认别名

func (*JPush) SetAuthorization

func (j *JPush) SetAuthorization(key, secret string)

SetAuthorization set Authorization

func (*JPush) SetZone

func (j *JPush) SetZone(zone string)

SetZone set jpush zone

type Meizu

type Meizu struct {
	Fcm
}

type MessageStatus

type MessageStatus struct {
	Status int `json:"status"`
}

MessageStatus message status

type NotificationAndroid

type NotificationAndroid struct {
	Alert             string                 `json:"alert"`
	Title             string                 `json:"title,omitempty"`
	BuilderID         int                    `json:"builder_id,int,omitempty"`
	Priority          int                    `json:"priority,omitempty"`
	Category          string                 `json:"category,omitempty"`
	Style             int                    `json:"style,int,omitempty"`
	AlertType         int                    `json:"alert_type,int,omitempty"`
	BigText           string                 `json:"big_text,omitempty"`
	Inbox             map[string]interface{} `json:"inbox,omitempty"`
	BigPicPath        string                 `json:"big_pic_path,omitempty"`
	Extras            map[string]interface{} `json:"extras,omitempty"`
	LargeIcon         string                 `json:"large_icon,omitempty"`
	Intent            map[string]interface{} `json:"intent,omitempty"`
	UriAction         string                 `json:"uri_action,omitempty"`
	UriActivity       string                 `json:"uri_activity,omitempty"`
	BadgeAddNum       int                    `json:"badge_add_num,omitempty"`
	BadgeClass        string                 `json:"badge_class,omitempty"`
	Sound             string                 `json:"sound,omitempty"`
	ShowBeginTime     string                 `json:"show_begin_time,omitempty"`
	ShowEndTime       string                 `json:"show_end_time,omitempty"`
	DisplayForeground string                 `json:"display_foreground,omitempty"`
	SmallIconUri      string                 `json:"small_icon_uri,omitempty"`
}

NotificationAndroid define android notification

type NotificationIOS

type NotificationIOS struct {
	Alert            interface{}            `json:"alert"`
	Sound            string                 `json:"sound,omitempty"`
	Badge            int                    `json:"badge,int,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"`
	ThreadId         string                 `json:"thread-id,omitempty"`
}

NotificationIOS define ios notification

type NotificationWinPhone

type NotificationWinPhone struct {
	Alert    string                 `json:"alert"`
	Title    string                 `json:"title,omitempty"`
	OpenPage string                 `json:"_open_page,omitempty"`
	Extras   map[string]interface{} `json:"extras,omitempty"`
}

NotificationWinPhone define winphone notification

type Oppo

type Oppo struct {
	Fcm
	BigPicPath string `json:"big_pic_path,omitempty"`
	ChannelID  string `json:"channel_id,omitempty"`
	LargeIcon  string `json:"large_icon,omitempty"`
	Style      int64  `json:"style,omitempty"`
}

type Platform

type Platform struct {
	Platforms []string
	// contains filtered or unexported fields
}

Platform define platform entry

func (*Platform) MarshalJSON

func (p *Platform) MarshalJSON() (data []byte, err error)

MarshalJSON marshal json

func (*Platform) SetAll

func (p *Platform) SetAll(all bool)

SetAll set isAll value

func (*Platform) UnmarshalJSON

func (p *Platform) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal json

type PushAudience

type PushAudience struct {
	Aud *Audience
	// contains filtered or unexported fields
}

PushAudience define audience entry

func (*PushAudience) MarshalJSON

func (p *PushAudience) MarshalJSON() (data []byte, err error)

MarshalJSON marshal json

func (*PushAudience) SetAll

func (p *PushAudience) SetAll(all bool)

SetAll set isAll

func (*PushAudience) UnmarshalJSON

func (p *PushAudience) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal json

type PushCIDResponse

type PushCIDResponse struct {
	ErrorResponse
	Cids []string `json:"cidlist"`
}

PushCIDResponse get cid response

type PushMessage

type PushMessage struct {
	MsgContent  string                 `json:"msg_content"`
	Title       string                 `json:"title,omitempty"`
	ContentType string                 `json:"content_type,omitempty"`
	Extras      map[string]interface{} `json:"extras,omitempty"`
}

PushMessage define push message

type PushNotification

type PushNotification struct {
	Alert    string                `json:"alert,omitempty"`
	Android  *NotificationAndroid  `json:"android,omitempty"`
	IOS      *NotificationIOS      `json:"ios,omitempty"`
	WinPhone *NotificationWinPhone `json:"winphone,omitempty"`
}

PushNotification define notification

type PushOptions

type PushOptions struct {
	SendNo            int               `json:"sendno,int,omitempty"`
	TimeToLive        int               `json:"time_to_live,int,omitempty"`
	OverrideMsgID     int64             `json:"override_msg_id,int64,omitempty"`
	ApnsProduction    bool              `json:"apns_production"`
	ApnsCollapseID    string            `json:"apns_collapse_id,omitempty"`
	BigPushDuration   int               `json:"big_push_duration,int,omitempty"`
	ThirdPartyChannel ThirdPartyChannel `json:"third_party_channel,omitempty"`
}

PushOptions define options

type PushRequest

type PushRequest struct {
	Cid          string            `json:"cid,omitempty"`
	Platform     *Platform         `json:"platform"`
	Audience     *PushAudience     `json:"audience"`
	Notification *PushNotification `json:"notification,omitempty"`
	Message      *PushMessage      `json:"message,omitempty"`
	SmsMessage   *SmsMessage       `json:"sms_message,omitempty"`
	Options      *PushOptions      `json:"options,omitempty"`
	Callback     *Callback         `json:"callback,omitempty"`
}

PushRequest define push request body

type PushResponse

type PushResponse struct {
	ErrorResponse
	MsgID  string `json:"msg_id"`
	Sendno string `json:"sendno"`
}

PushResponse define push repsone

type ReportAndroidMessage

type ReportAndroidMessage struct {
	Received   int `json:"received,omitempty"`
	Target     int `json:"target,omitempty"`
	OnlinePush int `json:"online_push,omitempty"`
	Click      int `json:"click,omitempty"`
	MsgClick   int `json:"msg_click,omitempty"`
}

ReportAndroidMessage android message

type ReportDetailResponse

type ReportDetailResponse struct {
	MsgId string `json:"msg_id"`
	Jpush struct {
		Target     int `json:"target"`
		OnlinePush int `json:"online_push"`
		Received   int `json:"received"`
		Click      int `json:"click"`
		MsgClick   int `json:"msg_click"`
	} `json:"jpush"`
	AndroidPns struct {
		PnsTarget   int `json:"pns_target"`
		PnsSent     int `json:"pns_sent"`
		PnsReceived int `json:"pns_received"`
		XmDetail    struct {
			Target   int `json:"target"`
			Sent     int `json:"sent"`
			Received int `json:"received"`
		} `json:"xm_detail"`
		HwDetail struct {
			Target   int `json:"target"`
			Sent     int `json:"sent"`
			Received int `json:"received"`
		} `json:"hw_detail"`
		MzDetail struct {
			Target   int `json:"target"`
			Sent     int `json:"sent"`
			Received int `json:"received"`
		} `json:"mz_detail"`
		OppoDetail struct {
			Target   int `json:"target"`
			Sent     int `json:"sent"`
			Received int `json:"received"`
		} `json:"oppo_detail"`
		VivoDetail struct {
			Target   int `json:"target"`
			Sent     int `json:"sent"`
			Received int `json:"received"`
		} `json:"vivo_detail"`
		FcmDetail struct {
			Target   int `json:"target"`
			Sent     int `json:"sent"`
			Received int `json:"received"`
		} `json:"fcm_detail"`
	} `json:"android_pns"`
	Ios struct {
		ApnsTarget   int `json:"apns_target"`
		ApnsSent     int `json:"apns_sent"`
		ApnsReceived int `json:"apns_received"`
		ApnsClick    int `json:"apns_click"`
		MsgTarget    int `json:"msg_target"`
		MsgReceived  int `json:"msg_received"`
		MsgClick     int `json:"msg_click"`
	} `json:"ios"`
	Winphone struct {
		MpnsTarget int `json:"mpns_target"`
		MpnsSent   int `json:"mpns_sent"`
		Click      int `json:"click"`
	} `json:"winphone"`
	QuickappJpush struct {
		Target     int `json:"target"`
		OnlinePush int `json:"online_push"`
		Received   int `json:"received"`
		Click      int `json:"click"`
		MsgClick   int `json:"msg_click"`
	} `json:"quickapp_jpush"`
	QuickappPns struct {
		PnsTarget int `json:"pns_target"`
		PnsSent   int `json:"pns_sent"`
	} `json:"quickapp_pns"`
}

ReportDetailResponse message statistics details

type ReportIOSMessage

type ReportIOSMessage struct {
	ApnsSent     int `json:"apns_sent,omitempty"`
	ApnsTarget   int `json:"apns_target,omitempty"`
	ApnsReceived int `json:"apns_received,omitempty"`
	Click        int `json:"click,omitempty"`
	Target       int `json:"target,omitempty"`
	Received     int `json:"received,omitempty"`
}

ReportIOSMessage ios message

type ReportMessagesResponse

type ReportMessagesResponse struct {
	ErrorResponse
	MsgID   string                `json:"msg_id,omitempty"`
	Android *ReportAndroidMessage `json:"android,omitempty"`
	IOS     *ReportIOSMessage     `json:"ios,omitempty"`
	Wp      *ReportWpMessage      `json:"winphone,omitempty"`
}

ReportMessagesResponse define report messages

type ReportReceivedResponse

type ReportReceivedResponse struct {
	ErrorResponse
	MsgID           float64 `json:"msg_id"`
	AndroidReceived int     `json:"android_received"`
	IOSApnsSent     int     `json:"ios_apns_sent"`
	IOSApnsReceived int     `json:"ios_apns_received"`
	IOSMsgReceived  int     `json:"ios_msg_received"`
	WpMpnsSent      int     `json:"wp_mpns_sent"`
}

ReportReceivedResponse define report received

type ReportStatusRequest

type ReportStatusRequest struct {
	MsgID           int         `json:"msg_id,int"`
	RegistrationIds []string    `json:"registration_ids"`
	Date            *ReportTime `json:"date,omitempty"`
}

ReportStatusRequest push message status

type ReportTime

type ReportTime time.Time

ReportTime report time

func (*ReportTime) MarshalJSON

func (r *ReportTime) MarshalJSON() (data []byte, err error)

MarshalJSON marshal json

func (*ReportTime) UnmarshalJSON

func (r *ReportTime) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal json

type ReportUser

type ReportUser struct {
	Time    *ReportTime        `json:"time"`
	Android *ReportUserAndroid `json:"android,omitempty"`
	IOS     *ReportUserIOS     `json:"ios,omitempty"`
}

ReportUser define report user item

type ReportUserAndroid

type ReportUserAndroid struct {
	New    int `json:"new,omitempty"`
	Active int `json:"active,omitempty"`
	Online int `json:"online,omitempty"`
}

ReportUserAndroid define report android user

type ReportUserIOS

type ReportUserIOS struct {
	New    int `json:"new,omitempty"`
	Active int `json:"active,omitempty"`
	Online int `json:"online,omitempty"`
}

ReportUserIOS define report ios user

type ReportUsersResponse

type ReportUsersResponse struct {
	ErrorResponse
	TimeUnit string       `json:"time_unit"`
	Start    *ReportTime  `json:"start"`
	Duration int          `json:"duration"`
	Items    []ReportUser `json:"items"`
}

ReportUsersResponse define report user response

type ReportWpMessage

type ReportWpMessage struct {
	MpnsTarget int `json:"mpns_target,omitempty"`
	MpnsSent   int `json:"mpns_sent,omitempty"`
	Click      int `json:"click,omitempty"`
}

ReportWpMessage wp message

type ScheduleMsgsResponse

type ScheduleMsgsResponse struct {
	ErrorResponse
	Count  int           `json:"count"`
	MsgIDs []interface{} `json:"msgids,omitempty"`
}

ScheduleMsgsResponse schedule message

type SchedulePageResponse

type SchedulePageResponse struct {
	ErrorResponse
	TotalCount int                `json:"total_count"`
	TotalPages int                `json:"total_pages"`
	Page       int                `json:"page"`
	Schedules  []ScheduleResponse `json:"schedules"`
}

SchedulePageResponse schedule page response

type SchedulePeriodical

type SchedulePeriodical struct {
	Start     *ScheduleTime `json:"start,omitempty"`
	End       *ScheduleTime `json:"end,omitempty"`
	Time      string        `json:"time,omitempty"`
	TimeUnit  string        `json:"time_unit,omitempty"`
	Frequency int           `json:"frequency,int,omitempty"`
	Point     []string      `json:"point,omitempty"`
}

SchedulePeriodical schedule periodical

type ScheduleRequest

type ScheduleRequest struct {
	Cid     string           `json:"cid,omitempty"`
	Push    *PushRequest     `json:"push,omitempty"`
	Name    string           `json:"name,omitempty"`
	Enabled bool             `json:"enabled,omitempty"`
	Trigger *ScheduleTrigger `json:"trigger,omitempty"`
}

ScheduleRequest schedule request body

type ScheduleResponse

type ScheduleResponse struct {
	ErrorResponse
	ScheduleID string           `json:"schedule_id"`
	Name       string           `json:"name"`
	Enabled    bool             `json:"enabled,omitempty"`
	Trigger    *ScheduleTrigger `json:"trigger,omitempty"`
	Push       *PushRequest     `json:"push,omitempty"`
}

ScheduleResponse new schedule response

type ScheduleSingle

type ScheduleSingle struct {
	Time *ScheduleTime `json:"time,omitempty"`
}

type ScheduleTime

type ScheduleTime time.Time

ScheduleTime schedule time

func (*ScheduleTime) MarshalJSON

func (s *ScheduleTime) MarshalJSON() (data []byte, err error)

MarshalJSON marshal json

func (*ScheduleTime) UnmarshalJSON

func (s *ScheduleTime) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal json

type ScheduleTrigger

type ScheduleTrigger struct {
	Single     *ScheduleSingle     `json:"single,omitempty"`
	Periodical *SchedulePeriodical `json:"periodical,omitempty"`
}

ScheduleTrigger schedule trigger

type SmsMessage

type SmsMessage struct {
	DelayTime int                    `json:"delay_time,int"`
	TempID    float64                `json:"temp_id,float"`
	TempPara  map[string]interface{} `json:"temp_para,omitempty"`
}

SmsMessage define sms message

type ThirdPartyChannel

type ThirdPartyChannel struct {
	Fcm    Fcm    `json:"fcm,omitempty"`
	Huawei Huawei `json:"huawei,omitempty"`
	Meizu  Meizu  `json:"meizu,omitempty"`
	Oppo   Oppo   `json:"oppo,omitempty"`
	Vivo   Vivo   `json:"vivo,omitempty"`
	Xiaomi Xiaomi `json:"xiaomi,omitempty"`
}

type Vivo

type Vivo struct {
	Fcm
	Classification int64 `json:"classification,omitempty"`
	PushMode       int64 `json:"push_mode,omitempty"`
}

type Xiaomi

type Xiaomi struct {
	Fcm
	BigText               string `json:"big_text,omitempty"`
	ChannelID             string `json:"channel_id,omitempty"`
	DistributionCustomize string `json:"distribution_customize,omitempty"`
	LargeIcon             string `json:"large_icon,omitempty"`
	SmallIconColor        string `json:"small_icon_color,omitempty"`
	SmallIconURI          string `json:"small_icon_uri,omitempty"`
	Style                 int64  `json:"style,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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