objc2-authentication-services 0.3.2

Bindings to the AuthenticationServices 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/authenticationservices/ascredentialproviderextensioncontext?language=objc)
    #[unsafe(super(NSExtensionContext, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ASCredentialProviderExtensionContext;
);

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

impl ASCredentialProviderExtensionContext {
    extern_methods!(
        #[cfg(all(feature = "ASPasswordCredential", feature = "block2"))]
        /// Complete the request by providing the user selected credential.
        ///
        /// Parameter `credential`: the credential that the user has selected.
        ///
        /// Parameter `completionHandler`: optionally contains any work which the extension may need to perform after the request has been completed,
        /// as a background-priority task. The `expired` parameter will be YES if the system decides to prematurely terminate a previous
        /// non-expiration invocation of the completionHandler.
        ///
        /// Calling this method will eventually dismiss the associated view controller.
        #[unsafe(method(completeRequestWithSelectedCredential:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeRequestWithSelectedCredential_completionHandler(
            &self,
            credential: &ASPasswordCredential,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(all(feature = "ASPasskeyAssertionCredential", feature = "block2"))]
        /// Complete the assertion request by providing the user selected passkey credential.
        ///
        /// Parameter `credential`: the credential that the user has selected. Includes assertion response.
        ///
        /// Parameter `completionHandler`: optionally contains any work which the extension may need to perform after the request has been completed,
        /// as a background-priority task. The `expired` parameter will be YES if the system decides to prematurely terminate a previous
        /// non-expiration invocation of the completionHandler.
        ///
        /// Calling this method will eventually dismiss the associated view controller.
        #[unsafe(method(completeAssertionRequestWithSelectedPasskeyCredential:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeAssertionRequestWithSelectedPasskeyCredential_completionHandler(
            &self,
            credential: &ASPasskeyAssertionCredential,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(all(feature = "ASPasskeyRegistrationCredential", feature = "block2"))]
        /// Complete the registration request by providing the newly created passkey credential.
        ///
        /// Parameter `credential`: the credential that was created in response to the registration request.
        ///
        /// Parameter `completionHandler`: optionally contains any work which the extension may need to perform after the request has been completed,
        /// as a background-priority task. The `expired` parameter will be YES if the system decides to prematurely terminate a previous
        /// non-expiration invocation of the completionHandler.
        ///
        /// Calling this method will eventually dismiss the associated view controller.
        #[unsafe(method(completeRegistrationRequestWithSelectedPasskeyCredential:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeRegistrationRequestWithSelectedPasskeyCredential_completionHandler(
            &self,
            credential: &ASPasskeyRegistrationCredential,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(all(feature = "ASOneTimeCodeCredential", feature = "block2"))]
        /// Complete the request by providing the user selected one time code credential.
        ///
        /// Parameter `credential`: the credential that the user has selected.
        ///
        /// Parameter `completionHandler`: optionally contains any work which the extension may need to perform after the request has been completed,
        /// as a background-priority task. The `expired` parameter will be YES if the system decides to prematurely terminate a previous
        /// non-expiration invocation of the completionHandler.
        ///
        /// Calling this method will eventually dismiss the associated view controller.
        #[unsafe(method(completeOneTimeCodeRequestWithSelectedCredential:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeOneTimeCodeRequestWithSelectedCredential_completionHandler(
            &self,
            credential: &ASOneTimeCodeCredential,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        /// Complete the request to configure the extension.
        ///
        /// Calling this method will eventually dismiss the associated view controller.
        #[unsafe(method(completeExtensionConfigurationRequest))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeExtensionConfigurationRequest(&self);

        #[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)>>,
        );

        /// Cancels the request.
        ///
        /// Parameter `error`: error's domain should be ASExtensionErrorDomain and the code should be a value of type ASExtensionErrorCode.
        ///
        /// The extension should call this method when the user cancels the action or a failure occurs.
        #[unsafe(method(cancelRequestWithError:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelRequestWithError(&self, error: &NSError);
    );
}

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