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
40unsafe impl NSObjectProtocol for CKContainer {}
41
42impl CKContainer {
43 extern_methods!(
44 #[unsafe(method(init))]
45 #[unsafe(method_family = init)]
46 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
47
48 #[unsafe(method(new))]
49 #[unsafe(method_family = new)]
50 pub unsafe fn new() -> Retained<Self>;
51
52 #[unsafe(method(defaultContainer))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn defaultContainer() -> Retained<CKContainer>;
65
66 #[unsafe(method(containerWithIdentifier:))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn containerWithIdentifier(
75 container_identifier: &NSString,
76 ) -> Retained<CKContainer>;
77
78 #[unsafe(method(containerIdentifier))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn containerIdentifier(&self) -> Option<Retained<NSString>>;
81
82 #[cfg(feature = "CKOperation")]
83 #[unsafe(method(addOperation:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn addOperation(&self, operation: &CKOperation);
86 );
87}
88
89impl CKContainer {
105 extern_methods!(
106 #[cfg(feature = "CKDatabase")]
107 #[unsafe(method(privateCloudDatabase))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn privateCloudDatabase(&self) -> Retained<CKDatabase>;
110
111 #[cfg(feature = "CKDatabase")]
112 #[unsafe(method(publicCloudDatabase))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn publicCloudDatabase(&self) -> Retained<CKDatabase>;
115
116 #[cfg(feature = "CKDatabase")]
117 #[unsafe(method(sharedCloudDatabase))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn sharedCloudDatabase(&self) -> Retained<CKDatabase>;
120
121 #[cfg(feature = "CKDatabase")]
122 #[unsafe(method(databaseWithDatabaseScope:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn databaseWithDatabaseScope(
129 &self,
130 database_scope: CKDatabaseScope,
131 ) -> Retained<CKDatabase>;
132 );
133}
134
135#[repr(transparent)]
140#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
141pub struct CKAccountStatus(pub NSInteger);
142impl CKAccountStatus {
143 #[doc(alias = "CKAccountStatusCouldNotDetermine")]
144 pub const CouldNotDetermine: Self = Self(0);
145 #[doc(alias = "CKAccountStatusAvailable")]
146 pub const Available: Self = Self(1);
147 #[doc(alias = "CKAccountStatusRestricted")]
148 pub const Restricted: Self = Self(2);
149 #[doc(alias = "CKAccountStatusNoAccount")]
150 pub const NoAccount: Self = Self(3);
151 #[doc(alias = "CKAccountStatusTemporarilyUnavailable")]
152 pub const TemporarilyUnavailable: Self = Self(4);
153}
154
155unsafe impl Encode for CKAccountStatus {
156 const ENCODING: Encoding = NSInteger::ENCODING;
157}
158
159unsafe impl RefEncode for CKAccountStatus {
160 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
161}
162
163extern "C" {
164 pub static CKAccountChangedNotification: &'static NSString;
172}
173
174impl CKContainer {
176 extern_methods!(
177 #[cfg(feature = "block2")]
178 #[unsafe(method(accountStatusWithCompletionHandler:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn accountStatusWithCompletionHandler(
181 &self,
182 completion_handler: &block2::Block<dyn Fn(CKAccountStatus, *mut NSError)>,
183 );
184 );
185}
186
187#[repr(transparent)]
190#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
191pub struct CKApplicationPermissions(pub NSUInteger);
192bitflags::bitflags! {
193 impl CKApplicationPermissions: NSUInteger {
194#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
196 #[doc(alias = "CKApplicationPermissionUserDiscoverability")]
197 const UserDiscoverability = 1<<0;
198 }
199}
200
201unsafe impl Encode for CKApplicationPermissions {
202 const ENCODING: Encoding = NSUInteger::ENCODING;
203}
204
205unsafe impl RefEncode for CKApplicationPermissions {
206 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
207}
208
209#[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
212#[repr(transparent)]
213#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
214pub struct CKApplicationPermissionStatus(pub NSInteger);
215impl CKApplicationPermissionStatus {
216 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
217 #[doc(alias = "CKApplicationPermissionStatusInitialState")]
218 pub const InitialState: Self = Self(0);
219 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
220 #[doc(alias = "CKApplicationPermissionStatusCouldNotComplete")]
221 pub const CouldNotComplete: Self = Self(1);
222 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
223 #[doc(alias = "CKApplicationPermissionStatusDenied")]
224 pub const Denied: Self = Self(2);
225 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
226 #[doc(alias = "CKApplicationPermissionStatusGranted")]
227 pub const Granted: Self = Self(3);
228}
229
230unsafe impl Encode for CKApplicationPermissionStatus {
231 const ENCODING: Encoding = NSInteger::ENCODING;
232}
233
234unsafe impl RefEncode for CKApplicationPermissionStatus {
235 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
236}
237
238#[cfg(feature = "block2")]
240pub type CKApplicationPermissionBlock =
241 *mut block2::Block<dyn Fn(CKApplicationPermissionStatus, *mut NSError)>;
242
243impl CKContainer {
245 extern_methods!(
246 #[cfg(feature = "block2")]
247 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
248 #[unsafe(method(statusForApplicationPermission:completionHandler:))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn statusForApplicationPermission_completionHandler(
251 &self,
252 application_permission: CKApplicationPermissions,
253 completion_handler: CKApplicationPermissionBlock,
254 );
255
256 #[cfg(feature = "block2")]
257 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
258 #[unsafe(method(requestApplicationPermission:completionHandler:))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn requestApplicationPermission_completionHandler(
261 &self,
262 application_permission: CKApplicationPermissions,
263 completion_handler: CKApplicationPermissionBlock,
264 );
265 );
266}
267
268impl CKContainer {
270 extern_methods!(
271 #[cfg(all(feature = "CKRecordID", feature = "block2"))]
272 #[unsafe(method(fetchUserRecordIDWithCompletionHandler:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn fetchUserRecordIDWithCompletionHandler(
280 &self,
281 completion_handler: &block2::Block<dyn Fn(*mut CKRecordID, *mut NSError)>,
282 );
283
284 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
285 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
291 #[unsafe(method(discoverAllIdentitiesWithCompletionHandler:))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn discoverAllIdentitiesWithCompletionHandler(
294 &self,
295 completion_handler: &block2::Block<dyn Fn(*mut NSArray<CKUserIdentity>, *mut NSError)>,
296 );
297
298 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
299 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
306 #[unsafe(method(discoverUserIdentityWithEmailAddress:completionHandler:))]
307 #[unsafe(method_family = none)]
308 pub unsafe fn discoverUserIdentityWithEmailAddress_completionHandler(
309 &self,
310 email: &NSString,
311 completion_handler: &block2::Block<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
312 );
313
314 #[cfg(all(feature = "CKUserIdentity", feature = "block2"))]
315 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
322 #[unsafe(method(discoverUserIdentityWithPhoneNumber:completionHandler:))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn discoverUserIdentityWithPhoneNumber_completionHandler(
325 &self,
326 phone_number: &NSString,
327 completion_handler: &block2::Block<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
328 );
329
330 #[cfg(all(feature = "CKRecordID", feature = "CKUserIdentity", feature = "block2"))]
331 #[deprecated = "No longer supported. Please see Sharing CloudKit Data with Other iCloud Users."]
338 #[unsafe(method(discoverUserIdentityWithUserRecordID:completionHandler:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn discoverUserIdentityWithUserRecordID_completionHandler(
341 &self,
342 user_record_id: &CKRecordID,
343 completion_handler: &block2::Block<dyn Fn(*mut CKUserIdentity, *mut NSError)>,
344 );
345 );
346}
347
348impl CKContainer {
350 extern_methods!(
351 #[cfg(all(feature = "CKShareParticipant", feature = "block2"))]
352 #[unsafe(method(fetchShareParticipantWithEmailAddress:completionHandler:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn fetchShareParticipantWithEmailAddress_completionHandler(
360 &self,
361 email_address: &NSString,
362 completion_handler: &block2::Block<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
363 );
364
365 #[cfg(all(feature = "CKShareParticipant", feature = "block2"))]
366 #[unsafe(method(fetchShareParticipantWithPhoneNumber:completionHandler:))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn fetchShareParticipantWithPhoneNumber_completionHandler(
369 &self,
370 phone_number: &NSString,
371 completion_handler: &block2::Block<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
372 );
373
374 #[cfg(all(
375 feature = "CKRecordID",
376 feature = "CKShareParticipant",
377 feature = "block2"
378 ))]
379 #[unsafe(method(fetchShareParticipantWithUserRecordID:completionHandler:))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn fetchShareParticipantWithUserRecordID_completionHandler(
382 &self,
383 user_record_id: &CKRecordID,
384 completion_handler: &block2::Block<dyn Fn(*mut CKShareParticipant, *mut NSError)>,
385 );
386
387 #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
388 #[unsafe(method(fetchShareMetadataWithURL:completionHandler:))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn fetchShareMetadataWithURL_completionHandler(
391 &self,
392 url: &NSURL,
393 completion_handler: &block2::Block<dyn Fn(*mut CKShareMetadata, *mut NSError)>,
394 );
395
396 #[cfg(all(
397 feature = "CKRecord",
398 feature = "CKShare",
399 feature = "CKShareMetadata",
400 feature = "block2"
401 ))]
402 #[unsafe(method(acceptShareMetadata:completionHandler:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn acceptShareMetadata_completionHandler(
405 &self,
406 metadata: &CKShareMetadata,
407 completion_handler: &block2::Block<dyn Fn(*mut CKShare, *mut NSError)>,
408 );
409 );
410}
411
412impl CKContainer {
414 extern_methods!(
415 #[cfg(all(feature = "CKOperation", feature = "block2"))]
416 #[unsafe(method(fetchAllLongLivedOperationIDsWithCompletionHandler:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn fetchAllLongLivedOperationIDsWithCompletionHandler(
423 &self,
424 completion_handler: &block2::Block<dyn Fn(*mut NSArray<CKOperationID>, *mut NSError)>,
425 );
426
427 #[cfg(all(feature = "CKOperation", feature = "block2"))]
428 #[unsafe(method(fetchLongLivedOperationWithID:completionHandler:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn fetchLongLivedOperationWithID_completionHandler(
431 &self,
432 operation_id: &CKOperationID,
433 completion_handler: &block2::Block<dyn Fn(*mut CKOperation, *mut NSError)>,
434 );
435 );
436}