objc2-user-notifications 0.2.2

Bindings to the UserNotifications framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNNotificationActionOptions(pub NSUInteger);
bitflags::bitflags! {
    impl UNNotificationActionOptions: NSUInteger {
        const UNNotificationActionOptionAuthenticationRequired = 1<<0;
        const UNNotificationActionOptionDestructive = 1<<1;
        const UNNotificationActionOptionForeground = 1<<2;
    }
}

unsafe impl Encode for UNNotificationActionOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UNNotificationActionOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

pub static UNNotificationActionOptionNone: UNNotificationActionOptions =
    UNNotificationActionOptions(0);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UNNotificationAction;

    unsafe impl ClassType for UNNotificationAction {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCoding for UNNotificationAction {}

unsafe impl NSCopying for UNNotificationAction {}

unsafe impl NSObjectProtocol for UNNotificationAction {}

unsafe impl NSSecureCoding for UNNotificationAction {}

extern_methods!(
    unsafe impl UNNotificationAction {
        #[method_id(@__retain_semantics Other identifier)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Retained<NSString>;

        #[method(options)]
        pub unsafe fn options(&self) -> UNNotificationActionOptions;

        #[cfg(feature = "UNNotificationActionIcon")]
        #[method_id(@__retain_semantics Other icon)]
        pub unsafe fn icon(&self) -> Option<Retained<UNNotificationActionIcon>>;

        #[method_id(@__retain_semantics Other actionWithIdentifier:title:options:)]
        pub unsafe fn actionWithIdentifier_title_options(
            identifier: &NSString,
            title: &NSString,
            options: UNNotificationActionOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "UNNotificationActionIcon")]
        #[method_id(@__retain_semantics Other actionWithIdentifier:title:options:icon:)]
        pub unsafe fn actionWithIdentifier_title_options_icon(
            identifier: &NSString,
            title: &NSString,
            options: UNNotificationActionOptions,
            icon: Option<&UNNotificationActionIcon>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UNNotificationAction {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UNTextInputNotificationAction;

    unsafe impl ClassType for UNTextInputNotificationAction {
        #[inherits(NSObject)]
        type Super = UNNotificationAction;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCoding for UNTextInputNotificationAction {}

unsafe impl NSCopying for UNTextInputNotificationAction {}

unsafe impl NSObjectProtocol for UNTextInputNotificationAction {}

unsafe impl NSSecureCoding for UNTextInputNotificationAction {}

extern_methods!(
    unsafe impl UNTextInputNotificationAction {
        #[method_id(@__retain_semantics Other actionWithIdentifier:title:options:textInputButtonTitle:textInputPlaceholder:)]
        pub unsafe fn actionWithIdentifier_title_options_textInputButtonTitle_textInputPlaceholder(
            identifier: &NSString,
            title: &NSString,
            options: UNNotificationActionOptions,
            text_input_button_title: &NSString,
            text_input_placeholder: &NSString,
        ) -> Retained<Self>;

        #[cfg(feature = "UNNotificationActionIcon")]
        #[method_id(@__retain_semantics Other actionWithIdentifier:title:options:icon:textInputButtonTitle:textInputPlaceholder:)]
        pub unsafe fn actionWithIdentifier_title_options_icon_textInputButtonTitle_textInputPlaceholder(
            identifier: &NSString,
            title: &NSString,
            options: UNNotificationActionOptions,
            icon: Option<&UNNotificationActionIcon>,
            text_input_button_title: &NSString,
            text_input_placeholder: &NSString,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other textInputButtonTitle)]
        pub unsafe fn textInputButtonTitle(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other textInputPlaceholder)]
        pub unsafe fn textInputPlaceholder(&self) -> Retained<NSString>;
    }
);

extern_methods!(
    /// Methods declared on superclass `UNNotificationAction`
    unsafe impl UNTextInputNotificationAction {
        #[method_id(@__retain_semantics Other actionWithIdentifier:title:options:)]
        pub unsafe fn actionWithIdentifier_title_options(
            identifier: &NSString,
            title: &NSString,
            options: UNNotificationActionOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "UNNotificationActionIcon")]
        #[method_id(@__retain_semantics Other actionWithIdentifier:title:options:icon:)]
        pub unsafe fn actionWithIdentifier_title_options_icon(
            identifier: &NSString,
            title: &NSString,
            options: UNNotificationActionOptions,
            icon: Option<&UNNotificationActionIcon>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UNTextInputNotificationAction {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);