objc2_messages/generated/MSMessage.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 /// The MSMessage encapsulates the data to be transferred to remote devices.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msmessage?language=objc)
14 #[unsafe(super(NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 pub struct MSMessage;
17);
18
19extern_conformance!(
20 unsafe impl NSCoding for MSMessage {}
21);
22
23extern_conformance!(
24 unsafe impl NSCopying for MSMessage {}
25);
26
27unsafe impl CopyingHelper for MSMessage {
28 type Result = Self;
29}
30
31extern_conformance!(
32 unsafe impl NSObjectProtocol for MSMessage {}
33);
34
35extern_conformance!(
36 unsafe impl NSSecureCoding for MSMessage {}
37);
38
39impl MSMessage {
40 extern_methods!(
41 /// Initializes a new message that is not part of a session.
42 #[unsafe(method(init))]
43 #[unsafe(method_family = init)]
44 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
45
46 #[cfg(feature = "MSSession")]
47 /// Initializes a message with a session.
48 ///
49 /// See: insertMessage:completionHandler:
50 ///
51 /// Parameter `session`: The session that new message will join.
52 ///
53 /// A message initialized with a session will be updated
54 /// and moved to the bottom of the conversation transcript when another message created
55 /// with the same session is sent.
56 #[unsafe(method(initWithSession:))]
57 #[unsafe(method_family = init)]
58 pub unsafe fn initWithSession(this: Allocated<Self>, session: &MSSession)
59 -> Retained<Self>;
60
61 #[cfg(feature = "MSSession")]
62 /// An MSSession that identifies the session that message belongs to.
63 #[unsafe(method(session))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn session(&self) -> Option<Retained<MSSession>>;
66
67 /// A BOOL representing whether the message is a pending message or is a message that has been sent/received.
68 ///
69 /// This value starts as `YES` when creating an `MSMessage` for sending. After calling `-[MSConversation insertMessage:completionHandler:]`, `isPending` still returns `YES` until `-[MSMessagesAppViewController didStartSendingMessage:conversation]` is called. This property is useful for knowing if the `selectedMessage` of `-[MSMessagesAppViewController activeConversation]` represents an unsent message.
70 #[unsafe(method(isPending))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn isPending(&self) -> bool;
73
74 /// A NSUUID instance that identifies the participant that sent the message.
75 ///
76 /// This NSUUID identifies the message's sender. This value is scoped to
77 /// the current device and will be different on all devices that participate in the
78 /// conversation.
79 #[unsafe(method(senderParticipantIdentifier))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn senderParticipantIdentifier(&self) -> Retained<NSUUID>;
82
83 #[cfg(feature = "MSMessageLayout")]
84 /// A subclass of MSMessageLayout.
85 ///
86 /// The MSMessageLayout subclass will be used to construct UI
87 /// representing the message in the conversation transcript.
88 #[unsafe(method(layout))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn layout(&self) -> Option<Retained<MSMessageLayout>>;
91
92 #[cfg(feature = "MSMessageLayout")]
93 /// Setter for [`layout`][Self::layout].
94 #[unsafe(method(setLayout:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn setLayout(&self, layout: Option<&MSMessageLayout>);
97
98 /// A HTTP(S) or data URL used to encode data to be transferred in message.
99 ///
100 /// This URL should encode any data that is to be delivered to the extension running
101 /// on the recipient's device(s). When no app exists on the receiving device that
102 /// can consume the message, if this URL is a HTTP(S) url, it will be loaded in a web browser.
103 #[unsafe(method(URL))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
106
107 /// Setter for [`URL`][Self::URL].
108 #[unsafe(method(setURL:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn setURL(&self, url: Option<&NSURL>);
111
112 /// A Boolean value that indicates whether the messages should expire after being read.
113 ///
114 /// YES if the message should expire after it is read. Expired messages will
115 /// be deleted a short time after being read by the receiver. The user may opt to keep the message.
116 /// This property defaults to NO.
117 #[unsafe(method(shouldExpire))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn shouldExpire(&self) -> bool;
120
121 /// Setter for [`shouldExpire`][Self::shouldExpire].
122 #[unsafe(method(setShouldExpire:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn setShouldExpire(&self, should_expire: bool);
125
126 /// A localized string describing the message.
127 ///
128 /// This string should provide a succinct description of the message. This
129 /// will be used by the Accessibility Speech feature when speaking the message for users
130 /// with disabilities.
131 #[unsafe(method(accessibilityLabel))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn accessibilityLabel(&self) -> Option<Retained<NSString>>;
134
135 /// Setter for [`accessibilityLabel`][Self::accessibilityLabel].
136 #[unsafe(method(setAccessibilityLabel:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn setAccessibilityLabel(&self, accessibility_label: Option<&NSString>);
139
140 /// A localized string describing the message.
141 ///
142 /// This string should provide a succinct description of the message. This
143 /// will be used to provide a summary of the message in the UI.
144 #[unsafe(method(summaryText))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn summaryText(&self) -> Option<Retained<NSString>>;
147
148 /// Setter for [`summaryText`][Self::summaryText].
149 #[unsafe(method(setSummaryText:))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn setSummaryText(&self, summary_text: Option<&NSString>);
152
153 /// An error object that indicates why a message failed to send.
154 ///
155 /// This value is nil if the message is has not yet been sent, is still
156 /// sending or has been sent successfully.
157 #[unsafe(method(error))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn error(&self) -> Option<Retained<NSError>>;
160
161 /// Setter for [`error`][Self::error].
162 #[unsafe(method(setError:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn setError(&self, error: Option<&NSError>);
165 );
166}
167
168/// Methods declared on superclass `NSObject`.
169impl MSMessage {
170 extern_methods!(
171 #[unsafe(method(new))]
172 #[unsafe(method_family = new)]
173 pub unsafe fn new() -> Retained<Self>;
174 );
175}