objc2_cloud_kit/generated/CKShareRequestAccessOperation.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/cksharerequestaccessoperation?language=objc)
12 #[unsafe(super(CKOperation, NSOperation, NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 #[cfg(feature = "CKOperation")]
15 pub struct CKShareRequestAccessOperation;
16);
17
18#[cfg(feature = "CKOperation")]
19extern_conformance!(
20 unsafe impl NSObjectProtocol for CKShareRequestAccessOperation {}
21);
22
23#[cfg(feature = "CKOperation")]
24impl CKShareRequestAccessOperation {
25 extern_methods!(
26 /// Creates a new, empty share request access operation.
27 #[unsafe(method(init))]
28 #[unsafe(method_family = init)]
29 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
30
31 /// Creates a share request access operation configured with specified share URLs.
32 ///
33 /// - Parameter shareURLs: An array of `NSURL` objects representing the shares to request access to.
34 /// - Returns: A configured ``CKShareRequestAccessOperation`` instance.
35 #[unsafe(method(initWithShareURLs:))]
36 #[unsafe(method_family = init)]
37 pub unsafe fn initWithShareURLs(
38 this: Allocated<Self>,
39 share_ur_ls: &NSArray<NSURL>,
40 ) -> Retained<Self>;
41
42 /// The URLs of the shares to request access to.
43 ///
44 /// Include multiple URLs to request access to multiple shares simultaneously. The server processes each URL independently.
45 ///
46 /// This property is not atomic.
47 ///
48 /// # Safety
49 ///
50 /// This might not be thread-safe.
51 #[unsafe(method(shareURLs))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn shareURLs(&self) -> Option<Retained<NSArray<NSURL>>>;
54
55 /// Setter for [`shareURLs`][Self::shareURLs].
56 ///
57 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
58 ///
59 /// # Safety
60 ///
61 /// This might not be thread-safe.
62 #[unsafe(method(setShareURLs:))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn setShareURLs(&self, share_ur_ls: Option<&NSArray<NSURL>>);
65
66 #[cfg(feature = "block2")]
67 /// A completion block called once for each processed share URL.
68 ///
69 /// The server does not disclose share existence to protect user privacy.
70 ///
71 /// - Parameters:
72 /// - shareURL: The URL of the share that was processed.
73 /// - shareRequestAccessError: An error describing why the access request failed, or `nil` if successful.
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 /// - This might not be thread-safe.
82 #[unsafe(method(perShareAccessRequestCompletionBlock))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn perShareAccessRequestCompletionBlock(
85 &self,
86 ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSURL>, *mut NSError)>;
87
88 #[cfg(feature = "block2")]
89 /// Setter for [`perShareAccessRequestCompletionBlock`][Self::perShareAccessRequestCompletionBlock].
90 ///
91 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
92 ///
93 /// # Safety
94 ///
95 /// This might not be thread-safe.
96 #[unsafe(method(setPerShareAccessRequestCompletionBlock:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn setPerShareAccessRequestCompletionBlock(
99 &self,
100 per_share_access_request_completion_block: Option<
101 &block2::DynBlock<dyn Fn(NonNull<NSURL>, *mut NSError)>,
102 >,
103 );
104
105 #[cfg(feature = "block2")]
106 /// A completion block called when the entire operation finishes.
107 ///
108 /// - Parameter operationError: An error describing the overall operation failure, or `nil` if successful.
109 ///
110 /// If `operationError` is `CKErrorPartialFailure`, the `userInfo` dictionary contains detailed errors for each share under ``CKPartialErrorsByItemIDKey``.
111 ///
112 /// This property is not atomic.
113 ///
114 /// # Safety
115 ///
116 /// - The returned block's argument must be a valid pointer or null.
117 /// - This might not be thread-safe.
118 #[unsafe(method(shareRequestAccessCompletionBlock))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn shareRequestAccessCompletionBlock(
121 &self,
122 ) -> *mut block2::DynBlock<dyn Fn(*mut NSError)>;
123
124 #[cfg(feature = "block2")]
125 /// Setter for [`shareRequestAccessCompletionBlock`][Self::shareRequestAccessCompletionBlock].
126 ///
127 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
128 ///
129 /// # Safety
130 ///
131 /// This might not be thread-safe.
132 #[unsafe(method(setShareRequestAccessCompletionBlock:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn setShareRequestAccessCompletionBlock(
135 &self,
136 share_request_access_completion_block: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
137 );
138 );
139}
140
141/// Methods declared on superclass `NSObject`.
142#[cfg(feature = "CKOperation")]
143impl CKShareRequestAccessOperation {
144 extern_methods!(
145 #[unsafe(method(new))]
146 #[unsafe(method_family = new)]
147 pub unsafe fn new() -> Retained<Self>;
148 );
149}