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/inplaymediaintent?language=objc)
    #[unsafe(super(INIntent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "INIntent")]
    pub struct INPlayMediaIntent;
);

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

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

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

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

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

#[cfg(feature = "INIntent")]
impl INPlayMediaIntent {
    extern_methods!(
        #[cfg(all(
            feature = "INMediaItem",
            feature = "INMediaSearch",
            feature = "INPlaybackQueueLocation",
            feature = "INPlaybackRepeatMode"
        ))]
        #[unsafe(method(initWithMediaItems:mediaContainer:playShuffled:playbackRepeatMode:resumePlayback:playbackQueueLocation:playbackSpeed:mediaSearch:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithMediaItems_mediaContainer_playShuffled_playbackRepeatMode_resumePlayback_playbackQueueLocation_playbackSpeed_mediaSearch(
            this: Allocated<Self>,
            media_items: Option<&NSArray<INMediaItem>>,
            media_container: Option<&INMediaItem>,
            play_shuffled: Option<&NSNumber>,
            playback_repeat_mode: INPlaybackRepeatMode,
            resume_playback: Option<&NSNumber>,
            playback_queue_location: INPlaybackQueueLocation,
            playback_speed: Option<&NSNumber>,
            media_search: Option<&INMediaSearch>,
        ) -> Retained<Self>;

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

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

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

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

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

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

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

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

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "INIntent")]
impl INPlayMediaIntent {
    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 INPlayMediaIntent. 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/inplaymediaintenthandling?language=objc)
    pub unsafe trait INPlayMediaIntentHandling: NSObjectProtocol {
        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResponse",
            feature = "INPlayMediaIntentResponse",
            feature = "block2"
        ))]
        /// Handling method - Execute the task represented by the INPlayMediaIntent 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 INPlayMediaIntentResponse containing the details of the result of having executed the intent
        ///
        ///
        /// See: INPlayMediaIntentResponse
        #[unsafe(method(handlePlayMedia:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn handlePlayMedia_completion(
            &self,
            intent: &INPlayMediaIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INPlayMediaIntentResponse>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResponse",
            feature = "INPlayMediaIntentResponse",
            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 INPlayMediaIntentResponse containing additional details about the intent that may be relevant for the system to show the user prior to handling.
        ///
        ///
        /// See: INPlayMediaIntentResponse
        #[optional]
        #[unsafe(method(confirmPlayMedia:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn confirmPlayMedia_completion(
            &self,
            intent: &INPlayMediaIntent,
            completion: &block2::DynBlock<dyn Fn(NonNull<INPlayMediaIntentResponse>)>,
        );

        #[cfg(all(
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INMediaItemResolutionResult",
            feature = "INPlayMediaMediaItemResolutionResult",
            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
        #[optional]
        #[unsafe(method(resolveMediaItemsForPlayMedia:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveMediaItemsForPlayMedia_withCompletion(
            &self,
            intent: &INPlayMediaIntent,
            completion: &block2::DynBlock<
                dyn Fn(NonNull<NSArray<INPlayMediaMediaItemResolutionResult>>),
            >,
        );

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

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

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

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

        #[cfg(all(
            feature = "INDoubleResolutionResult",
            feature = "INIntent",
            feature = "INIntentResolutionResult",
            feature = "INPlayMediaPlaybackSpeedResolutionResult",
            feature = "block2"
        ))]
        #[optional]
        #[unsafe(method(resolvePlaybackSpeedForPlayMedia:withCompletion:))]
        #[unsafe(method_family = none)]
        unsafe fn resolvePlaybackSpeedForPlayMedia_withCompletion(
            &self,
            intent: &INPlayMediaIntent,
            completion: &block2::DynBlock<
                dyn Fn(NonNull<INPlayMediaPlaybackSpeedResolutionResult>),
            >,
        );
    }
);