@@ -5,68 +5,107 @@ import (
55 "time"
66)
77
8- //EPushType defines the value for the apns-push-type header
8+ // EPushType defines the value for the apns-push-type header
99type EPushType string
1010
1111const (
12- //PushTypeAlert will set the apns-push-type header to 'alert'
12+ // PushTypeAlert is used for notifications that trigger a user interaction —
13+ // for example, an alert, badge, or sound. If you set this push type, the
14+ // apns-topic header field must use your app’s bundle ID as the topic. The
15+ // alert push type is required on watchOS 6 and later. It is recommended on
16+ // macOS, iOS, tvOS, and iPadOS.
1317 PushTypeAlert EPushType = "alert"
14- //PushTypeBackground will set the apns-push-type header to 'background'
18+
19+ // PushTypeBackground is used for notifications that deliver content in the
20+ // background, and don’t trigger any user interactions. If you set this push
21+ // type, the apns-topic header field must use your app’s bundle ID as the
22+ // topic. The background push type is required on watchOS 6 and later. It is
23+ // recommended on macOS, iOS, tvOS, and iPadOS.
1524 PushTypeBackground EPushType = "background"
16- //PushTypeVoIP will set the apns-push-type header to 'voip' which is required
17- // for PushKit applications.
18- PushTypeVoIP EPushType = "voip"
25+
26+ // PushTypeVOIP is used for notifications that provide information about an
27+ // incoming Voice-over-IP (VoIP) call. If you set this push type, the
28+ // apns-topic header field must use your app’s bundle ID with .voip appended
29+ // to the end. If you’re using certificate-based authentication, you must
30+ // also register the certificate for VoIP services. The voip push type is
31+ // not available on watchOS. It is recommended on macOS, iOS, tvOS, and
32+ // iPadOS.
33+ PushTypeVOIP EPushType = "voip"
34+
35+ // PushTypeComplication is used for notifications that contain update
36+ // information for a watchOS app’s complications. If you set this push type,
37+ // the apns-topic header field must use your app’s bundle ID with
38+ // .complication appended to the end. If you’re using certificate-based
39+ // authentication, you must also register the certificate for WatchKit
40+ // services. The complication push type is recommended for watchOS and iOS.
41+ // It is not available on macOS, tvOS, and iPadOS.
42+ PushTypeComplication EPushType = "complication"
43+
44+ // PushTypeFileProvider is used to signal changes to a File Provider
45+ // extension. If you set this push type, the apns-topic header field must
46+ // use your app’s bundle ID with .pushkit.fileprovider appended to the end.
47+ // The fileprovider push type is not available on watchOS. It is recommended
48+ // on macOS, iOS, tvOS, and iPadOS.
49+ PushTypeFileProvider EPushType = "fileprovider"
50+
51+ // PushTypeMDM is used for notifications that tell managed devices to
52+ // contact the MDM server. If you set this push type, you must use the topic
53+ // from the UID attribute in the subject of your MDM push certificate.
54+ PushTypeMDM EPushType = "mdm"
1955)
2056
2157const (
2258 // PriorityLow will tell APNs to send the push message at a time that takes
2359 // into account power considerations for the device. Notifications with this
24- // priority might be grouped and delivered in bursts. They are throttled, and
25- // in some cases are not delivered.
60+ // priority might be grouped and delivered in bursts. They are throttled,
61+ // and in some cases are not delivered.
2662 PriorityLow = 5
2763
2864 // PriorityHigh will tell APNs to send the push message immediately.
29- // Notifications with this priority must trigger an alert, sound, or badge on
30- // the target device. It is an error to use this priority for a push
65+ // Notifications with this priority must trigger an alert, sound, or badge
66+ // on the target device. It is an error to use this priority for a push
3167 // notification that contains only the content-available key.
3268 PriorityHigh = 10
3369)
3470
3571// Notification represents the the data and metadata for a APNs Remote Notification.
3672type Notification struct {
3773
38- // An optional canonical UUID that identifies the notification. The canonical
39- // form is 32 lowercase hexadecimal digits, displayed in five groups separated
40- // by hyphens in the form 8-4-4-4-12. An example UUID is as follows:
74+ // An optional canonical UUID that identifies the notification. The
75+ // canonical form is 32 lowercase hexadecimal digits, displayed in five
76+ // groups separated by hyphens in the form 8-4-4-4-12. An example UUID is as
77+ // follows:
4178 //
42- // 123e4567-e89b-12d3-a456-42665544000
79+ // 123e4567-e89b-12d3-a456-42665544000
4380 //
4481 // If you don't set this, a new UUID is created by APNs and returned in the
4582 // response.
4683 ApnsID string
4784
48- // A string which allows multiple notifications with the same collapse identifier
49- // to be displayed to the user as a single notification. The value should not
50- // exceed 64 bytes.
85+ // A string which allows multiple notifications with the same collapse
86+ // identifier to be displayed to the user as a single notification. The
87+ // value should not exceed 64 bytes.
5188 CollapseID string
5289
53- // A string containing hexadecimal bytes of the device token for the target device.
90+ // A string containing hexadecimal bytes of the device token for the target
91+ // device.
5492 DeviceToken string
5593
56- // The topic of the remote notification, which is typically the bundle ID for
57- // your app. The certificate you create in the Apple Developer Member Center
58- // must include the capability for this topic. If your certificate includes
59- // multiple topics, you must specify a value for this header. If you omit this
60- // header and your APNs certificate does not specify multiple topics, the APNs
61- // server uses the certificate’s Subject as the default topic.
94+ // The topic of the remote notification, which is typically the bundle ID
95+ // for your app. The certificate you create in the Apple Developer Member
96+ // Center must include the capability for this topic. If your certificate
97+ // includes multiple topics, you must specify a value for this header. If
98+ // you omit this header and your APNs certificate does not specify multiple
99+ // topics, the APNs server uses the certificate’s Subject as the default
100+ // topic.
62101 Topic string
63102
64103 // An optional time at which the notification is no longer valid and can be
65104 // discarded by APNs. If this value is in the past, APNs treats the
66105 // notification as if it expires immediately and does not store the
67106 // notification or attempt to redeliver it. If this value is left as the
68- // default (ie, Expiration.IsZero()) an expiration header will not added to the
69- // http request.
107+ // default (ie, Expiration.IsZero()) an expiration header will not added to
108+ // the http request.
70109 Expiration time.Time
71110
72111 // The priority of the notification. Specify ether apns.PriorityHigh (10) or
@@ -79,8 +118,9 @@ type Notification struct {
79118 // Remote Notification Programming Guide for more info.
80119 Payload interface {}
81120
82- // The pushtype of the push notification. If this values is left as the default
83- // an apns-push-type header with value 'alert' will be added to the http request.
121+ // The pushtype of the push notification. If this values is left as the
122+ // default an apns-push-type header with value 'alert' will be added to the
123+ // http request.
84124 PushType EPushType
85125}
86126
0 commit comments