objc2-call-kit 0.3.2

Bindings to the CallKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

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

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

impl CXCallController {
    extern_methods!(
        /// Initialize call controller with a private, serial queue.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "dispatch2")]
        /// Initialize call controller with specified queue, which is used for calling completion blocks.
        ///
        /// # Safety
        ///
        /// `queue` possibly has additional threading requirements.
        #[unsafe(method(initWithQueue:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithQueue(this: Allocated<Self>, queue: &DispatchQueue)
            -> Retained<Self>;

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

        #[cfg(all(feature = "CXTransaction", feature = "block2"))]
        /// Request a transaction to be performed by the in-app provider.
        ///
        /// If the completion block is called with a nil error, then the transaction will be passed to the CXProvider's -provider:executeTransaction: delegate callback.
        /// A non-nil error indicates that the requested transaction could not be executed.
        ///
        /// Completion block is performed on the queue supplied to designated initializer.
        #[unsafe(method(requestTransaction:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestTransaction_completion(
            &self,
            transaction: &CXTransaction,
            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
        );

        #[cfg(all(feature = "CXAction", feature = "block2"))]
        /// Request a transaction containing the specified actions to be performed by the in-app provider.
        ///
        /// If the completion block is called with a nil error, then the transaction will be passed to the CXProvider's -provider:executeTransaction: delegate callback.
        /// A non-nil error indicates that the requested transaction could not be executed.
        ///
        /// Completion block is performed on the queue supplied to designated initializer.
        #[unsafe(method(requestTransactionWithActions:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestTransactionWithActions_completion(
            &self,
            actions: &NSArray<CXAction>,
            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
        );

        #[cfg(all(feature = "CXAction", feature = "block2"))]
        /// Request a transaction containing the specified action to be performed by the in-app provider.
        ///
        /// If the completion block is called with a nil error, then the transaction will be passed to the CXProvider's -provider:executeTransaction: delegate callback.
        /// A non-nil error indicates that the requested transaction could not be executed.
        ///
        /// Completion block is performed on the queue supplied to designated initializer.
        #[unsafe(method(requestTransactionWithAction:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestTransactionWithAction_completion(
            &self,
            action: &CXAction,
            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
        );
    );
}

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