objc2_user_notifications/generated/
UNNotificationAction.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/usernotifications/unnotificationactionoptions?language=objc)
10// NS_OPTIONS
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct UNNotificationActionOptions(pub NSUInteger);
14bitflags::bitflags! {
15    impl UNNotificationActionOptions: NSUInteger {
16        #[doc(alias = "UNNotificationActionOptionAuthenticationRequired")]
17        const AuthenticationRequired = 1<<0;
18        #[doc(alias = "UNNotificationActionOptionDestructive")]
19        const Destructive = 1<<1;
20        #[doc(alias = "UNNotificationActionOptionForeground")]
21        const Foreground = 1<<2;
22    }
23}
24
25unsafe impl Encode for UNNotificationActionOptions {
26    const ENCODING: Encoding = NSUInteger::ENCODING;
27}
28
29unsafe impl RefEncode for UNNotificationActionOptions {
30    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33/// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unnotificationactionoptionnone?language=objc)
34pub static UNNotificationActionOptionNone: UNNotificationActionOptions =
35    UNNotificationActionOptions(0);
36
37extern_class!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unnotificationaction?language=objc)
39    #[unsafe(super(NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    pub struct UNNotificationAction;
42);
43
44extern_conformance!(
45    unsafe impl NSCoding for UNNotificationAction {}
46);
47
48extern_conformance!(
49    unsafe impl NSCopying for UNNotificationAction {}
50);
51
52unsafe impl CopyingHelper for UNNotificationAction {
53    type Result = Self;
54}
55
56extern_conformance!(
57    unsafe impl NSObjectProtocol for UNNotificationAction {}
58);
59
60extern_conformance!(
61    unsafe impl NSSecureCoding for UNNotificationAction {}
62);
63
64impl UNNotificationAction {
65    extern_methods!(
66        #[unsafe(method(identifier))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn identifier(&self) -> Retained<NSString>;
69
70        #[unsafe(method(title))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn title(&self) -> Retained<NSString>;
73
74        #[unsafe(method(options))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn options(&self) -> UNNotificationActionOptions;
77
78        #[cfg(feature = "UNNotificationActionIcon")]
79        #[unsafe(method(icon))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn icon(&self) -> Option<Retained<UNNotificationActionIcon>>;
82
83        #[unsafe(method(actionWithIdentifier:title:options:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn actionWithIdentifier_title_options(
86            identifier: &NSString,
87            title: &NSString,
88            options: UNNotificationActionOptions,
89        ) -> Retained<Self>;
90
91        #[cfg(feature = "UNNotificationActionIcon")]
92        #[unsafe(method(actionWithIdentifier:title:options:icon:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn actionWithIdentifier_title_options_icon(
95            identifier: &NSString,
96            title: &NSString,
97            options: UNNotificationActionOptions,
98            icon: Option<&UNNotificationActionIcon>,
99        ) -> Retained<Self>;
100
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
104    );
105}
106
107/// Methods declared on superclass `NSObject`.
108impl UNNotificationAction {
109    extern_methods!(
110        #[unsafe(method(new))]
111        #[unsafe(method_family = new)]
112        pub unsafe fn new() -> Retained<Self>;
113    );
114}
115
116extern_class!(
117    /// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction?language=objc)
118    #[unsafe(super(UNNotificationAction, NSObject))]
119    #[derive(Debug, PartialEq, Eq, Hash)]
120    pub struct UNTextInputNotificationAction;
121);
122
123extern_conformance!(
124    unsafe impl NSCoding for UNTextInputNotificationAction {}
125);
126
127extern_conformance!(
128    unsafe impl NSCopying for UNTextInputNotificationAction {}
129);
130
131unsafe impl CopyingHelper for UNTextInputNotificationAction {
132    type Result = Self;
133}
134
135extern_conformance!(
136    unsafe impl NSObjectProtocol for UNTextInputNotificationAction {}
137);
138
139extern_conformance!(
140    unsafe impl NSSecureCoding for UNTextInputNotificationAction {}
141);
142
143impl UNTextInputNotificationAction {
144    extern_methods!(
145        #[unsafe(method(actionWithIdentifier:title:options:textInputButtonTitle:textInputPlaceholder:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn actionWithIdentifier_title_options_textInputButtonTitle_textInputPlaceholder(
148            identifier: &NSString,
149            title: &NSString,
150            options: UNNotificationActionOptions,
151            text_input_button_title: &NSString,
152            text_input_placeholder: &NSString,
153        ) -> Retained<Self>;
154
155        #[cfg(feature = "UNNotificationActionIcon")]
156        #[unsafe(method(actionWithIdentifier:title:options:icon:textInputButtonTitle:textInputPlaceholder:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn actionWithIdentifier_title_options_icon_textInputButtonTitle_textInputPlaceholder(
159            identifier: &NSString,
160            title: &NSString,
161            options: UNNotificationActionOptions,
162            icon: Option<&UNNotificationActionIcon>,
163            text_input_button_title: &NSString,
164            text_input_placeholder: &NSString,
165        ) -> Retained<Self>;
166
167        #[unsafe(method(textInputButtonTitle))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn textInputButtonTitle(&self) -> Retained<NSString>;
170
171        #[unsafe(method(textInputPlaceholder))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn textInputPlaceholder(&self) -> Retained<NSString>;
174    );
175}
176
177/// Methods declared on superclass `UNNotificationAction`.
178impl UNTextInputNotificationAction {
179    extern_methods!(
180        #[unsafe(method(actionWithIdentifier:title:options:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn actionWithIdentifier_title_options(
183            identifier: &NSString,
184            title: &NSString,
185            options: UNNotificationActionOptions,
186        ) -> Retained<Self>;
187
188        #[cfg(feature = "UNNotificationActionIcon")]
189        #[unsafe(method(actionWithIdentifier:title:options:icon:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn actionWithIdentifier_title_options_icon(
192            identifier: &NSString,
193            title: &NSString,
194            options: UNNotificationActionOptions,
195            icon: Option<&UNNotificationActionIcon>,
196        ) -> Retained<Self>;
197
198        #[unsafe(method(init))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
201    );
202}
203
204/// Methods declared on superclass `NSObject`.
205impl UNTextInputNotificationAction {
206    extern_methods!(
207        #[unsafe(method(new))]
208        #[unsafe(method_family = new)]
209        pub unsafe fn new() -> Retained<Self>;
210    );
211}