Versions in this module Expand all Collapse all v1 v1.0.1 Oct 9, 2019 Changes in this version type OS + const IOS v1.0.0 Oct 9, 2018 Changes in this version + var ErrInvalidCID = errors.New("invalid cid") + func GetPushID(ctx context.Context) (string, error) + func GetScheduleID(ctx context.Context) (string, error) + func Push(ctx context.Context, payload *Payload, callback PushResultHandle) error + func PushValidate(ctx context.Context, payload *Payload, callback PushResultHandle) error + func Terminate() + type AndroidNotification struct + Alert string + AlertType int + BigPicPath string + BigText string + BuilderID int + Category string + Extras map[string]interface{} + Inbox map[string]interface{} + Priority int + Style int + Title string + func NewAndroidNotification() *AndroidNotification + func (n *AndroidNotification) SetAlert(alert string) *AndroidNotification + func (n *AndroidNotification) SetAlertType(alertType int) *AndroidNotification + func (n *AndroidNotification) SetBigPicPath(bigPicPath string) *AndroidNotification + func (n *AndroidNotification) SetBigText(bigText string) *AndroidNotification + func (n *AndroidNotification) SetBuilderID(builderID int) *AndroidNotification + func (n *AndroidNotification) SetCategory(category string) *AndroidNotification + func (n *AndroidNotification) SetExtras(extras map[string]interface{}) *AndroidNotification + func (n *AndroidNotification) SetInbox(inbox map[string]interface{}) *AndroidNotification + func (n *AndroidNotification) SetPriority(priority int) *AndroidNotification + func (n *AndroidNotification) SetStyle(style int) *AndroidNotification + func (n *AndroidNotification) SetTitle(title string) *AndroidNotification + type Audience struct + IsAll bool + Value map[string][]string + func NewAudience() *Audience + func (a *Audience) All() *Audience + func (a *Audience) MarshalJSON() ([]byte, error) + func (a *Audience) SetAbTest(abtests ...string) *Audience + func (a *Audience) SetAlias(aliases ...string) *Audience + func (a *Audience) SetRegistrationID(registrationIDs ...string) *Audience + func (a *Audience) SetSegment(segments ...string) *Audience + func (a *Audience) SetTag(tags ...string) *Audience + func (a *Audience) SetTagAnd(tags ...string) *Audience + func (a *Audience) SetTagNot(tags ...string) *Audience + func (a *Audience) SetValue(key string, values ...string) *Audience + type CIDClient struct + func NewCIDClient(count int, opts ...Option) *CIDClient + func (c *CIDClient) GetPushID(ctx context.Context) (string, error) + func (c *CIDClient) GetScheduleID(ctx context.Context) (string, error) + type Client struct + func Init(maxThread int, opts ...Option) *Client + func NewClient(maxThread int, opts ...Option) *Client + func (c *Client) GetPushID(ctx context.Context) (string, error) + func (c *Client) GetScheduleID(ctx context.Context) (string, error) + func (c *Client) Push(ctx context.Context, payload *Payload, callback PushResultHandle) error + func (c *Client) PushValidate(ctx context.Context, payload *Payload, callback PushResultHandle) error + func (c *Client) Terminate() + type Error struct + ErrorItem *ErrorItem + HeaderItem *HeaderItem + StatusCode int + func (e *Error) Error() string + type ErrorItem struct + Code int + Message string + func NewErrorItem(code int, message string) *ErrorItem + type HeaderItem struct + XRateLimitQuota int + XRateLimitRemaining int + XRateLimitReset int + type IOSNotification struct + Alert interface{} + Badge interface{} + Category string + ContentAvailable bool + Extras map[string]interface{} + MutableContent bool + Sound string + func NewIOSNotification() *IOSNotification + func (n *IOSNotification) SetAlert(alert interface{}) *IOSNotification + func (n *IOSNotification) SetBadge(badge interface{}) *IOSNotification + func (n *IOSNotification) SetCategory(category string) *IOSNotification + func (n *IOSNotification) SetContentAvailable(contentAvailable bool) *IOSNotification + func (n *IOSNotification) SetExtras(extras map[string]interface{}) *IOSNotification + func (n *IOSNotification) SetMutableContent(mutableContent bool) *IOSNotification + func (n *IOSNotification) SetSound(sound string) *IOSNotification + type Message struct + Content string + ContentType string + Extras map[string]interface{} + Title string + func NewMessage() *Message + func (m *Message) SetContent(content string) *Message + func (m *Message) SetContentType(contentType string) *Message + func (m *Message) SetExtras(extras map[string]interface{}) *Message + func (m *Message) SetTitle(title string) *Message + type Notification struct + Alert string + Android *AndroidNotification + IOS *IOSNotification + WinPhone *WinPhoneNotification + func NewNotification() *Notification + func (n *Notification) SetAlert(alert string) *Notification + func (n *Notification) SetAndroidNotification(android *AndroidNotification) *Notification + func (n *Notification) SetIOSNotification(ios *IOSNotification) *Notification + func (n *Notification) SetWinPhoneNotification(winPhone *WinPhoneNotification) *Notification + type OS string + const Android + const WinPhone + func (o OS) String() string + type Option func(o *options) + func SetAppKey(appKey string) Option + func SetCIDCount(count int) Option + func SetHost(host string) Option + func SetMasterSecret(masterSecret string) Option + type Options struct + ApnsCollapseID string + ApnsProduction bool + BigPushDuration int + OverrideMsgID int64 + SendNO int + TimeLive int + func NewOptions() *Options + func (o *Options) SetApnsCollapseID(apnsCollapseID string) *Options + func (o *Options) SetApnsProduction(prod bool) *Options + func (o *Options) SetBigPushDuration(bigPushDuration int) *Options + func (o *Options) SetOverrideMsgID(overrideMsgID int64) *Options + func (o *Options) SetSendNO(sendNO int) *Options + func (o *Options) SetTimeLive(timeLive int) *Options + type Payload struct + Audience *Audience + CID string + Message *Message + Notification *Notification + Options *Options + Platform *Platform + SmsMessage *SmsMessage + func (p *Payload) Reader() io.Reader + func (p *Payload) String() string + type Platform struct + IsAll bool + Value []string + func NewPlatform() *Platform + func (p *Platform) Add(oss ...OS) *Platform + func (p *Platform) All() *Platform + func (p *Platform) MarshalJSON() ([]byte, error) + type PushResult struct + MsgID string + SendNO string + func (r *PushResult) String() string + type PushResultHandle func(context.Context, *PushResult, error) + type SmsMessage struct + DelayTime int + TempID int64 + TempPara interface{} + func NewSmsMessage() *SmsMessage + func (m *SmsMessage) SetDelayTime(delayTime int) *SmsMessage + func (m *SmsMessage) SetTempID(tempID int64) *SmsMessage + func (m *SmsMessage) SetTempPara(tempPara interface{}) *SmsMessage + type WinPhoneNotification struct + Alert string + Extras map[string]interface{} + OpenPage string + Title string + func NewWinPhoneNotification() *WinPhoneNotification + func (n *WinPhoneNotification) SetAlert(alert string) *WinPhoneNotification + func (n *WinPhoneNotification) SetExtras(extras map[string]interface{}) *WinPhoneNotification + func (n *WinPhoneNotification) SetOpenPage(openPage string) *WinPhoneNotification + func (n *WinPhoneNotification) SetTitle(title string) *WinPhoneNotification