objc2_authentication_services/generated/
ASAuthorizationAppleIDProvider.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/// Authorization state of an Apple ID credential.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidprovidercredentialstate?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct ASAuthorizationAppleIDProviderCredentialState(pub NSInteger);
17impl ASAuthorizationAppleIDProviderCredentialState {
18    #[doc(alias = "ASAuthorizationAppleIDProviderCredentialRevoked")]
19    pub const Revoked: Self = Self(0);
20    #[doc(alias = "ASAuthorizationAppleIDProviderCredentialAuthorized")]
21    pub const Authorized: Self = Self(1);
22    #[doc(alias = "ASAuthorizationAppleIDProviderCredentialNotFound")]
23    pub const NotFound: Self = Self(2);
24    #[doc(alias = "ASAuthorizationAppleIDProviderCredentialTransferred")]
25    pub const Transferred: Self = Self(3);
26}
27
28unsafe impl Encode for ASAuthorizationAppleIDProviderCredentialState {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for ASAuthorizationAppleIDProviderCredentialState {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidprovidercredentialrevokednotification?language=objc)
38    pub static ASAuthorizationAppleIDProviderCredentialRevokedNotification:
39        &'static NSNotificationName;
40}
41
42extern_class!(
43    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidprovider?language=objc)
44    #[unsafe(super(NSObject))]
45    #[derive(Debug, PartialEq, Eq, Hash)]
46    pub struct ASAuthorizationAppleIDProvider;
47);
48
49#[cfg(feature = "ASAuthorizationProvider")]
50extern_conformance!(
51    unsafe impl ASAuthorizationProvider for ASAuthorizationAppleIDProvider {}
52);
53
54extern_conformance!(
55    unsafe impl NSObjectProtocol for ASAuthorizationAppleIDProvider {}
56);
57
58impl ASAuthorizationAppleIDProvider {
59    extern_methods!(
60        #[cfg(all(
61            feature = "ASAuthorizationAppleIDRequest",
62            feature = "ASAuthorizationOpenIDRequest",
63            feature = "ASAuthorizationRequest"
64        ))]
65        /// This method initializes and returns an instance of
66        ///
67        /// See: ASAuthorizationAppleIDRequest to be serviced by
68        ///
69        /// See: ASAuthorizationController.
70        #[unsafe(method(createRequest))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn createRequest(&self) -> Retained<ASAuthorizationAppleIDRequest>;
73
74        #[cfg(feature = "block2")]
75        /// This method can be used to get the current state of an opaque user ID previously given.
76        ///
77        /// Parameter `userID`: Opaque user identifier that will be checked for state.
78        ///
79        /// Parameter `completion`: A completion block that will return one of 3 possible states
80        ///
81        /// See: ASAuthorizationAppleIDProviderCredentialState.
82        ///
83        ///
84        /// Note: If credentialState is
85        ///
86        /// See: ASAuthorizationAppleIDProviderCredentialNotFound, an error will also be passed in the completion block.
87        #[unsafe(method(getCredentialStateForUserID:completion:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn getCredentialStateForUserID_completion(
90            &self,
91            user_id: &NSString,
92            completion: &block2::DynBlock<
93                dyn Fn(ASAuthorizationAppleIDProviderCredentialState, *mut NSError),
94            >,
95        );
96    );
97}
98
99/// Methods declared on superclass `NSObject`.
100impl ASAuthorizationAppleIDProvider {
101    extern_methods!(
102        #[unsafe(method(init))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
105
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub unsafe fn new() -> Retained<Self>;
109    );
110}