objc2_authentication_services/generated/
ASAuthorizationAppleIDCredential.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asuserdetectionstatus?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct ASUserDetectionStatus(pub NSInteger);
14impl ASUserDetectionStatus {
15    #[doc(alias = "ASUserDetectionStatusUnsupported")]
16    pub const Unsupported: Self = Self(0);
17    #[doc(alias = "ASUserDetectionStatusUnknown")]
18    pub const Unknown: Self = Self(1);
19    #[doc(alias = "ASUserDetectionStatusLikelyReal")]
20    pub const LikelyReal: Self = Self(2);
21}
22
23unsafe impl Encode for ASUserDetectionStatus {
24    const ENCODING: Encoding = NSInteger::ENCODING;
25}
26
27unsafe impl RefEncode for ASUserDetectionStatus {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asuseragerange?language=objc)
32// NS_ENUM
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct ASUserAgeRange(pub NSInteger);
36impl ASUserAgeRange {
37    #[doc(alias = "ASUserAgeRangeUnknown")]
38    pub const Unknown: Self = Self(0);
39    #[doc(alias = "ASUserAgeRangeChild")]
40    pub const Child: Self = Self(1);
41    #[doc(alias = "ASUserAgeRangeNotChild")]
42    pub const NotChild: Self = Self(2);
43}
44
45unsafe impl Encode for ASUserAgeRange {
46    const ENCODING: Encoding = NSInteger::ENCODING;
47}
48
49unsafe impl RefEncode for ASUserAgeRange {
50    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
51}
52
53extern_class!(
54    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential?language=objc)
55    #[unsafe(super(NSObject))]
56    #[derive(Debug, PartialEq, Eq, Hash)]
57    pub struct ASAuthorizationAppleIDCredential;
58);
59
60#[cfg(feature = "ASAuthorizationCredential")]
61extern_conformance!(
62    unsafe impl ASAuthorizationCredential for ASAuthorizationAppleIDCredential {}
63);
64
65extern_conformance!(
66    unsafe impl NSCoding for ASAuthorizationAppleIDCredential {}
67);
68
69extern_conformance!(
70    unsafe impl NSCopying for ASAuthorizationAppleIDCredential {}
71);
72
73unsafe impl CopyingHelper for ASAuthorizationAppleIDCredential {
74    type Result = Self;
75}
76
77extern_conformance!(
78    unsafe impl NSObjectProtocol for ASAuthorizationAppleIDCredential {}
79);
80
81extern_conformance!(
82    unsafe impl NSSecureCoding for ASAuthorizationAppleIDCredential {}
83);
84
85impl ASAuthorizationAppleIDCredential {
86    extern_methods!(
87        /// An opaque user ID associated with the AppleID used for the sign in. This identifier will be stable across the 'developer team', it can later be used as an input to
88        ///
89        /// See: ASAuthorizationRequest to request user contact information.
90        ///
91        /// The identifier will remain stable as long as the user is connected with the requesting client.  The value may change upon user disconnecting from the identity provider.
92        #[unsafe(method(user))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn user(&self) -> Retained<NSString>;
95
96        /// A copy of the state value that was passed to ASAuthorizationRequest.
97        #[unsafe(method(state))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn state(&self) -> Option<Retained<NSString>>;
100
101        #[cfg(feature = "ASAuthorization")]
102        /// This value will contain a list of scopes for which the user provided authorization.  These may contain a subset of the requested scopes on
103        ///
104        /// See: ASAuthorizationAppleIDRequest.  The application should query this value to identify which scopes were returned as it maybe different from ones requested.
105        #[unsafe(method(authorizedScopes))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn authorizedScopes(&self) -> Retained<NSArray<ASAuthorizationScope>>;
108
109        /// A short-lived, one-time valid token that provides proof of authorization to the server component of the app. The authorization code is bound to the specific transaction using the state attribute passed in the authorization request. The server component of the app can validate the code using Apple’s identity service endpoint provided for this purpose.
110        #[unsafe(method(authorizationCode))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn authorizationCode(&self) -> Option<Retained<NSData>>;
113
114        /// A JSON Web Token (JWT) used to communicate information about the identity of the user in a secure way to the app. The ID token will contain the following information: Issuer Identifier, Subject Identifier, Audience, Expiry Time and Issuance Time signed by Apple's identity service.
115        #[unsafe(method(identityToken))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn identityToken(&self) -> Option<Retained<NSData>>;
118
119        /// An optional email shared by the user.  This field is populated with a value that the user authorized.
120        #[unsafe(method(email))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn email(&self) -> Option<Retained<NSString>>;
123
124        /// An optional full name shared by the user.  This field is populated with a value that the user authorized.
125        #[unsafe(method(fullName))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn fullName(&self) -> Option<Retained<NSPersonNameComponents>>;
128
129        /// Check this property for a hint as to whether the current user is a "real user".
130        ///
131        /// See: ASUserDetectionStatus for guidelines on handling each status
132        #[unsafe(method(realUserStatus))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn realUserStatus(&self) -> ASUserDetectionStatus;
135
136        /// Check this property to determine whether the current user is a child.
137        ///
138        /// See: ASUserAgeRange for guidelines on handling each status.
139        #[unsafe(method(userAgeRange))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn userAgeRange(&self) -> ASUserAgeRange;
142
143        #[unsafe(method(new))]
144        #[unsafe(method_family = new)]
145        pub unsafe fn new() -> Retained<Self>;
146
147        #[unsafe(method(init))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
150    );
151}