objc2_cloud_kit/generated/CKAcceptSharesOperation.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/ckacceptsharesoperation?language=objc)
12 #[unsafe(super(CKOperation, NSOperation, NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 #[cfg(feature = "CKOperation")]
15 pub struct CKAcceptSharesOperation;
16);
17
18#[cfg(feature = "CKOperation")]
19extern_conformance!(
20 unsafe impl NSObjectProtocol for CKAcceptSharesOperation {}
21);
22
23#[cfg(feature = "CKOperation")]
24impl CKAcceptSharesOperation {
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 = "CKShareMetadata")]
31 #[unsafe(method(initWithShareMetadatas:))]
32 #[unsafe(method_family = init)]
33 pub unsafe fn initWithShareMetadatas(
34 this: Allocated<Self>,
35 share_metadatas: &NSArray<CKShareMetadata>,
36 ) -> Retained<Self>;
37
38 #[cfg(feature = "CKShareMetadata")]
39 /// This property is not atomic.
40 ///
41 /// # Safety
42 ///
43 /// This might not be thread-safe.
44 #[unsafe(method(shareMetadatas))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn shareMetadatas(&self) -> Option<Retained<NSArray<CKShareMetadata>>>;
47
48 #[cfg(feature = "CKShareMetadata")]
49 /// Setter for [`shareMetadatas`][Self::shareMetadatas].
50 ///
51 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
52 ///
53 /// # Safety
54 ///
55 /// This might not be thread-safe.
56 #[unsafe(method(setShareMetadatas:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn setShareMetadatas(&self, share_metadatas: Option<&NSArray<CKShareMetadata>>);
59
60 #[cfg(all(
61 feature = "CKRecord",
62 feature = "CKShare",
63 feature = "CKShareMetadata",
64 feature = "block2"
65 ))]
66 /// Called once for each share metadata that the server processed
67 ///
68 ///
69 /// If error is nil then the share was successfully accepted.
70 /// Each
71 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
72 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
73 /// should not be concurrently used outside of blocks assigned to this operation.
74 ///
75 /// This property is not atomic.
76 ///
77 /// # Safety
78 ///
79 /// - The returned block's argument 1 must be a valid pointer.
80 /// - The returned block's argument 2 must be a valid pointer or null.
81 /// - The returned block's argument 3 must be a valid pointer or null.
82 /// - This might not be thread-safe.
83 #[unsafe(method(perShareCompletionBlock))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn perShareCompletionBlock(
86 &self,
87 ) -> *mut block2::DynBlock<dyn Fn(NonNull<CKShareMetadata>, *mut CKShare, *mut NSError)>;
88
89 #[cfg(all(
90 feature = "CKRecord",
91 feature = "CKShare",
92 feature = "CKShareMetadata",
93 feature = "block2"
94 ))]
95 /// Setter for [`perShareCompletionBlock`][Self::perShareCompletionBlock].
96 ///
97 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
98 ///
99 /// # Safety
100 ///
101 /// This might not be thread-safe.
102 #[unsafe(method(setPerShareCompletionBlock:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn setPerShareCompletionBlock(
105 &self,
106 per_share_completion_block: Option<
107 &block2::DynBlock<dyn Fn(NonNull<CKShareMetadata>, *mut CKShare, *mut NSError)>,
108 >,
109 );
110
111 #[cfg(feature = "block2")]
112 /// This block is called when the operation completes.
113 ///
114 ///
115 /// The
116 ///
117 /// ```text
118 /// -[NSOperation completionBlock]
119 /// ```
120 ///
121 /// will also be called if both are set.
122 /// If the error is
123 /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of shareURLs to errors keyed off of
124 /// `CKPartialErrorsByItemIDKey.`These errors are repeats of those sent back in previous
125 /// `perShareCompletionBlock`invocations
126 /// Each
127 /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
128 /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
129 /// should not be concurrently used outside of blocks assigned to this operation.
130 ///
131 /// This property is not atomic.
132 ///
133 /// # Safety
134 ///
135 /// - The returned block's argument must be a valid pointer or null.
136 /// - This might not be thread-safe.
137 #[unsafe(method(acceptSharesCompletionBlock))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn acceptSharesCompletionBlock(
140 &self,
141 ) -> *mut block2::DynBlock<dyn Fn(*mut NSError)>;
142
143 #[cfg(feature = "block2")]
144 /// Setter for [`acceptSharesCompletionBlock`][Self::acceptSharesCompletionBlock].
145 ///
146 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
147 ///
148 /// # Safety
149 ///
150 /// This might not be thread-safe.
151 #[unsafe(method(setAcceptSharesCompletionBlock:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn setAcceptSharesCompletionBlock(
154 &self,
155 accept_shares_completion_block: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
156 );
157 );
158}
159
160/// Methods declared on superclass `NSObject`.
161#[cfg(feature = "CKOperation")]
162impl CKAcceptSharesOperation {
163 extern_methods!(
164 #[unsafe(method(new))]
165 #[unsafe(method_family = new)]
166 pub unsafe fn new() -> Retained<Self>;
167 );
168}