Documentation ¶
Index ¶
Constants ¶
const ( Development = "https://api.development.push.apple.com" Production = "https://api.push.apple.com" )
Apple Development and Production URLs
const ( ApnsID = "apns-id" ApnsExpiration = "apns-expiration" ApnsPriority = "apns-priority" ApnsTopic = "apns-topic" )
Request headers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // A short string describing the purpose of the notification. Apple Watch // displays this string as part of the notification interface. This // string is displayed only briefly and should be crafted so that // it can be understood quickly. This key was added in iOS 8.2. Title string `json:"title,omitempty"` // The text of the alert message. Body string `json:"body,omitempty"` // The key to a title string in the Localizable.strings file for the current localization. // The key string can be formatted with %@ and %n$@ specifiers to take the variables // specified in the title-loc-args array. See Localized Formatted Strings for // more information.This key was added in iOS 8.2. TitleLocKey string `json:"title-loc-key,omitempty"` // Variable string values to appear in place of the format specifiers in title-loc-key. // See Localized Formatted Strings for more information.This key was added in iOS 8.2. TitleLocArgs []string `json:"title-loc-args,omitempty"` // If a string is specified, the system displays an alert that includes the Close and View buttons. // The string is used as a key to get a localized string in the current localization to use // for the right button’s title instead of “View”. See Localized Formatted Strings // for more information. ActionLocKey string `json:"action-loc-key,omitempty"` // A key to an alert-message string in a Localizable.strings file for the current // localization (which is set by the user’s language preference).The key string // can be formatted with %@ and %n$@ specifiers to take the variables // specified in the loc-args array. See Localized Formatted // Strings for more information. LocKey string `json:"loc-key,omitempty"` // Variable string values to appear in place of the format specifiers in loc-key. See Localized Formatted Strings for more information. LocArgs []string `json:"loc-args,omitempty"` // The filename of an image file in the app bundle; it may include the extension or omit it. // The image is used as the launch image when users tap the action button or move the // action slider.If this property is not specified, the system either uses the // previous snapshot,uses the image identified by the UILaunchImageFile key // in the app’s Info.plist file, or falls back to Default.png. // This property was added in iOS 4.0. LaunchImage string `json:"launch-image,omitempty"` }
Alert If this property is included, the system displays a standard alert or a banner, based on the user’s setting. You can specify a string or a dictionary as the value of alert.
type ApnsResponse ¶
type ApnsResponse struct { StatusCode int StatusCodeDescription string ApnsID string `json:"apns-id,omitempty"` Reason string `json:"reason,omitempty"` }
ApnsResponse contains apns-id, reason, status code, status code description.
type Client ¶
type Client struct { HTTPClient *http.Client Certificate tls.Certificate Host string }
Client struct with HTTPClient, Certificate, Host as parameters.
type ErrorResponse ¶
type ErrorResponse struct { Reason string `json:"reason,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` }
ErrorResponse contains reason, timestamp
type Payload ¶
type Payload struct { // If this property is included, the system displays a standard alert or a banner, based on the user’s setting. Alert Alert // The number to display as the badge of the app icon. If this // property is absent, the badge is not changed. To remove // the badge, set the value of this property to 0. Badge uint // The name of a sound file in the app bundle or in the Library/Sounds folder of the app’s data container. The sound // in this file is played as an alert. If the sound file doesn’t exist or default is specified as the value, // the default alert sound is played.The audio must be in one of the audio data formats that are // compatible with system sounds. Sound string // Provide this key with a value of 1 to indicate that new content is available. Including // this key and value means that when your app is launched in the background or resumed, // application:didReceiveRemoteNotification:fetchCompletionHandler: is called. ContentAvailable bool // Provide this key with a string value that represents the identifier // property of the UIMutableUserNotificationCategory object // you created to define custom actions Category string }
Payload For each notification, compose a JSON dictionary object (as defined by RFC 4627). This dictionary must contain another dictionary identified by the aps key. The aps dictionary can contain one or more properties that specify the following user notification types: An alert message to display to the user A number to badge the app icon with A sound to play.
func (Payload) MarshalJSON ¶
MarshalJSON returns []byte, error