objc2-intents 0.3.2

Bindings to the Intents framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/intents/inmessagetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INMessageType(pub NSInteger);
impl INMessageType {
    #[doc(alias = "INMessageTypeUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "INMessageTypeText")]
    pub const Text: Self = Self(1);
    #[doc(alias = "INMessageTypeAudio")]
    pub const Audio: Self = Self(2);
    #[doc(alias = "INMessageTypeDigitalTouch")]
    pub const DigitalTouch: Self = Self(3);
    #[doc(alias = "INMessageTypeHandwriting")]
    pub const Handwriting: Self = Self(4);
    #[doc(alias = "INMessageTypeSticker")]
    pub const Sticker: Self = Self(5);
    #[doc(alias = "INMessageTypeTapbackLiked")]
    #[deprecated = "Use INMessageReaction"]
    pub const TapbackLiked: Self = Self(6);
    #[doc(alias = "INMessageTypeTapbackDisliked")]
    #[deprecated = "Use INMessageReaction"]
    pub const TapbackDisliked: Self = Self(7);
    #[doc(alias = "INMessageTypeTapbackEmphasized")]
    #[deprecated = "Use INMessageReaction"]
    pub const TapbackEmphasized: Self = Self(8);
    #[doc(alias = "INMessageTypeTapbackLoved")]
    #[deprecated = "Use INMessageReaction"]
    pub const TapbackLoved: Self = Self(9);
    #[doc(alias = "INMessageTypeTapbackQuestioned")]
    #[deprecated = "Use INMessageReaction"]
    pub const TapbackQuestioned: Self = Self(10);
    #[doc(alias = "INMessageTypeTapbackLaughed")]
    #[deprecated = "Use INMessageReaction"]
    pub const TapbackLaughed: Self = Self(11);
    #[doc(alias = "INMessageTypeMediaCalendar")]
    pub const MediaCalendar: Self = Self(12);
    #[doc(alias = "INMessageTypeMediaLocation")]
    pub const MediaLocation: Self = Self(13);
    #[doc(alias = "INMessageTypeMediaAddressCard")]
    pub const MediaAddressCard: Self = Self(14);
    #[doc(alias = "INMessageTypeMediaImage")]
    pub const MediaImage: Self = Self(15);
    #[doc(alias = "INMessageTypeMediaVideo")]
    pub const MediaVideo: Self = Self(16);
    #[doc(alias = "INMessageTypeMediaPass")]
    pub const MediaPass: Self = Self(17);
    #[doc(alias = "INMessageTypeMediaAudio")]
    pub const MediaAudio: Self = Self(18);
    #[doc(alias = "INMessageTypePaymentSent")]
    pub const PaymentSent: Self = Self(19);
    #[doc(alias = "INMessageTypePaymentRequest")]
    pub const PaymentRequest: Self = Self(20);
    #[doc(alias = "INMessageTypePaymentNote")]
    pub const PaymentNote: Self = Self(21);
    #[doc(alias = "INMessageTypeAnimoji")]
    pub const Animoji: Self = Self(22);
    #[doc(alias = "INMessageTypeActivitySnippet")]
    pub const ActivitySnippet: Self = Self(23);
    #[doc(alias = "INMessageTypeFile")]
    pub const File: Self = Self(24);
    #[doc(alias = "INMessageTypeLink")]
    pub const Link: Self = Self(25);
    /// The message contains a reaction to another message.
    #[doc(alias = "INMessageTypeReaction")]
    pub const Reaction: Self = Self(26);
    /// Media content containing an animated image, such as a GIF.
    #[doc(alias = "INMessageTypeMediaAnimatedImage")]
    pub const MediaAnimatedImage: Self = Self(27);
    /// The message contains an attachment from a third party application.
    #[doc(alias = "INMessageTypeThirdPartyAttachment")]
    pub const ThirdPartyAttachment: Self = Self(28);
}

unsafe impl Encode for INMessageType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for INMessageType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/intents/inmessage?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct INMessage;
);

extern_conformance!(
    unsafe impl NSCoding for INMessage {}
);

extern_conformance!(
    unsafe impl NSCopying for INMessage {}
);

unsafe impl CopyingHelper for INMessage {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for INMessage {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for INMessage {}
);

impl INMessage {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(all(
            feature = "INFile",
            feature = "INPerson",
            feature = "INSpeakableString"
        ))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:attachmentFiles:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType_serviceName_attachmentFiles(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            message_type: INMessageType,
            service_name: Option<&NSString>,
            attachment_files: Option<&NSArray<INFile>>,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "INFile",
            feature = "INPerson",
            feature = "INSpeakableString"
        ))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:audioMessageFile:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType_serviceName_audioMessageFile(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            message_type: INMessageType,
            service_name: Option<&NSString>,
            audio_message_file: Option<&INFile>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "INPerson", feature = "INSpeakableString"))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType_serviceName(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            message_type: INMessageType,
            service_name: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "INPerson", feature = "INSpeakableString"))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_messageType(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            message_type: INMessageType,
        ) -> Retained<Self>;

        #[cfg(feature = "INPerson")]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:messageType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_messageType(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            message_type: INMessageType,
        ) -> Retained<Self>;

        #[cfg(feature = "INPerson")]
        #[unsafe(method(initWithIdentifier:content:dateSent:sender:recipients:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_content_dateSent_sender_recipients(
            this: Allocated<Self>,
            identifier: &NSString,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "INMessageLinkMetadata",
            feature = "INPerson",
            feature = "INSpeakableString"
        ))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:linkMetadata:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_linkMetadata(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            service_name: Option<&NSString>,
            link_metadata: Option<&INMessageLinkMetadata>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "INPerson", feature = "INSpeakableString"))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:messageType:numberOfAttachments:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_messageType_numberOfAttachments(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            service_name: Option<&NSString>,
            message_type: INMessageType,
            number_of_attachments: Option<&NSNumber>,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "INMessageReaction",
            feature = "INPerson",
            feature = "INSpeakableString"
        ))]
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:messageType:referencedMessage:reaction:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_messageType_referencedMessage_reaction(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            service_name: Option<&NSString>,
            message_type: INMessageType,
            referenced_message: Option<&INMessage>,
            reaction: Option<&INMessageReaction>,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "INMessageReaction",
            feature = "INPerson",
            feature = "INSpeakableString",
            feature = "INSticker"
        ))]
        /// Creates a message that includes a reaction and references the original message for the reaction.
        ///
        /// - Parameters:
        /// - identifier: The message’s unique identifier.
        /// - conversationIdentifier: The identifier of the conversation that contains this message.
        /// - content: The text that Siri recites to the message recipient.
        /// - dateSent: The date and time the app sent the message to each recipient.
        /// - sender: The person who sent the message.
        /// - recipients: The people who received the message.
        /// - groupName: The name of the group conversation.
        /// - serviceName: The name of the service that delivers the message.
        /// - messageType: The type of content the message contains.
        /// - referencedMessage: The referenced message that received a reaction if the message object itself was a reaction.
        /// - sticker: The sticker that this message contains.
        /// - reaction: The message reaction that this message contains.
        #[unsafe(method(initWithIdentifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:serviceName:messageType:referencedMessage:sticker:reaction:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_conversationIdentifier_content_dateSent_sender_recipients_groupName_serviceName_messageType_referencedMessage_sticker_reaction(
            this: Allocated<Self>,
            identifier: &NSString,
            conversation_identifier: Option<&NSString>,
            content: Option<&NSString>,
            date_sent: Option<&NSDate>,
            sender: Option<&INPerson>,
            recipients: Option<&NSArray<INPerson>>,
            group_name: Option<&INSpeakableString>,
            service_name: Option<&NSString>,
            message_type: INMessageType,
            referenced_message: Option<&INMessage>,
            sticker: Option<&INSticker>,
            reaction: Option<&INMessageReaction>,
        ) -> Retained<Self>;

        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        #[unsafe(method(conversationIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn conversationIdentifier(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(content))]
        #[unsafe(method_family = none)]
        pub unsafe fn content(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(dateSent))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateSent(&self) -> Option<Retained<NSDate>>;

        #[cfg(feature = "INPerson")]
        #[unsafe(method(sender))]
        #[unsafe(method_family = none)]
        pub unsafe fn sender(&self) -> Option<Retained<INPerson>>;

        #[cfg(feature = "INPerson")]
        #[unsafe(method(recipients))]
        #[unsafe(method_family = none)]
        pub unsafe fn recipients(&self) -> Option<Retained<NSArray<INPerson>>>;

        #[cfg(feature = "INSpeakableString")]
        #[unsafe(method(groupName))]
        #[unsafe(method_family = none)]
        pub unsafe fn groupName(&self) -> Option<Retained<INSpeakableString>>;

        #[unsafe(method(messageType))]
        #[unsafe(method_family = none)]
        pub unsafe fn messageType(&self) -> INMessageType;

        #[unsafe(method(serviceName))]
        #[unsafe(method_family = none)]
        pub unsafe fn serviceName(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "INFile")]
        #[unsafe(method(attachmentFiles))]
        #[unsafe(method_family = none)]
        pub unsafe fn attachmentFiles(&self) -> Option<Retained<NSArray<INFile>>>;

        #[unsafe(method(numberOfAttachments))]
        #[unsafe(method_family = none)]
        pub unsafe fn numberOfAttachments(&self) -> Option<Retained<NSNumber>>;

        #[cfg(feature = "INFile")]
        #[deprecated = "Use attachmentFile instead"]
        #[unsafe(method(audioMessageFile))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioMessageFile(&self) -> Option<Retained<INFile>>;

        #[cfg(feature = "INMessageLinkMetadata")]
        #[unsafe(method(linkMetadata))]
        #[unsafe(method_family = none)]
        pub unsafe fn linkMetadata(&self) -> Option<Retained<INMessageLinkMetadata>>;

        #[cfg(feature = "INSticker")]
        /// The sticker that this message contains.
        #[unsafe(method(sticker))]
        #[unsafe(method_family = none)]
        pub unsafe fn sticker(&self) -> Option<Retained<INSticker>>;

        #[cfg(feature = "INSticker")]
        /// Setter for [`sticker`][Self::sticker].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSticker:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSticker(&self, sticker: Option<&INSticker>);

        #[cfg(feature = "INMessageReaction")]
        /// The message reaction that this message contains.
        #[unsafe(method(reaction))]
        #[unsafe(method_family = none)]
        pub unsafe fn reaction(&self) -> Option<Retained<INMessageReaction>>;

        #[cfg(feature = "INMessageReaction")]
        /// Setter for [`reaction`][Self::reaction].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setReaction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setReaction(&self, reaction: Option<&INMessageReaction>);
    );
}

/// Methods declared on superclass `NSObject`.
impl INMessage {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}