objc2-intents 0.3.2

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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/intents/inintenthandlingstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INIntentHandlingStatus(pub NSInteger);
impl INIntentHandlingStatus {
    #[doc(alias = "INIntentHandlingStatusUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "INIntentHandlingStatusReady")]
    pub const Ready: Self = Self(1);
    #[doc(alias = "INIntentHandlingStatusInProgress")]
    pub const InProgress: Self = Self(2);
    #[doc(alias = "INIntentHandlingStatusSuccess")]
    pub const Success: Self = Self(3);
    #[doc(alias = "INIntentHandlingStatusFailure")]
    pub const Failure: Self = Self(4);
    #[doc(alias = "INIntentHandlingStatusDeferredToApplication")]
    pub const DeferredToApplication: Self = Self(5);
    #[doc(alias = "INIntentHandlingStatusUserConfirmationRequired")]
    pub const UserConfirmationRequired: Self = Self(6);
}

unsafe impl Encode for INIntentHandlingStatus {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/intents/ininteractiondirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INInteractionDirection(pub NSInteger);
impl INInteractionDirection {
    #[doc(alias = "INInteractionDirectionUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "INInteractionDirectionOutgoing")]
    pub const Outgoing: Self = Self(1);
    #[doc(alias = "INInteractionDirectionIncoming")]
    pub const Incoming: Self = Self(2);
}

unsafe impl Encode for INInteractionDirection {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/intents/ininteraction?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct INInteraction;
);

extern_conformance!(
    unsafe impl NSCoding for INInteraction {}
);

extern_conformance!(
    unsafe impl NSCopying for INInteraction {}
);

unsafe impl CopyingHelper for INInteraction {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for INInteraction {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for INInteraction {}
);

impl INInteraction {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(all(feature = "INIntent", feature = "INIntentResponse"))]
        #[unsafe(method(initWithIntent:response:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIntent_response(
            this: Allocated<Self>,
            intent: &INIntent,
            response: Option<&INIntentResponse>,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        #[unsafe(method(donateInteractionWithCompletion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn donateInteractionWithCompletion(
            &self,
            completion: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(deleteAllInteractionsWithCompletion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteAllInteractionsWithCompletion(
            completion: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(deleteInteractionsWithIdentifiers:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteInteractionsWithIdentifiers_completion(
            identifiers: &NSArray<NSString>,
            completion: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(deleteInteractionsWithGroupIdentifier:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteInteractionsWithGroupIdentifier_completion(
            group_identifier: &NSString,
            completion: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "INIntent")]
        #[unsafe(method(intent))]
        #[unsafe(method_family = none)]
        pub unsafe fn intent(&self) -> Retained<INIntent>;

        #[cfg(feature = "INIntentResponse")]
        #[unsafe(method(intentResponse))]
        #[unsafe(method_family = none)]
        pub unsafe fn intentResponse(&self) -> Option<Retained<INIntentResponse>>;

        #[unsafe(method(intentHandlingStatus))]
        #[unsafe(method_family = none)]
        pub unsafe fn intentHandlingStatus(&self) -> INIntentHandlingStatus;

        #[unsafe(method(direction))]
        #[unsafe(method_family = none)]
        pub unsafe fn direction(&self) -> INInteractionDirection;

        /// Setter for [`direction`][Self::direction].
        #[unsafe(method(setDirection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDirection(&self, direction: INInteractionDirection);

        #[unsafe(method(dateInterval))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateInterval(&self) -> Option<Retained<NSDateInterval>>;

        /// Setter for [`dateInterval`][Self::dateInterval].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setDateInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDateInterval(&self, date_interval: Option<&NSDateInterval>);

        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        /// Setter for [`identifier`][Self::identifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIdentifier(&self, identifier: &NSString);

        #[unsafe(method(groupIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn groupIdentifier(&self) -> Option<Retained<NSString>>;

        /// Setter for [`groupIdentifier`][Self::groupIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setGroupIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setGroupIdentifier(&self, group_identifier: Option<&NSString>);
    );
}

/// Methods declared on superclass `NSObject`.
impl INInteraction {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}