objc2-pass-kit 0.3.2

Bindings to the PassKit 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!(
    /// Used to request information from an identity document stored as a Wallet pass.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/passkit/pkidentityauthorizationcontroller?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKIdentityAuthorizationController;
);

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

impl PKIdentityAuthorizationController {
    extern_methods!(
        #[cfg(all(feature = "PKIdentityDocumentDescriptor", feature = "block2"))]
        /// Determines if a document can be requested, taking into account the entitlement of the
        /// calling process as well as the state of this device.
        #[unsafe(method(checkCanRequestDocument:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkCanRequestDocument_completion(
            &self,
            descriptor: &ProtocolObject<dyn PKIdentityDocumentDescriptor>,
            completion: &block2::DynBlock<dyn Fn(Bool)>,
        );

        #[cfg(all(
            feature = "PKIdentityDocument",
            feature = "PKIdentityRequest",
            feature = "block2"
        ))]
        /// Requests identity document information from the user. The user will be prompted to approve
        /// the request before any data is released.
        /// If the user approves, the document will be returned through the completion handler.
        /// If the user does not approve, PKIdentityErrorUserCancelled will be returned through
        /// the completion handler.
        /// If the request is cancelled by the calling app through cancelRequest, PKIdentityErrorAppCancelled
        /// will be returned.
        /// Only one request can be in progress at a time, otherwise PKIdentityErrorRequestAlreadyInProgress
        /// will be returned.
        #[unsafe(method(requestDocument:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestDocument_completion(
            &self,
            request: &PKIdentityRequest,
            completion: &block2::DynBlock<dyn Fn(*mut PKIdentityDocument, *mut NSError)>,
        );

        /// If there is a request in progress through requestDocument, this will cancel that request
        /// if possible. If the request is cancelled, PKIdentityErrorAppCancelled will be returned in the
        /// requestDocument:completion: completion handler. Cancellation is not guaranteed; even if
        /// this method is called, it is possible that requestDocument:completion: will return a document
        /// response if a response was already in flight.
        #[unsafe(method(cancelRequest))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelRequest(&self);
    );
}

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