1use reqwest;
12use serde::{Deserialize, Serialize};
13
14use super::{configuration, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum OrganizationsDomainSsoDetailsPostError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum OrganizationsOrgIdDomainGetError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum OrganizationsOrgIdDomainIdDeleteError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum OrganizationsOrgIdDomainIdGetError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum OrganizationsOrgIdDomainIdRemovePostError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum OrganizationsOrgIdDomainIdVerifyPostError {
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum OrganizationsOrgIdDomainPostError {
63 UnknownValue(serde_json::Value),
64}
65
66pub async fn organizations_domain_sso_details_post(
67 configuration: &configuration::Configuration,
68 organization_domain_sso_details_request_model: Option<
69 models::OrganizationDomainSsoDetailsRequestModel,
70 >,
71) -> Result<
72 models::OrganizationDomainSsoDetailsResponseModel,
73 Error<OrganizationsDomainSsoDetailsPostError>,
74> {
75 let local_var_configuration = configuration;
76
77 let local_var_client = &local_var_configuration.client;
78
79 let local_var_uri_str = format!(
80 "{}/organizations/domain/sso/details",
81 local_var_configuration.base_path
82 );
83 let mut local_var_req_builder =
84 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
85
86 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
87 local_var_req_builder =
88 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
89 }
90 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
91 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
92 };
93 local_var_req_builder =
94 local_var_req_builder.json(&organization_domain_sso_details_request_model);
95
96 let local_var_req = local_var_req_builder.build()?;
97 let local_var_resp = local_var_client.execute(local_var_req).await?;
98
99 let local_var_status = local_var_resp.status();
100 let local_var_content = local_var_resp.text().await?;
101
102 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
103 serde_json::from_str(&local_var_content).map_err(Error::from)
104 } else {
105 let local_var_entity: Option<OrganizationsDomainSsoDetailsPostError> =
106 serde_json::from_str(&local_var_content).ok();
107 let local_var_error = ResponseContent {
108 status: local_var_status,
109 content: local_var_content,
110 entity: local_var_entity,
111 };
112 Err(Error::ResponseError(local_var_error))
113 }
114}
115
116pub async fn organizations_org_id_domain_get(
117 configuration: &configuration::Configuration,
118 org_id: uuid::Uuid,
119) -> Result<
120 models::OrganizationDomainResponseModelListResponseModel,
121 Error<OrganizationsOrgIdDomainGetError>,
122> {
123 let local_var_configuration = configuration;
124
125 let local_var_client = &local_var_configuration.client;
126
127 let local_var_uri_str = format!(
128 "{}/organizations/{orgId}/domain",
129 local_var_configuration.base_path,
130 orgId = crate::apis::urlencode(org_id.to_string())
131 );
132 let mut local_var_req_builder =
133 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
134
135 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
136 local_var_req_builder =
137 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
138 }
139 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
140 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
141 };
142
143 let local_var_req = local_var_req_builder.build()?;
144 let local_var_resp = local_var_client.execute(local_var_req).await?;
145
146 let local_var_status = local_var_resp.status();
147 let local_var_content = local_var_resp.text().await?;
148
149 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
150 serde_json::from_str(&local_var_content).map_err(Error::from)
151 } else {
152 let local_var_entity: Option<OrganizationsOrgIdDomainGetError> =
153 serde_json::from_str(&local_var_content).ok();
154 let local_var_error = ResponseContent {
155 status: local_var_status,
156 content: local_var_content,
157 entity: local_var_entity,
158 };
159 Err(Error::ResponseError(local_var_error))
160 }
161}
162
163pub async fn organizations_org_id_domain_id_delete(
164 configuration: &configuration::Configuration,
165 org_id: uuid::Uuid,
166 id: uuid::Uuid,
167) -> Result<(), Error<OrganizationsOrgIdDomainIdDeleteError>> {
168 let local_var_configuration = configuration;
169
170 let local_var_client = &local_var_configuration.client;
171
172 let local_var_uri_str = format!(
173 "{}/organizations/{orgId}/domain/{id}",
174 local_var_configuration.base_path,
175 orgId = crate::apis::urlencode(org_id.to_string()),
176 id = crate::apis::urlencode(id.to_string())
177 );
178 let mut local_var_req_builder =
179 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
180
181 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
182 local_var_req_builder =
183 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184 }
185 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
186 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
187 };
188
189 let local_var_req = local_var_req_builder.build()?;
190 let local_var_resp = local_var_client.execute(local_var_req).await?;
191
192 let local_var_status = local_var_resp.status();
193 let local_var_content = local_var_resp.text().await?;
194
195 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
196 Ok(())
197 } else {
198 let local_var_entity: Option<OrganizationsOrgIdDomainIdDeleteError> =
199 serde_json::from_str(&local_var_content).ok();
200 let local_var_error = ResponseContent {
201 status: local_var_status,
202 content: local_var_content,
203 entity: local_var_entity,
204 };
205 Err(Error::ResponseError(local_var_error))
206 }
207}
208
209pub async fn organizations_org_id_domain_id_get(
210 configuration: &configuration::Configuration,
211 org_id: uuid::Uuid,
212 id: uuid::Uuid,
213) -> Result<models::OrganizationDomainResponseModel, Error<OrganizationsOrgIdDomainIdGetError>> {
214 let local_var_configuration = configuration;
215
216 let local_var_client = &local_var_configuration.client;
217
218 let local_var_uri_str = format!(
219 "{}/organizations/{orgId}/domain/{id}",
220 local_var_configuration.base_path,
221 orgId = crate::apis::urlencode(org_id.to_string()),
222 id = crate::apis::urlencode(id.to_string())
223 );
224 let mut local_var_req_builder =
225 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
226
227 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
228 local_var_req_builder =
229 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
230 }
231 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
232 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
233 };
234
235 let local_var_req = local_var_req_builder.build()?;
236 let local_var_resp = local_var_client.execute(local_var_req).await?;
237
238 let local_var_status = local_var_resp.status();
239 let local_var_content = local_var_resp.text().await?;
240
241 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
242 serde_json::from_str(&local_var_content).map_err(Error::from)
243 } else {
244 let local_var_entity: Option<OrganizationsOrgIdDomainIdGetError> =
245 serde_json::from_str(&local_var_content).ok();
246 let local_var_error = ResponseContent {
247 status: local_var_status,
248 content: local_var_content,
249 entity: local_var_entity,
250 };
251 Err(Error::ResponseError(local_var_error))
252 }
253}
254
255pub async fn organizations_org_id_domain_id_remove_post(
256 configuration: &configuration::Configuration,
257 org_id: uuid::Uuid,
258 id: uuid::Uuid,
259) -> Result<(), Error<OrganizationsOrgIdDomainIdRemovePostError>> {
260 let local_var_configuration = configuration;
261
262 let local_var_client = &local_var_configuration.client;
263
264 let local_var_uri_str = format!(
265 "{}/organizations/{orgId}/domain/{id}/remove",
266 local_var_configuration.base_path,
267 orgId = crate::apis::urlencode(org_id.to_string()),
268 id = crate::apis::urlencode(id.to_string())
269 );
270 let mut local_var_req_builder =
271 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
272
273 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
274 local_var_req_builder =
275 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
276 }
277 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
278 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
279 };
280
281 let local_var_req = local_var_req_builder.build()?;
282 let local_var_resp = local_var_client.execute(local_var_req).await?;
283
284 let local_var_status = local_var_resp.status();
285 let local_var_content = local_var_resp.text().await?;
286
287 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
288 Ok(())
289 } else {
290 let local_var_entity: Option<OrganizationsOrgIdDomainIdRemovePostError> =
291 serde_json::from_str(&local_var_content).ok();
292 let local_var_error = ResponseContent {
293 status: local_var_status,
294 content: local_var_content,
295 entity: local_var_entity,
296 };
297 Err(Error::ResponseError(local_var_error))
298 }
299}
300
301pub async fn organizations_org_id_domain_id_verify_post(
302 configuration: &configuration::Configuration,
303 org_id: uuid::Uuid,
304 id: uuid::Uuid,
305) -> Result<models::OrganizationDomainResponseModel, Error<OrganizationsOrgIdDomainIdVerifyPostError>>
306{
307 let local_var_configuration = configuration;
308
309 let local_var_client = &local_var_configuration.client;
310
311 let local_var_uri_str = format!(
312 "{}/organizations/{orgId}/domain/{id}/verify",
313 local_var_configuration.base_path,
314 orgId = crate::apis::urlencode(org_id.to_string()),
315 id = crate::apis::urlencode(id.to_string())
316 );
317 let mut local_var_req_builder =
318 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
319
320 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
321 local_var_req_builder =
322 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
323 }
324 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
325 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
326 };
327
328 let local_var_req = local_var_req_builder.build()?;
329 let local_var_resp = local_var_client.execute(local_var_req).await?;
330
331 let local_var_status = local_var_resp.status();
332 let local_var_content = local_var_resp.text().await?;
333
334 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
335 serde_json::from_str(&local_var_content).map_err(Error::from)
336 } else {
337 let local_var_entity: Option<OrganizationsOrgIdDomainIdVerifyPostError> =
338 serde_json::from_str(&local_var_content).ok();
339 let local_var_error = ResponseContent {
340 status: local_var_status,
341 content: local_var_content,
342 entity: local_var_entity,
343 };
344 Err(Error::ResponseError(local_var_error))
345 }
346}
347
348pub async fn organizations_org_id_domain_post(
349 configuration: &configuration::Configuration,
350 org_id: uuid::Uuid,
351 organization_domain_request_model: Option<models::OrganizationDomainRequestModel>,
352) -> Result<models::OrganizationDomainResponseModel, Error<OrganizationsOrgIdDomainPostError>> {
353 let local_var_configuration = configuration;
354
355 let local_var_client = &local_var_configuration.client;
356
357 let local_var_uri_str = format!(
358 "{}/organizations/{orgId}/domain",
359 local_var_configuration.base_path,
360 orgId = crate::apis::urlencode(org_id.to_string())
361 );
362 let mut local_var_req_builder =
363 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
364
365 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
366 local_var_req_builder =
367 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
368 }
369 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
370 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
371 };
372 local_var_req_builder = local_var_req_builder.json(&organization_domain_request_model);
373
374 let local_var_req = local_var_req_builder.build()?;
375 let local_var_resp = local_var_client.execute(local_var_req).await?;
376
377 let local_var_status = local_var_resp.status();
378 let local_var_content = local_var_resp.text().await?;
379
380 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381 serde_json::from_str(&local_var_content).map_err(Error::from)
382 } else {
383 let local_var_entity: Option<OrganizationsOrgIdDomainPostError> =
384 serde_json::from_str(&local_var_content).ok();
385 let local_var_error = ResponseContent {
386 status: local_var_status,
387 content: local_var_content,
388 entity: local_var_entity,
389 };
390 Err(Error::ResponseError(local_var_error))
391 }
392}