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!(
    /// An ASPasswordCredentialIdentity is used to describe an identity that can use a service upon successful password based authentication.
    /// Use this class to save entries into ASCredentialIdentityStore.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/aspasswordcredentialidentity?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ASPasswordCredentialIdentity;
);

#[cfg(feature = "ASCredentialIdentity")]
extern_conformance!(
    unsafe impl ASCredentialIdentity for ASPasswordCredentialIdentity {}
);

extern_conformance!(
    unsafe impl NSCoding for ASPasswordCredentialIdentity {}
);

extern_conformance!(
    unsafe impl NSCopying for ASPasswordCredentialIdentity {}
);

unsafe impl CopyingHelper for ASPasswordCredentialIdentity {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for ASPasswordCredentialIdentity {}
);

impl ASPasswordCredentialIdentity {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "ASCredentialServiceIdentifier")]
        /// Initializes an instance of ASPasswordCredentialIdentity.
        ///
        /// Parameter `serviceIdentifier`: the service identifier for which this credential identity is valid.
        ///
        /// Parameter `user`: the user that can authenticate into the service indicated by the serviceIdentifier.
        ///
        /// Parameter `recordIdentifier`: an optional string to uniquely identify this record in your local database.
        #[unsafe(method(initWithServiceIdentifier:user:recordIdentifier:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithServiceIdentifier_user_recordIdentifier(
            this: Allocated<Self>,
            service_identifier: &ASCredentialServiceIdentifier,
            user: &NSString,
            record_identifier: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(feature = "ASCredentialServiceIdentifier")]
        /// Creates and initializes an instance of ASPasswordCredentialIdentity.
        ///
        /// Parameter `serviceIdentifier`: the service identifier for which this credential identity is valid.
        ///
        /// Parameter `user`: the user that can authenticate into the service indicated by the serviceIdentifier.
        ///
        /// Parameter `recordIdentifier`: an optional string to uniquely identify this record in your local database.
        #[unsafe(method(identityWithServiceIdentifier:user:recordIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn identityWithServiceIdentifier_user_recordIdentifier(
            service_identifier: &ASCredentialServiceIdentifier,
            user: &NSString,
            record_identifier: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(feature = "ASCredentialServiceIdentifier")]
        /// Get the service identifier.
        ///
        /// Returns: The service identifier for this credential identity.
        #[unsafe(method(serviceIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn serviceIdentifier(&self) -> Retained<ASCredentialServiceIdentifier>;

        /// Get the user.
        ///
        /// Returns: The user string.
        #[unsafe(method(user))]
        #[unsafe(method_family = none)]
        pub unsafe fn user(&self) -> Retained<NSString>;

        /// Get the record identifier.
        ///
        /// Returns: The record identifier.
        ///
        /// You can utilize the record identifier to uniquely identify the credential identity in your local database.
        #[unsafe(method(recordIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn recordIdentifier(&self) -> Option<Retained<NSString>>;

        /// Get or set the rank of the credential identity object.
        ///
        /// The system may utilize the rank to decide which credential identity precedes the other
        /// if two identities have the same service identifier. A credential identity with a larger rank value
        /// precedes one with a smaller value if both credential identities have the same service identifier.
        /// The default value of this property is 0.
        #[unsafe(method(rank))]
        #[unsafe(method_family = none)]
        pub unsafe fn rank(&self) -> NSInteger;

        /// Setter for [`rank`][Self::rank].
        #[unsafe(method(setRank:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRank(&self, rank: NSInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl ASPasswordCredentialIdentity {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}