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;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/callkit/cxcalldirectoryextensioncontextdelegate?language=objc)
    pub unsafe trait CXCallDirectoryExtensionContextDelegate: NSObjectProtocol {
        #[unsafe(method(requestFailedForExtensionContext:withError:))]
        #[unsafe(method_family = none)]
        unsafe fn requestFailedForExtensionContext_withError(
            &self,
            extension_context: &CXCallDirectoryExtensionContext,
            error: &NSError,
        );
    }
);

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

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

impl CXCallDirectoryExtensionContext {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn CXCallDirectoryExtensionContextDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn CXCallDirectoryExtensionContextDelegate>>,
        );

        /// Whether the request should provide incremental data.
        ///
        /// If this is called at the beginning of the request (before any entries have been added or removed) and the result is YES,
        /// then the request must only provide an "incremental" set of entries, i.e. only add or remove entries relative to the last time data
        /// was loaded for the extension. Otherwise, if this method is not called OR is called and returns NO, then the request must provide
        /// a "complete" set of entries, adding the full list of entries from scratch (and removing none), regardless of whether data has ever been
        /// successfully loaded in the past.
        #[unsafe(method(isIncremental))]
        #[unsafe(method_family = none)]
        pub unsafe fn isIncremental(&self) -> bool;

        #[cfg(feature = "CXCallDirectory")]
        #[unsafe(method(addBlockingEntryWithNextSequentialPhoneNumber:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addBlockingEntryWithNextSequentialPhoneNumber(
            &self,
            phone_number: CXCallDirectoryPhoneNumber,
        );

        #[cfg(feature = "CXCallDirectory")]
        /// Remove blocking entry with the specified phone number.
        ///
        /// May only be used when `-isIncremental` returns YES, indicating that the request should provide incremental entries and thus may use this
        /// API to remove a previously-added blocking entry.
        ///
        ///
        /// Parameter `phoneNumber`: The blocking entry phone number to remove.
        #[unsafe(method(removeBlockingEntryWithPhoneNumber:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeBlockingEntryWithPhoneNumber(
            &self,
            phone_number: CXCallDirectoryPhoneNumber,
        );

        /// Remove all currently-stored blocking entries.
        ///
        /// May only be used when `-isIncremental` returns YES, indicating that the request should provide incremental entries and thus may use this
        /// API to remove all previously-added blocking entries.
        #[unsafe(method(removeAllBlockingEntries))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAllBlockingEntries(&self);

        #[cfg(feature = "CXCallDirectory")]
        #[unsafe(method(addIdentificationEntryWithNextSequentialPhoneNumber:label:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addIdentificationEntryWithNextSequentialPhoneNumber_label(
            &self,
            phone_number: CXCallDirectoryPhoneNumber,
            label: &NSString,
        );

        #[cfg(feature = "CXCallDirectory")]
        /// Remove identification entry with the specified phone number.
        ///
        /// May only be used when `-isIncremental` returns YES, indicating that the request should provide incremental entries and thus may use this
        /// API to remove a previously-added identification entry. Removes all identification entries with the specified phone number, even if
        /// multiple identification entries with different labels are present for a single phone number.
        ///
        ///
        /// Parameter `phoneNumber`: The identification entry phone number to remove.
        #[unsafe(method(removeIdentificationEntryWithPhoneNumber:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeIdentificationEntryWithPhoneNumber(
            &self,
            phone_number: CXCallDirectoryPhoneNumber,
        );

        /// Remove all currently-stored identification entries.
        ///
        /// May only be used when `-isIncremental` returns YES, indicating that the request should provide incremental entries and thus may use this
        /// API to remove all previously-added identification entries.
        #[unsafe(method(removeAllIdentificationEntries))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAllIdentificationEntries(&self);

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

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `items` generic should be of the correct type.
        #[unsafe(method(completeRequestReturningItems:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeRequestReturningItems_completionHandler(
            &self,
            items: Option<&NSArray>,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl CXCallDirectoryExtensionContext {
    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>;
    );
}