|  | 
|  | 1 | +//===----------------------------------------------------------------------===// | 
|  | 2 | +// | 
|  | 3 | +// This source file is part of the APNSwift open source project | 
|  | 4 | +// | 
|  | 5 | +// Copyright (c) 2022 the APNSwift project authors | 
|  | 6 | +// Licensed under Apache License v2.0 | 
|  | 7 | +// | 
|  | 8 | +// See LICENSE.txt for license information | 
|  | 9 | +// See CONTRIBUTORS.txt for the list of APNSwift project authors | 
|  | 10 | +// | 
|  | 11 | +// SPDX-License-Identifier: Apache-2.0 | 
|  | 12 | +// | 
|  | 13 | +//===----------------------------------------------------------------------===// | 
|  | 14 | + | 
|  | 15 | +import struct Foundation.UUID | 
|  | 16 | + | 
|  | 17 | +/// A location notification. | 
|  | 18 | +public struct APNSLocationNotification { | 
|  | 19 | +    /// A canonical UUID that identifies the notification. If there is an error sending the notification, | 
|  | 20 | +    /// APNs uses this value to identify the notification to your server. The canonical form is 32 lowercase hexadecimal digits, | 
|  | 21 | +    /// displayed in five groups separated by hyphens in the form 8-4-4-4-12. An example UUID is as follows: | 
|  | 22 | +    /// `123e4567-e89b-12d3-a456-42665544000`. | 
|  | 23 | +    /// | 
|  | 24 | +    /// If you omit this, a new UUID is created by APNs and returned in the response. | 
|  | 25 | +    public var apnsID: UUID? | 
|  | 26 | + | 
|  | 27 | +    /// The topic for the notification. In general, the topic is your app’s bundle ID/app ID suffixed with `.location-query`. | 
|  | 28 | +    public var topic: String | 
|  | 29 | + | 
|  | 30 | +    /// The priority of the notification. | 
|  | 31 | +    public var priority: APNSPriority | 
|  | 32 | + | 
|  | 33 | +    /// Initializes a new ``APNSLocationNotification``. | 
|  | 34 | +    /// | 
|  | 35 | +    /// - Important: Your dynamic payload will get encoded to the root of the JSON payload that is send to APNs. | 
|  | 36 | +    /// It is **important** that you do not encode anything with the key `aps` | 
|  | 37 | +    /// | 
|  | 38 | +    /// - Parameters: | 
|  | 39 | +    ///   - priority: The priority of the notification. | 
|  | 40 | +    ///   - appID: Your app’s bundle ID/app ID. This will be suffixed with `.location-query`. | 
|  | 41 | +    ///   - apnsID: A canonical UUID that identifies the notification. | 
|  | 42 | +    @inlinable | 
|  | 43 | +    public init( | 
|  | 44 | +        priority: APNSPriority, | 
|  | 45 | +        appID: String, | 
|  | 46 | +        apnsID: UUID? = nil | 
|  | 47 | +    ) { | 
|  | 48 | +        self.init( | 
|  | 49 | +            priority: priority, | 
|  | 50 | +            topic: appID + ".location-query", | 
|  | 51 | +            apnsID: apnsID | 
|  | 52 | +        ) | 
|  | 53 | +    } | 
|  | 54 | + | 
|  | 55 | +    /// Initializes a new ``APNSLocationNotification``. | 
|  | 56 | +    /// | 
|  | 57 | +    /// - Important: Your dynamic payload will get encoded to the root of the JSON payload that is send to APNs. | 
|  | 58 | +    /// It is **important** that you do not encode anything with the key `aps` | 
|  | 59 | +    /// | 
|  | 60 | +    /// - Parameters: | 
|  | 61 | +    ///   - priority: The priority of the notification. | 
|  | 62 | +    ///   - topic: The topic for the notification. In general, the topic is your app’s bundle ID/app ID suffixed with `.location-query`. | 
|  | 63 | +    ///   - apnsID: A canonical UUID that identifies the notification. | 
|  | 64 | +    @inlinable | 
|  | 65 | +    public init( | 
|  | 66 | +        priority: APNSPriority, | 
|  | 67 | +        topic: String, | 
|  | 68 | +        apnsID: UUID? = nil | 
|  | 69 | +    ) { | 
|  | 70 | +        self.priority = priority | 
|  | 71 | +        self.topic = topic | 
|  | 72 | +        self.apnsID = apnsID | 
|  | 73 | +    } | 
|  | 74 | +} | 
0 commit comments