objc2_cloud_kit/generated/
CKFetchRecordZoneChangesOperation.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// This operation will fetch records changes across the given record zones
12    ///
13    ///
14    /// For each
15    /// `previousServerChangeToken`passed in with a
16    /// `CKFetchRecordZoneChangesConfiguration,`only records that have changed since that anchor will be fetched.
17    /// If this is your first fetch of a zone or if you wish to re-fetch all records within a zone, do not include a
18    /// `previousServerChangeToken.`Change tokens are opaque tokens and clients should not infer any behavior based on their content.
19    ///
20    /// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchrecordzonechangesoperation?language=objc)
21    #[unsafe(super(CKDatabaseOperation, CKOperation, NSOperation, NSObject))]
22    #[derive(Debug, PartialEq, Eq, Hash)]
23    #[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
24    pub struct CKFetchRecordZoneChangesOperation;
25);
26
27#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
28extern_conformance!(
29    unsafe impl NSObjectProtocol for CKFetchRecordZoneChangesOperation {}
30);
31
32#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
33impl CKFetchRecordZoneChangesOperation {
34    extern_methods!(
35        #[unsafe(method(init))]
36        #[unsafe(method_family = init)]
37        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
38
39        #[cfg(feature = "CKRecordZoneID")]
40        #[unsafe(method(initWithRecordZoneIDs:configurationsByRecordZoneID:))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn initWithRecordZoneIDs_configurationsByRecordZoneID(
43            this: Allocated<Self>,
44            record_zone_i_ds: &NSArray<CKRecordZoneID>,
45            configurations_by_record_zone_id: Option<
46                &NSDictionary<CKRecordZoneID, CKFetchRecordZoneChangesConfiguration>,
47            >,
48        ) -> Retained<Self>;
49
50        #[cfg(feature = "CKRecordZoneID")]
51        #[unsafe(method(recordZoneIDs))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn recordZoneIDs(&self) -> Option<Retained<NSArray<CKRecordZoneID>>>;
54
55        #[cfg(feature = "CKRecordZoneID")]
56        /// Setter for [`recordZoneIDs`][Self::recordZoneIDs].
57        #[unsafe(method(setRecordZoneIDs:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setRecordZoneIDs(&self, record_zone_i_ds: Option<&NSArray<CKRecordZoneID>>);
60
61        #[cfg(feature = "CKRecordZoneID")]
62        #[unsafe(method(configurationsByRecordZoneID))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn configurationsByRecordZoneID(
65            &self,
66        ) -> Option<Retained<NSDictionary<CKRecordZoneID, CKFetchRecordZoneChangesConfiguration>>>;
67
68        #[cfg(feature = "CKRecordZoneID")]
69        /// Setter for [`configurationsByRecordZoneID`][Self::configurationsByRecordZoneID].
70        #[unsafe(method(setConfigurationsByRecordZoneID:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setConfigurationsByRecordZoneID(
73            &self,
74            configurations_by_record_zone_id: Option<
75                &NSDictionary<CKRecordZoneID, CKFetchRecordZoneChangesConfiguration>,
76            >,
77        );
78
79        /// Determines if the operation should fetch all changes from the server before completing.
80        ///
81        ///
82        /// When set to YES, this operation will send repeated requests to the server until all record changes have been fetched.
83        /// `recordZoneChangeTokensUpdatedBlock`will be invoked periodically, to give clients an updated change token so that already-fetched record changes don't need to be re-fetched on a subsequent operation.
84        /// `recordZoneFetchCompletionBlock`will only be called once and
85        /// `moreComing`will always be NO.
86        ///
87        /// When set to NO, it is the responsibility of the caller to issue subsequent fetch-changes operations when
88        /// `moreComing`is YES in a
89        /// `recordZoneFetchCompletionBlock`invocation.
90        ///
91        /// `fetchAllChanges`is YES by default
92        #[unsafe(method(fetchAllChanges))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn fetchAllChanges(&self) -> bool;
95
96        /// Setter for [`fetchAllChanges`][Self::fetchAllChanges].
97        #[unsafe(method(setFetchAllChanges:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setFetchAllChanges(&self, fetch_all_changes: bool);
100
101        #[cfg(all(feature = "CKRecord", feature = "block2"))]
102        /// If the replacement callback
103        /// `recordWasChangedBlock`is set, this callback block is ignored.
104        /// Each
105        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
106        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
107        /// should not be concurrently used outside of blocks assigned to this operation.
108        #[deprecated = "Use recordWasChangedBlock instead, which surfaces per-record errors"]
109        #[unsafe(method(recordChangedBlock))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn recordChangedBlock(&self)
112            -> *mut block2::DynBlock<dyn Fn(NonNull<CKRecord>)>;
113
114        #[cfg(all(feature = "CKRecord", feature = "block2"))]
115        /// Setter for [`recordChangedBlock`][Self::recordChangedBlock].
116        #[deprecated = "Use recordWasChangedBlock instead, which surfaces per-record errors"]
117        #[unsafe(method(setRecordChangedBlock:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setRecordChangedBlock(
120            &self,
121            record_changed_block: Option<&block2::DynBlock<dyn Fn(NonNull<CKRecord>)>>,
122        );
123
124        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
125        /// If a record fails in post-processing (say, a network failure materializing a
126        /// `CKAsset`record field), the per-record error will be passed here.
127        /// Each
128        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
129        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
130        /// should not be concurrently used outside of blocks assigned to this operation.
131        #[unsafe(method(recordWasChangedBlock))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn recordWasChangedBlock(
134            &self,
135        ) -> *mut block2::DynBlock<dyn Fn(NonNull<CKRecordID>, *mut CKRecord, *mut NSError)>;
136
137        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
138        /// Setter for [`recordWasChangedBlock`][Self::recordWasChangedBlock].
139        #[unsafe(method(setRecordWasChangedBlock:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn setRecordWasChangedBlock(
142            &self,
143            record_was_changed_block: Option<
144                &block2::DynBlock<dyn Fn(NonNull<CKRecordID>, *mut CKRecord, *mut NSError)>,
145            >,
146        );
147
148        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
149        /// Each
150        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
151        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
152        /// should not be concurrently used outside of blocks assigned to this operation.
153        #[unsafe(method(recordWithIDWasDeletedBlock))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn recordWithIDWasDeletedBlock(
156            &self,
157        ) -> *mut block2::DynBlock<dyn Fn(NonNull<CKRecordID>, NonNull<CKRecordType>)>;
158
159        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
160        /// Setter for [`recordWithIDWasDeletedBlock`][Self::recordWithIDWasDeletedBlock].
161        #[unsafe(method(setRecordWithIDWasDeletedBlock:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setRecordWithIDWasDeletedBlock(
164            &self,
165            record_with_id_was_deleted_block: Option<
166                &block2::DynBlock<dyn Fn(NonNull<CKRecordID>, NonNull<CKRecordType>)>,
167            >,
168        );
169
170        #[cfg(all(
171            feature = "CKRecordZoneID",
172            feature = "CKServerChangeToken",
173            feature = "block2"
174        ))]
175        /// Clients are responsible for saving this per-recordZone
176        /// `serverChangeToken`and passing it in to the next call to
177        /// `CKFetchRecordZoneChangesOperation.`Note that a fetch can fail partway. If that happens, an updated change token may be returned in this block so that already fetched records don't need to be re-downloaded on a subsequent operation.
178        /// `recordZoneChangeTokensUpdatedBlock`will not be called after the last batch of changes in a zone; the
179        /// `recordZoneFetchCompletionBlock`block will be called instead.
180        /// The
181        /// `clientChangeTokenData`from the most recent
182        /// `CKModifyRecordsOperation`issued on this zone is also returned, or nil if none was provided.
183        /// If the server returns a
184        /// `CKErrorChangeTokenExpired`error, the
185        /// `serverChangeToken`used for this record zone when initting this operation was too old and the client should toss its local cache and re-fetch the changes in this record zone starting with a nil
186        /// `serverChangeToken.``recordZoneChangeTokensUpdatedBlock`will not be called if
187        /// `fetchAllChanges`is NO.
188        /// Each
189        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
190        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
191        /// should not be concurrently used outside of blocks assigned to this operation.
192        #[unsafe(method(recordZoneChangeTokensUpdatedBlock))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn recordZoneChangeTokensUpdatedBlock(
195            &self,
196        ) -> *mut block2::DynBlock<
197            dyn Fn(NonNull<CKRecordZoneID>, *mut CKServerChangeToken, *mut NSData),
198        >;
199
200        #[cfg(all(
201            feature = "CKRecordZoneID",
202            feature = "CKServerChangeToken",
203            feature = "block2"
204        ))]
205        /// Setter for [`recordZoneChangeTokensUpdatedBlock`][Self::recordZoneChangeTokensUpdatedBlock].
206        #[unsafe(method(setRecordZoneChangeTokensUpdatedBlock:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setRecordZoneChangeTokensUpdatedBlock(
209            &self,
210            record_zone_change_tokens_updated_block: Option<
211                &block2::DynBlock<
212                    dyn Fn(NonNull<CKRecordZoneID>, *mut CKServerChangeToken, *mut NSData),
213                >,
214            >,
215        );
216
217        #[cfg(all(
218            feature = "CKRecordZoneID",
219            feature = "CKServerChangeToken",
220            feature = "block2"
221        ))]
222        #[unsafe(method(recordZoneFetchCompletionBlock))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn recordZoneFetchCompletionBlock(
225            &self,
226        ) -> *mut block2::DynBlock<
227            dyn Fn(
228                NonNull<CKRecordZoneID>,
229                *mut CKServerChangeToken,
230                *mut NSData,
231                Bool,
232                *mut NSError,
233            ),
234        >;
235
236        #[cfg(all(
237            feature = "CKRecordZoneID",
238            feature = "CKServerChangeToken",
239            feature = "block2"
240        ))]
241        /// Setter for [`recordZoneFetchCompletionBlock`][Self::recordZoneFetchCompletionBlock].
242        #[unsafe(method(setRecordZoneFetchCompletionBlock:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setRecordZoneFetchCompletionBlock(
245            &self,
246            record_zone_fetch_completion_block: Option<
247                &block2::DynBlock<
248                    dyn Fn(
249                        NonNull<CKRecordZoneID>,
250                        *mut CKServerChangeToken,
251                        *mut NSData,
252                        Bool,
253                        *mut NSError,
254                    ),
255                >,
256            >,
257        );
258
259        #[cfg(feature = "block2")]
260        /// This block is called when the operation completes.
261        ///
262        ///
263        /// `serverChangeToken-s`previously returned via a
264        /// `recordZoneChangeTokensUpdatedBlock`or
265        /// `recordZoneFetchCompletionBlock`invocation, along with the record changes that preceded it, are valid even if there is a subsequent
266        /// `operationError`If the error is
267        /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of recordIDs and zoneIDs to errors keyed off of
268        /// `CKPartialErrorsByItemIDKey.`Each
269        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
270        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
271        /// should not be concurrently used outside of blocks assigned to this operation.
272        #[unsafe(method(fetchRecordZoneChangesCompletionBlock))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn fetchRecordZoneChangesCompletionBlock(
275            &self,
276        ) -> *mut block2::DynBlock<dyn Fn(*mut NSError)>;
277
278        #[cfg(feature = "block2")]
279        /// Setter for [`fetchRecordZoneChangesCompletionBlock`][Self::fetchRecordZoneChangesCompletionBlock].
280        #[unsafe(method(setFetchRecordZoneChangesCompletionBlock:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn setFetchRecordZoneChangesCompletionBlock(
283            &self,
284            fetch_record_zone_changes_completion_block: Option<
285                &block2::DynBlock<dyn Fn(*mut NSError)>,
286            >,
287        );
288    );
289}
290
291/// Methods declared on superclass `NSObject`.
292#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
293impl CKFetchRecordZoneChangesOperation {
294    extern_methods!(
295        #[unsafe(method(new))]
296        #[unsafe(method_family = new)]
297        pub unsafe fn new() -> Retained<Self>;
298    );
299}
300
301/// Deprecated.
302#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
303impl CKFetchRecordZoneChangesOperation {
304    extern_methods!(
305        #[cfg(feature = "CKRecordZoneID")]
306        #[deprecated]
307        #[unsafe(method(initWithRecordZoneIDs:optionsByRecordZoneID:))]
308        #[unsafe(method_family = init)]
309        pub unsafe fn initWithRecordZoneIDs_optionsByRecordZoneID(
310            this: Allocated<Self>,
311            record_zone_i_ds: &NSArray<CKRecordZoneID>,
312            options_by_record_zone_id: Option<
313                &NSDictionary<CKRecordZoneID, CKFetchRecordZoneChangesOptions>,
314            >,
315        ) -> Retained<Self>;
316
317        #[cfg(feature = "CKRecordZoneID")]
318        #[deprecated]
319        #[unsafe(method(optionsByRecordZoneID))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn optionsByRecordZoneID(
322            &self,
323        ) -> Option<Retained<NSDictionary<CKRecordZoneID, CKFetchRecordZoneChangesOptions>>>;
324
325        #[cfg(feature = "CKRecordZoneID")]
326        /// Setter for [`optionsByRecordZoneID`][Self::optionsByRecordZoneID].
327        #[deprecated]
328        #[unsafe(method(setOptionsByRecordZoneID:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn setOptionsByRecordZoneID(
331            &self,
332            options_by_record_zone_id: Option<
333                &NSDictionary<CKRecordZoneID, CKFetchRecordZoneChangesOptions>,
334            >,
335        );
336    );
337}
338
339extern_class!(
340    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchrecordzonechangesconfiguration?language=objc)
341    #[unsafe(super(NSObject))]
342    #[derive(Debug, PartialEq, Eq, Hash)]
343    pub struct CKFetchRecordZoneChangesConfiguration;
344);
345
346extern_conformance!(
347    unsafe impl NSCoding for CKFetchRecordZoneChangesConfiguration {}
348);
349
350extern_conformance!(
351    unsafe impl NSCopying for CKFetchRecordZoneChangesConfiguration {}
352);
353
354unsafe impl CopyingHelper for CKFetchRecordZoneChangesConfiguration {
355    type Result = Self;
356}
357
358extern_conformance!(
359    unsafe impl NSObjectProtocol for CKFetchRecordZoneChangesConfiguration {}
360);
361
362extern_conformance!(
363    unsafe impl NSSecureCoding for CKFetchRecordZoneChangesConfiguration {}
364);
365
366impl CKFetchRecordZoneChangesConfiguration {
367    extern_methods!(
368        #[cfg(feature = "CKServerChangeToken")]
369        #[unsafe(method(previousServerChangeToken))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn previousServerChangeToken(&self) -> Option<Retained<CKServerChangeToken>>;
372
373        #[cfg(feature = "CKServerChangeToken")]
374        /// Setter for [`previousServerChangeToken`][Self::previousServerChangeToken].
375        #[unsafe(method(setPreviousServerChangeToken:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setPreviousServerChangeToken(
378            &self,
379            previous_server_change_token: Option<&CKServerChangeToken>,
380        );
381
382        #[unsafe(method(resultsLimit))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn resultsLimit(&self) -> NSUInteger;
385
386        /// Setter for [`resultsLimit`][Self::resultsLimit].
387        #[unsafe(method(setResultsLimit:))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn setResultsLimit(&self, results_limit: NSUInteger);
390
391        #[cfg(feature = "CKRecord")]
392        /// Declares which user-defined keys should be fetched and added to the resulting CKRecords.
393        ///
394        ///
395        /// If nil, declares the entire record should be downloaded. If set to an empty array, declares that no user fields should be downloaded.
396        /// Defaults to
397        /// `nil.`
398        #[unsafe(method(desiredKeys))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn desiredKeys(&self) -> Option<Retained<NSArray<CKRecordFieldKey>>>;
401
402        #[cfg(feature = "CKRecord")]
403        /// Setter for [`desiredKeys`][Self::desiredKeys].
404        #[unsafe(method(setDesiredKeys:))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn setDesiredKeys(&self, desired_keys: Option<&NSArray<CKRecordFieldKey>>);
407    );
408}
409
410/// Methods declared on superclass `NSObject`.
411impl CKFetchRecordZoneChangesConfiguration {
412    extern_methods!(
413        #[unsafe(method(init))]
414        #[unsafe(method_family = init)]
415        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
416
417        #[unsafe(method(new))]
418        #[unsafe(method_family = new)]
419        pub unsafe fn new() -> Retained<Self>;
420    );
421}
422
423extern_class!(
424    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchrecordzonechangesoptions?language=objc)
425    #[unsafe(super(NSObject))]
426    #[derive(Debug, PartialEq, Eq, Hash)]
427    #[deprecated]
428    pub struct CKFetchRecordZoneChangesOptions;
429);
430
431extern_conformance!(
432    unsafe impl NSCoding for CKFetchRecordZoneChangesOptions {}
433);
434
435extern_conformance!(
436    unsafe impl NSCopying for CKFetchRecordZoneChangesOptions {}
437);
438
439unsafe impl CopyingHelper for CKFetchRecordZoneChangesOptions {
440    type Result = Self;
441}
442
443extern_conformance!(
444    unsafe impl NSObjectProtocol for CKFetchRecordZoneChangesOptions {}
445);
446
447extern_conformance!(
448    unsafe impl NSSecureCoding for CKFetchRecordZoneChangesOptions {}
449);
450
451impl CKFetchRecordZoneChangesOptions {
452    extern_methods!(
453        #[cfg(feature = "CKServerChangeToken")]
454        #[deprecated]
455        #[unsafe(method(previousServerChangeToken))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn previousServerChangeToken(&self) -> Option<Retained<CKServerChangeToken>>;
458
459        #[cfg(feature = "CKServerChangeToken")]
460        /// Setter for [`previousServerChangeToken`][Self::previousServerChangeToken].
461        #[deprecated]
462        #[unsafe(method(setPreviousServerChangeToken:))]
463        #[unsafe(method_family = none)]
464        pub unsafe fn setPreviousServerChangeToken(
465            &self,
466            previous_server_change_token: Option<&CKServerChangeToken>,
467        );
468
469        #[deprecated]
470        #[unsafe(method(resultsLimit))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn resultsLimit(&self) -> NSUInteger;
473
474        /// Setter for [`resultsLimit`][Self::resultsLimit].
475        #[deprecated]
476        #[unsafe(method(setResultsLimit:))]
477        #[unsafe(method_family = none)]
478        pub unsafe fn setResultsLimit(&self, results_limit: NSUInteger);
479
480        #[cfg(feature = "CKRecord")]
481        #[deprecated]
482        #[unsafe(method(desiredKeys))]
483        #[unsafe(method_family = none)]
484        pub unsafe fn desiredKeys(&self) -> Option<Retained<NSArray<CKRecordFieldKey>>>;
485
486        #[cfg(feature = "CKRecord")]
487        /// Setter for [`desiredKeys`][Self::desiredKeys].
488        #[deprecated]
489        #[unsafe(method(setDesiredKeys:))]
490        #[unsafe(method_family = none)]
491        pub unsafe fn setDesiredKeys(&self, desired_keys: Option<&NSArray<CKRecordFieldKey>>);
492    );
493}
494
495/// Methods declared on superclass `NSObject`.
496impl CKFetchRecordZoneChangesOptions {
497    extern_methods!(
498        #[unsafe(method(init))]
499        #[unsafe(method_family = init)]
500        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
501
502        #[unsafe(method(new))]
503        #[unsafe(method_family = new)]
504        pub unsafe fn new() -> Retained<Self>;
505    );
506}