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

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

impl ASAuthorizationProviderExtensionAuthorizationResult {
    extern_methods!(
        /// Authorization succeeded with an authorization tokens stored in HTTP headers.
        #[unsafe(method(initWithHTTPAuthorizationHeaders:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithHTTPAuthorizationHeaders(
            this: Allocated<Self>,
            http_authorization_headers: &NSDictionary<NSString, NSString>,
        ) -> Retained<Self>;

        /// Authorization succeeded with a HTTP response.
        #[unsafe(method(initWithHTTPResponse:httpBody:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithHTTPResponse_httpBody(
            this: Allocated<Self>,
            http_response: &NSHTTPURLResponse,
            http_body: Option<&NSData>,
        ) -> Retained<Self>;

        /// HTTP extra headers for addition with credentials.
        #[unsafe(method(httpAuthorizationHeaders))]
        #[unsafe(method_family = none)]
        pub unsafe fn httpAuthorizationHeaders(
            &self,
        ) -> Option<Retained<NSDictionary<NSString, NSString>>>;

        /// Setter for [`httpAuthorizationHeaders`][Self::httpAuthorizationHeaders].
        #[unsafe(method(setHttpAuthorizationHeaders:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHttpAuthorizationHeaders(
            &self,
            http_authorization_headers: Option<&NSDictionary<NSString, NSString>>,
        );

        /// HTTP response for OAUth and SAML based authentications.
        #[unsafe(method(httpResponse))]
        #[unsafe(method_family = none)]
        pub unsafe fn httpResponse(&self) -> Option<Retained<NSHTTPURLResponse>>;

        /// Setter for [`httpResponse`][Self::httpResponse].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setHttpResponse:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHttpResponse(&self, http_response: Option<&NSHTTPURLResponse>);

        /// HTTP response body for OAUth and SAML based authentications.
        #[unsafe(method(httpBody))]
        #[unsafe(method_family = none)]
        pub unsafe fn httpBody(&self) -> Option<Retained<NSData>>;

        /// Setter for [`httpBody`][Self::httpBody].
        #[unsafe(method(setHttpBody:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHttpBody(&self, http_body: Option<&NSData>);

        /// Private SecKeys.
        #[unsafe(method(privateKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn privateKeys(&self) -> Retained<NSArray>;

        /// Setter for [`privateKeys`][Self::privateKeys].
        ///
        /// # Safety
        ///
        /// `private_keys` generic should be of the correct type.
        #[unsafe(method(setPrivateKeys:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPrivateKeys(&self, private_keys: &NSArray);
    );
}

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