objc2_cloud_kit/generated/CKFetchDatabaseChangesOperation.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 changes to record zones within a database
12 ///
13 ///
14 /// If a change anchor from a previous
15 /// `CKFetchDatabaseChangesOperation`is passed in, only the zones that have changed since that anchor will be returned.
16 /// This per-database
17 /// `serverChangeToken`is not to be confused with the per-recordZone
18 /// `serverChangeToken`from
19 /// `CKFetchRecordZoneChangesOperation.`If this is your first fetch or if you wish to re-fetch all zones, pass nil for the change token.
20 /// Change token are opaque tokens and clients should not infer any behavior based on their content.
21 /// `CKFetchDatabaseChangesOperation`is supported in a
22 /// `privateCloudDatabase`and
23 /// `sharedCloudDatabase`
24 ///
25 /// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchdatabasechangesoperation?language=objc)
26 #[unsafe(super(CKDatabaseOperation, CKOperation, NSOperation, NSObject))]
27 #[derive(Debug, PartialEq, Eq, Hash)]
28 #[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
29 pub struct CKFetchDatabaseChangesOperation;
30);
31
32#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
33unsafe impl NSObjectProtocol for CKFetchDatabaseChangesOperation {}
34
35#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
36impl CKFetchDatabaseChangesOperation {
37 extern_methods!(
38 #[unsafe(method(init))]
39 #[unsafe(method_family = init)]
40 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
41
42 #[cfg(feature = "CKServerChangeToken")]
43 #[unsafe(method(initWithPreviousServerChangeToken:))]
44 #[unsafe(method_family = init)]
45 pub unsafe fn initWithPreviousServerChangeToken(
46 this: Allocated<Self>,
47 previous_server_change_token: Option<&CKServerChangeToken>,
48 ) -> Retained<Self>;
49
50 #[cfg(feature = "CKServerChangeToken")]
51 #[unsafe(method(previousServerChangeToken))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn previousServerChangeToken(&self) -> Option<Retained<CKServerChangeToken>>;
54
55 #[cfg(feature = "CKServerChangeToken")]
56 /// Setter for [`previousServerChangeToken`][Self::previousServerChangeToken].
57 #[unsafe(method(setPreviousServerChangeToken:))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn setPreviousServerChangeToken(
60 &self,
61 previous_server_change_token: Option<&CKServerChangeToken>,
62 );
63
64 #[unsafe(method(resultsLimit))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn resultsLimit(&self) -> NSUInteger;
67
68 /// Setter for [`resultsLimit`][Self::resultsLimit].
69 #[unsafe(method(setResultsLimit:))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn setResultsLimit(&self, results_limit: NSUInteger);
72
73 /// When set to YES, this operation will send repeated requests to the server until all record zone changes have been fetched.
74 ///
75 /// `changeTokenUpdatedBlock`will be invoked periodically, to give clients an updated change token so that already-fetched record zone changes don't need to be re-fetched on a subsequent operation.
76 /// When set to NO, it is the responsibility of the caller to issue subsequent fetch-changes operations when moreComing is YES in a
77 /// `fetchDatabaseChangesCompletionBlock`invocation.
78 /// `fetchAllChanges`is
79 /// `YES`by default
80 /// Each
81 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations
82 /// Blocks assigned to this operation may share mutable state with other blocks assigned to this operation, but any such mutable state
83 /// should not be concurrently used outside of blocks assigned to this operation.
84 #[unsafe(method(fetchAllChanges))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn fetchAllChanges(&self) -> bool;
87
88 /// Setter for [`fetchAllChanges`][Self::fetchAllChanges].
89 #[unsafe(method(setFetchAllChanges:))]
90 #[unsafe(method_family = none)]
91 pub unsafe fn setFetchAllChanges(&self, fetch_all_changes: bool);
92
93 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
94 /// Each
95 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
96 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
97 /// should not be concurrently used outside of blocks assigned to this operation.
98 #[unsafe(method(recordZoneWithIDChangedBlock))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn recordZoneWithIDChangedBlock(
101 &self,
102 ) -> *mut block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>;
103
104 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
105 /// Setter for [`recordZoneWithIDChangedBlock`][Self::recordZoneWithIDChangedBlock].
106 #[unsafe(method(setRecordZoneWithIDChangedBlock:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn setRecordZoneWithIDChangedBlock(
109 &self,
110 record_zone_with_id_changed_block: Option<
111 &block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>,
112 >,
113 );
114
115 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
116 /// Each
117 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
118 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
119 /// should not be concurrently used outside of blocks assigned to this operation.
120 #[unsafe(method(recordZoneWithIDWasDeletedBlock))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn recordZoneWithIDWasDeletedBlock(
123 &self,
124 ) -> *mut block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>;
125
126 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
127 /// Setter for [`recordZoneWithIDWasDeletedBlock`][Self::recordZoneWithIDWasDeletedBlock].
128 #[unsafe(method(setRecordZoneWithIDWasDeletedBlock:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn setRecordZoneWithIDWasDeletedBlock(
131 &self,
132 record_zone_with_id_was_deleted_block: Option<
133 &block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>,
134 >,
135 );
136
137 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
138 /// If this block is set it will be called instead of
139 /// `recordZoneWithIDWasDeletedBlock`if the user deleted this zone via the iCloud storage UI.
140 ///
141 ///
142 /// This is an indication that the user wanted all data deleted, so local cached data should be wiped and not re-uploaded to the server.
143 /// Each
144 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations
145 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
146 /// should not be concurrently used outside of blocks assigned to this operation.
147 #[unsafe(method(recordZoneWithIDWasPurgedBlock))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn recordZoneWithIDWasPurgedBlock(
150 &self,
151 ) -> *mut block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>;
152
153 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
154 /// Setter for [`recordZoneWithIDWasPurgedBlock`][Self::recordZoneWithIDWasPurgedBlock].
155 #[unsafe(method(setRecordZoneWithIDWasPurgedBlock:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn setRecordZoneWithIDWasPurgedBlock(
158 &self,
159 record_zone_with_id_was_purged_block: Option<
160 &block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>,
161 >,
162 );
163
164 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
165 /// If this block is set it will be called instead of
166 /// `recordZoneWithIDWasDeletedBlock`if the user chose to reset all encrypted data for their account.
167 ///
168 ///
169 /// This is an indication that the user had to reset encrypted data during account recovery, so local cached data should be re-uploaded to the server to minimize data loss.
170 /// Each
171 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations
172 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
173 /// should not be concurrently used outside of blocks assigned to this operation.
174 #[unsafe(method(recordZoneWithIDWasDeletedDueToUserEncryptedDataResetBlock))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn recordZoneWithIDWasDeletedDueToUserEncryptedDataResetBlock(
177 &self,
178 ) -> *mut block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>;
179
180 #[cfg(all(feature = "CKRecordZoneID", feature = "block2"))]
181 /// Setter for [`recordZoneWithIDWasDeletedDueToUserEncryptedDataResetBlock`][Self::recordZoneWithIDWasDeletedDueToUserEncryptedDataResetBlock].
182 #[unsafe(method(setRecordZoneWithIDWasDeletedDueToUserEncryptedDataResetBlock:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn setRecordZoneWithIDWasDeletedDueToUserEncryptedDataResetBlock(
185 &self,
186 record_zone_with_id_was_deleted_due_to_user_encrypted_data_reset_block: Option<
187 &block2::Block<dyn Fn(NonNull<CKRecordZoneID>)>,
188 >,
189 );
190
191 #[cfg(all(feature = "CKServerChangeToken", feature = "block2"))]
192 /// Each
193 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
194 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
195 /// should not be concurrently used outside of blocks assigned to this operation.
196 #[unsafe(method(changeTokenUpdatedBlock))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn changeTokenUpdatedBlock(
199 &self,
200 ) -> *mut block2::Block<dyn Fn(NonNull<CKServerChangeToken>)>;
201
202 #[cfg(all(feature = "CKServerChangeToken", feature = "block2"))]
203 /// Setter for [`changeTokenUpdatedBlock`][Self::changeTokenUpdatedBlock].
204 #[unsafe(method(setChangeTokenUpdatedBlock:))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn setChangeTokenUpdatedBlock(
207 &self,
208 change_token_updated_block: Option<
209 &block2::Block<dyn Fn(NonNull<CKServerChangeToken>)>,
210 >,
211 );
212
213 #[cfg(all(feature = "CKServerChangeToken", feature = "block2"))]
214 /// This block is called when the operation completes.
215 ///
216 ///
217 /// Clients are responsible for saving the change token at the end of the operation and passing it in to the next call to
218 /// `CKFetchDatabaseChangesOperation.`If the server returns a
219 /// `CKErrorChangeTokenExpired`error, the
220 /// `previousServerChangeToken`value was too old and the client should toss its local cache and re-fetch the changes in this record zone starting with a nil
221 /// `previousServerChangeToken.`If
222 /// `moreComing`is true then the server wasn't able to return all the changes in this response. Another
223 /// `CKFetchDatabaseChangesOperation`operation should be run with the
224 /// `previousServerChangeToken`token from this operation.
225 /// Each
226 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations
227 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
228 /// should not be concurrently used outside of blocks assigned to this operation.
229 #[unsafe(method(fetchDatabaseChangesCompletionBlock))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn fetchDatabaseChangesCompletionBlock(
232 &self,
233 ) -> *mut block2::Block<dyn Fn(*mut CKServerChangeToken, Bool, *mut NSError)>;
234
235 #[cfg(all(feature = "CKServerChangeToken", feature = "block2"))]
236 /// Setter for [`fetchDatabaseChangesCompletionBlock`][Self::fetchDatabaseChangesCompletionBlock].
237 #[unsafe(method(setFetchDatabaseChangesCompletionBlock:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn setFetchDatabaseChangesCompletionBlock(
240 &self,
241 fetch_database_changes_completion_block: Option<
242 &block2::Block<dyn Fn(*mut CKServerChangeToken, Bool, *mut NSError)>,
243 >,
244 );
245 );
246}
247
248/// Methods declared on superclass `NSObject`.
249#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
250impl CKFetchDatabaseChangesOperation {
251 extern_methods!(
252 #[unsafe(method(new))]
253 #[unsafe(method_family = new)]
254 pub unsafe fn new() -> Retained<Self>;
255 );
256}