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
//! 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::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/messages/msconversation?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MSConversation;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MSConversation {}
);
impl MSConversation {
extern_methods!(
/// A NSUUID that identifies conversation participant on this device.
///
/// This NSUUID that identifies conversation participant on this device,
/// this value will be stable while the extension is enabled. If the extension is
/// disabled and re-enabled or the containing App is removed and re-installed this
/// value will change.
#[unsafe(method(localParticipantIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn localParticipantIdentifier(&self) -> Retained<NSUUID>;
/// A NSArray of NSUUID instances, each uniquely identifies a remote participant in the conversation.
///
/// Each NSUUID identifies the a remote participant in the conversation scoped to
/// this device. These values will be stable while the extension is enabled. If the extension
/// is disabled and re-enabled or the containing App is removed and re-installed these
/// values will change.
#[unsafe(method(remoteParticipantIdentifiers))]
#[unsafe(method_family = none)]
pub unsafe fn remoteParticipantIdentifiers(&self) -> Retained<NSArray<NSUUID>>;
#[cfg(feature = "MSMessage")]
/// An MSMessage instance that may be edited and returned to Messages
///
/// If the extension has been invoked in response to the user interacting with
/// a message in the conversation transcript this property will contain the message.
/// Otherwise this property will be nil. The message object provided may be saved to the
/// file system. Later, this saved object may be loaded, modified and staged for sending.
#[unsafe(method(selectedMessage))]
#[unsafe(method_family = none)]
pub unsafe fn selectedMessage(&self) -> Option<Retained<MSMessage>>;
#[cfg(all(feature = "MSMessage", feature = "block2"))]
/// Stages the provided MSMessage object for sending.
///
/// This method inserts a MSMessage object into the Messages input field,
/// Subsequent calls to this method will replace any existing message on the input field.
/// If the message was successfully inserted on the input field, 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.
/// 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`.
///
/// Parameter `message`: The MSMessage instance describing the message to be sent.
///
/// Parameter `completionHandler`: A completion handler called when the message has been staged or if there was an error.
#[unsafe(method(insertMessage:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn insertMessage_completionHandler(
&self,
message: &MSMessage,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(all(feature = "MSSticker", feature = "block2"))]
/// The sticker is inserted into the Messages.app input field.
///
/// Parameter `sticker`: The sticker to be inserted.
///
/// Parameter `completionHandler`: A completion handler called when the insert is complete.
#[unsafe(method(insertSticker:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn insertSticker_completionHandler(
&self,
sticker: &MSSticker,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
/// The NSString instance provided in the text parameter is inserted into the Messages.app input field.
///
/// 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`.
///
/// Parameter `text`: The text to be inserted.
///
/// Parameter `completionHandler`: A completion handler called when the insert is complete.
#[unsafe(method(insertText:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn insertText_completionHandler(
&self,
text: &NSString,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
/// The NSURL instance provided in the URL parameter is inserted into the Messages.app
/// input field. This must be a file URL.
///
/// 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`.
///
/// Parameter `URL`: The URL to the media file to be inserted.
///
/// 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.
///
/// Parameter `completionHandler`: A completion handler called when the insert is complete.
#[unsafe(method(insertAttachment:withAlternateFilename:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn insertAttachment_withAlternateFilename_completionHandler(
&self,
url: &NSURL,
filename: Option<&NSString>,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(all(feature = "MSMessage", feature = "block2"))]
/// Start sending a message
///
/// 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.
/// 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`.
///
/// Parameter `message`: The MSMessage instance describing the message to be sent.
///
/// Parameter `completionHandler`: A completion handler called when the message has been staged or if there was an error.
#[unsafe(method(sendMessage:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn sendMessage_completionHandler(
&self,
message: &MSMessage,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(all(feature = "MSSticker", feature = "block2"))]
/// Start sending a sticker
///
/// 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`.
///
/// Parameter `sticker`: The sticker to be inserted.
///
/// Parameter `completionHandler`: A completion handler called when the insert is complete.
#[unsafe(method(sendSticker:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn sendSticker_completionHandler(
&self,
sticker: &MSSticker,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
/// Start sending text
///
/// 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.
/// 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`.
///
/// Parameter `text`: The text to be inserted.
///
/// Parameter `completionHandler`: A completion handler called when the insert is complete.
#[unsafe(method(sendText:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn sendText_completionHandler(
&self,
text: &NSString,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
/// Start sending a file located at the provided URL. This must be a file URL.
///
/// 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.
/// 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`.
///
/// Parameter `URL`: The URL to the media file to be inserted.
///
/// 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.
///
/// Parameter `completionHandler`: A completion handler called when the insert is complete.
#[unsafe(method(sendAttachment:withAlternateFilename:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn sendAttachment_withAlternateFilename_completionHandler(
&self,
url: &NSURL,
filename: Option<&NSString>,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
);
}
/// Methods declared on superclass `NSObject`.
impl MSConversation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}