objc2_mail_kit/generated/
MEMessage.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagestate?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct MEMessageState(pub NSInteger);
14impl MEMessageState {
15    #[doc(alias = "MEMessageStateReceived")]
16    pub const Received: Self = Self(0);
17    #[doc(alias = "MEMessageStateDraft")]
18    pub const Draft: Self = Self(1);
19    #[doc(alias = "MEMessageStateSending")]
20    pub const Sending: Self = Self(2);
21}
22
23unsafe impl Encode for MEMessageState {
24    const ENCODING: Encoding = NSInteger::ENCODING;
25}
26
27unsafe impl RefEncode for MEMessageState {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31/// [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessageencryptionstate?language=objc)
32// NS_ENUM
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct MEMessageEncryptionState(pub NSInteger);
36impl MEMessageEncryptionState {
37    #[doc(alias = "MEMessageEncryptionStateUnknown")]
38    pub const Unknown: Self = Self(0);
39    #[doc(alias = "MEMessageEncryptionStateNotEncrypted")]
40    pub const NotEncrypted: Self = Self(1);
41    #[doc(alias = "MEMessageEncryptionStateEncrypted")]
42    pub const Encrypted: Self = Self(2);
43}
44
45unsafe impl Encode for MEMessageEncryptionState {
46    const ENCODING: Encoding = NSInteger::ENCODING;
47}
48
49unsafe impl RefEncode for MEMessageEncryptionState {
50    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
51}
52
53extern_class!(
54    /// Contains information about a mail message on which actions can be performed.
55    ///
56    /// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessage?language=objc)
57    #[unsafe(super(NSObject))]
58    #[derive(Debug, PartialEq, Eq, Hash)]
59    pub struct MEMessage;
60);
61
62extern_conformance!(
63    unsafe impl NSCoding for MEMessage {}
64);
65
66extern_conformance!(
67    unsafe impl NSObjectProtocol for MEMessage {}
68);
69
70extern_conformance!(
71    unsafe impl NSSecureCoding for MEMessage {}
72);
73
74impl MEMessage {
75    extern_methods!(
76        /// The state of the mail message.
77        #[unsafe(method(state))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn state(&self) -> MEMessageState;
80
81        /// The encryption state of the mail message.
82        #[unsafe(method(encryptionState))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn encryptionState(&self) -> MEMessageEncryptionState;
85
86        /// The subject of the mail message.
87        #[unsafe(method(subject))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn subject(&self) -> Retained<NSString>;
90
91        #[cfg(feature = "MEEmailAddress")]
92        /// Message sender's email address.
93        #[unsafe(method(fromAddress))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn fromAddress(&self) -> Retained<MEEmailAddress>;
96
97        #[cfg(feature = "MEEmailAddress")]
98        /// Recipient email addresses in the "To" address field of the message.
99        #[unsafe(method(toAddresses))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn toAddresses(&self) -> Retained<NSArray<MEEmailAddress>>;
102
103        #[cfg(feature = "MEEmailAddress")]
104        /// Recipient email addresses in the "Cc" address field of the message.
105        #[unsafe(method(ccAddresses))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn ccAddresses(&self) -> Retained<NSArray<MEEmailAddress>>;
108
109        #[cfg(feature = "MEEmailAddress")]
110        /// Recipient email addresses in the "Bcc" address field of the message.
111        #[unsafe(method(bccAddresses))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn bccAddresses(&self) -> Retained<NSArray<MEEmailAddress>>;
114
115        #[cfg(feature = "MEEmailAddress")]
116        /// Recipient email addresses in the "Reply-To" field of the message.
117        #[unsafe(method(replyToAddresses))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn replyToAddresses(&self) -> Retained<NSArray<MEEmailAddress>>;
120
121        #[cfg(feature = "MEEmailAddress")]
122        /// An array containing all recipients of the message.
123        #[unsafe(method(allRecipientAddresses))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn allRecipientAddresses(&self) -> Retained<NSArray<MEEmailAddress>>;
126
127        /// The date the mail message was sent. Optionally set by the by the sender.
128        #[unsafe(method(dateSent))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn dateSent(&self) -> Option<Retained<NSDate>>;
131
132        /// The date the mail message was received. Only present if the message has been received.
133        #[unsafe(method(dateReceived))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn dateReceived(&self) -> Option<Retained<NSDate>>;
136
137        /// The headers for the message. Might only be a subset if the full body has not been downloaded.
138        #[unsafe(method(headers))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn headers(&self)
141            -> Option<Retained<NSDictionary<NSString, NSArray<NSString>>>>;
142
143        /// The full raw RFC822 message data if it has been downloaded and the extension has permissions to access.
144        #[unsafe(method(rawData))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn rawData(&self) -> Option<Retained<NSData>>;
147
148        #[unsafe(method(init))]
149        #[unsafe(method_family = init)]
150        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
151
152        #[unsafe(method(new))]
153        #[unsafe(method_family = new)]
154        pub unsafe fn new() -> Retained<Self>;
155    );
156}