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