1use std::sync::Arc;
12
13use async_trait::async_trait;
14#[cfg(feature = "mockall")]
15use mockall::automock;
16use reqwest;
17use serde::{Deserialize, Serialize, de::Error as _};
18
19use super::{Error, configuration};
20use crate::{
21 apis::{ContentType, ResponseContent},
22 models,
23};
24
25#[cfg_attr(feature = "mockall", automock)]
26#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
27#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
28pub trait OrganizationsApi: Send + Sync {
29 async fn api_key<'a>(
31 &self,
32 id: &'a str,
33 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
34 ) -> Result<models::ApiKeyResponseModel, Error<ApiKeyError>>;
35
36 async fn api_key_information<'a>(
38 &self,
39 id: uuid::Uuid,
40 r#type: models::OrganizationApiKeyType,
41 ) -> Result<models::OrganizationApiKeyInformationListResponseModel, Error<ApiKeyInformationError>>;
42
43 async fn create_without_payment<'a>(
45 &self,
46 organization_no_payment_create_request: Option<models::OrganizationNoPaymentCreateRequest>,
47 ) -> Result<models::OrganizationResponseModel, Error<CreateWithoutPaymentError>>;
48
49 async fn delete<'a>(
51 &self,
52 id: &'a str,
53 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
54 ) -> Result<(), Error<DeleteError>>;
55
56 async fn get<'a>(
58 &self,
59 id: &'a str,
60 ) -> Result<models::OrganizationResponseModel, Error<GetError>>;
61
62 async fn get_auto_enroll_status<'a>(
64 &self,
65 identifier: &'a str,
66 ) -> Result<models::OrganizationAutoEnrollStatusResponseModel, Error<GetAutoEnrollStatusError>>;
67
68 async fn get_license<'a>(
70 &self,
71 id: uuid::Uuid,
72 installation_id: Option<uuid::Uuid>,
73 ) -> Result<models::OrganizationLicense, Error<GetLicenseError>>;
74
75 async fn get_plan_type<'a>(
77 &self,
78 id: &'a str,
79 ) -> Result<models::PlanType, Error<GetPlanTypeError>>;
80
81 async fn get_public_key<'a>(
83 &self,
84 id: &'a str,
85 ) -> Result<models::OrganizationPublicKeyResponseModel, Error<GetPublicKeyError>>;
86
87 async fn get_sso<'a>(
89 &self,
90 id: uuid::Uuid,
91 ) -> Result<models::OrganizationSsoResponseModel, Error<GetSsoError>>;
92
93 async fn get_subscription<'a>(
95 &self,
96 id: uuid::Uuid,
97 ) -> Result<models::OrganizationSubscriptionResponseModel, Error<GetSubscriptionError>>;
98
99 async fn get_tax_info<'a>(
101 &self,
102 id: uuid::Uuid,
103 ) -> Result<models::TaxInfoResponseModel, Error<GetTaxInfoError>>;
104
105 async fn get_user(
107 &self,
108 ) -> Result<models::ProfileOrganizationResponseModelListResponseModel, Error<GetUserError>>;
109
110 async fn leave<'a>(&self, id: uuid::Uuid) -> Result<(), Error<LeaveError>>;
112
113 async fn post<'a>(
115 &self,
116 organization_create_request_model: Option<models::OrganizationCreateRequestModel>,
117 ) -> Result<models::OrganizationResponseModel, Error<PostError>>;
118
119 async fn post_cancel<'a>(
121 &self,
122 id: uuid::Uuid,
123 subscription_cancellation_request_model: Option<
124 models::SubscriptionCancellationRequestModel,
125 >,
126 ) -> Result<(), Error<PostCancelError>>;
127
128 async fn post_delete_recover_token<'a>(
130 &self,
131 id: uuid::Uuid,
132 organization_verify_delete_recover_request_model: Option<
133 models::OrganizationVerifyDeleteRecoverRequestModel,
134 >,
135 ) -> Result<(), Error<PostDeleteRecoverTokenError>>;
136
137 async fn post_keys<'a>(
139 &self,
140 id: uuid::Uuid,
141 organization_keys_request_model: Option<models::OrganizationKeysRequestModel>,
142 ) -> Result<models::OrganizationKeysResponseModel, Error<PostKeysError>>;
143
144 async fn post_reinstate<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PostReinstateError>>;
146
147 async fn post_seat<'a>(
149 &self,
150 id: uuid::Uuid,
151 organization_seat_request_model: Option<models::OrganizationSeatRequestModel>,
152 ) -> Result<models::PaymentResponseModel, Error<PostSeatError>>;
153
154 async fn post_sm_subscription<'a>(
156 &self,
157 id: uuid::Uuid,
158 secrets_manager_subscription_update_request_model: Option<
159 models::SecretsManagerSubscriptionUpdateRequestModel,
160 >,
161 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSmSubscriptionError>>;
162
163 async fn post_sso<'a>(
165 &self,
166 id: uuid::Uuid,
167 organization_sso_request_model: Option<models::OrganizationSsoRequestModel>,
168 ) -> Result<models::OrganizationSsoResponseModel, Error<PostSsoError>>;
169
170 async fn post_storage<'a>(
172 &self,
173 id: &'a str,
174 storage_request_model: Option<models::StorageRequestModel>,
175 ) -> Result<models::PaymentResponseModel, Error<PostStorageError>>;
176
177 async fn post_subscribe_secrets_manager<'a>(
179 &self,
180 id: uuid::Uuid,
181 secrets_manager_subscribe_request_model: Option<
182 models::SecretsManagerSubscribeRequestModel,
183 >,
184 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscribeSecretsManagerError>>;
185
186 async fn post_subscription<'a>(
188 &self,
189 id: uuid::Uuid,
190 organization_subscription_update_request_model: Option<
191 models::OrganizationSubscriptionUpdateRequestModel,
192 >,
193 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscriptionError>>;
194
195 async fn post_upgrade<'a>(
197 &self,
198 id: uuid::Uuid,
199 organization_upgrade_request_model: Option<models::OrganizationUpgradeRequestModel>,
200 ) -> Result<models::PaymentResponseModel, Error<PostUpgradeError>>;
201
202 async fn put<'a>(
204 &self,
205 id: &'a str,
206 organization_update_request_model: Option<models::OrganizationUpdateRequestModel>,
207 ) -> Result<models::OrganizationResponseModel, Error<PutError>>;
208
209 async fn put_collection_management<'a>(
211 &self,
212 id: uuid::Uuid,
213 organization_collection_management_update_request_model: Option<
214 models::OrganizationCollectionManagementUpdateRequestModel,
215 >,
216 ) -> Result<models::OrganizationResponseModel, Error<PutCollectionManagementError>>;
217
218 async fn put_tax_info<'a>(
220 &self,
221 id: uuid::Uuid,
222 expanded_tax_info_update_request_model: Option<models::ExpandedTaxInfoUpdateRequestModel>,
223 ) -> Result<(), Error<PutTaxInfoError>>;
224
225 async fn rotate_api_key<'a>(
227 &self,
228 id: &'a str,
229 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
230 ) -> Result<models::ApiKeyResponseModel, Error<RotateApiKeyError>>;
231}
232
233pub struct OrganizationsApiClient {
234 configuration: Arc<configuration::Configuration>,
235}
236
237impl OrganizationsApiClient {
238 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
239 Self { configuration }
240 }
241}
242
243#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
244#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
245impl OrganizationsApi for OrganizationsApiClient {
246 async fn api_key<'a>(
247 &self,
248 id: &'a str,
249 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
250 ) -> Result<models::ApiKeyResponseModel, Error<ApiKeyError>> {
251 let local_var_configuration = &self.configuration;
252
253 let local_var_client = &local_var_configuration.client;
254
255 let local_var_uri_str = format!(
256 "{}/organizations/{id}/api-key",
257 local_var_configuration.base_path,
258 id = crate::apis::urlencode(id)
259 );
260 let mut local_var_req_builder =
261 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
262
263 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
264 local_var_req_builder = local_var_req_builder
265 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
266 }
267 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
268 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
269 };
270 local_var_req_builder = local_var_req_builder.json(&organization_api_key_request_model);
271
272 let local_var_req = local_var_req_builder.build()?;
273 let local_var_resp = local_var_client.execute(local_var_req).await?;
274
275 let local_var_status = local_var_resp.status();
276 let local_var_content_type = local_var_resp
277 .headers()
278 .get("content-type")
279 .and_then(|v| v.to_str().ok())
280 .unwrap_or("application/octet-stream");
281 let local_var_content_type = super::ContentType::from(local_var_content_type);
282 let local_var_content = local_var_resp.text().await?;
283
284 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
285 match local_var_content_type {
286 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
287 ContentType::Text => {
288 return Err(Error::from(serde_json::Error::custom(
289 "Received `text/plain` content type response that cannot be converted to `models::ApiKeyResponseModel`",
290 )));
291 }
292 ContentType::Unsupported(local_var_unknown_type) => {
293 return Err(Error::from(serde_json::Error::custom(format!(
294 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ApiKeyResponseModel`"
295 ))));
296 }
297 }
298 } else {
299 let local_var_entity: Option<ApiKeyError> =
300 serde_json::from_str(&local_var_content).ok();
301 let local_var_error = ResponseContent {
302 status: local_var_status,
303 content: local_var_content,
304 entity: local_var_entity,
305 };
306 Err(Error::ResponseError(local_var_error))
307 }
308 }
309
310 async fn api_key_information<'a>(
311 &self,
312 id: uuid::Uuid,
313 r#type: models::OrganizationApiKeyType,
314 ) -> Result<models::OrganizationApiKeyInformationListResponseModel, Error<ApiKeyInformationError>>
315 {
316 let local_var_configuration = &self.configuration;
317
318 let local_var_client = &local_var_configuration.client;
319
320 let local_var_uri_str = format!("{}/organizations/{id}/api-key-information/{type}", local_var_configuration.base_path, id=id, type=r#type.to_string());
321 let mut local_var_req_builder =
322 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
323
324 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
325 local_var_req_builder = local_var_req_builder
326 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
327 }
328 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
329 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
330 };
331
332 let local_var_req = local_var_req_builder.build()?;
333 let local_var_resp = local_var_client.execute(local_var_req).await?;
334
335 let local_var_status = local_var_resp.status();
336 let local_var_content_type = local_var_resp
337 .headers()
338 .get("content-type")
339 .and_then(|v| v.to_str().ok())
340 .unwrap_or("application/octet-stream");
341 let local_var_content_type = super::ContentType::from(local_var_content_type);
342 let local_var_content = local_var_resp.text().await?;
343
344 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
345 match local_var_content_type {
346 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
347 ContentType::Text => {
348 return Err(Error::from(serde_json::Error::custom(
349 "Received `text/plain` content type response that cannot be converted to `models::OrganizationApiKeyInformationListResponseModel`",
350 )));
351 }
352 ContentType::Unsupported(local_var_unknown_type) => {
353 return Err(Error::from(serde_json::Error::custom(format!(
354 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationApiKeyInformationListResponseModel`"
355 ))));
356 }
357 }
358 } else {
359 let local_var_entity: Option<ApiKeyInformationError> =
360 serde_json::from_str(&local_var_content).ok();
361 let local_var_error = ResponseContent {
362 status: local_var_status,
363 content: local_var_content,
364 entity: local_var_entity,
365 };
366 Err(Error::ResponseError(local_var_error))
367 }
368 }
369
370 async fn create_without_payment<'a>(
371 &self,
372 organization_no_payment_create_request: Option<models::OrganizationNoPaymentCreateRequest>,
373 ) -> Result<models::OrganizationResponseModel, Error<CreateWithoutPaymentError>> {
374 let local_var_configuration = &self.configuration;
375
376 let local_var_client = &local_var_configuration.client;
377
378 let local_var_uri_str = format!(
379 "{}/organizations/create-without-payment",
380 local_var_configuration.base_path
381 );
382 let mut local_var_req_builder =
383 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
384
385 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
386 local_var_req_builder = local_var_req_builder
387 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
388 }
389 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
390 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
391 };
392 local_var_req_builder = local_var_req_builder.json(&organization_no_payment_create_request);
393
394 let local_var_req = local_var_req_builder.build()?;
395 let local_var_resp = local_var_client.execute(local_var_req).await?;
396
397 let local_var_status = local_var_resp.status();
398 let local_var_content_type = local_var_resp
399 .headers()
400 .get("content-type")
401 .and_then(|v| v.to_str().ok())
402 .unwrap_or("application/octet-stream");
403 let local_var_content_type = super::ContentType::from(local_var_content_type);
404 let local_var_content = local_var_resp.text().await?;
405
406 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
407 match local_var_content_type {
408 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
409 ContentType::Text => {
410 return Err(Error::from(serde_json::Error::custom(
411 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
412 )));
413 }
414 ContentType::Unsupported(local_var_unknown_type) => {
415 return Err(Error::from(serde_json::Error::custom(format!(
416 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
417 ))));
418 }
419 }
420 } else {
421 let local_var_entity: Option<CreateWithoutPaymentError> =
422 serde_json::from_str(&local_var_content).ok();
423 let local_var_error = ResponseContent {
424 status: local_var_status,
425 content: local_var_content,
426 entity: local_var_entity,
427 };
428 Err(Error::ResponseError(local_var_error))
429 }
430 }
431
432 async fn delete<'a>(
433 &self,
434 id: &'a str,
435 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
436 ) -> Result<(), Error<DeleteError>> {
437 let local_var_configuration = &self.configuration;
438
439 let local_var_client = &local_var_configuration.client;
440
441 let local_var_uri_str = format!(
442 "{}/organizations/{id}",
443 local_var_configuration.base_path,
444 id = crate::apis::urlencode(id)
445 );
446 let mut local_var_req_builder =
447 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
448
449 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
450 local_var_req_builder = local_var_req_builder
451 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
452 }
453 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
454 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
455 };
456 local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model);
457
458 let local_var_req = local_var_req_builder.build()?;
459 let local_var_resp = local_var_client.execute(local_var_req).await?;
460
461 let local_var_status = local_var_resp.status();
462 let local_var_content = local_var_resp.text().await?;
463
464 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
465 Ok(())
466 } else {
467 let local_var_entity: Option<DeleteError> =
468 serde_json::from_str(&local_var_content).ok();
469 let local_var_error = ResponseContent {
470 status: local_var_status,
471 content: local_var_content,
472 entity: local_var_entity,
473 };
474 Err(Error::ResponseError(local_var_error))
475 }
476 }
477
478 async fn get<'a>(
479 &self,
480 id: &'a str,
481 ) -> Result<models::OrganizationResponseModel, Error<GetError>> {
482 let local_var_configuration = &self.configuration;
483
484 let local_var_client = &local_var_configuration.client;
485
486 let local_var_uri_str = format!(
487 "{}/organizations/{id}",
488 local_var_configuration.base_path,
489 id = crate::apis::urlencode(id)
490 );
491 let mut local_var_req_builder =
492 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
493
494 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
495 local_var_req_builder = local_var_req_builder
496 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
497 }
498 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
499 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
500 };
501
502 let local_var_req = local_var_req_builder.build()?;
503 let local_var_resp = local_var_client.execute(local_var_req).await?;
504
505 let local_var_status = local_var_resp.status();
506 let local_var_content_type = local_var_resp
507 .headers()
508 .get("content-type")
509 .and_then(|v| v.to_str().ok())
510 .unwrap_or("application/octet-stream");
511 let local_var_content_type = super::ContentType::from(local_var_content_type);
512 let local_var_content = local_var_resp.text().await?;
513
514 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
515 match local_var_content_type {
516 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
517 ContentType::Text => {
518 return Err(Error::from(serde_json::Error::custom(
519 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
520 )));
521 }
522 ContentType::Unsupported(local_var_unknown_type) => {
523 return Err(Error::from(serde_json::Error::custom(format!(
524 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
525 ))));
526 }
527 }
528 } else {
529 let local_var_entity: Option<GetError> = serde_json::from_str(&local_var_content).ok();
530 let local_var_error = ResponseContent {
531 status: local_var_status,
532 content: local_var_content,
533 entity: local_var_entity,
534 };
535 Err(Error::ResponseError(local_var_error))
536 }
537 }
538
539 async fn get_auto_enroll_status<'a>(
540 &self,
541 identifier: &'a str,
542 ) -> Result<models::OrganizationAutoEnrollStatusResponseModel, Error<GetAutoEnrollStatusError>>
543 {
544 let local_var_configuration = &self.configuration;
545
546 let local_var_client = &local_var_configuration.client;
547
548 let local_var_uri_str = format!(
549 "{}/organizations/{identifier}/auto-enroll-status",
550 local_var_configuration.base_path,
551 identifier = crate::apis::urlencode(identifier)
552 );
553 let mut local_var_req_builder =
554 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
555
556 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
557 local_var_req_builder = local_var_req_builder
558 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
559 }
560 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
561 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
562 };
563
564 let local_var_req = local_var_req_builder.build()?;
565 let local_var_resp = local_var_client.execute(local_var_req).await?;
566
567 let local_var_status = local_var_resp.status();
568 let local_var_content_type = local_var_resp
569 .headers()
570 .get("content-type")
571 .and_then(|v| v.to_str().ok())
572 .unwrap_or("application/octet-stream");
573 let local_var_content_type = super::ContentType::from(local_var_content_type);
574 let local_var_content = local_var_resp.text().await?;
575
576 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
577 match local_var_content_type {
578 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
579 ContentType::Text => {
580 return Err(Error::from(serde_json::Error::custom(
581 "Received `text/plain` content type response that cannot be converted to `models::OrganizationAutoEnrollStatusResponseModel`",
582 )));
583 }
584 ContentType::Unsupported(local_var_unknown_type) => {
585 return Err(Error::from(serde_json::Error::custom(format!(
586 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationAutoEnrollStatusResponseModel`"
587 ))));
588 }
589 }
590 } else {
591 let local_var_entity: Option<GetAutoEnrollStatusError> =
592 serde_json::from_str(&local_var_content).ok();
593 let local_var_error = ResponseContent {
594 status: local_var_status,
595 content: local_var_content,
596 entity: local_var_entity,
597 };
598 Err(Error::ResponseError(local_var_error))
599 }
600 }
601
602 async fn get_license<'a>(
603 &self,
604 id: uuid::Uuid,
605 installation_id: Option<uuid::Uuid>,
606 ) -> Result<models::OrganizationLicense, Error<GetLicenseError>> {
607 let local_var_configuration = &self.configuration;
608
609 let local_var_client = &local_var_configuration.client;
610
611 let local_var_uri_str = format!(
612 "{}/organizations/{id}/license",
613 local_var_configuration.base_path,
614 id = id
615 );
616 let mut local_var_req_builder =
617 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
618
619 if let Some(ref param_value) = installation_id {
620 local_var_req_builder =
621 local_var_req_builder.query(&[("installationId", ¶m_value.to_string())]);
622 }
623 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
624 local_var_req_builder = local_var_req_builder
625 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
626 }
627 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
628 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
629 };
630
631 let local_var_req = local_var_req_builder.build()?;
632 let local_var_resp = local_var_client.execute(local_var_req).await?;
633
634 let local_var_status = local_var_resp.status();
635 let local_var_content_type = local_var_resp
636 .headers()
637 .get("content-type")
638 .and_then(|v| v.to_str().ok())
639 .unwrap_or("application/octet-stream");
640 let local_var_content_type = super::ContentType::from(local_var_content_type);
641 let local_var_content = local_var_resp.text().await?;
642
643 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
644 match local_var_content_type {
645 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
646 ContentType::Text => {
647 return Err(Error::from(serde_json::Error::custom(
648 "Received `text/plain` content type response that cannot be converted to `models::OrganizationLicense`",
649 )));
650 }
651 ContentType::Unsupported(local_var_unknown_type) => {
652 return Err(Error::from(serde_json::Error::custom(format!(
653 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationLicense`"
654 ))));
655 }
656 }
657 } else {
658 let local_var_entity: Option<GetLicenseError> =
659 serde_json::from_str(&local_var_content).ok();
660 let local_var_error = ResponseContent {
661 status: local_var_status,
662 content: local_var_content,
663 entity: local_var_entity,
664 };
665 Err(Error::ResponseError(local_var_error))
666 }
667 }
668
669 async fn get_plan_type<'a>(
670 &self,
671 id: &'a str,
672 ) -> Result<models::PlanType, Error<GetPlanTypeError>> {
673 let local_var_configuration = &self.configuration;
674
675 let local_var_client = &local_var_configuration.client;
676
677 let local_var_uri_str = format!(
678 "{}/organizations/{id}/plan-type",
679 local_var_configuration.base_path,
680 id = crate::apis::urlencode(id)
681 );
682 let mut local_var_req_builder =
683 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
684
685 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
686 local_var_req_builder = local_var_req_builder
687 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
688 }
689 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
690 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
691 };
692
693 let local_var_req = local_var_req_builder.build()?;
694 let local_var_resp = local_var_client.execute(local_var_req).await?;
695
696 let local_var_status = local_var_resp.status();
697 let local_var_content_type = local_var_resp
698 .headers()
699 .get("content-type")
700 .and_then(|v| v.to_str().ok())
701 .unwrap_or("application/octet-stream");
702 let local_var_content_type = super::ContentType::from(local_var_content_type);
703 let local_var_content = local_var_resp.text().await?;
704
705 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
706 match local_var_content_type {
707 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
708 ContentType::Text => {
709 return Err(Error::from(serde_json::Error::custom(
710 "Received `text/plain` content type response that cannot be converted to `models::PlanType`",
711 )));
712 }
713 ContentType::Unsupported(local_var_unknown_type) => {
714 return Err(Error::from(serde_json::Error::custom(format!(
715 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PlanType`"
716 ))));
717 }
718 }
719 } else {
720 let local_var_entity: Option<GetPlanTypeError> =
721 serde_json::from_str(&local_var_content).ok();
722 let local_var_error = ResponseContent {
723 status: local_var_status,
724 content: local_var_content,
725 entity: local_var_entity,
726 };
727 Err(Error::ResponseError(local_var_error))
728 }
729 }
730
731 async fn get_public_key<'a>(
732 &self,
733 id: &'a str,
734 ) -> Result<models::OrganizationPublicKeyResponseModel, Error<GetPublicKeyError>> {
735 let local_var_configuration = &self.configuration;
736
737 let local_var_client = &local_var_configuration.client;
738
739 let local_var_uri_str = format!(
740 "{}/organizations/{id}/public-key",
741 local_var_configuration.base_path,
742 id = crate::apis::urlencode(id)
743 );
744 let mut local_var_req_builder =
745 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
746
747 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
748 local_var_req_builder = local_var_req_builder
749 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
750 }
751 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
752 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
753 };
754
755 let local_var_req = local_var_req_builder.build()?;
756 let local_var_resp = local_var_client.execute(local_var_req).await?;
757
758 let local_var_status = local_var_resp.status();
759 let local_var_content_type = local_var_resp
760 .headers()
761 .get("content-type")
762 .and_then(|v| v.to_str().ok())
763 .unwrap_or("application/octet-stream");
764 let local_var_content_type = super::ContentType::from(local_var_content_type);
765 let local_var_content = local_var_resp.text().await?;
766
767 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
768 match local_var_content_type {
769 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
770 ContentType::Text => {
771 return Err(Error::from(serde_json::Error::custom(
772 "Received `text/plain` content type response that cannot be converted to `models::OrganizationPublicKeyResponseModel`",
773 )));
774 }
775 ContentType::Unsupported(local_var_unknown_type) => {
776 return Err(Error::from(serde_json::Error::custom(format!(
777 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationPublicKeyResponseModel`"
778 ))));
779 }
780 }
781 } else {
782 let local_var_entity: Option<GetPublicKeyError> =
783 serde_json::from_str(&local_var_content).ok();
784 let local_var_error = ResponseContent {
785 status: local_var_status,
786 content: local_var_content,
787 entity: local_var_entity,
788 };
789 Err(Error::ResponseError(local_var_error))
790 }
791 }
792
793 async fn get_sso<'a>(
794 &self,
795 id: uuid::Uuid,
796 ) -> Result<models::OrganizationSsoResponseModel, Error<GetSsoError>> {
797 let local_var_configuration = &self.configuration;
798
799 let local_var_client = &local_var_configuration.client;
800
801 let local_var_uri_str = format!(
802 "{}/organizations/{id}/sso",
803 local_var_configuration.base_path,
804 id = id
805 );
806 let mut local_var_req_builder =
807 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
808
809 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
810 local_var_req_builder = local_var_req_builder
811 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
812 }
813 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
814 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
815 };
816
817 let local_var_req = local_var_req_builder.build()?;
818 let local_var_resp = local_var_client.execute(local_var_req).await?;
819
820 let local_var_status = local_var_resp.status();
821 let local_var_content_type = local_var_resp
822 .headers()
823 .get("content-type")
824 .and_then(|v| v.to_str().ok())
825 .unwrap_or("application/octet-stream");
826 let local_var_content_type = super::ContentType::from(local_var_content_type);
827 let local_var_content = local_var_resp.text().await?;
828
829 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
830 match local_var_content_type {
831 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
832 ContentType::Text => {
833 return Err(Error::from(serde_json::Error::custom(
834 "Received `text/plain` content type response that cannot be converted to `models::OrganizationSsoResponseModel`",
835 )));
836 }
837 ContentType::Unsupported(local_var_unknown_type) => {
838 return Err(Error::from(serde_json::Error::custom(format!(
839 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationSsoResponseModel`"
840 ))));
841 }
842 }
843 } else {
844 let local_var_entity: Option<GetSsoError> =
845 serde_json::from_str(&local_var_content).ok();
846 let local_var_error = ResponseContent {
847 status: local_var_status,
848 content: local_var_content,
849 entity: local_var_entity,
850 };
851 Err(Error::ResponseError(local_var_error))
852 }
853 }
854
855 async fn get_subscription<'a>(
856 &self,
857 id: uuid::Uuid,
858 ) -> Result<models::OrganizationSubscriptionResponseModel, Error<GetSubscriptionError>> {
859 let local_var_configuration = &self.configuration;
860
861 let local_var_client = &local_var_configuration.client;
862
863 let local_var_uri_str = format!(
864 "{}/organizations/{id}/subscription",
865 local_var_configuration.base_path,
866 id = id
867 );
868 let mut local_var_req_builder =
869 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
870
871 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
872 local_var_req_builder = local_var_req_builder
873 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
874 }
875 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
876 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
877 };
878
879 let local_var_req = local_var_req_builder.build()?;
880 let local_var_resp = local_var_client.execute(local_var_req).await?;
881
882 let local_var_status = local_var_resp.status();
883 let local_var_content_type = local_var_resp
884 .headers()
885 .get("content-type")
886 .and_then(|v| v.to_str().ok())
887 .unwrap_or("application/octet-stream");
888 let local_var_content_type = super::ContentType::from(local_var_content_type);
889 let local_var_content = local_var_resp.text().await?;
890
891 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
892 match local_var_content_type {
893 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
894 ContentType::Text => {
895 return Err(Error::from(serde_json::Error::custom(
896 "Received `text/plain` content type response that cannot be converted to `models::OrganizationSubscriptionResponseModel`",
897 )));
898 }
899 ContentType::Unsupported(local_var_unknown_type) => {
900 return Err(Error::from(serde_json::Error::custom(format!(
901 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationSubscriptionResponseModel`"
902 ))));
903 }
904 }
905 } else {
906 let local_var_entity: Option<GetSubscriptionError> =
907 serde_json::from_str(&local_var_content).ok();
908 let local_var_error = ResponseContent {
909 status: local_var_status,
910 content: local_var_content,
911 entity: local_var_entity,
912 };
913 Err(Error::ResponseError(local_var_error))
914 }
915 }
916
917 async fn get_tax_info<'a>(
918 &self,
919 id: uuid::Uuid,
920 ) -> Result<models::TaxInfoResponseModel, Error<GetTaxInfoError>> {
921 let local_var_configuration = &self.configuration;
922
923 let local_var_client = &local_var_configuration.client;
924
925 let local_var_uri_str = format!(
926 "{}/organizations/{id}/tax",
927 local_var_configuration.base_path,
928 id = id
929 );
930 let mut local_var_req_builder =
931 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
932
933 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
934 local_var_req_builder = local_var_req_builder
935 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
936 }
937 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
938 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
939 };
940
941 let local_var_req = local_var_req_builder.build()?;
942 let local_var_resp = local_var_client.execute(local_var_req).await?;
943
944 let local_var_status = local_var_resp.status();
945 let local_var_content_type = local_var_resp
946 .headers()
947 .get("content-type")
948 .and_then(|v| v.to_str().ok())
949 .unwrap_or("application/octet-stream");
950 let local_var_content_type = super::ContentType::from(local_var_content_type);
951 let local_var_content = local_var_resp.text().await?;
952
953 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
954 match local_var_content_type {
955 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
956 ContentType::Text => {
957 return Err(Error::from(serde_json::Error::custom(
958 "Received `text/plain` content type response that cannot be converted to `models::TaxInfoResponseModel`",
959 )));
960 }
961 ContentType::Unsupported(local_var_unknown_type) => {
962 return Err(Error::from(serde_json::Error::custom(format!(
963 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::TaxInfoResponseModel`"
964 ))));
965 }
966 }
967 } else {
968 let local_var_entity: Option<GetTaxInfoError> =
969 serde_json::from_str(&local_var_content).ok();
970 let local_var_error = ResponseContent {
971 status: local_var_status,
972 content: local_var_content,
973 entity: local_var_entity,
974 };
975 Err(Error::ResponseError(local_var_error))
976 }
977 }
978
979 async fn get_user(
980 &self,
981 ) -> Result<models::ProfileOrganizationResponseModelListResponseModel, Error<GetUserError>>
982 {
983 let local_var_configuration = &self.configuration;
984
985 let local_var_client = &local_var_configuration.client;
986
987 let local_var_uri_str = format!("{}/organizations", local_var_configuration.base_path);
988 let mut local_var_req_builder =
989 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
990
991 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
992 local_var_req_builder = local_var_req_builder
993 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
994 }
995 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
996 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
997 };
998
999 let local_var_req = local_var_req_builder.build()?;
1000 let local_var_resp = local_var_client.execute(local_var_req).await?;
1001
1002 let local_var_status = local_var_resp.status();
1003 let local_var_content_type = local_var_resp
1004 .headers()
1005 .get("content-type")
1006 .and_then(|v| v.to_str().ok())
1007 .unwrap_or("application/octet-stream");
1008 let local_var_content_type = super::ContentType::from(local_var_content_type);
1009 let local_var_content = local_var_resp.text().await?;
1010
1011 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1012 match local_var_content_type {
1013 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1014 ContentType::Text => {
1015 return Err(Error::from(serde_json::Error::custom(
1016 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModelListResponseModel`",
1017 )));
1018 }
1019 ContentType::Unsupported(local_var_unknown_type) => {
1020 return Err(Error::from(serde_json::Error::custom(format!(
1021 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModelListResponseModel`"
1022 ))));
1023 }
1024 }
1025 } else {
1026 let local_var_entity: Option<GetUserError> =
1027 serde_json::from_str(&local_var_content).ok();
1028 let local_var_error = ResponseContent {
1029 status: local_var_status,
1030 content: local_var_content,
1031 entity: local_var_entity,
1032 };
1033 Err(Error::ResponseError(local_var_error))
1034 }
1035 }
1036
1037 async fn leave<'a>(&self, id: uuid::Uuid) -> Result<(), Error<LeaveError>> {
1038 let local_var_configuration = &self.configuration;
1039
1040 let local_var_client = &local_var_configuration.client;
1041
1042 let local_var_uri_str = format!(
1043 "{}/organizations/{id}/leave",
1044 local_var_configuration.base_path,
1045 id = id
1046 );
1047 let mut local_var_req_builder =
1048 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1049
1050 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1051 local_var_req_builder = local_var_req_builder
1052 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1053 }
1054 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1055 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1056 };
1057
1058 let local_var_req = local_var_req_builder.build()?;
1059 let local_var_resp = local_var_client.execute(local_var_req).await?;
1060
1061 let local_var_status = local_var_resp.status();
1062 let local_var_content = local_var_resp.text().await?;
1063
1064 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1065 Ok(())
1066 } else {
1067 let local_var_entity: Option<LeaveError> =
1068 serde_json::from_str(&local_var_content).ok();
1069 let local_var_error = ResponseContent {
1070 status: local_var_status,
1071 content: local_var_content,
1072 entity: local_var_entity,
1073 };
1074 Err(Error::ResponseError(local_var_error))
1075 }
1076 }
1077
1078 async fn post<'a>(
1079 &self,
1080 organization_create_request_model: Option<models::OrganizationCreateRequestModel>,
1081 ) -> Result<models::OrganizationResponseModel, Error<PostError>> {
1082 let local_var_configuration = &self.configuration;
1083
1084 let local_var_client = &local_var_configuration.client;
1085
1086 let local_var_uri_str = format!("{}/organizations", local_var_configuration.base_path);
1087 let mut local_var_req_builder =
1088 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1089
1090 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1091 local_var_req_builder = local_var_req_builder
1092 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1093 }
1094 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1095 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1096 };
1097 local_var_req_builder = local_var_req_builder.json(&organization_create_request_model);
1098
1099 let local_var_req = local_var_req_builder.build()?;
1100 let local_var_resp = local_var_client.execute(local_var_req).await?;
1101
1102 let local_var_status = local_var_resp.status();
1103 let local_var_content_type = local_var_resp
1104 .headers()
1105 .get("content-type")
1106 .and_then(|v| v.to_str().ok())
1107 .unwrap_or("application/octet-stream");
1108 let local_var_content_type = super::ContentType::from(local_var_content_type);
1109 let local_var_content = local_var_resp.text().await?;
1110
1111 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1112 match local_var_content_type {
1113 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1114 ContentType::Text => {
1115 return Err(Error::from(serde_json::Error::custom(
1116 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
1117 )));
1118 }
1119 ContentType::Unsupported(local_var_unknown_type) => {
1120 return Err(Error::from(serde_json::Error::custom(format!(
1121 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
1122 ))));
1123 }
1124 }
1125 } else {
1126 let local_var_entity: Option<PostError> = serde_json::from_str(&local_var_content).ok();
1127 let local_var_error = ResponseContent {
1128 status: local_var_status,
1129 content: local_var_content,
1130 entity: local_var_entity,
1131 };
1132 Err(Error::ResponseError(local_var_error))
1133 }
1134 }
1135
1136 async fn post_cancel<'a>(
1137 &self,
1138 id: uuid::Uuid,
1139 subscription_cancellation_request_model: Option<
1140 models::SubscriptionCancellationRequestModel,
1141 >,
1142 ) -> Result<(), Error<PostCancelError>> {
1143 let local_var_configuration = &self.configuration;
1144
1145 let local_var_client = &local_var_configuration.client;
1146
1147 let local_var_uri_str = format!(
1148 "{}/organizations/{id}/cancel",
1149 local_var_configuration.base_path,
1150 id = id
1151 );
1152 let mut local_var_req_builder =
1153 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1154
1155 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1156 local_var_req_builder = local_var_req_builder
1157 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1158 }
1159 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1160 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1161 };
1162 local_var_req_builder =
1163 local_var_req_builder.json(&subscription_cancellation_request_model);
1164
1165 let local_var_req = local_var_req_builder.build()?;
1166 let local_var_resp = local_var_client.execute(local_var_req).await?;
1167
1168 let local_var_status = local_var_resp.status();
1169 let local_var_content = local_var_resp.text().await?;
1170
1171 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1172 Ok(())
1173 } else {
1174 let local_var_entity: Option<PostCancelError> =
1175 serde_json::from_str(&local_var_content).ok();
1176 let local_var_error = ResponseContent {
1177 status: local_var_status,
1178 content: local_var_content,
1179 entity: local_var_entity,
1180 };
1181 Err(Error::ResponseError(local_var_error))
1182 }
1183 }
1184
1185 async fn post_delete_recover_token<'a>(
1186 &self,
1187 id: uuid::Uuid,
1188 organization_verify_delete_recover_request_model: Option<
1189 models::OrganizationVerifyDeleteRecoverRequestModel,
1190 >,
1191 ) -> Result<(), Error<PostDeleteRecoverTokenError>> {
1192 let local_var_configuration = &self.configuration;
1193
1194 let local_var_client = &local_var_configuration.client;
1195
1196 let local_var_uri_str = format!(
1197 "{}/organizations/{id}/delete-recover-token",
1198 local_var_configuration.base_path,
1199 id = id
1200 );
1201 let mut local_var_req_builder =
1202 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1203
1204 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1205 local_var_req_builder = local_var_req_builder
1206 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1207 }
1208 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1209 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1210 };
1211 local_var_req_builder =
1212 local_var_req_builder.json(&organization_verify_delete_recover_request_model);
1213
1214 let local_var_req = local_var_req_builder.build()?;
1215 let local_var_resp = local_var_client.execute(local_var_req).await?;
1216
1217 let local_var_status = local_var_resp.status();
1218 let local_var_content = local_var_resp.text().await?;
1219
1220 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1221 Ok(())
1222 } else {
1223 let local_var_entity: Option<PostDeleteRecoverTokenError> =
1224 serde_json::from_str(&local_var_content).ok();
1225 let local_var_error = ResponseContent {
1226 status: local_var_status,
1227 content: local_var_content,
1228 entity: local_var_entity,
1229 };
1230 Err(Error::ResponseError(local_var_error))
1231 }
1232 }
1233
1234 async fn post_keys<'a>(
1235 &self,
1236 id: uuid::Uuid,
1237 organization_keys_request_model: Option<models::OrganizationKeysRequestModel>,
1238 ) -> Result<models::OrganizationKeysResponseModel, Error<PostKeysError>> {
1239 let local_var_configuration = &self.configuration;
1240
1241 let local_var_client = &local_var_configuration.client;
1242
1243 let local_var_uri_str = format!(
1244 "{}/organizations/{id}/keys",
1245 local_var_configuration.base_path,
1246 id = id
1247 );
1248 let mut local_var_req_builder =
1249 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1250
1251 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1252 local_var_req_builder = local_var_req_builder
1253 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1254 }
1255 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1256 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1257 };
1258 local_var_req_builder = local_var_req_builder.json(&organization_keys_request_model);
1259
1260 let local_var_req = local_var_req_builder.build()?;
1261 let local_var_resp = local_var_client.execute(local_var_req).await?;
1262
1263 let local_var_status = local_var_resp.status();
1264 let local_var_content_type = local_var_resp
1265 .headers()
1266 .get("content-type")
1267 .and_then(|v| v.to_str().ok())
1268 .unwrap_or("application/octet-stream");
1269 let local_var_content_type = super::ContentType::from(local_var_content_type);
1270 let local_var_content = local_var_resp.text().await?;
1271
1272 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1273 match local_var_content_type {
1274 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1275 ContentType::Text => {
1276 return Err(Error::from(serde_json::Error::custom(
1277 "Received `text/plain` content type response that cannot be converted to `models::OrganizationKeysResponseModel`",
1278 )));
1279 }
1280 ContentType::Unsupported(local_var_unknown_type) => {
1281 return Err(Error::from(serde_json::Error::custom(format!(
1282 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationKeysResponseModel`"
1283 ))));
1284 }
1285 }
1286 } else {
1287 let local_var_entity: Option<PostKeysError> =
1288 serde_json::from_str(&local_var_content).ok();
1289 let local_var_error = ResponseContent {
1290 status: local_var_status,
1291 content: local_var_content,
1292 entity: local_var_entity,
1293 };
1294 Err(Error::ResponseError(local_var_error))
1295 }
1296 }
1297
1298 async fn post_reinstate<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PostReinstateError>> {
1299 let local_var_configuration = &self.configuration;
1300
1301 let local_var_client = &local_var_configuration.client;
1302
1303 let local_var_uri_str = format!(
1304 "{}/organizations/{id}/reinstate",
1305 local_var_configuration.base_path,
1306 id = id
1307 );
1308 let mut local_var_req_builder =
1309 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1310
1311 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1312 local_var_req_builder = local_var_req_builder
1313 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1314 }
1315 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1316 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1317 };
1318
1319 let local_var_req = local_var_req_builder.build()?;
1320 let local_var_resp = local_var_client.execute(local_var_req).await?;
1321
1322 let local_var_status = local_var_resp.status();
1323 let local_var_content = local_var_resp.text().await?;
1324
1325 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1326 Ok(())
1327 } else {
1328 let local_var_entity: Option<PostReinstateError> =
1329 serde_json::from_str(&local_var_content).ok();
1330 let local_var_error = ResponseContent {
1331 status: local_var_status,
1332 content: local_var_content,
1333 entity: local_var_entity,
1334 };
1335 Err(Error::ResponseError(local_var_error))
1336 }
1337 }
1338
1339 async fn post_seat<'a>(
1340 &self,
1341 id: uuid::Uuid,
1342 organization_seat_request_model: Option<models::OrganizationSeatRequestModel>,
1343 ) -> Result<models::PaymentResponseModel, Error<PostSeatError>> {
1344 let local_var_configuration = &self.configuration;
1345
1346 let local_var_client = &local_var_configuration.client;
1347
1348 let local_var_uri_str = format!(
1349 "{}/organizations/{id}/seat",
1350 local_var_configuration.base_path,
1351 id = id
1352 );
1353 let mut local_var_req_builder =
1354 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1355
1356 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1357 local_var_req_builder = local_var_req_builder
1358 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1359 }
1360 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1361 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1362 };
1363 local_var_req_builder = local_var_req_builder.json(&organization_seat_request_model);
1364
1365 let local_var_req = local_var_req_builder.build()?;
1366 let local_var_resp = local_var_client.execute(local_var_req).await?;
1367
1368 let local_var_status = local_var_resp.status();
1369 let local_var_content_type = local_var_resp
1370 .headers()
1371 .get("content-type")
1372 .and_then(|v| v.to_str().ok())
1373 .unwrap_or("application/octet-stream");
1374 let local_var_content_type = super::ContentType::from(local_var_content_type);
1375 let local_var_content = local_var_resp.text().await?;
1376
1377 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1378 match local_var_content_type {
1379 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1380 ContentType::Text => {
1381 return Err(Error::from(serde_json::Error::custom(
1382 "Received `text/plain` content type response that cannot be converted to `models::PaymentResponseModel`",
1383 )));
1384 }
1385 ContentType::Unsupported(local_var_unknown_type) => {
1386 return Err(Error::from(serde_json::Error::custom(format!(
1387 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PaymentResponseModel`"
1388 ))));
1389 }
1390 }
1391 } else {
1392 let local_var_entity: Option<PostSeatError> =
1393 serde_json::from_str(&local_var_content).ok();
1394 let local_var_error = ResponseContent {
1395 status: local_var_status,
1396 content: local_var_content,
1397 entity: local_var_entity,
1398 };
1399 Err(Error::ResponseError(local_var_error))
1400 }
1401 }
1402
1403 async fn post_sm_subscription<'a>(
1404 &self,
1405 id: uuid::Uuid,
1406 secrets_manager_subscription_update_request_model: Option<
1407 models::SecretsManagerSubscriptionUpdateRequestModel,
1408 >,
1409 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSmSubscriptionError>> {
1410 let local_var_configuration = &self.configuration;
1411
1412 let local_var_client = &local_var_configuration.client;
1413
1414 let local_var_uri_str = format!(
1415 "{}/organizations/{id}/sm-subscription",
1416 local_var_configuration.base_path,
1417 id = id
1418 );
1419 let mut local_var_req_builder =
1420 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1421
1422 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1423 local_var_req_builder = local_var_req_builder
1424 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1425 }
1426 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1427 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1428 };
1429 local_var_req_builder =
1430 local_var_req_builder.json(&secrets_manager_subscription_update_request_model);
1431
1432 let local_var_req = local_var_req_builder.build()?;
1433 let local_var_resp = local_var_client.execute(local_var_req).await?;
1434
1435 let local_var_status = local_var_resp.status();
1436 let local_var_content_type = local_var_resp
1437 .headers()
1438 .get("content-type")
1439 .and_then(|v| v.to_str().ok())
1440 .unwrap_or("application/octet-stream");
1441 let local_var_content_type = super::ContentType::from(local_var_content_type);
1442 let local_var_content = local_var_resp.text().await?;
1443
1444 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1445 match local_var_content_type {
1446 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1447 ContentType::Text => {
1448 return Err(Error::from(serde_json::Error::custom(
1449 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`",
1450 )));
1451 }
1452 ContentType::Unsupported(local_var_unknown_type) => {
1453 return Err(Error::from(serde_json::Error::custom(format!(
1454 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`"
1455 ))));
1456 }
1457 }
1458 } else {
1459 let local_var_entity: Option<PostSmSubscriptionError> =
1460 serde_json::from_str(&local_var_content).ok();
1461 let local_var_error = ResponseContent {
1462 status: local_var_status,
1463 content: local_var_content,
1464 entity: local_var_entity,
1465 };
1466 Err(Error::ResponseError(local_var_error))
1467 }
1468 }
1469
1470 async fn post_sso<'a>(
1471 &self,
1472 id: uuid::Uuid,
1473 organization_sso_request_model: Option<models::OrganizationSsoRequestModel>,
1474 ) -> Result<models::OrganizationSsoResponseModel, Error<PostSsoError>> {
1475 let local_var_configuration = &self.configuration;
1476
1477 let local_var_client = &local_var_configuration.client;
1478
1479 let local_var_uri_str = format!(
1480 "{}/organizations/{id}/sso",
1481 local_var_configuration.base_path,
1482 id = id
1483 );
1484 let mut local_var_req_builder =
1485 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1486
1487 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1488 local_var_req_builder = local_var_req_builder
1489 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1490 }
1491 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1492 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1493 };
1494 local_var_req_builder = local_var_req_builder.json(&organization_sso_request_model);
1495
1496 let local_var_req = local_var_req_builder.build()?;
1497 let local_var_resp = local_var_client.execute(local_var_req).await?;
1498
1499 let local_var_status = local_var_resp.status();
1500 let local_var_content_type = local_var_resp
1501 .headers()
1502 .get("content-type")
1503 .and_then(|v| v.to_str().ok())
1504 .unwrap_or("application/octet-stream");
1505 let local_var_content_type = super::ContentType::from(local_var_content_type);
1506 let local_var_content = local_var_resp.text().await?;
1507
1508 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1509 match local_var_content_type {
1510 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1511 ContentType::Text => {
1512 return Err(Error::from(serde_json::Error::custom(
1513 "Received `text/plain` content type response that cannot be converted to `models::OrganizationSsoResponseModel`",
1514 )));
1515 }
1516 ContentType::Unsupported(local_var_unknown_type) => {
1517 return Err(Error::from(serde_json::Error::custom(format!(
1518 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationSsoResponseModel`"
1519 ))));
1520 }
1521 }
1522 } else {
1523 let local_var_entity: Option<PostSsoError> =
1524 serde_json::from_str(&local_var_content).ok();
1525 let local_var_error = ResponseContent {
1526 status: local_var_status,
1527 content: local_var_content,
1528 entity: local_var_entity,
1529 };
1530 Err(Error::ResponseError(local_var_error))
1531 }
1532 }
1533
1534 async fn post_storage<'a>(
1535 &self,
1536 id: &'a str,
1537 storage_request_model: Option<models::StorageRequestModel>,
1538 ) -> Result<models::PaymentResponseModel, Error<PostStorageError>> {
1539 let local_var_configuration = &self.configuration;
1540
1541 let local_var_client = &local_var_configuration.client;
1542
1543 let local_var_uri_str = format!(
1544 "{}/organizations/{id}/storage",
1545 local_var_configuration.base_path,
1546 id = crate::apis::urlencode(id)
1547 );
1548 let mut local_var_req_builder =
1549 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1550
1551 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1552 local_var_req_builder = local_var_req_builder
1553 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1554 }
1555 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1556 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1557 };
1558 local_var_req_builder = local_var_req_builder.json(&storage_request_model);
1559
1560 let local_var_req = local_var_req_builder.build()?;
1561 let local_var_resp = local_var_client.execute(local_var_req).await?;
1562
1563 let local_var_status = local_var_resp.status();
1564 let local_var_content_type = local_var_resp
1565 .headers()
1566 .get("content-type")
1567 .and_then(|v| v.to_str().ok())
1568 .unwrap_or("application/octet-stream");
1569 let local_var_content_type = super::ContentType::from(local_var_content_type);
1570 let local_var_content = local_var_resp.text().await?;
1571
1572 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1573 match local_var_content_type {
1574 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1575 ContentType::Text => {
1576 return Err(Error::from(serde_json::Error::custom(
1577 "Received `text/plain` content type response that cannot be converted to `models::PaymentResponseModel`",
1578 )));
1579 }
1580 ContentType::Unsupported(local_var_unknown_type) => {
1581 return Err(Error::from(serde_json::Error::custom(format!(
1582 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PaymentResponseModel`"
1583 ))));
1584 }
1585 }
1586 } else {
1587 let local_var_entity: Option<PostStorageError> =
1588 serde_json::from_str(&local_var_content).ok();
1589 let local_var_error = ResponseContent {
1590 status: local_var_status,
1591 content: local_var_content,
1592 entity: local_var_entity,
1593 };
1594 Err(Error::ResponseError(local_var_error))
1595 }
1596 }
1597
1598 async fn post_subscribe_secrets_manager<'a>(
1599 &self,
1600 id: uuid::Uuid,
1601 secrets_manager_subscribe_request_model: Option<
1602 models::SecretsManagerSubscribeRequestModel,
1603 >,
1604 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscribeSecretsManagerError>>
1605 {
1606 let local_var_configuration = &self.configuration;
1607
1608 let local_var_client = &local_var_configuration.client;
1609
1610 let local_var_uri_str = format!(
1611 "{}/organizations/{id}/subscribe-secrets-manager",
1612 local_var_configuration.base_path,
1613 id = id
1614 );
1615 let mut local_var_req_builder =
1616 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1617
1618 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1619 local_var_req_builder = local_var_req_builder
1620 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1621 }
1622 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1623 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1624 };
1625 local_var_req_builder =
1626 local_var_req_builder.json(&secrets_manager_subscribe_request_model);
1627
1628 let local_var_req = local_var_req_builder.build()?;
1629 let local_var_resp = local_var_client.execute(local_var_req).await?;
1630
1631 let local_var_status = local_var_resp.status();
1632 let local_var_content_type = local_var_resp
1633 .headers()
1634 .get("content-type")
1635 .and_then(|v| v.to_str().ok())
1636 .unwrap_or("application/octet-stream");
1637 let local_var_content_type = super::ContentType::from(local_var_content_type);
1638 let local_var_content = local_var_resp.text().await?;
1639
1640 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1641 match local_var_content_type {
1642 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1643 ContentType::Text => {
1644 return Err(Error::from(serde_json::Error::custom(
1645 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`",
1646 )));
1647 }
1648 ContentType::Unsupported(local_var_unknown_type) => {
1649 return Err(Error::from(serde_json::Error::custom(format!(
1650 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`"
1651 ))));
1652 }
1653 }
1654 } else {
1655 let local_var_entity: Option<PostSubscribeSecretsManagerError> =
1656 serde_json::from_str(&local_var_content).ok();
1657 let local_var_error = ResponseContent {
1658 status: local_var_status,
1659 content: local_var_content,
1660 entity: local_var_entity,
1661 };
1662 Err(Error::ResponseError(local_var_error))
1663 }
1664 }
1665
1666 async fn post_subscription<'a>(
1667 &self,
1668 id: uuid::Uuid,
1669 organization_subscription_update_request_model: Option<
1670 models::OrganizationSubscriptionUpdateRequestModel,
1671 >,
1672 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscriptionError>> {
1673 let local_var_configuration = &self.configuration;
1674
1675 let local_var_client = &local_var_configuration.client;
1676
1677 let local_var_uri_str = format!(
1678 "{}/organizations/{id}/subscription",
1679 local_var_configuration.base_path,
1680 id = id
1681 );
1682 let mut local_var_req_builder =
1683 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1684
1685 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1686 local_var_req_builder = local_var_req_builder
1687 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1688 }
1689 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1690 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1691 };
1692 local_var_req_builder =
1693 local_var_req_builder.json(&organization_subscription_update_request_model);
1694
1695 let local_var_req = local_var_req_builder.build()?;
1696 let local_var_resp = local_var_client.execute(local_var_req).await?;
1697
1698 let local_var_status = local_var_resp.status();
1699 let local_var_content_type = local_var_resp
1700 .headers()
1701 .get("content-type")
1702 .and_then(|v| v.to_str().ok())
1703 .unwrap_or("application/octet-stream");
1704 let local_var_content_type = super::ContentType::from(local_var_content_type);
1705 let local_var_content = local_var_resp.text().await?;
1706
1707 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1708 match local_var_content_type {
1709 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1710 ContentType::Text => {
1711 return Err(Error::from(serde_json::Error::custom(
1712 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`",
1713 )));
1714 }
1715 ContentType::Unsupported(local_var_unknown_type) => {
1716 return Err(Error::from(serde_json::Error::custom(format!(
1717 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`"
1718 ))));
1719 }
1720 }
1721 } else {
1722 let local_var_entity: Option<PostSubscriptionError> =
1723 serde_json::from_str(&local_var_content).ok();
1724 let local_var_error = ResponseContent {
1725 status: local_var_status,
1726 content: local_var_content,
1727 entity: local_var_entity,
1728 };
1729 Err(Error::ResponseError(local_var_error))
1730 }
1731 }
1732
1733 async fn post_upgrade<'a>(
1734 &self,
1735 id: uuid::Uuid,
1736 organization_upgrade_request_model: Option<models::OrganizationUpgradeRequestModel>,
1737 ) -> Result<models::PaymentResponseModel, Error<PostUpgradeError>> {
1738 let local_var_configuration = &self.configuration;
1739
1740 let local_var_client = &local_var_configuration.client;
1741
1742 let local_var_uri_str = format!(
1743 "{}/organizations/{id}/upgrade",
1744 local_var_configuration.base_path,
1745 id = id
1746 );
1747 let mut local_var_req_builder =
1748 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1749
1750 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1751 local_var_req_builder = local_var_req_builder
1752 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1753 }
1754 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1755 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1756 };
1757 local_var_req_builder = local_var_req_builder.json(&organization_upgrade_request_model);
1758
1759 let local_var_req = local_var_req_builder.build()?;
1760 let local_var_resp = local_var_client.execute(local_var_req).await?;
1761
1762 let local_var_status = local_var_resp.status();
1763 let local_var_content_type = local_var_resp
1764 .headers()
1765 .get("content-type")
1766 .and_then(|v| v.to_str().ok())
1767 .unwrap_or("application/octet-stream");
1768 let local_var_content_type = super::ContentType::from(local_var_content_type);
1769 let local_var_content = local_var_resp.text().await?;
1770
1771 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1772 match local_var_content_type {
1773 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1774 ContentType::Text => {
1775 return Err(Error::from(serde_json::Error::custom(
1776 "Received `text/plain` content type response that cannot be converted to `models::PaymentResponseModel`",
1777 )));
1778 }
1779 ContentType::Unsupported(local_var_unknown_type) => {
1780 return Err(Error::from(serde_json::Error::custom(format!(
1781 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PaymentResponseModel`"
1782 ))));
1783 }
1784 }
1785 } else {
1786 let local_var_entity: Option<PostUpgradeError> =
1787 serde_json::from_str(&local_var_content).ok();
1788 let local_var_error = ResponseContent {
1789 status: local_var_status,
1790 content: local_var_content,
1791 entity: local_var_entity,
1792 };
1793 Err(Error::ResponseError(local_var_error))
1794 }
1795 }
1796
1797 async fn put<'a>(
1798 &self,
1799 id: &'a str,
1800 organization_update_request_model: Option<models::OrganizationUpdateRequestModel>,
1801 ) -> Result<models::OrganizationResponseModel, Error<PutError>> {
1802 let local_var_configuration = &self.configuration;
1803
1804 let local_var_client = &local_var_configuration.client;
1805
1806 let local_var_uri_str = format!(
1807 "{}/organizations/{id}",
1808 local_var_configuration.base_path,
1809 id = crate::apis::urlencode(id)
1810 );
1811 let mut local_var_req_builder =
1812 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1813
1814 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1815 local_var_req_builder = local_var_req_builder
1816 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1817 }
1818 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1819 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1820 };
1821 local_var_req_builder = local_var_req_builder.json(&organization_update_request_model);
1822
1823 let local_var_req = local_var_req_builder.build()?;
1824 let local_var_resp = local_var_client.execute(local_var_req).await?;
1825
1826 let local_var_status = local_var_resp.status();
1827 let local_var_content_type = local_var_resp
1828 .headers()
1829 .get("content-type")
1830 .and_then(|v| v.to_str().ok())
1831 .unwrap_or("application/octet-stream");
1832 let local_var_content_type = super::ContentType::from(local_var_content_type);
1833 let local_var_content = local_var_resp.text().await?;
1834
1835 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1836 match local_var_content_type {
1837 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1838 ContentType::Text => {
1839 return Err(Error::from(serde_json::Error::custom(
1840 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
1841 )));
1842 }
1843 ContentType::Unsupported(local_var_unknown_type) => {
1844 return Err(Error::from(serde_json::Error::custom(format!(
1845 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
1846 ))));
1847 }
1848 }
1849 } else {
1850 let local_var_entity: Option<PutError> = serde_json::from_str(&local_var_content).ok();
1851 let local_var_error = ResponseContent {
1852 status: local_var_status,
1853 content: local_var_content,
1854 entity: local_var_entity,
1855 };
1856 Err(Error::ResponseError(local_var_error))
1857 }
1858 }
1859
1860 async fn put_collection_management<'a>(
1861 &self,
1862 id: uuid::Uuid,
1863 organization_collection_management_update_request_model: Option<
1864 models::OrganizationCollectionManagementUpdateRequestModel,
1865 >,
1866 ) -> Result<models::OrganizationResponseModel, Error<PutCollectionManagementError>> {
1867 let local_var_configuration = &self.configuration;
1868
1869 let local_var_client = &local_var_configuration.client;
1870
1871 let local_var_uri_str = format!(
1872 "{}/organizations/{id}/collection-management",
1873 local_var_configuration.base_path,
1874 id = id
1875 );
1876 let mut local_var_req_builder =
1877 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1878
1879 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1880 local_var_req_builder = local_var_req_builder
1881 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1882 }
1883 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1884 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1885 };
1886 local_var_req_builder =
1887 local_var_req_builder.json(&organization_collection_management_update_request_model);
1888
1889 let local_var_req = local_var_req_builder.build()?;
1890 let local_var_resp = local_var_client.execute(local_var_req).await?;
1891
1892 let local_var_status = local_var_resp.status();
1893 let local_var_content_type = local_var_resp
1894 .headers()
1895 .get("content-type")
1896 .and_then(|v| v.to_str().ok())
1897 .unwrap_or("application/octet-stream");
1898 let local_var_content_type = super::ContentType::from(local_var_content_type);
1899 let local_var_content = local_var_resp.text().await?;
1900
1901 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1902 match local_var_content_type {
1903 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1904 ContentType::Text => {
1905 return Err(Error::from(serde_json::Error::custom(
1906 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
1907 )));
1908 }
1909 ContentType::Unsupported(local_var_unknown_type) => {
1910 return Err(Error::from(serde_json::Error::custom(format!(
1911 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
1912 ))));
1913 }
1914 }
1915 } else {
1916 let local_var_entity: Option<PutCollectionManagementError> =
1917 serde_json::from_str(&local_var_content).ok();
1918 let local_var_error = ResponseContent {
1919 status: local_var_status,
1920 content: local_var_content,
1921 entity: local_var_entity,
1922 };
1923 Err(Error::ResponseError(local_var_error))
1924 }
1925 }
1926
1927 async fn put_tax_info<'a>(
1928 &self,
1929 id: uuid::Uuid,
1930 expanded_tax_info_update_request_model: Option<models::ExpandedTaxInfoUpdateRequestModel>,
1931 ) -> Result<(), Error<PutTaxInfoError>> {
1932 let local_var_configuration = &self.configuration;
1933
1934 let local_var_client = &local_var_configuration.client;
1935
1936 let local_var_uri_str = format!(
1937 "{}/organizations/{id}/tax",
1938 local_var_configuration.base_path,
1939 id = id
1940 );
1941 let mut local_var_req_builder =
1942 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1943
1944 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1945 local_var_req_builder = local_var_req_builder
1946 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1947 }
1948 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1949 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1950 };
1951 local_var_req_builder = local_var_req_builder.json(&expanded_tax_info_update_request_model);
1952
1953 let local_var_req = local_var_req_builder.build()?;
1954 let local_var_resp = local_var_client.execute(local_var_req).await?;
1955
1956 let local_var_status = local_var_resp.status();
1957 let local_var_content = local_var_resp.text().await?;
1958
1959 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1960 Ok(())
1961 } else {
1962 let local_var_entity: Option<PutTaxInfoError> =
1963 serde_json::from_str(&local_var_content).ok();
1964 let local_var_error = ResponseContent {
1965 status: local_var_status,
1966 content: local_var_content,
1967 entity: local_var_entity,
1968 };
1969 Err(Error::ResponseError(local_var_error))
1970 }
1971 }
1972
1973 async fn rotate_api_key<'a>(
1974 &self,
1975 id: &'a str,
1976 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
1977 ) -> Result<models::ApiKeyResponseModel, Error<RotateApiKeyError>> {
1978 let local_var_configuration = &self.configuration;
1979
1980 let local_var_client = &local_var_configuration.client;
1981
1982 let local_var_uri_str = format!(
1983 "{}/organizations/{id}/rotate-api-key",
1984 local_var_configuration.base_path,
1985 id = crate::apis::urlencode(id)
1986 );
1987 let mut local_var_req_builder =
1988 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1989
1990 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1991 local_var_req_builder = local_var_req_builder
1992 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1993 }
1994 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1995 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1996 };
1997 local_var_req_builder = local_var_req_builder.json(&organization_api_key_request_model);
1998
1999 let local_var_req = local_var_req_builder.build()?;
2000 let local_var_resp = local_var_client.execute(local_var_req).await?;
2001
2002 let local_var_status = local_var_resp.status();
2003 let local_var_content_type = local_var_resp
2004 .headers()
2005 .get("content-type")
2006 .and_then(|v| v.to_str().ok())
2007 .unwrap_or("application/octet-stream");
2008 let local_var_content_type = super::ContentType::from(local_var_content_type);
2009 let local_var_content = local_var_resp.text().await?;
2010
2011 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2012 match local_var_content_type {
2013 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2014 ContentType::Text => {
2015 return Err(Error::from(serde_json::Error::custom(
2016 "Received `text/plain` content type response that cannot be converted to `models::ApiKeyResponseModel`",
2017 )));
2018 }
2019 ContentType::Unsupported(local_var_unknown_type) => {
2020 return Err(Error::from(serde_json::Error::custom(format!(
2021 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ApiKeyResponseModel`"
2022 ))));
2023 }
2024 }
2025 } else {
2026 let local_var_entity: Option<RotateApiKeyError> =
2027 serde_json::from_str(&local_var_content).ok();
2028 let local_var_error = ResponseContent {
2029 status: local_var_status,
2030 content: local_var_content,
2031 entity: local_var_entity,
2032 };
2033 Err(Error::ResponseError(local_var_error))
2034 }
2035 }
2036}
2037
2038#[derive(Debug, Clone, Serialize, Deserialize)]
2040#[serde(untagged)]
2041pub enum ApiKeyError {
2042 UnknownValue(serde_json::Value),
2043}
2044#[derive(Debug, Clone, Serialize, Deserialize)]
2046#[serde(untagged)]
2047pub enum ApiKeyInformationError {
2048 UnknownValue(serde_json::Value),
2049}
2050#[derive(Debug, Clone, Serialize, Deserialize)]
2052#[serde(untagged)]
2053pub enum CreateWithoutPaymentError {
2054 UnknownValue(serde_json::Value),
2055}
2056#[derive(Debug, Clone, Serialize, Deserialize)]
2058#[serde(untagged)]
2059pub enum DeleteError {
2060 UnknownValue(serde_json::Value),
2061}
2062#[derive(Debug, Clone, Serialize, Deserialize)]
2064#[serde(untagged)]
2065pub enum GetError {
2066 UnknownValue(serde_json::Value),
2067}
2068#[derive(Debug, Clone, Serialize, Deserialize)]
2070#[serde(untagged)]
2071pub enum GetAutoEnrollStatusError {
2072 UnknownValue(serde_json::Value),
2073}
2074#[derive(Debug, Clone, Serialize, Deserialize)]
2076#[serde(untagged)]
2077pub enum GetLicenseError {
2078 UnknownValue(serde_json::Value),
2079}
2080#[derive(Debug, Clone, Serialize, Deserialize)]
2082#[serde(untagged)]
2083pub enum GetPlanTypeError {
2084 UnknownValue(serde_json::Value),
2085}
2086#[derive(Debug, Clone, Serialize, Deserialize)]
2088#[serde(untagged)]
2089pub enum GetPublicKeyError {
2090 UnknownValue(serde_json::Value),
2091}
2092#[derive(Debug, Clone, Serialize, Deserialize)]
2094#[serde(untagged)]
2095pub enum GetSsoError {
2096 UnknownValue(serde_json::Value),
2097}
2098#[derive(Debug, Clone, Serialize, Deserialize)]
2100#[serde(untagged)]
2101pub enum GetSubscriptionError {
2102 UnknownValue(serde_json::Value),
2103}
2104#[derive(Debug, Clone, Serialize, Deserialize)]
2106#[serde(untagged)]
2107pub enum GetTaxInfoError {
2108 UnknownValue(serde_json::Value),
2109}
2110#[derive(Debug, Clone, Serialize, Deserialize)]
2112#[serde(untagged)]
2113pub enum GetUserError {
2114 UnknownValue(serde_json::Value),
2115}
2116#[derive(Debug, Clone, Serialize, Deserialize)]
2118#[serde(untagged)]
2119pub enum LeaveError {
2120 UnknownValue(serde_json::Value),
2121}
2122#[derive(Debug, Clone, Serialize, Deserialize)]
2124#[serde(untagged)]
2125pub enum PostError {
2126 UnknownValue(serde_json::Value),
2127}
2128#[derive(Debug, Clone, Serialize, Deserialize)]
2130#[serde(untagged)]
2131pub enum PostCancelError {
2132 UnknownValue(serde_json::Value),
2133}
2134#[derive(Debug, Clone, Serialize, Deserialize)]
2136#[serde(untagged)]
2137pub enum PostDeleteRecoverTokenError {
2138 UnknownValue(serde_json::Value),
2139}
2140#[derive(Debug, Clone, Serialize, Deserialize)]
2142#[serde(untagged)]
2143pub enum PostKeysError {
2144 UnknownValue(serde_json::Value),
2145}
2146#[derive(Debug, Clone, Serialize, Deserialize)]
2148#[serde(untagged)]
2149pub enum PostReinstateError {
2150 UnknownValue(serde_json::Value),
2151}
2152#[derive(Debug, Clone, Serialize, Deserialize)]
2154#[serde(untagged)]
2155pub enum PostSeatError {
2156 UnknownValue(serde_json::Value),
2157}
2158#[derive(Debug, Clone, Serialize, Deserialize)]
2160#[serde(untagged)]
2161pub enum PostSmSubscriptionError {
2162 UnknownValue(serde_json::Value),
2163}
2164#[derive(Debug, Clone, Serialize, Deserialize)]
2166#[serde(untagged)]
2167pub enum PostSsoError {
2168 UnknownValue(serde_json::Value),
2169}
2170#[derive(Debug, Clone, Serialize, Deserialize)]
2172#[serde(untagged)]
2173pub enum PostStorageError {
2174 UnknownValue(serde_json::Value),
2175}
2176#[derive(Debug, Clone, Serialize, Deserialize)]
2178#[serde(untagged)]
2179pub enum PostSubscribeSecretsManagerError {
2180 UnknownValue(serde_json::Value),
2181}
2182#[derive(Debug, Clone, Serialize, Deserialize)]
2184#[serde(untagged)]
2185pub enum PostSubscriptionError {
2186 UnknownValue(serde_json::Value),
2187}
2188#[derive(Debug, Clone, Serialize, Deserialize)]
2190#[serde(untagged)]
2191pub enum PostUpgradeError {
2192 UnknownValue(serde_json::Value),
2193}
2194#[derive(Debug, Clone, Serialize, Deserialize)]
2196#[serde(untagged)]
2197pub enum PutError {
2198 UnknownValue(serde_json::Value),
2199}
2200#[derive(Debug, Clone, Serialize, Deserialize)]
2202#[serde(untagged)]
2203pub enum PutCollectionManagementError {
2204 UnknownValue(serde_json::Value),
2205}
2206#[derive(Debug, Clone, Serialize, Deserialize)]
2208#[serde(untagged)]
2209pub enum PutTaxInfoError {
2210 UnknownValue(serde_json::Value),
2211}
2212#[derive(Debug, Clone, Serialize, Deserialize)]
2214#[serde(untagged)]
2215pub enum RotateApiKeyError {
2216 UnknownValue(serde_json::Value),
2217}