pushie

package module
v0.0.0-...-8fbe7d1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: MIT Imports: 9 Imported by: 0

README

Pushie

GoDoc

Push notification library, intended for Apple's APNS and Google's FCM (GCM) processing, but with an interface to fit other services in as well

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDestination = errors.New("No destination: please specifify a device or a topic")
)

Error List

Functions

This section is empty.

Types

type Client

type Client struct {
	Google *google.Client
	Apple  *apple.Client
}

Client is a common interface for both APNS and FCM

func (*Client) SendApple

func (c *Client) SendApple(m *Message) (string, int, error)

SendApple calls to Apple service

func (*Client) SendGoogle

func (c *Client) SendGoogle(m *Message) (string, int, error)

SendGoogle calls to Google service

type Destination

type Destination struct {
	Topic  string `json:"topic,omitempty"`
	Device string `json:"device,omitempty"`
}

Destination is message recepient or topic

type Message

type Message struct {
	Apple  *Destination `json:"apple,omitempty"`
	Google *Destination `json:"google,omitempty"`

	Priority   Priority      `json:"priority,omitempty"`
	TTL        time.Duration `json:"ttl,omitempty"`
	Title      string        `json:"title,omitempty"`
	Body       string        `json:"body,omitempty"`
	CollapseID string        `json:"collapse_id,omitempty"`
	IsData     bool          `json:"is_data,omitempty"`

	Data map[string]interface{} `json:"data,omitempty"`
}

Message is the notification data

func (Message) ToApns

func (m Message) ToApns() *apns.Notification

ToApns converts the Message to a the Apns version

func (Message) ToFirebase

func (m Message) ToFirebase() *firebase.Message

ToFirebase converts the Message to a the Firebase version

type Priority

type Priority int

Priority is the message priority

const (
	PriorityNormal Priority = apns.PriorityLow
	PriorityHigh   Priority = apns.PriorityHigh
)

Priorities

func (Priority) String

func (p Priority) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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