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 pub static CKOwnerDefaultName: &'static NSString;
20}
21
22extern_class!(
23 #[unsafe(super(NSObject))]
32 #[derive(Debug, PartialEq, Eq, Hash)]
33 pub struct CKContainer;
34);
35
36unsafe impl Send for CKContainer {}
37
38unsafe impl Sync for CKContainer {}
39
40extern_conformance!(
41 unsafe impl NSObjectProtocol for CKContainer {}
42);
43
44impl CKContainer {
45 extern_methods!(
46 #[unsafe(method(init))]
47 #[unsafe(method_family = init)]
48 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
49
50 #[unsafe(method(new))]
51 #[unsafe(method_family = new)]
52 pub unsafe fn new() -> Retained<Self>;
53
54 #[unsafe(method(defaultContainer))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn defaultContainer() -> Retained<CKContainer>;
67
68 #[unsafe(method(containerWithIdentifier:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn containerWithIdentifier(
77 container_identifier: &NSString,
78 ) -> Retained<CKContainer>;
79
80 #[unsafe(method(containerIdentifier))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn containerIdentifier(&self) -> Option<Retained<NSString>>;
83
84 #[cfg(feature = "CKOperation")]
85 #[unsafe(method(addOperation:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn addOperation(&self, operation: &CKOperation);
88 );
89}
90
91impl CKContainer {
107 extern_methods!(
108 #[cfg(feature = "CKDatabase")]
109 #[unsafe(method(privateCloudDatabase))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn privateCloudDatabase(&self) -> Retained<CKDatabase>;
112
113 #[cfg(feature = "CKDatabase")]
114 #[unsafe(method(publicCloudDatabase))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn publicCloudDatabase(&self) -> Retained<CKDatabase>;
117
118 #[cfg(feature = "CKDatabase")]
119 #[unsafe(method(sharedCloudDatabase))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn sharedCloudDatabase(&self) -> Retained<CKDatabase>;
122
123 #[cfg(feature = "CKDatabase")]
124 #[unsafe(method(databaseWithDatabaseScope:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn databaseWithDatabaseScope(
131 &self,
132 database_scope: CKDatabaseScope,
133 ) -> Retained<CKDatabase>;
134 );
135}
136
137#[repr(transparent)]
142#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
143pub struct CKAccountStatus(pub NSInteger);
144impl CKAccountStatus {
145 #[doc(alias = "CKAccountStatusCouldNotDetermine")]
146 pub const CouldNotDetermine: Self = Self(0);
147 #[doc(alias = "CKAccountStatusAvailable")]
148 pub const Available: Self = Self(1);
149 #[doc(alias = "CKAccountStatusRestricted")]
150 pub const Restricted: Self = Self(2);
151 #[doc(alias = "CKAccountStatusNoAccount")]
152 pub const NoAccount: Self = Self(3);
153 #[doc(alias = "CKAccountStatusTemporarilyUnavailable")]
154 pub const TemporarilyUnavailable: Self = Self(4);
155}
156
157unsafe impl Encode for CKAccountStatus {
158 const ENCODING: Encoding = NSInteger::ENCODING;
159}
160
161unsafe impl RefEncode for CKAccountStatus {
162 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
163}
164
165extern "C" {
166 pub static CKAccountChangedNotification: &'static NSString;
174}
175
176impl CKContainer {
178 extern_methods!(
179 #[cfg(feature = "block2")]
180 #[unsafe(method(accountStatusWithCompletionHandler:))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn accountStatusWithCompletionHandler(
183 &self,
184 completion_handler: &block2::DynBlock<dyn Fn(CKAccountStatus, *mut NSError)>,
185 );
186 );
187}
188
189#[repr(transparent)]
192#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
193pub struct CKApplicationPermissions(pub NSUInteger);
194bitflags::bitflags! {
195 impl CKApplicationPermissions: NSUInteger {
196#[doc(alias = "CKApplicationPermissionUserDiscoverability")]
198#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
199 const UserDiscoverability = 1<<0;
200 }
201}
202
203unsafe impl Encode for CKApplicationPermissions {
204 const ENCODING: Encoding = NSUInteger::ENCODING;
205}
206
207unsafe impl RefEncode for CKApplicationPermissions {
208 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
209}
210
211#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
214#[repr(transparent)]
215#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
216pub struct CKApplicationPermissionStatus(pub NSInteger);
217impl CKApplicationPermissionStatus {
218 #[doc(alias = "CKApplicationPermissionStatusInitialState")]
219 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
220 pub const InitialState: Self = Self(0);
221 #[doc(alias = "CKApplicationPermissionStatusCouldNotComplete")]
222 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
223 pub const CouldNotComplete: Self = Self(1);
224 #[doc(alias = "CKApplicationPermissionStatusDenied")]
225 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
226 pub const Denied: Self = Self(2);
227 #[doc(alias = "CKApplicationPermissionStatusGranted")]
228 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
229 pub const Granted: Self = Self(3);
230}
231
232unsafe impl Encode for CKApplicationPermissionStatus {
233 const ENCODING: Encoding = NSInteger::ENCODING;
234}
235
236unsafe impl RefEncode for CKApplicationPermissionStatus {
237 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
238}
239
240#[cfg(feature = "block2")]
242pub type CKApplicationPermissionBlock =
243 *mut block2::DynBlock<dyn Fn(CKApplicationPermissionStatus, *mut NSError)>;
244
245impl CKContainer {
247 extern_methods!(
248 #[cfg(feature = "block2")]
249 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
250 #[unsafe(method(statusForApplicationPermission:completionHandler:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn statusForApplicationPermission_completionHandler(
253 &self,
254 application_permission: CKApplicationPermissions,
255 completion_handler: CKApplicationPermissionBlock,
256 );
257
258 #[cfg(feature = "block2")]
259 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
260 #[unsafe(method(requestApplicationPermission:completionHandler:))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn requestApplicationPermission_completionHandler(
263 &self,
264 application_permission: CKApplicationPermissions,
265 completion_handler: CKApplicationPermissionBlock,
266 );
267 );
268}
269
270impl CKContainer {
272 extern_methods!(
273 #[cfg(all(feature = "CKRecordID", feature = "block2"))]
274 #[unsafe(method(fetchUserRecordIDWithCompletionHandler:))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn fetchUserRecordIDWithCompletionHandler(
282 &self,
283 completion_handler: &block2::DynBlock<dyn Fn(*mut CKRecordID, *mut NSError)>,
284 );
285
286 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
287 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
293 #[unsafe(method(discoverAllIdentitiesWithCompletionHandler:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn discoverAllIdentitiesWithCompletionHandler(
296 &self,
297 completion_handler: &block2::DynBlock<
298 dyn Fn(*mut NSArray<CKUserIdentity>, *mut NSError),
299 >,
300 );
301
302 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
303 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
310 #[unsafe(method(discoverUserIdentityWithEmailAddress:completionHandler:))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn discoverUserIdentityWithEmailAddress_completionHandler(
313 &self,
314 email: &NSString,
315 completion_handler: &block2::DynBlock<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
316 );
317
318 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
319 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
326 #[unsafe(method(discoverUserIdentityWithPhoneNumber:completionHandler:))]
327 #[unsafe(method_family = none)]
328 pub unsafe fn discoverUserIdentityWithPhoneNumber_completionHandler(
329 &self,
330 phone_number: &NSString,
331 completion_handler: &block2::DynBlock<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
332 );
333
334 #[cfg(all(feature = "CKRecordID", feature = "CKUserIdentity", feature = "block2"))]
335 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
342 #[unsafe(method(discoverUserIdentityWithUserRecordID:completionHandler:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn discoverUserIdentityWithUserRecordID_completionHandler(
345 &self,
346 user_record_id: &CKRecordID,
347 completion_handler: &block2::DynBlock<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
348 );
349 );
350}
351
352impl CKContainer {
354 extern_methods!(
355 #[cfg(all(feature = "CKShareParticipant", feature = "block2"))]
356 #[unsafe(method(fetchShareParticipantWithEmailAddress:completionHandler:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn fetchShareParticipantWithEmailAddress_completionHandler(
364 &self,
365 email_address: &NSString,
366 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
367 );
368
369 #[cfg(all(feature = "CKShareParticipant", feature = "block2"))]
370 #[unsafe(method(fetchShareParticipantWithPhoneNumber:completionHandler:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn fetchShareParticipantWithPhoneNumber_completionHandler(
373 &self,
374 phone_number: &NSString,
375 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
376 );
377
378 #[cfg(all(
379 feature = "CKRecordID",
380 feature = "CKShareParticipant",
381 feature = "block2"
382 ))]
383 #[unsafe(method(fetchShareParticipantWithUserRecordID:completionHandler:))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn fetchShareParticipantWithUserRecordID_completionHandler(
386 &self,
387 user_record_id: &CKRecordID,
388 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
389 );
390
391 #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
392 #[unsafe(method(fetchShareMetadataWithURL:completionHandler:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn fetchShareMetadataWithURL_completionHandler(
395 &self,
396 url: &NSURL,
397 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShareMetadata, *mut NSError)>,
398 );
399
400 #[cfg(all(
401 feature = "CKRecord",
402 feature = "CKShare",
403 feature = "CKShareMetadata",
404 feature = "block2"
405 ))]
406 #[unsafe(method(acceptShareMetadata:completionHandler:))]
407 #[unsafe(method_family = none)]
408 pub unsafe fn acceptShareMetadata_completionHandler(
409 &self,
410 metadata: &CKShareMetadata,
411 completion_handler: &block2::DynBlock<dyn Fn(*mut CKShare, *mut NSError)>,
412 );
413 );
414}
415
416impl CKContainer {
418 extern_methods!(
419 #[cfg(all(feature = "CKOperation", feature = "block2"))]
420 #[unsafe(method(fetchAllLongLivedOperationIDsWithCompletionHandler:))]
425 #[unsafe(method_family = none)]
426 pub unsafe fn fetchAllLongLivedOperationIDsWithCompletionHandler(
427 &self,
428 completion_handler: &block2::DynBlock<
429 dyn Fn(*mut NSArray<CKOperationID>, *mut NSError),
430 >,
431 );
432
433 #[cfg(all(feature = "CKOperation", feature = "block2"))]
434 #[unsafe(method(fetchLongLivedOperationWithID:completionHandler:))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn fetchLongLivedOperationWithID_completionHandler(
437 &self,
438 operation_id: &CKOperationID,
439 completion_handler: &block2::DynBlock<dyn Fn(*mut CKOperation, *mut NSError)>,
440 );
441 );
442}