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_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asaccountauthenticationmodificationcontrollerdelegate?language=objc)
    pub unsafe trait ASAccountAuthenticationModificationControllerDelegate:
        NSObjectProtocol
    {
        #[cfg(feature = "ASAccountAuthenticationModificationRequest")]
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[optional]
        #[unsafe(method(accountAuthenticationModificationController:didSuccessfullyCompleteRequest:withUserInfo:))]
        #[unsafe(method_family = none)]
        unsafe fn accountAuthenticationModificationController_didSuccessfullyCompleteRequest_withUserInfo(
            &self,
            controller: &ASAccountAuthenticationModificationController,
            request: &ASAccountAuthenticationModificationRequest,
            user_info: Option<&NSDictionary>,
        );

        #[cfg(feature = "ASAccountAuthenticationModificationRequest")]
        #[optional]
        #[unsafe(method(accountAuthenticationModificationController:didFailRequest:withError:))]
        #[unsafe(method_family = none)]
        unsafe fn accountAuthenticationModificationController_didFailRequest_withError(
            &self,
            controller: &ASAccountAuthenticationModificationController,
            request: &ASAccountAuthenticationModificationRequest,
            error: &NSError,
        );
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asaccountauthenticationmodificationcontrollerpresentationcontextproviding?language=objc)
    pub unsafe trait ASAccountAuthenticationModificationControllerPresentationContextProviding:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(feature = "ASFoundation")]
        #[cfg(target_os = "macos")]
        /// Return a view anchor that is most appropriate for authorization UI to be presented over.
        #[unsafe(method(presentationAnchorForAccountAuthenticationModificationController:))]
        #[unsafe(method_family = none)]
        unsafe fn presentationAnchorForAccountAuthenticationModificationController(
            &self,
            controller: &ASAccountAuthenticationModificationController,
        ) -> Retained<ASPresentationAnchor>;
    }
);

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

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

impl ASAccountAuthenticationModificationController {
    extern_methods!(
        /// This delegate will be notified upon completion of the upgrade to report success or failure.
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<
            Retained<ProtocolObject<dyn ASAccountAuthenticationModificationControllerDelegate>>,
        >;

        /// 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 ASAccountAuthenticationModificationControllerDelegate>,
            >,
        );

        /// This will be used to provide a presentation context to display authorization UI.
        #[unsafe(method(presentationContextProvider))]
        #[unsafe(method_family = none)]
        pub unsafe fn presentationContextProvider(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<
            Retained<
                ProtocolObject<
                    dyn ASAccountAuthenticationModificationControllerPresentationContextProviding,
                >,
            >,
        >;

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

        #[cfg(feature = "ASAccountAuthenticationModificationRequest")]
        /// Perform an upgrade request, one at a time. Any requests initiated with a request already in progress will fail immediately.
        #[unsafe(method(performRequest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn performRequest(&self, request: &ASAccountAuthenticationModificationRequest);
    );
}

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