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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// The type of value represented by the service identifier.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialserviceidentifiertype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialServiceIdentifierType(pub NSInteger);
impl ASCredentialServiceIdentifierType {
    #[doc(alias = "ASCredentialServiceIdentifierTypeDomain")]
    pub const Domain: Self = Self(0);
    #[doc(alias = "ASCredentialServiceIdentifierTypeURL")]
    pub const URL: Self = Self(1);
}

unsafe impl Encode for ASCredentialServiceIdentifierType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for ASCredentialServiceIdentifierType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

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

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

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

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

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

impl ASCredentialServiceIdentifier {
    extern_methods!(
        /// Initializes an ASCredentialServiceIdentifier object.
        ///
        /// Parameter `identifier`: string value for the service identifier.
        ///
        /// Parameter `type`: the type that the service identifier string represents.
        #[unsafe(method(initWithIdentifier:type:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_type(
            this: Allocated<Self>,
            identifier: &NSString,
            r#type: ASCredentialServiceIdentifierType,
        ) -> Retained<Self>;

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

        /// Get the service identifier type.
        ///
        /// Returns: The service identifier type.
        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> ASCredentialServiceIdentifierType;
    );
}

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