pub struct Request<T = ()> {Show 18 fields
pub device_token: String,
pub push_type: PushType,
pub id: Option<Uuid>,
pub expiration: Option<OffsetDateTime>,
pub priority: Priority,
pub topic: Option<String>,
pub collapse_id: Option<String>,
pub alert: Option<Alert>,
pub badge: Option<u32>,
pub sound: Option<Sound>,
pub thread_id: Option<String>,
pub category: Option<String>,
pub content_available: bool,
pub mutable_content: bool,
pub target_content_id: Option<String>,
pub interruption_level: Option<InterruptionLevel>,
pub relevance_score: Option<f64>,
pub user_info: Option<T>,
}Expand description
Apple Push Notification service request options.
Fields§
§device_token: StringThe hex-encoded device token.
push_type: PushType(Required for watchOS 6 and later; recommended for macOS, iOS, tvOS, and iPadOS) The value of this header must accurately reflect the contents of your notification’s payload. If there’s a mismatch, or if the header is missing on required systems, APNs may return an error, delay the delivery of the notification, or drop it altogether.
id: Option<Uuid>A canonical UUID that is the unique ID for the notification. If an error occurs when sending the notification, APNs includes this value when reporting the error to your server. Canonical UUIDs are 32 lowercase hexadecimal digits, displayed in five groups separated by hyphens in the form 8-4-4-4-12. For example: 123e4567-e89b-12d3-a456-4266554400a0. If you omit this header, APNs creates a UUID for you and returns it in its response.
expiration: Option<OffsetDateTime>The date at which the notification is no longer valid. This value is a UNIX epoch expressed in seconds (UTC). If the value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed until the specified date. If the value is 0, APNs attempts to deliver the notification only once and doesn’t store it.
A single APNs attempt may involve retries over multiple network interfaces and connections of the destination device. Often these retries span over some time period, depending on the network characteristics. In addition, a push notification may take some time on the network after APNs sends it to the device. APNs uses best efforts to honor the expiry date without any guarantee. If the value is nonzero, the notification may be delivered after the mentioned date. If the value is 0, the notification may be delivered with some delay.
priority: PriorityThe priority of the notification. If you omit this header, APNs sets the notification priority to 10.
Specify 10 to send the notification immediately.
Specify 5 to send the notification based on power considerations on the user’s device.
Specify 1 to prioritize the device’s power considerations over all other factors for delivery, and prevent awakening the device.
topic: Option<String>The topic for the notification. In general, the topic is your app’s bundle ID/app ID. It can have a suffix based on the type of push notification. If you’re using a certificate that supports PushKit VoIP or watchOS complication notifications, you must include this header with bundle ID of you app and if applicable, the proper suffix. If you’re using token-based authentication with APNs, you must include this header with the correct bundle ID and suffix combination. To learn more about app ID, see Register an App ID.
collapse_id: Option<String>An identifier you use to coalesce multiple notifications into a single notification for the user. Typically, each notification request causes a new notification to be displayed on the user’s device. When sending the same notification more than once, use the same value in this header to coalesce the requests. The value of this key must not exceed 64 bytes.
alert: Option<Alert>The information for displaying an alert.
badge: Option<u32>The number to display in a badge on your app’s icon. Specify 0 to
remove the current badge, if any.
sound: Option<Sound>The name of a sound file in your app’s main bundle or in the
Library/Sounds folder of your app’s container directory or a
dictionary that contains sound information for critical alerts.
thread_id: Option<String>An app-specific identifier for grouping related notifications. This
value corresponds to the
threadIdentifier
property in the UNNotificationContent object.
category: Option<String>The notification’s type. This string must correspond to the
identifier
of one of the UNNotificationCategory objects you register at launch
time. See Declaring Your Actionable Notification
Types.
content_available: boolThe background notification flag. To perform a silent background update,
specify the value 1 and don’t include the alert, badge, or sound
keys in your payload. See Pushing Background Updates to Your
App.
mutable_content: boolThe notification service app extension flag. If the value is 1, the
system passes the notification to your notification service app
extension before delivery. Use your extension to modify the
notification’s content. See Modifying Content in Newly Delivered
Notifications.
target_content_id: Option<String>The identifier of the window brought forward. The value of this key will
be populated on the
UNNotificationContent
object created from the push payload. Access the value using the
UNNotificationContent
object’s
targetContentIdentifier
property.
interruption_level: Option<InterruptionLevel>The importance and delivery timing of a notification. The string values
passive, active, time-sensitive, or critical correspond to the
UNNotificationInterruptionLevel
enumeration cases.
relevance_score: Option<f64>The relevance score, a number between 0 and 1, that the system uses
to sort the notifications from your app. The highest score gets featured
in the notification summary. See
relevanceScore.
user_info: Option<T>Additional data to send.