use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ACAccountCredentialRenewResult(pub NSInteger);
impl ACAccountCredentialRenewResult {
#[doc(alias = "ACAccountCredentialRenewResultRenewed")]
pub const Renewed: Self = Self(0);
#[doc(alias = "ACAccountCredentialRenewResultRejected")]
pub const Rejected: Self = Self(1);
#[doc(alias = "ACAccountCredentialRenewResultFailed")]
pub const Failed: Self = Self(2);
}
unsafe impl Encode for ACAccountCredentialRenewResult {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for ACAccountCredentialRenewResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type ACAccountStoreSaveCompletionHandler = *mut block2::DynBlock<dyn Fn(Bool, *mut NSError)>;
#[cfg(feature = "block2")]
pub type ACAccountStoreRemoveCompletionHandler = *mut block2::DynBlock<dyn Fn(Bool, *mut NSError)>;
#[cfg(feature = "block2")]
pub type ACAccountStoreRequestAccessCompletionHandler =
*mut block2::DynBlock<dyn Fn(Bool, *mut NSError)>;
#[cfg(feature = "block2")]
pub type ACAccountStoreCredentialRenewalHandler =
*mut block2::DynBlock<dyn Fn(ACAccountCredentialRenewResult, *mut NSError)>;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
pub struct ACAccountStore;
);
extern_conformance!(
unsafe impl NSObjectProtocol for ACAccountStore {}
);
impl ACAccountStore {
extern_methods!(
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(accounts))]
#[unsafe(method_family = none)]
pub unsafe fn accounts(&self) -> Option<Retained<NSArray>>;
#[cfg(feature = "ACAccount")]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(accountWithIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn accountWithIdentifier(
&self,
identifier: Option<&NSString>,
) -> Option<Retained<ACAccount>>;
#[cfg(feature = "ACAccountType")]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(accountTypeWithAccountTypeIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn accountTypeWithAccountTypeIdentifier(
&self,
type_identifier: Option<&NSString>,
) -> Option<Retained<ACAccountType>>;
#[cfg(feature = "ACAccountType")]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(accountsWithAccountType:))]
#[unsafe(method_family = none)]
pub unsafe fn accountsWithAccountType(
&self,
account_type: Option<&ACAccountType>,
) -> Option<Retained<NSArray>>;
#[cfg(all(feature = "ACAccount", feature = "block2"))]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(saveAccount:withCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn saveAccount_withCompletionHandler(
&self,
account: Option<&ACAccount>,
completion_handler: ACAccountStoreSaveCompletionHandler,
);
#[cfg(all(feature = "ACAccountType", feature = "block2"))]
#[deprecated]
#[unsafe(method(requestAccessToAccountsWithType:withCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn requestAccessToAccountsWithType_withCompletionHandler(
&self,
account_type: Option<&ACAccountType>,
handler: ACAccountStoreRequestAccessCompletionHandler,
);
#[cfg(all(feature = "ACAccountType", feature = "block2"))]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(requestAccessToAccountsWithType:options:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn requestAccessToAccountsWithType_options_completion(
&self,
account_type: Option<&ACAccountType>,
options: Option<&NSDictionary>,
completion: ACAccountStoreRequestAccessCompletionHandler,
);
#[cfg(all(feature = "ACAccount", feature = "block2"))]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(renewCredentialsForAccount:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn renewCredentialsForAccount_completion(
&self,
account: Option<&ACAccount>,
completion_handler: ACAccountStoreCredentialRenewalHandler,
);
#[cfg(all(feature = "ACAccount", feature = "block2"))]
#[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
#[unsafe(method(removeAccount:withCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn removeAccount_withCompletionHandler(
&self,
account: Option<&ACAccount>,
completion_handler: ACAccountStoreRemoveCompletionHandler,
);
);
}
impl ACAccountStore {
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>;
);
}
extern "C" {
#[deprecated = "Public notification deprecated. Internal clients, see private header for replacement"]
pub static ACAccountStoreDidChangeNotification: Option<&'static NSString>;
}