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::*;

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

#[cfg(feature = "INIntent")]
extern_conformance!(
    unsafe impl NSCoding for INSendMessageIntent {}
);

#[cfg(feature = "INIntent")]
extern_conformance!(
    unsafe impl NSCopying for INSendMessageIntent {}
);

#[cfg(feature = "INIntent")]
unsafe impl CopyingHelper for INSendMessageIntent {
    type Result = Self;
}

#[cfg(feature = "INIntent")]
extern_conformance!(
    unsafe impl NSObjectProtocol for INSendMessageIntent {}
);

#[cfg(feature = "INIntent")]
extern_conformance!(
    unsafe impl NSSecureCoding for INSendMessageIntent {}
);

#[cfg(feature = "INIntent")]
impl INSendMessageIntent {
    extern_methods!(
        #[cfg(all(
            feature = "INOutgoingMessageType",
            feature = "INPerson",
            feature = "INSendMessageAttachment",
            feature = "INSpeakableString"
        ))]
        #[unsafe(method(initWithRecipients:outgoingMessageType:content:speakableGroupName:conversationIdentifier:serviceName:sender:attachments:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRecipients_outgoingMessageType_content_speakableGroupName_conversationIdentifier_serviceName_sender_attachments(
            this: Allocated<Self>,
            recipients: Option<&NSArray<INPerson>>,
            outgoing_message_type: INOutgoingMessageType,
            content: Option<&NSString>,
            speakable_group_name: Option<&INSpeakableString>,
            conversation_identifier: Option<&NSString>,
            service_name: Option<&NSString>,
            sender: Option<&INPerson>,
            attachments: Option<&NSArray<INSendMessageAttachment>>,
        ) -> Retained<Self>;

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

        #[cfg(feature = "INOutgoingMessageType")]
        #[unsafe(method(outgoingMessageType))]
        #[unsafe(method_family = none)]
        pub unsafe fn outgoingMessageType(&self) -> INOutgoingMessageType;

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

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

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

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

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

        #[cfg(feature = "INSendMessageAttachment")]
        #[unsafe(method(attachments))]
        #[unsafe(method_family = none)]
        pub unsafe fn attachments(&self) -> Option<Retained<NSArray<INSendMessageAttachment>>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "INIntent")]
impl INSendMessageIntent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_protocol!(
    /// Protocol to declare support for handling an INSendMessageIntent. By implementing this protocol, a class can provide logic for resolving, confirming and handling the intent.
    ///
    /// The minimum requirement for an implementing class is that it should be able to handle the intent. The resolution and confirmation methods are optional. The handling method is always called last, after resolving and confirming the intent.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/intents/insendmessageintenthandling?language=objc)
    pub unsafe trait INSendMessageIntentHandling: NSObjectProtocol {
        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResponse",
            feature = "INSendMessageIntentResponse",
            feature = "block2"
        ))]
        /// Handling method - Execute the task represented by the INSendMessageIntent that's passed in
        ///
        /// Called to actually execute the intent. The app must return a response for this intent.
        ///
        ///
        /// Parameter `intent`: The input intent
        ///
        /// Parameter `completion`: The response handling block takes a INSendMessageIntentResponse containing the details of the result of having executed the intent
        ///
        ///
        /// See: INSendMessageIntentResponse
        #[unsafe(method(handleSendMessage:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn handleSendMessage_completion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INSendMessageIntentResponse>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResponse",
            feature = "INSendMessageIntentResponse",
            feature = "block2"
        ))]
        /// Confirmation method - Validate that this intent is ready for the next step (i.e. handling)
        ///
        /// Called prior to asking the app to handle the intent. The app should return a response object that contains additional information about the intent, which may be relevant for the system to show the user prior to handling. If unimplemented, the system will assume the intent is valid following resolution, and will assume there is no additional information relevant to this intent.
        ///
        ///
        /// Parameter `intent`: The input intent
        ///
        /// Parameter `completion`: The response block contains an INSendMessageIntentResponse containing additional details about the intent that may be relevant for the system to show the user prior to handling.
        ///
        ///
        /// See: INSendMessageIntentResponse
        #[optional]
        #[unsafe(method(confirmSendMessage:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn confirmSendMessage_completion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INSendMessageIntentResponse>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INPersonResolutionResult",
            feature = "block2"
        ))]
        /// Resolution methods - Determine if this intent is ready for the next step (confirmation)
        ///
        /// Called to make sure the app extension is capable of handling this intent in its current form. This method is for validating if the intent needs any further fleshing out.
        ///
        ///
        /// Parameter `intent`: The input intent
        ///
        /// Parameter `completion`: The response block contains an INIntentResolutionResult for the parameter being resolved
        ///
        ///
        /// See: INIntentResolutionResult
        #[deprecated = "resolveRecipientsForSendMessage:withCompletion: is deprecated. Use resolveRecipientsForSendMessage:completion: instead"]
        #[optional]
        #[unsafe(method(resolveRecipientsForSendMessage:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveRecipientsForSendMessage_withCompletion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<NSArray<INPersonResolutionResult>>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INPersonResolutionResult",
            feature = "INSendMessageRecipientResolutionResult",
            feature = "block2"
        ))]
        #[optional]
        #[unsafe(method(resolveRecipientsForSendMessage:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveRecipientsForSendMessage_completion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<
                dyn Fn(NonNull<NSArray<INSendMessageRecipientResolutionResult>>),
            >,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INStringResolutionResult",
            feature = "block2"
        ))]
        #[deprecated = "resolveGroupNameForSendMessage:withCompletion: is deprecated. Use resolveSpeakableGroupNameForSendMessage:withCompletion: instead"]
        #[optional]
        #[unsafe(method(resolveGroupNameForSendMessage:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveGroupNameForSendMessage_withCompletion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INStringResolutionResult>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INOutgoingMessageTypeResolutionResult",
            feature = "block2"
        ))]
        #[optional]
        #[unsafe(method(resolveOutgoingMessageTypeForSendMessage:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveOutgoingMessageTypeForSendMessage_withCompletion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INOutgoingMessageTypeResolutionResult>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INStringResolutionResult",
            feature = "block2"
        ))]
        #[optional]
        #[unsafe(method(resolveContentForSendMessage:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveContentForSendMessage_withCompletion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INStringResolutionResult>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INSpeakableStringResolutionResult",
            feature = "block2"
        ))]
        #[optional]
        #[unsafe(method(resolveSpeakableGroupNameForSendMessage:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveSpeakableGroupNameForSendMessage_withCompletion(
            &self,
            intent: &INSendMessageIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INSpeakableStringResolutionResult>)>,
        );
    }
);