objc2_cloud_kit/generated/
CKFetchRecordsOperation.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    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchrecordsoperation?language=objc)
12    #[unsafe(super(CKDatabaseOperation, CKOperation, NSOperation, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
15    pub struct CKFetchRecordsOperation;
16);
17
18#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
19extern_conformance!(
20    unsafe impl NSObjectProtocol for CKFetchRecordsOperation {}
21);
22
23#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
24impl CKFetchRecordsOperation {
25    extern_methods!(
26        #[unsafe(method(init))]
27        #[unsafe(method_family = init)]
28        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
29
30        #[cfg(feature = "CKRecordID")]
31        #[unsafe(method(initWithRecordIDs:))]
32        #[unsafe(method_family = init)]
33        pub unsafe fn initWithRecordIDs(
34            this: Allocated<Self>,
35            record_i_ds: &NSArray<CKRecordID>,
36        ) -> Retained<Self>;
37
38        #[unsafe(method(fetchCurrentUserRecordOperation))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn fetchCurrentUserRecordOperation() -> Retained<Self>;
41
42        #[cfg(feature = "CKRecordID")]
43        /// This property is not atomic.
44        ///
45        /// # Safety
46        ///
47        /// This might not be thread-safe.
48        #[unsafe(method(recordIDs))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn recordIDs(&self) -> Option<Retained<NSArray<CKRecordID>>>;
51
52        #[cfg(feature = "CKRecordID")]
53        /// Setter for [`recordIDs`][Self::recordIDs].
54        ///
55        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
56        ///
57        /// # Safety
58        ///
59        /// This might not be thread-safe.
60        #[unsafe(method(setRecordIDs:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setRecordIDs(&self, record_i_ds: Option<&NSArray<CKRecordID>>);
63
64        #[cfg(feature = "CKRecord")]
65        /// Declares which user-defined keys should be fetched and added to the resulting CKRecords.
66        ///
67        ///
68        /// If nil, declares the entire record should be downloaded. If set to an empty array, declares that no user fields should be downloaded.
69        /// Defaults to
70        /// `nil.`
71        ///
72        /// This property is not atomic.
73        ///
74        /// # Safety
75        ///
76        /// This might not be thread-safe.
77        #[unsafe(method(desiredKeys))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn desiredKeys(&self) -> Option<Retained<NSArray<CKRecordFieldKey>>>;
80
81        #[cfg(feature = "CKRecord")]
82        /// Setter for [`desiredKeys`][Self::desiredKeys].
83        ///
84        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
85        ///
86        /// # Safety
87        ///
88        /// This might not be thread-safe.
89        #[unsafe(method(setDesiredKeys:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn setDesiredKeys(&self, desired_keys: Option<&NSArray<CKRecordFieldKey>>);
92
93        #[cfg(all(feature = "CKRecordID", feature = "block2"))]
94        /// Indicates the progress for each record.
95        ///
96        ///
97        /// This method is called at least once with a progress of 1.0 for every record. Intermediate progress is only reported for records that contain assets.
98        /// It is possible for progress to regress when a retry is automatically triggered.
99        /// Each
100        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
101        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
102        /// should not be concurrently used outside of blocks assigned to this operation.
103        ///
104        /// This property is not atomic.
105        ///
106        /// # Safety
107        ///
108        /// - The returned block's argument 1 must be a valid pointer.
109        /// - This might not be thread-safe.
110        #[unsafe(method(perRecordProgressBlock))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn perRecordProgressBlock(
113            &self,
114        ) -> *mut block2::DynBlock<dyn Fn(NonNull<CKRecordID>, c_double)>;
115
116        #[cfg(all(feature = "CKRecordID", feature = "block2"))]
117        /// Setter for [`perRecordProgressBlock`][Self::perRecordProgressBlock].
118        ///
119        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
120        ///
121        /// # Safety
122        ///
123        /// This might not be thread-safe.
124        #[unsafe(method(setPerRecordProgressBlock:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setPerRecordProgressBlock(
127            &self,
128            per_record_progress_block: Option<
129                &block2::DynBlock<dyn Fn(NonNull<CKRecordID>, c_double)>,
130            >,
131        );
132
133        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
134        /// Called on success or failure for each record.
135        ///
136        ///
137        /// Each
138        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
139        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
140        /// should not be concurrently used outside of blocks assigned to this operation.
141        ///
142        /// This property is not atomic.
143        ///
144        /// # Safety
145        ///
146        /// - The returned block's argument 1 must be a valid pointer or null.
147        /// - The returned block's argument 2 must be a valid pointer or null.
148        /// - The returned block's argument 3 must be a valid pointer or null.
149        /// - This might not be thread-safe.
150        #[unsafe(method(perRecordCompletionBlock))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn perRecordCompletionBlock(
153            &self,
154        ) -> *mut block2::DynBlock<dyn Fn(*mut CKRecord, *mut CKRecordID, *mut NSError)>;
155
156        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
157        /// Setter for [`perRecordCompletionBlock`][Self::perRecordCompletionBlock].
158        ///
159        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
160        ///
161        /// # Safety
162        ///
163        /// This might not be thread-safe.
164        #[unsafe(method(setPerRecordCompletionBlock:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn setPerRecordCompletionBlock(
167            &self,
168            per_record_completion_block: Option<
169                &block2::DynBlock<dyn Fn(*mut CKRecord, *mut CKRecordID, *mut NSError)>,
170            >,
171        );
172
173        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
174        /// This block is called when the operation completes.
175        ///
176        ///
177        /// The
178        ///
179        /// ```text
180        ///  -[NSOperation completionBlock]
181        /// ```
182        ///
183        /// will also be called if both are set.
184        /// If the error is
185        /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of recordIDs to errors keyed off of
186        /// `CKPartialErrorsByItemIDKey.``recordsByRecordID`and any
187        /// `CKPartialErrorsByItemIDKey`errors are repeats of the data sent back in previous
188        /// `perRecordCompletionBlock`invocations
189        /// Each
190        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
191        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
192        /// should not be concurrently used outside of blocks assigned to this operation.
193        ///
194        /// This property is not atomic.
195        ///
196        /// # Safety
197        ///
198        /// - The returned block's argument 1 must be a valid pointer or null.
199        /// - The returned block's argument 2 must be a valid pointer or null.
200        /// - This might not be thread-safe.
201        #[unsafe(method(fetchRecordsCompletionBlock))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn fetchRecordsCompletionBlock(
204            &self,
205        ) -> *mut block2::DynBlock<dyn Fn(*mut NSDictionary<CKRecordID, CKRecord>, *mut NSError)>;
206
207        #[cfg(all(feature = "CKRecord", feature = "CKRecordID", feature = "block2"))]
208        /// Setter for [`fetchRecordsCompletionBlock`][Self::fetchRecordsCompletionBlock].
209        ///
210        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
211        ///
212        /// # Safety
213        ///
214        /// This might not be thread-safe.
215        #[unsafe(method(setFetchRecordsCompletionBlock:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setFetchRecordsCompletionBlock(
218            &self,
219            fetch_records_completion_block: Option<
220                &block2::DynBlock<dyn Fn(*mut NSDictionary<CKRecordID, CKRecord>, *mut NSError)>,
221            >,
222        );
223    );
224}
225
226/// Methods declared on superclass `NSObject`.
227#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
228impl CKFetchRecordsOperation {
229    extern_methods!(
230        #[unsafe(method(new))]
231        #[unsafe(method_family = new)]
232        pub unsafe fn new() -> Retained<Self>;
233    );
234}