Documentation
¶
Index ¶
- Constants
- Variables
- type AdminAppRequest
- type AdminAppResponse
- type AdminCertificateRequest
- type AdminSuccessResponse
- type Audience
- type DefaultResponse
- type DeviceAliasResponse
- type DeviceModify
- type DeviceRegistrationIDRequest
- type DeviceRegistrationIDResponse
- type DeviceStatusRequest
- type DeviceStatusResponse
- type DeviceTagsListResponse
- type DeviceTagsRegistrationIDResponse
- type DeviceTagsRequest
- type ErrorMessage
- type ErrorResponse
- type GroupPush
- type JPush
- func (j *JPush) AdminApp(req **AdminAppRequest) (*AdminAppResponse, error)
- func (j *JPush) AdminAppCert(appkey string, req *AdminCertificateRequest) (*AdminSuccessResponse, error)
- func (j *JPush) AdminAppDelete(appkey string) (*AdminSuccessResponse, error)
- func (j *JPush) DeviceDeleteAlias(alias string, platforms []string) (*DefaultResponse, error)
- func (j *JPush) DeviceDeleteTags(tag string, platforms []string) (*DefaultResponse, error)
- func (j *JPush) DeviceGetAlias(alias string, platforms []string) (*DeviceAliasResponse, error)
- func (j *JPush) DeviceGetRegistrationID(registrationID string) (*DeviceRegistrationIDResponse, error)
- func (j *JPush) DeviceGetTags() (*DeviceTagsListResponse, error)
- func (j *JPush) DeviceGetTagsRegistrationID(tag string, registrationID string) (*DeviceTagsRegistrationIDResponse, error)
- func (j *JPush) DevicePostRegistrationID(registrationID string, req *DeviceRegistrationIDRequest) (*DefaultResponse, error)
- func (j *JPush) DevicePostStatus(req *DeviceStatusRequest) (map[string]DeviceStatusResponse, error)
- func (j *JPush) DevicePostTags(tag string, req *DeviceTagsRequest) (*DefaultResponse, error)
- func (j *JPush) GetURL(key string) string
- func (j *JPush) Push(req *PushRequest) (*PushResponse, error)
- func (j *JPush) PushGetCid(count int, cidtype string) (*PushCIDResponse, error)
- func (j *JPush) PushValidate(req *PushRequest) (*PushResponse, error)
- func (j *JPush) ReportMessages(msgIds []string) (*ReportMessagesResponse, error)
- func (j *JPush) ReportReceived(msgIds []string) ([]ReportReceivedResponse, error)
- func (j *JPush) ReportStatus(req *ReportStatusRequest) (map[string]MessageStatus, error)
- func (j *JPush) ReportUsers(timeUnit string, start time.Time, duration int) (*ReportUsersResponse, error)
- func (j *JPush) Schedule(req *ScheduleRequest) (*ScheduleResponse, error)
- func (j *JPush) ScheduleDelete(scheduleID string) (*DefaultResponse, error)
- func (j *JPush) ScheduleID(scheduleID string) (*ScheduleResponse, error)
- func (j *JPush) ScheduleIDMsgs(scheduleID string) (*ScheduleMsgsResponse, error)
- func (j *JPush) SchedulePage(page int) (*SchedulePageResponse, error)
- func (j *JPush) SchedulePut(scheduleID string, req *ScheduleRequest) (*ScheduleResponse, error)
- func (j *JPush) SetAuthorization(key, secret string)
- func (j *JPush) SetZone(zone string)
- type MessageStatus
- type NotificationAndroid
- type NotificationIOS
- type NotificationWinPhone
- type Platform
- type PushAudience
- type PushCIDResponse
- type PushMessage
- type PushNotification
- type PushOptions
- type PushRequest
- type PushResponse
- type ReportAndroidMessage
- type ReportIOSMessage
- type ReportMessagesResponse
- type ReportReceivedResponse
- type ReportStatusRequest
- type ReportTime
- type ReportUser
- type ReportUserAndroid
- type ReportUserIOS
- type ReportUsersResponse
- type ReportWpMessage
- type ScheduleMsgsResponse
- type SchedulePageResponse
- type SchedulePeriodical
- type ScheduleRequest
- type ScheduleResponse
- type ScheduleTime
- type ScheduleTrigger
- type SmsMessage
Constants ¶
const (
VERSION = "1.0"
)
VERSION api client version
Variables ¶
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 {
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 {
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"`
}
Audience define Audience
type DeviceAliasResponse ¶
type DeviceAliasResponse struct {
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 {
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 {
Online bool `json:"online"`
LastOnlineTime string `json:"last_online_time,omitempty"`
}
DeviceStatusResponse get device status response
type DeviceTagsListResponse ¶
type DeviceTagsListResponse struct {
Tags []string `json:"tags"`
}
DeviceTagsListResponse get tags list response
type DeviceTagsRegistrationIDResponse ¶
type DeviceTagsRegistrationIDResponse struct {
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 ¶
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 GroupPush ¶
type GroupPush struct {
JPush
}
GroupPush grouppush core struct
func NewGroupPush ¶
NewGroupPush new grouppush object
func (*GroupPush) GroupPush ¶
func (j *GroupPush) GroupPush(req *PushRequest) (*PushResponse, error)
GroupPush group push POST /v3/grouppush
func (*GroupPush) SetAuthorization ¶
SetAuthorization set grouppush authorization
type JPush ¶
type JPush struct {
Zone string
Quota int // 当前 AppKey 一个时间窗口内可调用次数
Remaining int // 当前时间窗口剩余的可用次数
Reset int // 距离时间窗口重置剩余的秒数
// contains filtered or unexported fields
}
JPush jpush core struct
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) 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) 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(count int, cidtype string) (*PushCIDResponse, error)
PushGetCid 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
func (*JPush) ReportReceived ¶
func (j *JPush) ReportReceived(msgIds []string) ([]ReportReceivedResponse, error)
ReportReceived report received GET /v3/received
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) 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) SetAuthorization ¶
SetAuthorization set Authorization
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"`
}
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"`
}
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 Platform ¶
type Platform struct {
Platforms []string
// contains filtered or unexported fields
}
Platform define platform entry
func (*Platform) MarshalJSON ¶
MarshalJSON marshal json
func (*Platform) UnmarshalJSON ¶
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) UnmarshalJSON ¶
func (p *PushAudience) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshal json
type PushCIDResponse ¶
type PushCIDResponse struct {
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"`
}
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"`
}
PushRequest define push request body
type PushResponse ¶
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 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 {
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 {
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 ¶
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 {
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 {
Count int `json:"count"`
MsgIDs []interface{} `json:"msgids,omitempty"`
}
ScheduleMsgsResponse schedule message
type SchedulePageResponse ¶
type SchedulePageResponse struct {
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 {
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 ScheduleTime ¶
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 *ScheduleTime `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