objc2_messages/generated/MSConversation.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/messages/msconversation?language=objc)
12 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct MSConversation;
15);
16
17extern_conformance!(
18 unsafe impl NSObjectProtocol for MSConversation {}
19);
20
21impl MSConversation {
22 extern_methods!(
23 /// A NSUUID that identifies conversation participant on this device.
24 ///
25 /// This NSUUID that identifies conversation participant on this device,
26 /// this value will be stable while the extension is enabled. If the extension is
27 /// disabled and re-enabled or the containing App is removed and re-installed this
28 /// value will change.
29 #[unsafe(method(localParticipantIdentifier))]
30 #[unsafe(method_family = none)]
31 pub unsafe fn localParticipantIdentifier(&self) -> Retained<NSUUID>;
32
33 /// A NSArray of NSUUID instances, each uniquely identifies a remote participant in the conversation.
34 ///
35 /// Each NSUUID identifies the a remote participant in the conversation scoped to
36 /// this device. These values will be stable while the extension is enabled. If the extension
37 /// is disabled and re-enabled or the containing App is removed and re-installed these
38 /// values will change.
39 #[unsafe(method(remoteParticipantIdentifiers))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn remoteParticipantIdentifiers(&self) -> Retained<NSArray<NSUUID>>;
42
43 #[cfg(feature = "MSMessage")]
44 /// An MSMessage instance that may be edited and returned to Messages
45 ///
46 /// If the extension has been invoked in response to the user interacting with
47 /// a message in the conversation transcript this property will contain the message.
48 /// Otherwise this property will be nil. The message object provided may be saved to the
49 /// file system. Later, this saved object may be loaded, modified and staged for sending.
50 #[unsafe(method(selectedMessage))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn selectedMessage(&self) -> Option<Retained<MSMessage>>;
53
54 #[cfg(all(feature = "MSMessage", feature = "block2"))]
55 /// Stages the provided MSMessage object for sending.
56 ///
57 /// This method inserts a MSMessage object into the Messages input field,
58 /// Subsequent calls to this method will replace any existing message on the input field.
59 /// If the message was successfully inserted on the input field, the completion handler
60 /// will be called with a nil error parameter otherwise the error parameter will be
61 /// populated with an NSError object describing the failure.
62 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext`.
63 ///
64 /// Parameter `message`: The MSMessage instance describing the message to be sent.
65 ///
66 /// Parameter `completionHandler`: A completion handler called when the message has been staged or if there was an error.
67 #[unsafe(method(insertMessage:completionHandler:))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn insertMessage_completionHandler(
70 &self,
71 message: &MSMessage,
72 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
73 );
74
75 #[cfg(all(feature = "MSSticker", feature = "block2"))]
76 /// The sticker is inserted into the Messages.app input field.
77 ///
78 /// Parameter `sticker`: The sticker to be inserted.
79 ///
80 /// Parameter `completionHandler`: A completion handler called when the insert is complete.
81 #[unsafe(method(insertSticker:completionHandler:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn insertSticker_completionHandler(
84 &self,
85 sticker: &MSSticker,
86 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
87 );
88
89 #[cfg(feature = "block2")]
90 /// The NSString instance provided in the text parameter is inserted into the Messages.app input field.
91 ///
92 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext`.
93 ///
94 /// Parameter `text`: The text to be inserted.
95 ///
96 /// Parameter `completionHandler`: A completion handler called when the insert is complete.
97 #[unsafe(method(insertText:completionHandler:))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn insertText_completionHandler(
100 &self,
101 text: &NSString,
102 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
103 );
104
105 #[cfg(feature = "block2")]
106 /// The NSURL instance provided in the URL parameter is inserted into the Messages.app
107 /// input field. This must be a file URL.
108 ///
109 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext` if the attachment type is not an image type supported by `MSSticker`.
110 ///
111 /// Parameter `URL`: The URL to the media file to be inserted.
112 ///
113 /// Parameter `filename`: If you supply a string here, the message UI uses it for the attachment. Use an alternate filename to better describe the attachment or to make the name more readable.
114 ///
115 /// Parameter `completionHandler`: A completion handler called when the insert is complete.
116 #[unsafe(method(insertAttachment:withAlternateFilename:completionHandler:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn insertAttachment_withAlternateFilename_completionHandler(
119 &self,
120 url: &NSURL,
121 filename: Option<&NSString>,
122 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
123 );
124
125 #[cfg(all(feature = "MSMessage", feature = "block2"))]
126 /// Start sending a message
127 ///
128 /// This method begins sending the provided MSMessage. The app must be visible and have had a recent touch interaction since either last launch or last send to succeed. If the message started sending successfully, the completion handler will be called with a nil error parameter. Otherwise the error parameter will be populated with an NSError object describing the failure.
129 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext`.
130 ///
131 /// Parameter `message`: The MSMessage instance describing the message to be sent.
132 ///
133 /// Parameter `completionHandler`: A completion handler called when the message has been staged or if there was an error.
134 #[unsafe(method(sendMessage:completionHandler:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn sendMessage_completionHandler(
137 &self,
138 message: &MSMessage,
139 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
140 );
141
142 #[cfg(all(feature = "MSSticker", feature = "block2"))]
143 /// Start sending a sticker
144 ///
145 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext`.
146 ///
147 /// Parameter `sticker`: The sticker to be inserted.
148 ///
149 /// Parameter `completionHandler`: A completion handler called when the insert is complete.
150 #[unsafe(method(sendSticker:completionHandler:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn sendSticker_completionHandler(
153 &self,
154 sticker: &MSSticker,
155 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
156 );
157
158 #[cfg(feature = "block2")]
159 /// Start sending text
160 ///
161 /// This method begins sending the provided NSString. The app must be visible and have had a recent touch interaction since either last launch or last send to succeed. If the message started sending successfully, the completion handler will be called with a nil error parameter. Otherwise the error parameter will be populated with an NSError object describing the failure.
162 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext`.
163 ///
164 /// Parameter `text`: The text to be inserted.
165 ///
166 /// Parameter `completionHandler`: A completion handler called when the insert is complete.
167 #[unsafe(method(sendText:completionHandler:))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn sendText_completionHandler(
170 &self,
171 text: &NSString,
172 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
173 );
174
175 #[cfg(feature = "block2")]
176 /// Start sending a file located at the provided URL. This must be a file URL.
177 ///
178 /// This method begins sending the file at the provided file URL. The app must be visible and have had a recent touch interaction since either last launch or last send to succeed. If the message started sending successfully, the completion handler will be called with a nil error parameter. Otherwise the error parameter will be populated with an NSError object describing the failure.
179 /// Calling this method when the presentation context is `MSMessagesAppPresentationContextMedia` will result in the completion handler getting called with an error object whose error code is `MSMessageErrorCodeAPIUnavailableInPresentationContext`.
180 ///
181 /// Parameter `URL`: The URL to the media file to be inserted.
182 ///
183 /// Parameter `filename`: If you supply a string here, the message UI uses it for the attachment. Use an alternate filename to better describe the attachment or to make the name more readable.
184 ///
185 /// Parameter `completionHandler`: A completion handler called when the insert is complete.
186 #[unsafe(method(sendAttachment:withAlternateFilename:completionHandler:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn sendAttachment_withAlternateFilename_completionHandler(
189 &self,
190 url: &NSURL,
191 filename: Option<&NSString>,
192 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
193 );
194 );
195}
196
197/// Methods declared on superclass `NSObject`.
198impl MSConversation {
199 extern_methods!(
200 #[unsafe(method(init))]
201 #[unsafe(method_family = init)]
202 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
203
204 #[unsafe(method(new))]
205 #[unsafe(method_family = new)]
206 pub unsafe fn new() -> Retained<Self>;
207 );
208}