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        #[unsafe(method(shareURLs))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn shareURLs(&self) -> Option<Retained<NSArray<NSURL>>>;
46
47        /// Setter for [`shareURLs`][Self::shareURLs].
48        #[unsafe(method(setShareURLs:))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn setShareURLs(&self, share_ur_ls: Option<&NSArray<NSURL>>);
51
52        /// If set to YES, the resulting
53        /// `CKShareMetadata`will have a
54        /// `rootRecord`object filled out.
55        ///
56        ///
57        /// Defaults to
58        /// `NO.`The resulting
59        /// `CKShareMetadata`will have a
60        /// `rootRecordID`property regardless of the value of this property.
61        #[unsafe(method(shouldFetchRootRecord))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn shouldFetchRootRecord(&self) -> bool;
64
65        /// Setter for [`shouldFetchRootRecord`][Self::shouldFetchRootRecord].
66        #[unsafe(method(setShouldFetchRootRecord:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setShouldFetchRootRecord(&self, should_fetch_root_record: bool);
69
70        #[cfg(feature = "CKRecord")]
71        /// Declares which user-defined keys should be fetched and added to the resulting
72        /// `rootRecord.`
73        ///
74        /// Only consulted if
75        /// `shouldFetchRootRecord`is
76        /// `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.
77        /// Defaults to
78        /// `nil.`
79        #[unsafe(method(rootRecordDesiredKeys))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn rootRecordDesiredKeys(&self) -> Option<Retained<NSArray<CKRecordFieldKey>>>;
82
83        #[cfg(feature = "CKRecord")]
84        /// Setter for [`rootRecordDesiredKeys`][Self::rootRecordDesiredKeys].
85        #[unsafe(method(setRootRecordDesiredKeys:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setRootRecordDesiredKeys(
88            &self,
89            root_record_desired_keys: Option<&NSArray<CKRecordFieldKey>>,
90        );
91
92        #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
93        /// Called once for each share URL that the server processed
94        ///
95        ///
96        /// Each
97        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
98        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
99        /// should not be concurrently used outside of blocks assigned to this operation.
100        #[unsafe(method(perShareMetadataBlock))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn perShareMetadataBlock(
103            &self,
104        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSURL>, *mut CKShareMetadata, *mut NSError)>;
105
106        #[cfg(all(feature = "CKShareMetadata", feature = "block2"))]
107        /// Setter for [`perShareMetadataBlock`][Self::perShareMetadataBlock].
108        #[unsafe(method(setPerShareMetadataBlock:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setPerShareMetadataBlock(
111            &self,
112            per_share_metadata_block: Option<
113                &block2::DynBlock<dyn Fn(NonNull<NSURL>, *mut CKShareMetadata, *mut NSError)>,
114            >,
115        );
116
117        #[cfg(feature = "block2")]
118        /// This block is called when the operation completes.
119        ///
120        ///
121        /// The
122        ///
123        /// ```text
124        ///  -[NSOperation completionBlock]
125        /// ```
126        ///
127        /// will also be called if both are set.
128        /// If the error is
129        /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of shareURLs to errors keyed off of
130        /// `CKPartialErrorsByItemIDKey.`These errors are repeats of those sent back in previous
131        /// `perShareMetadataBlock`invocations
132        /// Each
133        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
134        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
135        /// should not be concurrently used outside of blocks assigned to this operation.
136        #[unsafe(method(fetchShareMetadataCompletionBlock))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn fetchShareMetadataCompletionBlock(
139            &self,
140        ) -> *mut block2::DynBlock<dyn Fn(*mut NSError)>;
141
142        #[cfg(feature = "block2")]
143        /// Setter for [`fetchShareMetadataCompletionBlock`][Self::fetchShareMetadataCompletionBlock].
144        #[unsafe(method(setFetchShareMetadataCompletionBlock:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setFetchShareMetadataCompletionBlock(
147            &self,
148            fetch_share_metadata_completion_block: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
149        );
150    );
151}
152
153/// Methods declared on superclass `NSObject`.
154#[cfg(feature = "CKOperation")]
155impl CKFetchShareMetadataOperation {
156    extern_methods!(
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub unsafe fn new() -> Retained<Self>;
160    );
161}