1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct INMessageType(pub NSInteger);
15impl INMessageType {
16 #[doc(alias = "INMessageTypeUnspecified")]
17 pub const Unspecified: Self = Self(0);
18 #[doc(alias = "INMessageTypeText")]
19 pub const Text: Self = Self(1);
20 #[doc(alias = "INMessageTypeAudio")]
21 pub const Audio: Self = Self(2);
22 #[doc(alias = "INMessageTypeDigitalTouch")]
23 pub const DigitalTouch: Self = Self(3);
24 #[doc(alias = "INMessageTypeHandwriting")]
25 pub const Handwriting: Self = Self(4);
26 #[doc(alias = "INMessageTypeSticker")]
27 pub const Sticker: Self = Self(5);
28 #[doc(alias = "INMessageTypeTapbackLiked")]
29 #[deprecated = "Use INMessageReaction"]
30 pub const TapbackLiked: Self = Self(6);
31 #[doc(alias = "INMessageTypeTapbackDisliked")]
32 #[deprecated = "Use INMessageReaction"]
33 pub const TapbackDisliked: Self = Self(7);
34 #[doc(alias = "INMessageTypeTapbackEmphasized")]
35 #[deprecated = "Use INMessageReaction"]
36 pub const TapbackEmphasized: Self = Self(8);
37 #[doc(alias = "INMessageTypeTapbackLoved")]
38 #[deprecated = "Use INMessageReaction"]
39 pub const TapbackLoved: Self = Self(9);
40 #[doc(alias = "INMessageTypeTapbackQuestioned")]
41 #[deprecated = "Use INMessageReaction"]
42 pub const TapbackQuestioned: Self = Self(10);
43 #[doc(alias = "INMessageTypeTapbackLaughed")]
44 #[deprecated = "Use INMessageReaction"]
45 pub const TapbackLaughed: Self = Self(11);
46 #[doc(alias = "INMessageTypeMediaCalendar")]
47 pub const MediaCalendar: Self = Self(12);
48 #[doc(alias = "INMessageTypeMediaLocation")]
49 pub const MediaLocation: Self = Self(13);
50 #[doc(alias = "INMessageTypeMediaAddressCard")]
51 pub const MediaAddressCard: Self = Self(14);
52 #[doc(alias = "INMessageTypeMediaImage")]
53 pub const MediaImage: Self = Self(15);
54 #[doc(alias = "INMessageTypeMediaVideo")]
55 pub const MediaVideo: Self = Self(16);
56 #[doc(alias = "INMessageTypeMediaPass")]
57 pub const MediaPass: Self = Self(17);
58 #[doc(alias = "INMessageTypeMediaAudio")]
59 pub const MediaAudio: Self = Self(18);
60 #[doc(alias = "INMessageTypePaymentSent")]
61 pub const PaymentSent: Self = Self(19);
62 #[doc(alias = "INMessageTypePaymentRequest")]
63 pub const PaymentRequest: Self = Self(20);
64 #[doc(alias = "INMessageTypePaymentNote")]
65 pub const PaymentNote: Self = Self(21);
66 #[doc(alias = "INMessageTypeAnimoji")]
67 pub const Animoji: Self = Self(22);
68 #[doc(alias = "INMessageTypeActivitySnippet")]
69 pub const ActivitySnippet: Self = Self(23);
70 #[doc(alias = "INMessageTypeFile")]
71 pub const File: Self = Self(24);
72 #[doc(alias = "INMessageTypeLink")]
73 pub const Link: Self = Self(25);
74 #[doc(alias = "INMessageTypeReaction")]
76 pub const Reaction: Self = Self(26);
77 #[doc(alias = "INMessageTypeMediaAnimatedImage")]
79 pub const MediaAnimatedImage: Self = Self(27);
80 #[doc(alias = "INMessageTypeThirdPartyAttachment")]
82 pub const ThirdPartyAttachment: Self = Self(28);
83}
84
85unsafe impl Encode for INMessageType {
86 const ENCODING: Encoding = NSInteger::ENCODING;
87}
88
89unsafe impl RefEncode for INMessageType {
90 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
91}
92
93extern_class!(
94 #[unsafe(super(NSObject))]
96 #[derive(Debug, PartialEq, Eq, Hash)]
97 pub struct INMessage;
98);
99
100extern_conformance!(
101 unsafe impl NSCoding for INMessage {}
102);
103
104extern_conformance!(
105 unsafe impl NSCopying for INMessage {}
106);
107
108unsafe impl CopyingHelper for INMessage {
109 type Result = Self;
110}
111
112extern_conformance!(
113 unsafe impl NSObjectProtocol for INMessage {}
114);
115
116extern_conformance!(
117 unsafe impl NSSecureCoding for INMessage {}
118);
119
120impl INMessage {
121 extern_methods!(
122 #[unsafe(method(init))]
123 #[unsafe(method_family = init)]
124 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
125
126 #[cfg(all(
127 feature = "INFile",
128 feature = "INPerson",
129 feature = "INSpeakableString"
130 ))]
131 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:attachmentFiles:))]
132 #[unsafe(method_family = init)]
133 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType_serviceName_attachmentFiles(
134 this: Allocated<Self>,
135 identifier: &NSString,
136 conversation_identifier: Option<&NSString>,
137 content: Option<&NSString>,
138 date_sent: Option<&NSDate>,
139 sender: Option<&INPerson>,
140 recipients: Option<&NSArray<INPerson>>,
141 group_name: Option<&INSpeakableString>,
142 message_type: INMessageType,
143 service_name: Option<&NSString>,
144 attachment_files: Option<&NSArray<INFile>>,
145 ) -> Retained<Self>;
146
147 #[cfg(all(
148 feature = "INFile",
149 feature = "INPerson",
150 feature = "INSpeakableString"
151 ))]
152 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:audioMessageFile:))]
153 #[unsafe(method_family = init)]
154 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType_serviceName_audioMessageFile(
155 this: Allocated<Self>,
156 identifier: &NSString,
157 conversation_identifier: Option<&NSString>,
158 content: Option<&NSString>,
159 date_sent: Option<&NSDate>,
160 sender: Option<&INPerson>,
161 recipients: Option<&NSArray<INPerson>>,
162 group_name: Option<&INSpeakableString>,
163 message_type: INMessageType,
164 service_name: Option<&NSString>,
165 audio_message_file: Option<&INFile>,
166 ) -> Retained<Self>;
167
168 #[cfg(all(feature = "INPerson", feature = "INSpeakableString"))]
169 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:))]
170 #[unsafe(method_family = init)]
171 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType_serviceName(
172 this: Allocated<Self>,
173 identifier: &NSString,
174 conversation_identifier: Option<&NSString>,
175 content: Option<&NSString>,
176 date_sent: Option<&NSDate>,
177 sender: Option<&INPerson>,
178 recipients: Option<&NSArray<INPerson>>,
179 group_name: Option<&INSpeakableString>,
180 message_type: INMessageType,
181 service_name: Option<&NSString>,
182 ) -> Retained<Self>;
183
184 #[cfg(all(feature = "INPerson", feature = "INSpeakableString"))]
185 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:))]
186 #[unsafe(method_family = init)]
187 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType(
188 this: Allocated<Self>,
189 identifier: &NSString,
190 conversation_identifier: Option<&NSString>,
191 content: Option<&NSString>,
192 date_sent: Option<&NSDate>,
193 sender: Option<&INPerson>,
194 recipients: Option<&NSArray<INPerson>>,
195 group_name: Option<&INSpeakableString>,
196 message_type: INMessageType,
197 ) -> Retained<Self>;
198
199 #[cfg(feature = "INPerson")]
200 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:messageType:))]
201 #[unsafe(method_family = init)]
202 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_messageType(
203 this: Allocated<Self>,
204 identifier: &NSString,
205 conversation_identifier: Option<&NSString>,
206 content: Option<&NSString>,
207 date_sent: Option<&NSDate>,
208 sender: Option<&INPerson>,
209 recipients: Option<&NSArray<INPerson>>,
210 message_type: INMessageType,
211 ) -> Retained<Self>;
212
213 #[cfg(feature = "INPerson")]
214 #[unsafe(method(initWithIdentifier:content:dateSent:sender:recipients:))]
215 #[unsafe(method_family = init)]
216 pub unsafe fn initWithIdentifier_content_dateSent_sender_recipients(
217 this: Allocated<Self>,
218 identifier: &NSString,
219 content: Option<&NSString>,
220 date_sent: Option<&NSDate>,
221 sender: Option<&INPerson>,
222 recipients: Option<&NSArray<INPerson>>,
223 ) -> Retained<Self>;
224
225 #[cfg(all(
226 feature = "INMessageLinkMetadata",
227 feature = "INPerson",
228 feature = "INSpeakableString"
229 ))]
230 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:linkMetadata:))]
231 #[unsafe(method_family = init)]
232 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_linkMetadata(
233 this: Allocated<Self>,
234 identifier: &NSString,
235 conversation_identifier: Option<&NSString>,
236 content: Option<&NSString>,
237 date_sent: Option<&NSDate>,
238 sender: Option<&INPerson>,
239 recipients: Option<&NSArray<INPerson>>,
240 group_name: Option<&INSpeakableString>,
241 service_name: Option<&NSString>,
242 link_metadata: Option<&INMessageLinkMetadata>,
243 ) -> Retained<Self>;
244
245 #[cfg(all(feature = "INPerson", feature = "INSpeakableString"))]
246 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:messageType:numberOfAttachments:))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_messageType_numberOfAttachments(
249 this: Allocated<Self>,
250 identifier: &NSString,
251 conversation_identifier: Option<&NSString>,
252 content: Option<&NSString>,
253 date_sent: Option<&NSDate>,
254 sender: Option<&INPerson>,
255 recipients: Option<&NSArray<INPerson>>,
256 group_name: Option<&INSpeakableString>,
257 service_name: Option<&NSString>,
258 message_type: INMessageType,
259 number_of_attachments: Option<&NSNumber>,
260 ) -> Retained<Self>;
261
262 #[cfg(all(
263 feature = "INMessageReaction",
264 feature = "INPerson",
265 feature = "INSpeakableString"
266 ))]
267 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:messageType:referencedMessage:reaction:))]
268 #[unsafe(method_family = init)]
269 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_messageType_referencedMessage_reaction(
270 this: Allocated<Self>,
271 identifier: &NSString,
272 conversation_identifier: Option<&NSString>,
273 content: Option<&NSString>,
274 date_sent: Option<&NSDate>,
275 sender: Option<&INPerson>,
276 recipients: Option<&NSArray<INPerson>>,
277 group_name: Option<&INSpeakableString>,
278 service_name: Option<&NSString>,
279 message_type: INMessageType,
280 referenced_message: Option<&INMessage>,
281 reaction: Option<&INMessageReaction>,
282 ) -> Retained<Self>;
283
284 #[cfg(all(
285 feature = "INMessageReaction",
286 feature = "INPerson",
287 feature = "INSpeakableString",
288 feature = "INSticker"
289 ))]
290 #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:messageType:referencedMessage:sticker:reaction:))]
306 #[unsafe(method_family = init)]
307 pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_messageType_referencedMessage_sticker_reaction(
308 this: Allocated<Self>,
309 identifier: &NSString,
310 conversation_identifier: Option<&NSString>,
311 content: Option<&NSString>,
312 date_sent: Option<&NSDate>,
313 sender: Option<&INPerson>,
314 recipients: Option<&NSArray<INPerson>>,
315 group_name: Option<&INSpeakableString>,
316 service_name: Option<&NSString>,
317 message_type: INMessageType,
318 referenced_message: Option<&INMessage>,
319 sticker: Option<&INSticker>,
320 reaction: Option<&INMessageReaction>,
321 ) -> Retained<Self>;
322
323 #[unsafe(method(identifier))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn identifier(&self) -> Retained<NSString>;
326
327 #[unsafe(method(conversationIdentifier))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn conversationIdentifier(&self) -> Option<Retained<NSString>>;
330
331 #[unsafe(method(content))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn content(&self) -> Option<Retained<NSString>>;
334
335 #[unsafe(method(dateSent))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn dateSent(&self) -> Option<Retained<NSDate>>;
338
339 #[cfg(feature = "INPerson")]
340 #[unsafe(method(sender))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn sender(&self) -> Option<Retained<INPerson>>;
343
344 #[cfg(feature = "INPerson")]
345 #[unsafe(method(recipients))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn recipients(&self) -> Option<Retained<NSArray<INPerson>>>;
348
349 #[cfg(feature = "INSpeakableString")]
350 #[unsafe(method(groupName))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn groupName(&self) -> Option<Retained<INSpeakableString>>;
353
354 #[unsafe(method(messageType))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn messageType(&self) -> INMessageType;
357
358 #[unsafe(method(serviceName))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn serviceName(&self) -> Option<Retained<NSString>>;
361
362 #[cfg(feature = "INFile")]
363 #[unsafe(method(attachmentFiles))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn attachmentFiles(&self) -> Option<Retained<NSArray<INFile>>>;
366
367 #[unsafe(method(numberOfAttachments))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn numberOfAttachments(&self) -> Option<Retained<NSNumber>>;
370
371 #[cfg(feature = "INFile")]
372 #[deprecated = "Use attachmentFile instead"]
373 #[unsafe(method(audioMessageFile))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn audioMessageFile(&self) -> Option<Retained<INFile>>;
376
377 #[cfg(feature = "INMessageLinkMetadata")]
378 #[unsafe(method(linkMetadata))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn linkMetadata(&self) -> Option<Retained<INMessageLinkMetadata>>;
381
382 #[cfg(feature = "INSticker")]
383 #[unsafe(method(sticker))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn sticker(&self) -> Option<Retained<INSticker>>;
387
388 #[cfg(feature = "INSticker")]
389 #[unsafe(method(setSticker:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn setSticker(&self, sticker: Option<&INSticker>);
395
396 #[cfg(feature = "INMessageReaction")]
397 #[unsafe(method(reaction))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn reaction(&self) -> Option<Retained<INMessageReaction>>;
401
402 #[cfg(feature = "INMessageReaction")]
403 #[unsafe(method(setReaction:))]
407 #[unsafe(method_family = none)]
408 pub unsafe fn setReaction(&self, reaction: Option<&INMessageReaction>);
409 );
410}
411
412impl INMessage {
414 extern_methods!(
415 #[unsafe(method(new))]
416 #[unsafe(method_family = new)]
417 pub unsafe fn new() -> Retained<Self>;
418 );
419}