Documentation ¶
Index ¶
- func MakeBatch(pipe <-chan Recipient, buffer []Recipient) (int, bool)
- func Notify(c CMS, message *Message, pipe <-chan Recipient) error
- type APN
- type APNConfig
- type CMS
- type CMSConfig
- type CMSFactory
- type FCM
- type FCMConfig
- type GCM
- type GCMConfig
- type Message
- type Recipient
- type Recipients
- type Response
- type Responses
- type WNSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APN ¶
type APN struct {
// contains filtered or unexported fields
}
APN represent Apple Notification Service client.
func NewAPNClient ¶
NewAPNClient contructs an instance of APNS client.
func (*APN) NotifyMany ¶
NotifyMany notifies a chunk of recipients with the same message.
type CMS ¶
type CMS interface { // Close closes CMS client. Close() error // NotifyOne notifies only one recipient. NotifyOne(*Message, *Recipient) error // NotifeMany notifies multiple recipients. NotifyMany(*Message, []Recipient) error }
CMS generalize notion of Cloud Message Service client like APNS or GCM.
type CMSFactory ¶
type CMSFactory struct {
// contains filtered or unexported fields
}
CMSFactory contains common configuration for any CMS client and produce client by its name.
func NewCMSFactory ¶
func NewCMSFactory(cfg *CMSConfig, errs chan<- Response) (*CMSFactory, error)
NewCMSFactory creates new instance of factory.
func (CMSFactory) Produce ¶
func (f CMSFactory) Produce(name string, responses chan<- Response) (CMS, error)
Produce makes new instance of CMS client object by its name or target platform. Avaliable names are `apn` or `ios` for APNS, `fcm` or `android` for FCM, `gcm` for GCM and `wns` or `windows` for WNS.
type FCM ¶
type FCM struct {
// contains filtered or unexported fields
}
FCM represent Firebase Cloud Messaging service client.
func NewFCMClient ¶
NewFCMClient contructs an instance of FCM client.
func (*FCM) NotifyMany ¶
NotifyMany notifies a chunk of recipients with the same message.
type FCMConfig ¶
type FCMConfig struct {
APIKey string `toml:"api_key"`
}
FCMConfig stores settings for FCM client.
type GCM ¶
type GCM struct {
// contains filtered or unexported fields
}
GCM represent Google Cloud Messaging service client.
func NewGCMClient ¶
NewGCMClient contructs an instance of GCM client.
func (*GCM) NotifyMany ¶
NotifyMany notifies a chunk of recipients with the same message.
type Message ¶
Message contains push notification payload.
func MessageFromFile ¶
MessageFromFile fills notification payload from json file.
type Recipient ¶
type Recipient struct { Id uuid.UUID Token string }
Recipient identifies recipient by its UUID and push token string.
type Recipients ¶
type Recipients struct {
// contains filtered or unexported fields
}
Recipients represents object to iterates over lines of csv file with recipients identifiers like id or token.
func RecipientsFromFile ¶
func RecipientsFromFile(path string) (*Recipients, error)
RecipientsFromFile create instance of Recipients structure from csv file by its filename.
func (*Recipients) Next ¶
func (r *Recipients) Next() (*Recipient, error)
Next does step of iteration and returns next recipient.