objc2_open_directory/generated/ODSession.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#[cfg(feature = "objc2-security-foundation")]
7use objc2_security_foundation::*;
8
9use crate::*;
10
11extern "C" {
12 /// the address to connect to via proxy, used when making the options dictionary
13 ///
14 /// the address to connect to via proxy, used when making the options dictionary
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxyaddress?language=objc)
17 pub static ODSessionProxyAddress: Option<&'static NSString>;
18}
19
20extern "C" {
21 /// the port to connect to via proxy, used when making the options dictionary
22 ///
23 /// the port to connect to via proxy, used when making the options dictionary. This parameter
24 /// is optional and should not be passed normally.
25 ///
26 /// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxyport?language=objc)
27 pub static ODSessionProxyPort: Option<&'static NSString>;
28}
29
30extern "C" {
31 /// the username to connect with via proxy, used when making the options dictionary
32 ///
33 /// the username to connect with via proxy, used when making the options dictionary
34 ///
35 /// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxyusername?language=objc)
36 pub static ODSessionProxyUsername: Option<&'static NSString>;
37}
38
39extern "C" {
40 /// the password to connect with via proxy, used when making the options dictionary
41 ///
42 /// the password to connect with via proxy, used when making the options dictionary
43 ///
44 /// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxypassword?language=objc)
45 pub static ODSessionProxyPassword: Option<&'static NSString>;
46}
47
48extern_class!(
49 /// Class for working with OpenDirectory sessions.
50 ///
51 /// Class for working with OpenDirectory sessions.
52 ///
53 /// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsession?language=objc)
54 #[unsafe(super(NSObject))]
55 #[derive(Debug, PartialEq, Eq, Hash)]
56 pub struct ODSession;
57);
58
59extern_conformance!(
60 unsafe impl NSObjectProtocol for ODSession {}
61);
62
63impl ODSession {
64 extern_methods!(
65 /// Returns a shared instance of a local ODSession
66 ///
67 /// Returns a shared instance of a local ODSession. This can be used for most situations unless
68 /// more control is needed over the session.
69 #[unsafe(method(defaultSession))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn defaultSession() -> Option<Retained<ODSession>>;
72
73 /// Creates an autoreleased instance of ODSession directed over Proxy to another host
74 ///
75 /// Creates an autoreleased instance of ODSession directed over Proxy to another host. nil
76 /// can be passed for no options. outError is optional parameter, nil can be passed if error
77 /// details are not needed. Options include:
78 ///
79 /// If proxy is required then a dictionary with keys should be:
80 /// Key Value
81 /// ODSessionProxyAddress NSString(hostname or IP)
82 /// ODSessionProxyPort NSNumber(IP port, should not be set as it will default)
83 /// ODSessionProxyUsername NSString(username)
84 /// ODSessionProxyPassword NSString(password)
85 ///
86 /// # Safety
87 ///
88 /// - `in_options` generic should be of the correct type.
89 /// - `in_options` might not allow `None`.
90 /// - `out_error` might not allow `None`.
91 #[unsafe(method(sessionWithOptions:error:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn sessionWithOptions_error(
94 in_options: Option<&NSDictionary>,
95 out_error: Option<&mut Option<Retained<NSError>>>,
96 ) -> Option<Retained<Self>>;
97
98 /// Creates an instance of ODSession directed over Proxy to another host
99 ///
100 /// Creates an instance of ODSession directed over Proxy to another host. nil can be
101 /// passed for no options. outError is optional parameter, nil can be passed if error
102 /// details are not needed. Options include:
103 ///
104 /// If proxy is required then a dictionary with keys should be:
105 /// Key Value
106 /// ODSessionProxyAddress NSString(hostname or IP)
107 /// ODSessionProxyPort NSNumber(IP port, should not be set as it will default)
108 /// ODSessionProxyUsername NSString(username)
109 /// ODSessionProxyPassword NSString(password)
110 ///
111 /// # Safety
112 ///
113 /// - `in_options` generic should be of the correct type.
114 /// - `in_options` might not allow `None`.
115 /// - `out_error` might not allow `None`.
116 #[unsafe(method(initWithOptions:error:))]
117 #[unsafe(method_family = init)]
118 pub unsafe fn initWithOptions_error(
119 this: Allocated<Self>,
120 in_options: Option<&NSDictionary>,
121 out_error: Option<&mut Option<Retained<NSError>>>,
122 ) -> Option<Retained<Self>>;
123
124 /// Returns the node names that are registered on this ODSession
125 ///
126 /// Returns the node names that are registered on this ODSession. outError can be nil if
127 /// error details are not needed.
128 ///
129 /// # Safety
130 ///
131 /// `out_error` might not allow `None`.
132 #[unsafe(method(nodeNamesAndReturnError:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn nodeNamesAndReturnError(
135 &self,
136 out_error: Option<&mut Option<Retained<NSError>>>,
137 ) -> Option<Retained<NSArray>>;
138
139 /// Returns a list of names as NSStrings for all available configuration templates.
140 ///
141 ///
142 /// Returns a list of names as NSStrings for all available configuration templates. Configuration templates
143 /// have pre-configured modules and/or mappings. Useful for re-using existing configurations
144 /// that may change with operating system without changing the actual configuration.
145 #[unsafe(method(configurationTemplateNames))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn configurationTemplateNames(&self) -> Retained<NSArray>;
148
149 /// Returns a list names as NSStrings for all available mapping templates.
150 ///
151 ///
152 /// Returns a list names as NSStrings for all available mapping templates. Mapping templates have pre-configured
153 /// record/attribute mappings. Useful if a configuration uses a common layout of mappings for a type of server.
154 #[unsafe(method(mappingTemplateNames))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn mappingTemplateNames(&self) -> Retained<NSArray>;
157
158 #[cfg(feature = "objc2-security-foundation")]
159 /// Returns an authorization appropriate for managing configurations.
160 ///
161 ///
162 /// Returns an authorization appropriate for managing configurations. If a proxy session is in use this method will return
163 /// nil and no error.
164 ///
165 /// # Safety
166 ///
167 /// `error` might not allow `None`.
168 #[unsafe(method(configurationAuthorizationAllowingUserInteraction:error:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn configurationAuthorizationAllowingUserInteraction_error(
171 &self,
172 allow_interaction: bool,
173 error: Option<&mut Option<Retained<NSError>>>,
174 ) -> Option<Retained<SFAuthorization>>;
175
176 #[cfg(feature = "ODConfiguration")]
177 /// Reads the configuration for a given nodename.
178 ///
179 ///
180 /// Reads the configuration for a given nodename.
181 ///
182 /// # Safety
183 ///
184 /// `nodename` might not allow `None`.
185 #[unsafe(method(configurationForNodename:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn configurationForNodename(
188 &self,
189 nodename: Option<&NSString>,
190 ) -> Option<Retained<ODConfiguration>>;
191
192 #[cfg(all(feature = "ODConfiguration", feature = "objc2-security-foundation"))]
193 /// Adds a new configuration to the existing ODSession.
194 ///
195 ///
196 /// Adds a new configuration to the existing ODSession. An SFAuthorization can be provided if necessary.
197 ///
198 /// # Safety
199 ///
200 /// - `configuration` might not allow `None`.
201 /// - `authorization` might not allow `None`.
202 /// - `error` might not allow `None`.
203 #[unsafe(method(addConfiguration:authorization:error:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn addConfiguration_authorization_error(
206 &self,
207 configuration: Option<&ODConfiguration>,
208 authorization: Option<&SFAuthorization>,
209 error: Option<&mut Option<Retained<NSError>>>,
210 ) -> bool;
211
212 #[cfg(all(feature = "ODConfiguration", feature = "objc2-security-foundation"))]
213 /// Deletes an existing configuration from the ODSession.
214 ///
215 ///
216 /// Deletes an existing configuration from the ODSession. An authorization can be provided if necessary.
217 ///
218 /// # Safety
219 ///
220 /// - `configuration` might not allow `None`.
221 /// - `authorization` might not allow `None`.
222 /// - `error` might not allow `None`.
223 #[unsafe(method(deleteConfiguration:authorization:error:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn deleteConfiguration_authorization_error(
226 &self,
227 configuration: Option<&ODConfiguration>,
228 authorization: Option<&SFAuthorization>,
229 error: Option<&mut Option<Retained<NSError>>>,
230 ) -> bool;
231
232 #[cfg(feature = "objc2-security-foundation")]
233 /// Deletes an existing configuration from the ODSession.
234 ///
235 ///
236 /// Deletes an existing configuration from the ODSession. An authorization can be provided if necessary.
237 ///
238 /// # Safety
239 ///
240 /// - `nodename` might not allow `None`.
241 /// - `authorization` might not allow `None`.
242 /// - `error` might not allow `None`.
243 #[unsafe(method(deleteConfigurationWithNodename:authorization:error:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn deleteConfigurationWithNodename_authorization_error(
246 &self,
247 nodename: Option<&NSString>,
248 authorization: Option<&SFAuthorization>,
249 error: Option<&mut Option<Retained<NSError>>>,
250 ) -> bool;
251 );
252}
253
254/// Methods declared on superclass `NSObject`.
255impl ODSession {
256 extern_methods!(
257 #[unsafe(method(init))]
258 #[unsafe(method_family = init)]
259 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
260
261 #[unsafe(method(new))]
262 #[unsafe(method_family = new)]
263 pub unsafe fn new() -> Retained<Self>;
264 );
265}