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        ///
95        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
96        #[unsafe(method(setLayout:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setLayout(&self, layout: Option<&MSMessageLayout>);
99
100        /// A HTTP(S) or data URL used to encode data to be transferred in message.
101        ///
102        /// This URL should encode any data that is to be delivered to the extension running
103        /// on the recipient's device(s). When no app exists on the receiving device that
104        /// can consume the message, if this URL is a HTTP(S) url, it will be loaded in a web browser.
105        #[unsafe(method(URL))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
108
109        /// Setter for [`URL`][Self::URL].
110        ///
111        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
112        #[unsafe(method(setURL:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setURL(&self, url: Option<&NSURL>);
115
116        /// A Boolean value that indicates whether the messages should expire after being read.
117        ///
118        /// YES if the message should expire after it is read. Expired messages will
119        /// be deleted a short time after being read by the receiver. The user may opt to keep the message.
120        /// This property defaults to NO.
121        #[unsafe(method(shouldExpire))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn shouldExpire(&self) -> bool;
124
125        /// Setter for [`shouldExpire`][Self::shouldExpire].
126        #[unsafe(method(setShouldExpire:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setShouldExpire(&self, should_expire: bool);
129
130        /// A localized string describing the message.
131        ///
132        /// This string should provide a succinct description of the message. This
133        /// will be used by the Accessibility Speech feature when speaking the message for users
134        /// with disabilities.
135        #[unsafe(method(accessibilityLabel))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn accessibilityLabel(&self) -> Option<Retained<NSString>>;
138
139        /// Setter for [`accessibilityLabel`][Self::accessibilityLabel].
140        ///
141        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
142        #[unsafe(method(setAccessibilityLabel:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setAccessibilityLabel(&self, accessibility_label: Option<&NSString>);
145
146        /// A localized string describing the message.
147        ///
148        /// This string should provide a succinct description of the message. This
149        /// will be used to provide a summary of the message in the UI.
150        #[unsafe(method(summaryText))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn summaryText(&self) -> Option<Retained<NSString>>;
153
154        /// Setter for [`summaryText`][Self::summaryText].
155        ///
156        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
157        #[unsafe(method(setSummaryText:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setSummaryText(&self, summary_text: Option<&NSString>);
160
161        /// An error object that indicates why a message failed to send.
162        ///
163        /// This value is nil if the message is has not yet been sent, is still
164        /// sending or has been sent successfully.
165        #[unsafe(method(error))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn error(&self) -> Option<Retained<NSError>>;
168
169        /// Setter for [`error`][Self::error].
170        ///
171        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
172        #[unsafe(method(setError:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn setError(&self, error: Option<&NSError>);
175    );
176}
177
178/// Methods declared on superclass `NSObject`.
179impl MSMessage {
180    extern_methods!(
181        #[unsafe(method(new))]
182        #[unsafe(method_family = new)]
183        pub unsafe fn new() -> Retained<Self>;
184    );
185}