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
44unsafe impl NSCoding for UNNotificationAction {}
45
46unsafe impl NSCopying for UNNotificationAction {}
47
48unsafe impl CopyingHelper for UNNotificationAction {
49    type Result = Self;
50}
51
52unsafe impl NSObjectProtocol for UNNotificationAction {}
53
54unsafe impl NSSecureCoding for UNNotificationAction {}
55
56impl UNNotificationAction {
57    extern_methods!(
58        #[unsafe(method(identifier))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn identifier(&self) -> Retained<NSString>;
61
62        #[unsafe(method(title))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn title(&self) -> Retained<NSString>;
65
66        #[unsafe(method(options))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn options(&self) -> UNNotificationActionOptions;
69
70        #[cfg(feature = "UNNotificationActionIcon")]
71        #[unsafe(method(icon))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn icon(&self) -> Option<Retained<UNNotificationActionIcon>>;
74
75        #[unsafe(method(actionWithIdentifier:title:options:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn actionWithIdentifier_title_options(
78            identifier: &NSString,
79            title: &NSString,
80            options: UNNotificationActionOptions,
81        ) -> Retained<Self>;
82
83        #[cfg(feature = "UNNotificationActionIcon")]
84        #[unsafe(method(actionWithIdentifier:title:options:icon:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn actionWithIdentifier_title_options_icon(
87            identifier: &NSString,
88            title: &NSString,
89            options: UNNotificationActionOptions,
90            icon: Option<&UNNotificationActionIcon>,
91        ) -> Retained<Self>;
92
93        #[unsafe(method(init))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
96    );
97}
98
99/// Methods declared on superclass `NSObject`.
100impl UNNotificationAction {
101    extern_methods!(
102        #[unsafe(method(new))]
103        #[unsafe(method_family = new)]
104        pub unsafe fn new() -> Retained<Self>;
105    );
106}
107
108extern_class!(
109    /// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction?language=objc)
110    #[unsafe(super(UNNotificationAction, NSObject))]
111    #[derive(Debug, PartialEq, Eq, Hash)]
112    pub struct UNTextInputNotificationAction;
113);
114
115unsafe impl NSCoding for UNTextInputNotificationAction {}
116
117unsafe impl NSCopying for UNTextInputNotificationAction {}
118
119unsafe impl CopyingHelper for UNTextInputNotificationAction {
120    type Result = Self;
121}
122
123unsafe impl NSObjectProtocol for UNTextInputNotificationAction {}
124
125unsafe impl NSSecureCoding for UNTextInputNotificationAction {}
126
127impl UNTextInputNotificationAction {
128    extern_methods!(
129        #[unsafe(method(actionWithIdentifier:title:options:textInputButtonTitle:textInputPlaceholder:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn actionWithIdentifier_title_options_textInputButtonTitle_textInputPlaceholder(
132            identifier: &NSString,
133            title: &NSString,
134            options: UNNotificationActionOptions,
135            text_input_button_title: &NSString,
136            text_input_placeholder: &NSString,
137        ) -> Retained<Self>;
138
139        #[cfg(feature = "UNNotificationActionIcon")]
140        #[unsafe(method(actionWithIdentifier:title:options:icon:textInputButtonTitle:textInputPlaceholder:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn actionWithIdentifier_title_options_icon_textInputButtonTitle_textInputPlaceholder(
143            identifier: &NSString,
144            title: &NSString,
145            options: UNNotificationActionOptions,
146            icon: Option<&UNNotificationActionIcon>,
147            text_input_button_title: &NSString,
148            text_input_placeholder: &NSString,
149        ) -> Retained<Self>;
150
151        #[unsafe(method(textInputButtonTitle))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn textInputButtonTitle(&self) -> Retained<NSString>;
154
155        #[unsafe(method(textInputPlaceholder))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn textInputPlaceholder(&self) -> Retained<NSString>;
158    );
159}
160
161/// Methods declared on superclass `UNNotificationAction`.
162impl UNTextInputNotificationAction {
163    extern_methods!(
164        #[unsafe(method(actionWithIdentifier:title:options:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn actionWithIdentifier_title_options(
167            identifier: &NSString,
168            title: &NSString,
169            options: UNNotificationActionOptions,
170        ) -> Retained<Self>;
171
172        #[cfg(feature = "UNNotificationActionIcon")]
173        #[unsafe(method(actionWithIdentifier:title:options:icon:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn actionWithIdentifier_title_options_icon(
176            identifier: &NSString,
177            title: &NSString,
178            options: UNNotificationActionOptions,
179            icon: Option<&UNNotificationActionIcon>,
180        ) -> Retained<Self>;
181
182        #[unsafe(method(init))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
185    );
186}
187
188/// Methods declared on superclass `NSObject`.
189impl UNTextInputNotificationAction {
190    extern_methods!(
191        #[unsafe(method(new))]
192        #[unsafe(method_family = new)]
193        pub unsafe fn new() -> Retained<Self>;
194    );
195}