objc2_pass_kit/generated/
PKPassLibrary.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct PKPassLibraryAddPassesStatus(pub NSInteger);
15impl PKPassLibraryAddPassesStatus {
16 #[doc(alias = "PKPassLibraryDidAddPasses")]
17 pub const DidAddPasses: Self = Self(0);
18 #[doc(alias = "PKPassLibraryShouldReviewPasses")]
19 pub const ShouldReviewPasses: Self = Self(1);
20 #[doc(alias = "PKPassLibraryDidCancelAddPasses")]
21 pub const DidCancelAddPasses: Self = Self(2);
22}
23
24unsafe impl Encode for PKPassLibraryAddPassesStatus {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for PKPassLibraryAddPassesStatus {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct PKAutomaticPassPresentationSuppressionResult(pub NSUInteger);
37impl PKAutomaticPassPresentationSuppressionResult {
38 #[doc(alias = "PKAutomaticPassPresentationSuppressionResultNotSupported")]
39 pub const NotSupported: Self = Self(0);
40 #[doc(alias = "PKAutomaticPassPresentationSuppressionResultAlreadyPresenting")]
41 pub const AlreadyPresenting: Self = Self(1);
42 #[doc(alias = "PKAutomaticPassPresentationSuppressionResultDenied")]
43 pub const Denied: Self = Self(2);
44 #[doc(alias = "PKAutomaticPassPresentationSuppressionResultCancelled")]
45 pub const Cancelled: Self = Self(3);
46 #[doc(alias = "PKAutomaticPassPresentationSuppressionResultSuccess")]
47 pub const Success: Self = Self(4);
48}
49
50unsafe impl Encode for PKAutomaticPassPresentationSuppressionResult {
51 const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for PKAutomaticPassPresentationSuppressionResult {
55 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58pub type PKSuppressionRequestToken = NSUInteger;
60
61extern_class!(
62 #[unsafe(super(NSObject))]
64 #[derive(Debug, PartialEq, Eq, Hash)]
65 pub struct PKPassLibrary;
66);
67
68extern_conformance!(
69 unsafe impl NSObjectProtocol for PKPassLibrary {}
70);
71
72impl PKPassLibrary {
73 extern_methods!(
74 #[unsafe(method(isPassLibraryAvailable))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn isPassLibraryAvailable() -> bool;
77
78 #[cfg(feature = "block2")]
79 #[unsafe(method(requestAutomaticPassPresentationSuppressionWithResponseHandler:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn requestAutomaticPassPresentationSuppressionWithResponseHandler(
82 response_handler: &block2::DynBlock<
83 dyn Fn(PKAutomaticPassPresentationSuppressionResult),
84 >,
85 ) -> PKSuppressionRequestToken;
86
87 #[unsafe(method(endAutomaticPassPresentationSuppressionWithRequestToken:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn endAutomaticPassPresentationSuppressionWithRequestToken(
90 request_token: PKSuppressionRequestToken,
91 );
92
93 #[unsafe(method(isSuppressingAutomaticPassPresentation))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn isSuppressingAutomaticPassPresentation() -> bool;
96
97 #[deprecated = "Use -[PKPassLibrary isPaymentPassActivationAvailable] instead"]
98 #[unsafe(method(isPaymentPassActivationAvailable))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn isPaymentPassActivationAvailable_class() -> bool;
101
102 #[deprecated = "Use -[PKPassLibrary isSecureElementPassActivationAvailable] instead"]
103 #[unsafe(method(isPaymentPassActivationAvailable))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn isPaymentPassActivationAvailable(&self) -> bool;
106
107 #[unsafe(method(isSecureElementPassActivationAvailable))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn isSecureElementPassActivationAvailable(&self) -> bool;
110
111 #[cfg(all(feature = "PKObject", feature = "PKPass"))]
112 #[unsafe(method(passes))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn passes(&self) -> Retained<NSArray<PKPass>>;
115
116 #[cfg(all(feature = "PKObject", feature = "PKPass"))]
117 #[unsafe(method(passWithPassTypeIdentifier:serialNumber:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn passWithPassTypeIdentifier_serialNumber(
120 &self,
121 identifier: &NSString,
122 serial_number: &NSString,
123 ) -> Option<Retained<PKPass>>;
124
125 #[cfg(all(
126 feature = "PKObject",
127 feature = "PKPass",
128 feature = "PKSecureElementPass"
129 ))]
130 #[unsafe(method(passesWithReaderIdentifier:))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn passesWithReaderIdentifier(
133 &self,
134 reader_identifier: &NSString,
135 ) -> Retained<NSSet<PKSecureElementPass>>;
136
137 #[cfg(all(feature = "PKObject", feature = "PKPass", feature = "PKPass_Types"))]
138 #[unsafe(method(passesOfType:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn passesOfType(&self, pass_type: PKPassType) -> Retained<NSArray<PKPass>>;
141
142 #[cfg(all(
143 feature = "PKObject",
144 feature = "PKPass",
145 feature = "PKPaymentPass",
146 feature = "PKSecureElementPass"
147 ))]
148 #[deprecated = "Use -[PKPassLibrary remoteSecureElementPasses] instead"]
149 #[unsafe(method(remotePaymentPasses))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn remotePaymentPasses(&self) -> Retained<NSArray<PKPaymentPass>>;
152
153 #[cfg(all(
154 feature = "PKObject",
155 feature = "PKPass",
156 feature = "PKSecureElementPass"
157 ))]
158 #[unsafe(method(remoteSecureElementPasses))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn remoteSecureElementPasses(&self) -> Retained<NSArray<PKSecureElementPass>>;
161
162 #[cfg(all(feature = "PKObject", feature = "PKPass"))]
163 #[unsafe(method(removePass:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn removePass(&self, pass: &PKPass);
166
167 #[cfg(all(feature = "PKObject", feature = "PKPass"))]
168 #[unsafe(method(containsPass:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn containsPass(&self, pass: &PKPass) -> bool;
171
172 #[cfg(all(feature = "PKObject", feature = "PKPass"))]
173 #[unsafe(method(replacePassWithPass:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn replacePassWithPass(&self, pass: &PKPass) -> bool;
176
177 #[cfg(all(feature = "PKObject", feature = "PKPass", feature = "block2"))]
178 #[unsafe(method(addPasses:withCompletionHandler:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn addPasses_withCompletionHandler(
181 &self,
182 passes: &NSArray<PKPass>,
183 completion: Option<&block2::DynBlock<dyn Fn(PKPassLibraryAddPassesStatus)>>,
184 );
185
186 #[unsafe(method(openPaymentSetup))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn openPaymentSetup(&self);
189
190 #[cfg(all(
191 feature = "PKObject",
192 feature = "PKPass",
193 feature = "PKPaymentPass",
194 feature = "PKSecureElementPass"
195 ))]
196 #[deprecated = "Use -[PKPassLibrary presentSecureElementPass:] instead"]
197 #[unsafe(method(presentPaymentPass:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn presentPaymentPass(&self, pass: &PKPaymentPass);
200
201 #[cfg(all(
202 feature = "PKObject",
203 feature = "PKPass",
204 feature = "PKSecureElementPass"
205 ))]
206 #[unsafe(method(presentSecureElementPass:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn presentSecureElementPass(&self, pass: &PKSecureElementPass);
209
210 #[deprecated = "Use -[PKPassLibrary canAddSecureElementPassWithPrimaryAccountIdentifier] instead"]
211 #[unsafe(method(canAddPaymentPassWithPrimaryAccountIdentifier:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn canAddPaymentPassWithPrimaryAccountIdentifier(
214 &self,
215 primary_account_identifier: &NSString,
216 ) -> bool;
217
218 #[unsafe(method(canAddSecureElementPassWithPrimaryAccountIdentifier:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn canAddSecureElementPassWithPrimaryAccountIdentifier(
221 &self,
222 primary_account_identifier: &NSString,
223 ) -> bool;
224
225 #[unsafe(method(canAddFelicaPass))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn canAddFelicaPass(&self) -> bool;
228
229 #[cfg(all(
230 feature = "PKObject",
231 feature = "PKPass",
232 feature = "PKPaymentPass",
233 feature = "PKSecureElementPass",
234 feature = "block2"
235 ))]
236 #[deprecated = "Use activateSecureElementPass:withActivationData:completion: instead"]
237 #[unsafe(method(activatePaymentPass:withActivationData:completion:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn activatePaymentPass_withActivationData_completion(
240 &self,
241 payment_pass: &PKPaymentPass,
242 activation_data: &NSData,
243 completion: Option<&block2::DynBlock<dyn Fn(Bool, NonNull<NSError>)>>,
244 );
245
246 #[cfg(all(
247 feature = "PKObject",
248 feature = "PKPass",
249 feature = "PKPaymentPass",
250 feature = "PKSecureElementPass",
251 feature = "block2"
252 ))]
253 #[deprecated = "Use activatePaymentPass:withActivationData:completion: instead"]
254 #[unsafe(method(activatePaymentPass:withActivationCode:completion:))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn activatePaymentPass_withActivationCode_completion(
257 &self,
258 payment_pass: &PKPaymentPass,
259 activation_code: &NSString,
260 completion: Option<&block2::DynBlock<dyn Fn(Bool, NonNull<NSError>)>>,
261 );
262
263 #[cfg(all(
264 feature = "PKObject",
265 feature = "PKPass",
266 feature = "PKSecureElementPass",
267 feature = "block2"
268 ))]
269 #[unsafe(method(activateSecureElementPass:withActivationData:completion:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn activateSecureElementPass_withActivationData_completion(
272 &self,
273 secure_element_pass: &PKSecureElementPass,
274 activation_data: &NSData,
275 completion: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
276 );
277
278 #[cfg(all(
279 feature = "PKObject",
280 feature = "PKPass",
281 feature = "PKSecureElementPass",
282 feature = "block2"
283 ))]
284 #[unsafe(method(signData:withSecureElementPass:completion:))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn signData_withSecureElementPass_completion(
287 &self,
288 sign_data: &NSData,
289 secure_element_pass: &PKSecureElementPass,
290 completion: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSData, *mut NSError)>,
291 );
292
293 #[cfg(all(
294 feature = "PKObject",
295 feature = "PKPass",
296 feature = "PKSecureElementPass",
297 feature = "block2"
298 ))]
299 #[unsafe(method(encryptedServiceProviderDataForSecureElementPass:completion:))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn encryptedServiceProviderDataForSecureElementPass_completion(
302 &self,
303 secure_element_pass: &PKSecureElementPass,
304 completion: &block2::DynBlock<dyn Fn(*mut NSDictionary, *mut NSError)>,
305 );
306
307 #[cfg(all(
308 feature = "PKObject",
309 feature = "PKPass",
310 feature = "PKSecureElementPass",
311 feature = "block2"
312 ))]
313 #[unsafe(method(serviceProviderDataForSecureElementPass:completion:))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn serviceProviderDataForSecureElementPass_completion(
316 &self,
317 secure_element_pass: &PKSecureElementPass,
318 completion: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
319 );
320 );
321}
322
323impl PKPassLibrary {
325 extern_methods!(
326 #[unsafe(method(init))]
327 #[unsafe(method_family = init)]
328 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
329
330 #[unsafe(method(new))]
331 #[unsafe(method_family = new)]
332 pub unsafe fn new() -> Retained<Self>;
333 );
334}
335
336pub type PKPassLibraryNotificationName = NSString;
339
340extern "C" {
341 pub static PKPassLibraryDidChangeNotification: &'static PKPassLibraryNotificationName;
343}
344
345extern "C" {
346 pub static PKPassLibraryRemotePaymentPassesDidChangeNotification:
348 &'static PKPassLibraryNotificationName;
349}
350
351pub type PKPassLibraryNotificationKey = NSString;
354
355extern "C" {
356 pub static PKPassLibraryAddedPassesUserInfoKey: &'static PKPassLibraryNotificationKey;
358}
359
360extern "C" {
361 pub static PKPassLibraryReplacementPassesUserInfoKey: &'static PKPassLibraryNotificationKey;
363}
364
365extern "C" {
366 pub static PKPassLibraryRemovedPassInfosUserInfoKey: &'static PKPassLibraryNotificationKey;
368}
369
370extern "C" {
371 pub static PKPassLibraryPassTypeIdentifierUserInfoKey: &'static PKPassLibraryNotificationKey;
373}
374
375extern "C" {
376 pub static PKPassLibrarySerialNumberUserInfoKey: &'static PKPassLibraryNotificationKey;
378}
379
380extern "C" {
381 pub static PKPassLibraryRecoveredPassesUserInfoKey: &'static PKPassLibraryNotificationKey;
383}