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