#[cfg(feature = "block2")]
use block2::*;
use objc2::__framework_prelude::*;
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static ASCredentialIdentityStoreErrorDomain: &'static NSErrorDomain;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialIdentityStoreErrorCode(pub NSInteger);
impl ASCredentialIdentityStoreErrorCode {
#[doc(alias = "ASCredentialIdentityStoreErrorCodeInternalError")]
pub const InternalError: Self = Self(0);
#[doc(alias = "ASCredentialIdentityStoreErrorCodeStoreDisabled")]
pub const StoreDisabled: Self = Self(1);
#[doc(alias = "ASCredentialIdentityStoreErrorCodeStoreBusy")]
pub const StoreBusy: Self = Self(2);
}
unsafe impl Encode for ASCredentialIdentityStoreErrorCode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for ASCredentialIdentityStoreErrorCode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialIdentityTypes(pub NSUInteger);
impl ASCredentialIdentityTypes {
#[doc(alias = "ASCredentialIdentityTypesAll")]
pub const All: Self = Self(0);
#[doc(alias = "ASCredentialIdentityTypesPassword")]
pub const Password: Self = Self(1);
#[doc(alias = "ASCredentialIdentityTypesPasskey")]
pub const Passkey: Self = Self(1 << 1);
}
unsafe impl Encode for ASCredentialIdentityTypes {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for ASCredentialIdentityTypes {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct ASCredentialIdentityStore;
unsafe impl ClassType for ASCredentialIdentityStore {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for ASCredentialIdentityStore {}
extern_methods!(
unsafe impl ASCredentialIdentityStore {
#[method_id(@__retain_semantics Other sharedStore)]
pub unsafe fn sharedStore() -> Id<ASCredentialIdentityStore>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[cfg(all(feature = "ASCredentialIdentityStoreState", feature = "block2"))]
#[method(getCredentialIdentityStoreStateWithCompletion:)]
pub unsafe fn getCredentialIdentityStoreStateWithCompletion(
&self,
completion: &Block<dyn Fn(NonNull<ASCredentialIdentityStoreState>)>,
);
#[cfg(all(
feature = "ASCredentialIdentity",
feature = "ASCredentialServiceIdentifier",
feature = "block2"
))]
#[method(getCredentialIdentitiesForService:credentialIdentityTypes:completionHandler:)]
pub unsafe fn getCredentialIdentitiesForService_credentialIdentityTypes_completionHandler(
&self,
service_identifier: Option<&ASCredentialServiceIdentifier>,
credential_identity_types: ASCredentialIdentityTypes,
completion_handler: &Block<
dyn Fn(NonNull<NSArray<ProtocolObject<dyn ASCredentialIdentity>>>),
>,
);
#[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
#[deprecated]
#[method(saveCredentialIdentities:completion:)]
pub unsafe fn saveCredentialIdentities_completion(
&self,
credential_identities: &NSArray<ASPasswordCredentialIdentity>,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
#[method(saveCredentialIdentityEntries:completion:)]
pub unsafe fn saveCredentialIdentityEntries_completion(
&self,
credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
#[deprecated]
#[method(removeCredentialIdentities:completion:)]
pub unsafe fn removeCredentialIdentities_completion(
&self,
credential_identities: &NSArray<ASPasswordCredentialIdentity>,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
#[method(removeCredentialIdentityEntries:completion:)]
pub unsafe fn removeCredentialIdentityEntries_completion(
&self,
credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(feature = "block2")]
#[method(removeAllCredentialIdentitiesWithCompletion:)]
pub unsafe fn removeAllCredentialIdentitiesWithCompletion(
&self,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
#[deprecated]
#[method(replaceCredentialIdentitiesWithIdentities:completion:)]
pub unsafe fn replaceCredentialIdentitiesWithIdentities_completion(
&self,
new_credential_identities: &NSArray<ASPasswordCredentialIdentity>,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
#[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
#[method(replaceCredentialIdentityEntries:completion:)]
pub unsafe fn replaceCredentialIdentityEntries_completion(
&self,
new_credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
);
}
);
extern_methods!(
unsafe impl ASCredentialIdentityStore {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);