Documentation ¶
Overview ¶
Package payload serializes a JSON payload to push.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrIncomplete = errors.New("payload does not contain necessary fields")
)
validation errors
Functions ¶
This section is empty.
Types ¶
type APS ¶
type APS struct { // Alert dictionary. Alert Alert // Badge to display on the app icon. // Set to badge.Preserve (default), badge.Clear // or a specific value with badge.New(n). Badge badge.Badge // The name of a sound file to play as an alert. Sound string // Content available for silent notifications. // With no alert, sound, or badge. ContentAvailable bool // Category identifier for custom actions in iOS 8 or newer. Category string }
APS is Apple's reserved namespace.
func (*APS) Map ¶
Map returns the APS payload as a map that you can customize before serializing it to JSON. TODO: Make this map implement json.Marshaler for use with Service.Push.
func (APS) MarshalJSON ¶
MarshalJSON allows you to json.Marshal(aps) directly.
type Alert ¶
type Alert struct { // Title is a short string shown briefly on Apple Watch in iOS 8.2 or newer. Title string `json:"title,omitempty"` TitleLocKey string `json:"title-loc-key,omitempty"` TitleLocArgs []string `json:"title-loc-args,omitempty"` // Body text of the alert message. Body string `json:"body,omitempty"` LocKey string `json:"loc-key,omitempty"` LocArgs []string `json:"loc-args,omitempty"` // Key for localized string for "View" button. ActionLocKey string `json:"action-loc-key,omitempty"` // Image file to be used when user taps or slides the action button. LaunchImage string `json:"launch-image,omitempty"` }
Alert dictionary.
type Browser ¶ added in v0.2.0
type Browser struct { // Alert dictionary. Alert BrowserAlert URLArgs []string }
Browser for Safari Push Notifications
func (Browser) MarshalJSON ¶ added in v0.2.0
MarshalJSON allows you to json.Marshal(browser) directly.
type BrowserAlert ¶ added in v0.2.0
type BrowserAlert struct { // Title and Body are required Title string `json:"title"` Body string `json:"body"` // Action button label (defaults to "Show") Action string `json:"action,omitempty"` }
BrowserAlert for Safari Push Notifications
Click to show internal directories.
Click to hide internal directories.