objc2_photos/generated/
PHAssetChangeRequest.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-location")]
10use objc2_core_location::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16 #[unsafe(super(PHChangeRequest, NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 #[cfg(feature = "PHChangeRequest")]
20 pub struct PHAssetChangeRequest;
21);
22
23#[cfg(feature = "PHChangeRequest")]
24extern_conformance!(
25 unsafe impl NSObjectProtocol for PHAssetChangeRequest {}
26);
27
28#[cfg(feature = "PHChangeRequest")]
29impl PHAssetChangeRequest {
30 extern_methods!(
31 #[cfg(feature = "objc2-app-kit")]
32 #[cfg(target_os = "macos")]
33 #[unsafe(method(creationRequestForAssetFromImage:))]
34 #[unsafe(method_family = none)]
35 pub unsafe fn creationRequestForAssetFromImage(image: &NSImage) -> Retained<Self>;
36
37 #[unsafe(method(creationRequestForAssetFromImageAtFileURL:))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn creationRequestForAssetFromImageAtFileURL(
40 file_url: &NSURL,
41 ) -> Option<Retained<Self>>;
42
43 #[unsafe(method(creationRequestForAssetFromVideoAtFileURL:))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn creationRequestForAssetFromVideoAtFileURL(
46 file_url: &NSURL,
47 ) -> Option<Retained<Self>>;
48
49 #[cfg(feature = "PHObject")]
50 #[unsafe(method(placeholderForCreatedAsset))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn placeholderForCreatedAsset(&self) -> Option<Retained<PHObjectPlaceholder>>;
53
54 #[unsafe(method(deleteAssets:))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn deleteAssets(assets: &ProtocolObject<dyn NSFastEnumeration>);
60
61 #[cfg(all(feature = "PHAsset", feature = "PHObject"))]
62 #[unsafe(method(changeRequestForAsset:))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn changeRequestForAsset(asset: &PHAsset) -> Retained<Self>;
65
66 #[unsafe(method(creationDate))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
69
70 #[unsafe(method(setCreationDate:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);
74
75 #[cfg(feature = "objc2-core-location")]
76 #[unsafe(method(location))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn location(&self) -> Option<Retained<CLLocation>>;
79
80 #[cfg(feature = "objc2-core-location")]
81 #[unsafe(method(setLocation:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn setLocation(&self, location: Option<&CLLocation>);
85
86 #[unsafe(method(isFavorite))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn isFavorite(&self) -> bool;
89
90 #[unsafe(method(setFavorite:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn setFavorite(&self, favorite: bool);
94
95 #[unsafe(method(isHidden))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn isHidden(&self) -> bool;
98
99 #[unsafe(method(setHidden:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setHidden(&self, hidden: bool);
103
104 #[cfg(feature = "PHContentEditingOutput")]
105 #[unsafe(method(contentEditingOutput))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn contentEditingOutput(&self) -> Option<Retained<PHContentEditingOutput>>;
108
109 #[cfg(feature = "PHContentEditingOutput")]
110 #[unsafe(method(setContentEditingOutput:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn setContentEditingOutput(
114 &self,
115 content_editing_output: Option<&PHContentEditingOutput>,
116 );
117
118 #[unsafe(method(revertAssetContentToOriginal))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn revertAssetContentToOriginal(&self);
121 );
122}
123
124#[cfg(feature = "PHChangeRequest")]
126impl PHAssetChangeRequest {
127 extern_methods!(
128 #[unsafe(method(init))]
129 #[unsafe(method_family = init)]
130 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
131
132 #[unsafe(method(new))]
133 #[unsafe(method_family = new)]
134 pub unsafe fn new() -> Retained<Self>;
135 );
136}
137
138pub type PHContentEditingInputRequestID = NSUInteger;
140
141extern_class!(
142 #[unsafe(super(NSObject))]
144 #[derive(Debug, PartialEq, Eq, Hash)]
145 pub struct PHContentEditingInputRequestOptions;
146);
147
148extern_conformance!(
149 unsafe impl NSObjectProtocol for PHContentEditingInputRequestOptions {}
150);
151
152impl PHContentEditingInputRequestOptions {
153 extern_methods!(
154 #[cfg(all(feature = "PHAdjustmentData", feature = "block2"))]
155 #[unsafe(method(canHandleAdjustmentData))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn canHandleAdjustmentData(
161 &self,
162 ) -> NonNull<block2::DynBlock<dyn Fn(NonNull<PHAdjustmentData>) -> Bool>>;
163
164 #[cfg(all(feature = "PHAdjustmentData", feature = "block2"))]
165 #[unsafe(method(setCanHandleAdjustmentData:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn setCanHandleAdjustmentData(
171 &self,
172 can_handle_adjustment_data: &block2::DynBlock<
173 dyn Fn(NonNull<PHAdjustmentData>) -> Bool,
174 >,
175 );
176
177 #[unsafe(method(isNetworkAccessAllowed))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn isNetworkAccessAllowed(&self) -> bool;
180
181 #[unsafe(method(setNetworkAccessAllowed:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn setNetworkAccessAllowed(&self, network_access_allowed: bool);
185
186 #[cfg(feature = "block2")]
187 #[unsafe(method(progressHandler))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn progressHandler(
193 &self,
194 ) -> *mut block2::DynBlock<dyn Fn(c_double, NonNull<Bool>)>;
195
196 #[cfg(feature = "block2")]
197 #[unsafe(method(setProgressHandler:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn setProgressHandler(
203 &self,
204 progress_handler: Option<&block2::DynBlock<dyn Fn(c_double, NonNull<Bool>)>>,
205 );
206 );
207}
208
209impl PHContentEditingInputRequestOptions {
211 extern_methods!(
212 #[unsafe(method(init))]
213 #[unsafe(method_family = init)]
214 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
215
216 #[unsafe(method(new))]
217 #[unsafe(method_family = new)]
218 pub unsafe fn new() -> Retained<Self>;
219 );
220}
221
222#[cfg(all(feature = "PHAsset", feature = "PHObject"))]
224impl PHAsset {
225 extern_methods!(
226 #[cfg(all(feature = "PHContentEditingInput", feature = "block2"))]
227 #[unsafe(method(requestContentEditingInputWithOptions:completionHandler:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn requestContentEditingInputWithOptions_completionHandler(
230 &self,
231 options: Option<&PHContentEditingInputRequestOptions>,
232 completion_handler: &block2::DynBlock<
233 dyn Fn(*mut PHContentEditingInput, NonNull<NSDictionary>),
234 >,
235 ) -> PHContentEditingInputRequestID;
236
237 #[unsafe(method(cancelContentEditingInputRequest:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn cancelContentEditingInputRequest(
240 &self,
241 request_id: PHContentEditingInputRequestID,
242 );
243 );
244}
245
246extern "C" {
247 pub static PHContentEditingInputResultIsInCloudKey: &'static NSString;
249}
250
251extern "C" {
252 pub static PHContentEditingInputCancelledKey: &'static NSString;
254}
255
256extern "C" {
257 pub static PHContentEditingInputErrorKey: &'static NSString;
259}
260
261#[cfg(feature = "PHContentEditingOutput")]
263impl PHContentEditingOutput {
264 extern_methods!(
265 #[cfg(feature = "PHObject")]
266 #[unsafe(method(initWithPlaceholderForCreatedAsset:))]
267 #[unsafe(method_family = init)]
268 pub unsafe fn initWithPlaceholderForCreatedAsset(
269 this: Allocated<Self>,
270 placeholder_for_created_asset: &PHObjectPlaceholder,
271 ) -> Retained<Self>;
272 );
273}