objc2_accounts/generated/
ACAccountStore.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountcredentialrenewresult?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct ACAccountCredentialRenewResult(pub NSInteger);
15impl ACAccountCredentialRenewResult {
16    #[doc(alias = "ACAccountCredentialRenewResultRenewed")]
17    pub const Renewed: Self = Self(0);
18    #[doc(alias = "ACAccountCredentialRenewResultRejected")]
19    pub const Rejected: Self = Self(1);
20    #[doc(alias = "ACAccountCredentialRenewResultFailed")]
21    pub const Failed: Self = Self(2);
22}
23
24unsafe impl Encode for ACAccountCredentialRenewResult {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for ACAccountCredentialRenewResult {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountstoresavecompletionhandler?language=objc)
33#[cfg(feature = "block2")]
34pub type ACAccountStoreSaveCompletionHandler = *mut block2::DynBlock<dyn Fn(Bool, *mut NSError)>;
35
36/// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountstoreremovecompletionhandler?language=objc)
37#[cfg(feature = "block2")]
38pub type ACAccountStoreRemoveCompletionHandler = *mut block2::DynBlock<dyn Fn(Bool, *mut NSError)>;
39
40/// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountstorerequestaccesscompletionhandler?language=objc)
41#[cfg(feature = "block2")]
42pub type ACAccountStoreRequestAccessCompletionHandler =
43    *mut block2::DynBlock<dyn Fn(Bool, *mut NSError)>;
44
45/// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountstorecredentialrenewalhandler?language=objc)
46#[cfg(feature = "block2")]
47pub type ACAccountStoreCredentialRenewalHandler =
48    *mut block2::DynBlock<dyn Fn(ACAccountCredentialRenewResult, *mut NSError)>;
49
50extern_class!(
51    /// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountstore?language=objc)
52    #[unsafe(super(NSObject))]
53    #[derive(Debug, PartialEq, Eq, Hash)]
54    #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
55    pub struct ACAccountStore;
56);
57
58extern_conformance!(
59    unsafe impl NSObjectProtocol for ACAccountStore {}
60);
61
62impl ACAccountStore {
63    extern_methods!(
64        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
65        #[unsafe(method(accounts))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn accounts(&self) -> Option<Retained<NSArray>>;
68
69        #[cfg(feature = "ACAccount")]
70        /// # Safety
71        ///
72        /// `identifier` might not allow `None`.
73        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
74        #[unsafe(method(accountWithIdentifier:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn accountWithIdentifier(
77            &self,
78            identifier: Option<&NSString>,
79        ) -> Option<Retained<ACAccount>>;
80
81        #[cfg(feature = "ACAccountType")]
82        /// # Safety
83        ///
84        /// `type_identifier` might not allow `None`.
85        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
86        #[unsafe(method(accountTypeWithAccountTypeIdentifier:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn accountTypeWithAccountTypeIdentifier(
89            &self,
90            type_identifier: Option<&NSString>,
91        ) -> Option<Retained<ACAccountType>>;
92
93        #[cfg(feature = "ACAccountType")]
94        /// # Safety
95        ///
96        /// `account_type` might not allow `None`.
97        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
98        #[unsafe(method(accountsWithAccountType:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn accountsWithAccountType(
101            &self,
102            account_type: Option<&ACAccountType>,
103        ) -> Option<Retained<NSArray>>;
104
105        #[cfg(all(feature = "ACAccount", feature = "block2"))]
106        /// # Safety
107        ///
108        /// - `account` might not allow `None`.
109        /// - `completion_handler` must be a valid pointer.
110        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
111        #[unsafe(method(saveAccount:withCompletionHandler:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn saveAccount_withCompletionHandler(
114            &self,
115            account: Option<&ACAccount>,
116            completion_handler: ACAccountStoreSaveCompletionHandler,
117        );
118
119        #[cfg(all(feature = "ACAccountType", feature = "block2"))]
120        /// # Safety
121        ///
122        /// - `account_type` might not allow `None`.
123        /// - `handler` must be a valid pointer.
124        #[deprecated]
125        #[unsafe(method(requestAccessToAccountsWithType:withCompletionHandler:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn requestAccessToAccountsWithType_withCompletionHandler(
128            &self,
129            account_type: Option<&ACAccountType>,
130            handler: ACAccountStoreRequestAccessCompletionHandler,
131        );
132
133        #[cfg(all(feature = "ACAccountType", feature = "block2"))]
134        /// # Safety
135        ///
136        /// - `account_type` might not allow `None`.
137        /// - `options` generic should be of the correct type.
138        /// - `options` might not allow `None`.
139        /// - `completion` must be a valid pointer.
140        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
141        #[unsafe(method(requestAccessToAccountsWithType:options:completion:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn requestAccessToAccountsWithType_options_completion(
144            &self,
145            account_type: Option<&ACAccountType>,
146            options: Option<&NSDictionary>,
147            completion: ACAccountStoreRequestAccessCompletionHandler,
148        );
149
150        #[cfg(all(feature = "ACAccount", feature = "block2"))]
151        /// # Safety
152        ///
153        /// - `account` might not allow `None`.
154        /// - `completion_handler` must be a valid pointer.
155        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
156        #[unsafe(method(renewCredentialsForAccount:completion:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn renewCredentialsForAccount_completion(
159            &self,
160            account: Option<&ACAccount>,
161            completion_handler: ACAccountStoreCredentialRenewalHandler,
162        );
163
164        #[cfg(all(feature = "ACAccount", feature = "block2"))]
165        /// # Safety
166        ///
167        /// - `account` might not allow `None`.
168        /// - `completion_handler` must be a valid pointer.
169        #[deprecated = "Use appropriate non-Apple SDK corresponding to the type of account you want to reference instead"]
170        #[unsafe(method(removeAccount:withCompletionHandler:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn removeAccount_withCompletionHandler(
173            &self,
174            account: Option<&ACAccount>,
175            completion_handler: ACAccountStoreRemoveCompletionHandler,
176        );
177    );
178}
179
180/// Methods declared on superclass `NSObject`.
181impl ACAccountStore {
182    extern_methods!(
183        #[unsafe(method(init))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186
187        #[unsafe(method(new))]
188        #[unsafe(method_family = new)]
189        pub unsafe fn new() -> Retained<Self>;
190    );
191}
192
193extern "C" {
194    /// [Apple's documentation](https://developer.apple.com/documentation/accounts/acaccountstoredidchangenotification?language=objc)
195    #[deprecated = "Public notification deprecated. Internal clients, see private header for replacement"]
196    pub static ACAccountStoreDidChangeNotification: Option<&'static NSString>;
197}