objc2_cloud_kit/generated/
CKContainer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern "C" {
11 pub static CKCurrentUserDefaultName: &'static NSString;
15}
16
17extern "C" {
18 #[deprecated]
20 pub static CKOwnerDefaultName: &'static NSString;
21}
22
23extern_class!(
24 #[unsafe(super(NSObject))]
33 #[derive(Debug, PartialEq, Eq, Hash)]
34 pub struct CKContainer;
35);
36
37unsafe impl Send for CKContainer {}
38
39unsafe impl Sync for CKContainer {}
40
41extern_conformance!(
42 unsafe impl NSObjectProtocol for CKContainer {}
43);
44
45impl CKContainer {
46 extern_methods!(
47 #[unsafe(method(init))]
48 #[unsafe(method_family = init)]
49 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
50
51 #[unsafe(method(new))]
52 #[unsafe(method_family = new)]
53 pub unsafe fn new() -> Retained<Self>;
54
55 #[unsafe(method(defaultContainer))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn defaultContainer() -> Retained<CKContainer>;
68
69 #[unsafe(method(containerWithIdentifier:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn containerWithIdentifier(
78 container_identifier: &NSString,
79 ) -> Retained<CKContainer>;
80
81 #[unsafe(method(containerIdentifier))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn containerIdentifier(&self) -> Option<Retained<NSString>>;
89
90 #[cfg(feature = "CKOperation")]
91 #[unsafe(method(addOperation:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn addOperation(&self, operation: &CKOperation);
94 );
95}
96
97impl CKContainer {
114 extern_methods!(
115 #[cfg(feature = "CKDatabase")]
116 #[unsafe(method(privateCloudDatabase))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn privateCloudDatabase(&self) -> Retained<CKDatabase>;
124
125 #[cfg(feature = "CKDatabase")]
126 #[unsafe(method(publicCloudDatabase))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn publicCloudDatabase(&self) -> Retained<CKDatabase>;
134
135 #[cfg(feature = "CKDatabase")]
136 #[unsafe(method(sharedCloudDatabase))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn sharedCloudDatabase(&self) -> Retained<CKDatabase>;
144
145 #[cfg(feature = "CKDatabase")]
146 #[unsafe(method(databaseWithDatabaseScope:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn databaseWithDatabaseScope(
153 &self,
154 database_scope: CKDatabaseScope,
155 ) -> Retained<CKDatabase>;
156 );
157}
158
159#[repr(transparent)]
164#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
165pub struct CKAccountStatus(pub NSInteger);
166impl CKAccountStatus {
167 #[doc(alias = "CKAccountStatusCouldNotDetermine")]
168 pub const CouldNotDetermine: Self = Self(0);
169 #[doc(alias = "CKAccountStatusAvailable")]
170 pub const Available: Self = Self(1);
171 #[doc(alias = "CKAccountStatusRestricted")]
172 pub const Restricted: Self = Self(2);
173 #[doc(alias = "CKAccountStatusNoAccount")]
174 pub const NoAccount: Self = Self(3);
175 #[doc(alias = "CKAccountStatusTemporarilyUnavailable")]
176 pub const TemporarilyUnavailable: Self = Self(4);
177}
178
179unsafe impl Encode for CKAccountStatus {
180 const ENCODING: Encoding = NSInteger::ENCODING;
181}
182
183unsafe impl RefEncode for CKAccountStatus {
184 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
185}
186
187extern "C" {
188 pub static CKAccountChangedNotification: &'static NSString;
196}
197
198impl CKContainer {
200 extern_methods!(
201 #[cfg(feature = "block2")]
202 #[unsafe(method(accountStatusWithCompletionHandler:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn accountStatusWithCompletionHandler(
208 &self,
209 completion_handler: &block2::DynBlock<dyn Fn(CKAccountStatus, *mut NSError)>,
210 );
211 );
212}
213
214#[repr(transparent)]
217#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
218pub struct CKApplicationPermissions(pub NSUInteger);
219bitflags::bitflags! {
220 impl CKApplicationPermissions: NSUInteger {
221#[doc(alias = "CKApplicationPermissionUserDiscoverability")]
223#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
224 const UserDiscoverability = 1<<0;
225 }
226}
227
228unsafe impl Encode for CKApplicationPermissions {
229 const ENCODING: Encoding = NSUInteger::ENCODING;
230}
231
232unsafe impl RefEncode for CKApplicationPermissions {
233 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
234}
235
236#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
239#[repr(transparent)]
240#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
241pub struct CKApplicationPermissionStatus(pub NSInteger);
242impl CKApplicationPermissionStatus {
243 #[doc(alias = "CKApplicationPermissionStatusInitialState")]
244 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
245 pub const InitialState: Self = Self(0);
246 #[doc(alias = "CKApplicationPermissionStatusCouldNotComplete")]
247 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
248 pub const CouldNotComplete: Self = Self(1);
249 #[doc(alias = "CKApplicationPermissionStatusDenied")]
250 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
251 pub const Denied: Self = Self(2);
252 #[doc(alias = "CKApplicationPermissionStatusGranted")]
253 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
254 pub const Granted: Self = Self(3);
255}
256
257unsafe impl Encode for CKApplicationPermissionStatus {
258 const ENCODING: Encoding = NSInteger::ENCODING;
259}
260
261unsafe impl RefEncode for CKApplicationPermissionStatus {
262 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
263}
264
265#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
267#[cfg(feature = "block2")]
268pub type CKApplicationPermissionBlock =
269 *mut block2::DynBlock<dyn Fn(CKApplicationPermissionStatus, *mut NSError)>;
270
271impl CKContainer {
273 extern_methods!(
274 #[cfg(feature = "block2")]
275 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
279 #[unsafe(method(statusForApplicationPermission:completionHandler:))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn statusForApplicationPermission_completionHandler(
282 &self,
283 application_permission: CKApplicationPermissions,
284 completion_handler: CKApplicationPermissionBlock,
285 );
286
287 #[cfg(feature = "block2")]
288 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
292 #[unsafe(method(requestApplicationPermission:completionHandler:))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn requestApplicationPermission_completionHandler(
295 &self,
296 application_permission: CKApplicationPermissions,
297 completion_handler: CKApplicationPermissionBlock,
298 );
299 );
300}
301
302impl CKContainer {
304 extern_methods!(
305 #[cfg(all(feature = "CKRecordID", feature = "block2"))]
306 #[unsafe(method(fetchUserRecordIDWithCompletionHandler:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn fetchUserRecordIDWithCompletionHandler(
318 &self,
319 completion_handler: &block2::DynBlock<dyn Fn(*mut CKRecordID, *mut NSError)>,
320 );
321
322 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
323 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
333 #[unsafe(method(discoverAllIdentitiesWithCompletionHandler:))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn discoverAllIdentitiesWithCompletionHandler(
336 &self,
337 completion_handler: &block2::DynBlock<
338 dyn Fn(*mut NSArray<CKUserIdentity>, *mut NSError),
339 >,
340 );
341
342 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
343 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
354 #[unsafe(method(discoverUserIdentityWithEmailAddress:completionHandler:))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn discoverUserIdentityWithEmailAddress_completionHandler(
357 &self,
358 email: &NSString,
359 completion_handler: &block2::DynBlock<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
360 );
361
362 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
363 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
374 #[unsafe(method(discoverUserIdentityWithPhoneNumber:completionHandler:))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn discoverUserIdentityWithPhoneNumber_completionHandler(
377 &self,
378 phone_number: &NSString,
379 completion_handler: &block2::DynBlock<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
380 );
381
382 #[cfg(all(feature = "CKRecordID", feature = "CKUserIdentity", feature = "block2"))]
383 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
394 #[unsafe(method(discoverUserIdentityWithUserRecordID:completionHandler:))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn discoverUserIdentityWithUserRecordID_completionHandler(
397 &self,
398 user_record_id: &CKRecordID,
399 completion_handler: &block2::DynBlock<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
400 );
401 );
402}
403
404impl CKContainer {
406 extern_methods!(
407 #[cfg(all(feature = "CKShareParticipant", feature = "block2"))]
408 #[unsafe(method(fetchShareParticipantWithEmailAddress:completionHandler:))]
418 #[unsafe(method_family = none)]
419 pub unsafe fn fetchShareParticipantWithEmailAddress_completionHandler(
420 &self,
421 email_address: &NSString,
422 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
423 );
424
425 #[cfg(all(feature = "CKShareParticipant", feature = "block2"))]
426 #[unsafe(method(fetchShareParticipantWithPhoneNumber:completionHandler:))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn fetchShareParticipantWithPhoneNumber_completionHandler(
432 &self,
433 phone_number: &NSString,
434 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
435 );
436
437 #[cfg(all(
438 feature = "CKRecordID",
439 feature = "CKShareParticipant",
440 feature = "block2"
441 ))]
442 #[unsafe(method(fetchShareParticipantWithUserRecordID:completionHandler:))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn fetchShareParticipantWithUserRecordID_completionHandler(
448 &self,
449 user_record_id: &CKRecordID,
450 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
451 );
452
453 #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
454 #[unsafe(method(fetchShareMetadataWithURL:completionHandler:))]
458 #[unsafe(method_family = none)]
459 pub unsafe fn fetchShareMetadataWithURL_completionHandler(
460 &self,
461 url: &NSURL,
462 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareMetadata, *mut NSError)>,
463 );
464
465 #[cfg(all(
466 feature = "CKRecord",
467 feature = "CKShare",
468 feature = "CKShareMetadata",
469 feature = "block2"
470 ))]
471 #[unsafe(method(acceptShareMetadata:completionHandler:))]
475 #[unsafe(method_family = none)]
476 pub unsafe fn acceptShareMetadata_completionHandler(
477 &self,
478 metadata: &CKShareMetadata,
479 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShare, *mut NSError)>,
480 );
481 );
482}
483
484impl CKContainer {
486 extern_methods!(
487 #[cfg(all(feature = "CKOperation", feature = "block2"))]
488 #[unsafe(method(fetchAllLongLivedOperationIDsWithCompletionHandler:))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn fetchAllLongLivedOperationIDsWithCompletionHandler(
499 &self,
500 completion_handler: &block2::DynBlock<
501 dyn Fn(*mut NSArray<CKOperationID>, *mut NSError),
502 >,
503 );
504
505 #[cfg(all(feature = "CKOperation", feature = "block2"))]
506 #[unsafe(method(fetchLongLivedOperationWithID:completionHandler:))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn fetchLongLivedOperationWithID_completionHandler(
512 &self,
513 operation_id: &CKOperationID,
514 completion_handler: &block2::DynBlock<dyn Fn(*mut CKOperation, *mut NSError)>,
515 );
516 );
517}