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/asaccountauthenticationmodificationextensioncontext?language=objc)
    #[unsafe(super(NSExtensionContext, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ASAccountAuthenticationModificationExtensionContext;
);

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

impl ASAccountAuthenticationModificationExtensionContext {
    extern_methods!(
        #[cfg(all(feature = "ASAuthorizationAppleIDCredential", feature = "block2"))]
        /// Retrieves a Sign in with Apple credential from the system.
        ///
        /// Parameter `state`: Can be specified to enhance security. State is returned in the ASAuthorizationAppleIDCredential.
        ///
        /// Parameter `nonce`: Can be specified to enhance security. The returned identityToken on the ASAuthorizationAppleIDCredential can be exchanged with the server for the nonce.
        ///
        /// Calling this method will cause the system Sign in with Apple upgrade sheet
        /// to appear. If extension UI is showing when this method is called, the extension UI will be
        /// dismissed before the sheet is presented.
        #[unsafe(method(getSignInWithAppleUpgradeAuthorizationWithState:nonce:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getSignInWithAppleUpgradeAuthorizationWithState_nonce_completionHandler(
            &self,
            state: Option<&NSString>,
            nonce: Option<&NSString>,
            completion_handler: &block2::DynBlock<
                dyn Fn(*mut ASAuthorizationAppleIDCredential, *mut NSError),
            >,
        );

        /// Confirms successful completion of a Sign in with Apple upgrade.
        ///
        /// Parameter `userInfo`: For upgrades invoked within the extension's containing app, any
        /// information the extension wants to pass back to the app.
        ///
        /// Once a Sign in with Apple upgrade is completed, the system will delete
        /// the password-based credential from the Keychain, if it is saved there.
        ///
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[unsafe(method(completeUpgradeToSignInWithAppleWithUserInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeUpgradeToSignInWithAppleWithUserInfo(
            &self,
            user_info: Option<&NSDictionary>,
        );

        #[cfg(feature = "ASPasswordCredential")]
        /// Confirms successful completion of a strong password upgrade.
        ///
        /// Parameter `updatedCredential`: contains the account username and new password.
        ///
        /// Parameter `userInfo`: For upgrades invoked within the extension's containing app, any
        /// information the extension wants to pass back to the app.
        ///
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[unsafe(method(completeChangePasswordRequestWithUpdatedCredential:userInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeChangePasswordRequestWithUpdatedCredential_userInfo(
            &self,
            updated_credential: &ASPasswordCredential,
            user_info: Option<&NSDictionary>,
        );

        /// Used to either ask for user interaction in a request or to fail a request.
        #[unsafe(method(cancelRequestWithError:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelRequestWithError(&self, error: &NSError);
    );
}

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