objc2_authentication_services/generated/
ASAuthorizationProviderExtensionAuthorizationRequest.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/authenticationservices/asauthorizationproviderauthorizationoperation?language=objc)
11// NS_TYPED_EXTENSIBLE_ENUM
12pub type ASAuthorizationProviderAuthorizationOperation = NSString;
13
14extern "C" {
15    /// Operation which is invoked when the extension configuration is removed from the system.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationproviderauthorizationoperationconfigurationremoved?language=objc)
18    pub static ASAuthorizationProviderAuthorizationOperationConfigurationRemoved:
19        &'static ASAuthorizationProviderAuthorizationOperation;
20}
21
22extern "C" {
23    /// Operation which is invoked when a request is sent direct to the extension instead of loaded in an ASWebAuthenticationSession.
24    ///
25    /// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationproviderauthorizationoperationdirectrequest?language=objc)
26    pub static ASAuthorizationProviderAuthorizationOperationDirectRequest:
27        &'static ASAuthorizationProviderAuthorizationOperation;
28}
29
30extern_protocol!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationproviderextensionauthorizationrequesthandler?language=objc)
32    pub unsafe trait ASAuthorizationProviderExtensionAuthorizationRequestHandler:
33        NSObjectProtocol + MainThreadOnly
34    {
35        /// Called to begin the authorization. It’s called on the main thread.
36        #[unsafe(method(beginAuthorizationWithRequest:))]
37        #[unsafe(method_family = none)]
38        unsafe fn beginAuthorizationWithRequest(
39            &self,
40            request: &ASAuthorizationProviderExtensionAuthorizationRequest,
41        );
42
43        /// Called when the authorization was canceled by authorization service. It’s called on the main thread.
44        #[optional]
45        #[unsafe(method(cancelAuthorizationWithRequest:))]
46        #[unsafe(method_family = none)]
47        unsafe fn cancelAuthorizationWithRequest(
48            &self,
49            request: &ASAuthorizationProviderExtensionAuthorizationRequest,
50        );
51    }
52);
53
54extern_class!(
55    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationproviderextensionauthorizationrequest?language=objc)
56    #[unsafe(super(NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    pub struct ASAuthorizationProviderExtensionAuthorizationRequest;
59);
60
61extern_conformance!(
62    unsafe impl NSObjectProtocol for ASAuthorizationProviderExtensionAuthorizationRequest {}
63);
64
65impl ASAuthorizationProviderExtensionAuthorizationRequest {
66    extern_methods!(
67        /// Call when authorization was not handled.
68        #[unsafe(method(doNotHandle))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn doNotHandle(&self);
71
72        /// Call when authorization needs to be canceled from some reason (for example user pressed Cancel button).
73        #[unsafe(method(cancel))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn cancel(&self);
76
77        /// Call when authorization succeeded without any output.
78        #[unsafe(method(complete))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn complete(&self);
81
82        /// Call when authorization succeeded with an authorization tokens stored in HTTP headers.
83        #[unsafe(method(completeWithHTTPAuthorizationHeaders:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn completeWithHTTPAuthorizationHeaders(
86            &self,
87            http_authorization_headers: &NSDictionary<NSString, NSString>,
88        );
89
90        /// Call when authorization succeeded with a HTTP response.
91        #[unsafe(method(completeWithHTTPResponse:httpBody:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn completeWithHTTPResponse_httpBody(
94            &self,
95            http_response: &NSHTTPURLResponse,
96            http_body: Option<&NSData>,
97        );
98
99        #[cfg(feature = "ASAuthorizationProviderExtensionAuthorizationResult")]
100        /// Call when authorization succeeded with
101        ///
102        /// See: ASAuthorizationProviderExtensionAuthorizationResult.
103        #[unsafe(method(completeWithAuthorizationResult:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn completeWithAuthorizationResult(
106            &self,
107            authorization_result: &ASAuthorizationProviderExtensionAuthorizationResult,
108        );
109
110        /// Call when authorization failed with an error.
111        #[unsafe(method(completeWithError:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn completeWithError(&self, error: &NSError);
114
115        #[cfg(feature = "block2")]
116        /// Asks authorization service to show extension view controller. If the controller cannot be shown an error is returned.
117        #[unsafe(method(presentAuthorizationViewControllerWithCompletion:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn presentAuthorizationViewControllerWithCompletion(
120            &self,
121            completion: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
122        );
123
124        /// Request URL with all components.
125        #[unsafe(method(url))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn url(&self) -> Retained<NSURL>;
128
129        /// Operation to be executed by the extension.
130        #[unsafe(method(requestedOperation))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn requestedOperation(
133            &self,
134        ) -> Retained<ASAuthorizationProviderAuthorizationOperation>;
135
136        /// Request HTTP headers.
137        #[unsafe(method(httpHeaders))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn httpHeaders(&self) -> Retained<NSDictionary<NSString, NSString>>;
140
141        /// Request body.
142        #[unsafe(method(httpBody))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn httpBody(&self) -> Retained<NSData>;
145
146        /// Realm.
147        #[unsafe(method(realm))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn realm(&self) -> Retained<NSString>;
150
151        /// Extension data from extension configuration provided by MDM stored as a property-list.
152        #[unsafe(method(extensionData))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn extensionData(&self) -> Retained<NSDictionary>;
155
156        /// Identification of the calling application.
157        #[unsafe(method(callerBundleIdentifier))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn callerBundleIdentifier(&self) -> Retained<NSString>;
160
161        /// Authorization options.
162        #[unsafe(method(authorizationOptions))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn authorizationOptions(&self) -> Retained<NSDictionary>;
165
166        /// Indicates whether the calling application is managed.
167        #[unsafe(method(isCallerManaged))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn isCallerManaged(&self) -> bool;
170
171        /// Team identifier of the calling application.
172        #[unsafe(method(callerTeamIdentifier))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn callerTeamIdentifier(&self) -> Retained<NSString>;
175
176        /// Localized display name of the calling application.
177        #[unsafe(method(localizedCallerDisplayName))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn localizedCallerDisplayName(&self) -> Retained<NSString>;
180
181        /// Audit token of the calling application.
182        #[unsafe(method(callerAuditToken))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn callerAuditToken(&self) -> Retained<NSData>;
185
186        /// Indicates whether the authorization user interface is enabled.
187        ///
188        /// If user interface is not enabled, then the authorization will fail with
189        ///
190        /// See: ASAuthorizationErrorNotInteractive if it attempts to display the authorization user interface via
191        ///
192        /// See: presentAuthorizationViewControllerWithCompletion.
193        #[unsafe(method(isUserInterfaceEnabled))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn isUserInterfaceEnabled(&self) -> bool;
196
197        #[cfg(feature = "ASAuthorizationProviderExtensionLoginManager")]
198        /// The login manager to interface with the Platform SSO configuration.
199        #[unsafe(method(loginManager))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn loginManager(
202            &self,
203        ) -> Option<Retained<ASAuthorizationProviderExtensionLoginManager>>;
204    );
205}
206
207/// Methods declared on superclass `NSObject`.
208impl ASAuthorizationProviderExtensionAuthorizationRequest {
209    extern_methods!(
210        #[unsafe(method(init))]
211        #[unsafe(method_family = init)]
212        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
213
214        #[unsafe(method(new))]
215        #[unsafe(method_family = new)]
216        pub unsafe fn new() -> Retained<Self>;
217    );
218}