objc2_cloud_kit/generated/
CKFetchShareMetadataOperation.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    /// Fetch the
12    /// `CKShareMetadata`for a share URL.
13    ///
14    ///
15    /// Since you can't know what container this share is in before you fetch its metadata, you may run this operation in any container you have access to
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchsharemetadataoperation?language=objc)
18    #[unsafe(super(CKOperation, NSOperation, NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(feature = "CKOperation")]
21    pub struct CKFetchShareMetadataOperation;
22);
23
24#[cfg(feature = "CKOperation")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for CKFetchShareMetadataOperation {}
27);
28
29#[cfg(feature = "CKOperation")]
30impl CKFetchShareMetadataOperation {
31    extern_methods!(
32        #[unsafe(method(init))]
33        #[unsafe(method_family = init)]
34        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
35
36        #[unsafe(method(initWithShareURLs:))]
37        #[unsafe(method_family = init)]
38        pub unsafe fn initWithShareURLs(
39            this: Allocated<Self>,
40            share_ur_ls: &NSArray<NSURL>,
41        ) -> Retained<Self>;
42
43        /// This property is not atomic.
44        ///
45        /// # Safety
46        ///
47        /// This might not be thread-safe.
48        #[unsafe(method(shareURLs))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn shareURLs(&self) -> Option<Retained<NSArray<NSURL>>>;
51
52        /// Setter for [`shareURLs`][Self::shareURLs].
53        ///
54        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
55        ///
56        /// # Safety
57        ///
58        /// This might not be thread-safe.
59        #[unsafe(method(setShareURLs:))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn setShareURLs(&self, share_ur_ls: Option<&NSArray<NSURL>>);
62
63        /// If set to YES, the resulting
64        /// `CKShareMetadata`will have a
65        /// `rootRecord`object filled out.
66        ///
67        ///
68        /// Defaults to
69        /// `NO.`The resulting
70        /// `CKShareMetadata`will have a
71        /// `rootRecordID`property regardless of the value of this property.
72        ///
73        /// This property is not atomic.
74        ///
75        /// # Safety
76        ///
77        /// This might not be thread-safe.
78        #[unsafe(method(shouldFetchRootRecord))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn shouldFetchRootRecord(&self) -> bool;
81
82        /// Setter for [`shouldFetchRootRecord`][Self::shouldFetchRootRecord].
83        ///
84        /// # Safety
85        ///
86        /// This might not be thread-safe.
87        #[unsafe(method(setShouldFetchRootRecord:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setShouldFetchRootRecord(&self, should_fetch_root_record: bool);
90
91        #[cfg(feature = "CKRecord")]
92        /// Declares which user-defined keys should be fetched and added to the resulting
93        /// `rootRecord.`
94        ///
95        /// Only consulted if
96        /// `shouldFetchRootRecord`is
97        /// `YES.`If nil, declares the entire root record should be downloaded. If set to an empty array, declares that no user fields should be downloaded.
98        /// Defaults to
99        /// `nil.`
100        ///
101        /// This property is not atomic.
102        ///
103        /// # Safety
104        ///
105        /// This might not be thread-safe.
106        #[unsafe(method(rootRecordDesiredKeys))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn rootRecordDesiredKeys(&self) -> Option<Retained<NSArray<CKRecordFieldKey>>>;
109
110        #[cfg(feature = "CKRecord")]
111        /// Setter for [`rootRecordDesiredKeys`][Self::rootRecordDesiredKeys].
112        ///
113        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
114        ///
115        /// # Safety
116        ///
117        /// This might not be thread-safe.
118        #[unsafe(method(setRootRecordDesiredKeys:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn setRootRecordDesiredKeys(
121            &self,
122            root_record_desired_keys: Option<&NSArray<CKRecordFieldKey>>,
123        );
124
125        #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
126        /// Called once for each share URL that the server processed
127        ///
128        ///
129        /// Each
130        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
131        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
132        /// should not be concurrently used outside of blocks assigned to this operation.
133        ///
134        /// This property is not atomic.
135        ///
136        /// # Safety
137        ///
138        /// - The returned block's argument 1 must be a valid pointer.
139        /// - The returned block's argument 2 must be a valid pointer or null.
140        /// - The returned block's argument 3 must be a valid pointer or null.
141        /// - This might not be thread-safe.
142        #[unsafe(method(perShareMetadataBlock))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn perShareMetadataBlock(
145            &self,
146        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSURL>, *mut CKShareMetadata, *mut NSError)>;
147
148        #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
149        /// Setter for [`perShareMetadataBlock`][Self::perShareMetadataBlock].
150        ///
151        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
152        ///
153        /// # Safety
154        ///
155        /// This might not be thread-safe.
156        #[unsafe(method(setPerShareMetadataBlock:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setPerShareMetadataBlock(
159            &self,
160            per_share_metadata_block: Option<
161                &block2::DynBlock<dyn Fn(NonNull<NSURL>, *mut CKShareMetadata, *mut NSError)>,
162            >,
163        );
164
165        #[cfg(feature = "block2")]
166        /// This block is called when the operation completes.
167        ///
168        ///
169        /// The
170        ///
171        /// ```text
172        ///  -[NSOperation completionBlock]
173        /// ```
174        ///
175        /// will also be called if both are set.
176        /// If the error is
177        /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of shareURLs to errors keyed off of
178        /// `CKPartialErrorsByItemIDKey.`These errors are repeats of those sent back in previous
179        /// `perShareMetadataBlock`invocations
180        /// Each
181        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
182        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
183        /// should not be concurrently used outside of blocks assigned to this operation.
184        ///
185        /// This property is not atomic.
186        ///
187        /// # Safety
188        ///
189        /// - The returned block's argument must be a valid pointer or null.
190        /// - This might not be thread-safe.
191        #[unsafe(method(fetchShareMetadataCompletionBlock))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn fetchShareMetadataCompletionBlock(
194            &self,
195        ) -> *mut block2::DynBlock<dyn Fn(*mut NSError)>;
196
197        #[cfg(feature = "block2")]
198        /// Setter for [`fetchShareMetadataCompletionBlock`][Self::fetchShareMetadataCompletionBlock].
199        ///
200        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
201        ///
202        /// # Safety
203        ///
204        /// This might not be thread-safe.
205        #[unsafe(method(setFetchShareMetadataCompletionBlock:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn setFetchShareMetadataCompletionBlock(
208            &self,
209            fetch_share_metadata_completion_block: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
210        );
211    );
212}
213
214/// Methods declared on superclass `NSObject`.
215#[cfg(feature = "CKOperation")]
216impl CKFetchShareMetadataOperation {
217    extern_methods!(
218        #[unsafe(method(new))]
219        #[unsafe(method_family = new)]
220        pub unsafe fn new() -> Retained<Self>;
221    );
222}