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::{AuthRequired, 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_user(
101 &self,
102 ) -> Result<models::ProfileOrganizationResponseModelListResponseModel, Error<GetUserError>>;
103
104 async fn leave<'a>(&self, id: uuid::Uuid) -> Result<(), Error<LeaveError>>;
106
107 async fn post<'a>(
109 &self,
110 organization_create_request_model: Option<models::OrganizationCreateRequestModel>,
111 ) -> Result<models::OrganizationResponseModel, Error<PostError>>;
112
113 async fn post_cancel<'a>(
115 &self,
116 id: uuid::Uuid,
117 subscription_cancellation_request_model: Option<
118 models::SubscriptionCancellationRequestModel,
119 >,
120 ) -> Result<(), Error<PostCancelError>>;
121
122 async fn post_delete_recover_token<'a>(
124 &self,
125 id: uuid::Uuid,
126 organization_verify_delete_recover_request_model: Option<
127 models::OrganizationVerifyDeleteRecoverRequestModel,
128 >,
129 ) -> Result<(), Error<PostDeleteRecoverTokenError>>;
130
131 async fn post_keys<'a>(
133 &self,
134 id: uuid::Uuid,
135 organization_keys_request_model: Option<models::OrganizationKeysRequestModel>,
136 ) -> Result<models::OrganizationKeysResponseModel, Error<PostKeysError>>;
137
138 async fn post_reinstate<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PostReinstateError>>;
140
141 async fn post_seat<'a>(
143 &self,
144 id: uuid::Uuid,
145 organization_seat_request_model: Option<models::OrganizationSeatRequestModel>,
146 ) -> Result<models::PaymentResponseModel, Error<PostSeatError>>;
147
148 async fn post_sm_subscription<'a>(
150 &self,
151 id: uuid::Uuid,
152 secrets_manager_subscription_update_request_model: Option<
153 models::SecretsManagerSubscriptionUpdateRequestModel,
154 >,
155 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSmSubscriptionError>>;
156
157 async fn post_sso<'a>(
159 &self,
160 id: uuid::Uuid,
161 organization_sso_request_model: Option<models::OrganizationSsoRequestModel>,
162 ) -> Result<models::OrganizationSsoResponseModel, Error<PostSsoError>>;
163
164 async fn post_storage<'a>(
166 &self,
167 id: &'a str,
168 storage_request_model: Option<models::StorageRequestModel>,
169 ) -> Result<models::PaymentResponseModel, Error<PostStorageError>>;
170
171 async fn post_subscribe_secrets_manager<'a>(
173 &self,
174 id: uuid::Uuid,
175 secrets_manager_subscribe_request_model: Option<
176 models::SecretsManagerSubscribeRequestModel,
177 >,
178 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscribeSecretsManagerError>>;
179
180 async fn post_subscription<'a>(
182 &self,
183 id: uuid::Uuid,
184 organization_subscription_update_request_model: Option<
185 models::OrganizationSubscriptionUpdateRequestModel,
186 >,
187 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscriptionError>>;
188
189 async fn post_upgrade<'a>(
191 &self,
192 id: uuid::Uuid,
193 organization_upgrade_request_model: Option<models::OrganizationUpgradeRequestModel>,
194 ) -> Result<models::PaymentResponseModel, Error<PostUpgradeError>>;
195
196 async fn put<'a>(
198 &self,
199 organization_id: uuid::Uuid,
200 organization_update_request_model: Option<models::OrganizationUpdateRequestModel>,
201 ) -> Result<(), Error<PutError>>;
202
203 async fn put_collection_management<'a>(
205 &self,
206 id: uuid::Uuid,
207 organization_collection_management_update_request_model: Option<
208 models::OrganizationCollectionManagementUpdateRequestModel,
209 >,
210 ) -> Result<models::OrganizationResponseModel, Error<PutCollectionManagementError>>;
211
212 async fn rotate_api_key<'a>(
214 &self,
215 id: &'a str,
216 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
217 ) -> Result<models::ApiKeyResponseModel, Error<RotateApiKeyError>>;
218}
219
220pub struct OrganizationsApiClient {
221 configuration: Arc<configuration::Configuration>,
222}
223
224impl OrganizationsApiClient {
225 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
226 Self { configuration }
227 }
228}
229
230#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
231#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
232impl OrganizationsApi for OrganizationsApiClient {
233 async fn api_key<'a>(
234 &self,
235 id: &'a str,
236 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
237 ) -> Result<models::ApiKeyResponseModel, Error<ApiKeyError>> {
238 let local_var_configuration = &self.configuration;
239
240 let local_var_client = &local_var_configuration.client;
241
242 let local_var_uri_str = format!(
243 "{}/organizations/{id}/api-key",
244 local_var_configuration.base_path,
245 id = crate::apis::urlencode(id)
246 );
247 let mut local_var_req_builder =
248 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
249
250 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
251 local_var_req_builder = local_var_req_builder.json(&organization_api_key_request_model);
252
253 let local_var_resp = local_var_req_builder.send().await?;
254
255 let local_var_status = local_var_resp.status();
256 let local_var_content_type = local_var_resp
257 .headers()
258 .get("content-type")
259 .and_then(|v| v.to_str().ok())
260 .unwrap_or("application/octet-stream");
261 let local_var_content_type = super::ContentType::from(local_var_content_type);
262 let local_var_content = local_var_resp.text().await?;
263
264 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
265 match local_var_content_type {
266 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
267 ContentType::Text => {
268 return Err(Error::from(serde_json::Error::custom(
269 "Received `text/plain` content type response that cannot be converted to `models::ApiKeyResponseModel`",
270 )));
271 }
272 ContentType::Unsupported(local_var_unknown_type) => {
273 return Err(Error::from(serde_json::Error::custom(format!(
274 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ApiKeyResponseModel`"
275 ))));
276 }
277 }
278 } else {
279 let local_var_entity: Option<ApiKeyError> =
280 serde_json::from_str(&local_var_content).ok();
281 let local_var_error = ResponseContent {
282 status: local_var_status,
283 content: local_var_content,
284 entity: local_var_entity,
285 };
286 Err(Error::ResponseError(local_var_error))
287 }
288 }
289
290 async fn api_key_information<'a>(
291 &self,
292 id: uuid::Uuid,
293 r#type: models::OrganizationApiKeyType,
294 ) -> Result<models::OrganizationApiKeyInformationListResponseModel, Error<ApiKeyInformationError>>
295 {
296 let local_var_configuration = &self.configuration;
297
298 let local_var_client = &local_var_configuration.client;
299
300 let local_var_uri_str = format!("{}/organizations/{id}/api-key-information/{type}", local_var_configuration.base_path, id=id, type=r#type.to_string());
301 let mut local_var_req_builder =
302 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
303
304 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
305
306 let local_var_resp = local_var_req_builder.send().await?;
307
308 let local_var_status = local_var_resp.status();
309 let local_var_content_type = local_var_resp
310 .headers()
311 .get("content-type")
312 .and_then(|v| v.to_str().ok())
313 .unwrap_or("application/octet-stream");
314 let local_var_content_type = super::ContentType::from(local_var_content_type);
315 let local_var_content = local_var_resp.text().await?;
316
317 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
318 match local_var_content_type {
319 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
320 ContentType::Text => {
321 return Err(Error::from(serde_json::Error::custom(
322 "Received `text/plain` content type response that cannot be converted to `models::OrganizationApiKeyInformationListResponseModel`",
323 )));
324 }
325 ContentType::Unsupported(local_var_unknown_type) => {
326 return Err(Error::from(serde_json::Error::custom(format!(
327 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationApiKeyInformationListResponseModel`"
328 ))));
329 }
330 }
331 } else {
332 let local_var_entity: Option<ApiKeyInformationError> =
333 serde_json::from_str(&local_var_content).ok();
334 let local_var_error = ResponseContent {
335 status: local_var_status,
336 content: local_var_content,
337 entity: local_var_entity,
338 };
339 Err(Error::ResponseError(local_var_error))
340 }
341 }
342
343 async fn create_without_payment<'a>(
344 &self,
345 organization_no_payment_create_request: Option<models::OrganizationNoPaymentCreateRequest>,
346 ) -> Result<models::OrganizationResponseModel, Error<CreateWithoutPaymentError>> {
347 let local_var_configuration = &self.configuration;
348
349 let local_var_client = &local_var_configuration.client;
350
351 let local_var_uri_str = format!(
352 "{}/organizations/create-without-payment",
353 local_var_configuration.base_path
354 );
355 let mut local_var_req_builder =
356 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
357
358 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
359 local_var_req_builder = local_var_req_builder.json(&organization_no_payment_create_request);
360
361 let local_var_resp = local_var_req_builder.send().await?;
362
363 let local_var_status = local_var_resp.status();
364 let local_var_content_type = local_var_resp
365 .headers()
366 .get("content-type")
367 .and_then(|v| v.to_str().ok())
368 .unwrap_or("application/octet-stream");
369 let local_var_content_type = super::ContentType::from(local_var_content_type);
370 let local_var_content = local_var_resp.text().await?;
371
372 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
373 match local_var_content_type {
374 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
375 ContentType::Text => {
376 return Err(Error::from(serde_json::Error::custom(
377 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
378 )));
379 }
380 ContentType::Unsupported(local_var_unknown_type) => {
381 return Err(Error::from(serde_json::Error::custom(format!(
382 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
383 ))));
384 }
385 }
386 } else {
387 let local_var_entity: Option<CreateWithoutPaymentError> =
388 serde_json::from_str(&local_var_content).ok();
389 let local_var_error = ResponseContent {
390 status: local_var_status,
391 content: local_var_content,
392 entity: local_var_entity,
393 };
394 Err(Error::ResponseError(local_var_error))
395 }
396 }
397
398 async fn delete<'a>(
399 &self,
400 id: &'a str,
401 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
402 ) -> Result<(), Error<DeleteError>> {
403 let local_var_configuration = &self.configuration;
404
405 let local_var_client = &local_var_configuration.client;
406
407 let local_var_uri_str = format!(
408 "{}/organizations/{id}",
409 local_var_configuration.base_path,
410 id = crate::apis::urlencode(id)
411 );
412 let mut local_var_req_builder =
413 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
414
415 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
416 local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model);
417
418 let local_var_resp = local_var_req_builder.send().await?;
419
420 let local_var_status = local_var_resp.status();
421 let local_var_content = local_var_resp.text().await?;
422
423 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
424 Ok(())
425 } else {
426 let local_var_entity: Option<DeleteError> =
427 serde_json::from_str(&local_var_content).ok();
428 let local_var_error = ResponseContent {
429 status: local_var_status,
430 content: local_var_content,
431 entity: local_var_entity,
432 };
433 Err(Error::ResponseError(local_var_error))
434 }
435 }
436
437 async fn get<'a>(
438 &self,
439 id: &'a str,
440 ) -> Result<models::OrganizationResponseModel, Error<GetError>> {
441 let local_var_configuration = &self.configuration;
442
443 let local_var_client = &local_var_configuration.client;
444
445 let local_var_uri_str = format!(
446 "{}/organizations/{id}",
447 local_var_configuration.base_path,
448 id = crate::apis::urlencode(id)
449 );
450 let mut local_var_req_builder =
451 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
452
453 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
454
455 let local_var_resp = local_var_req_builder.send().await?;
456
457 let local_var_status = local_var_resp.status();
458 let local_var_content_type = local_var_resp
459 .headers()
460 .get("content-type")
461 .and_then(|v| v.to_str().ok())
462 .unwrap_or("application/octet-stream");
463 let local_var_content_type = super::ContentType::from(local_var_content_type);
464 let local_var_content = local_var_resp.text().await?;
465
466 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
467 match local_var_content_type {
468 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
469 ContentType::Text => {
470 return Err(Error::from(serde_json::Error::custom(
471 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
472 )));
473 }
474 ContentType::Unsupported(local_var_unknown_type) => {
475 return Err(Error::from(serde_json::Error::custom(format!(
476 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
477 ))));
478 }
479 }
480 } else {
481 let local_var_entity: Option<GetError> = serde_json::from_str(&local_var_content).ok();
482 let local_var_error = ResponseContent {
483 status: local_var_status,
484 content: local_var_content,
485 entity: local_var_entity,
486 };
487 Err(Error::ResponseError(local_var_error))
488 }
489 }
490
491 async fn get_auto_enroll_status<'a>(
492 &self,
493 identifier: &'a str,
494 ) -> Result<models::OrganizationAutoEnrollStatusResponseModel, Error<GetAutoEnrollStatusError>>
495 {
496 let local_var_configuration = &self.configuration;
497
498 let local_var_client = &local_var_configuration.client;
499
500 let local_var_uri_str = format!(
501 "{}/organizations/{identifier}/auto-enroll-status",
502 local_var_configuration.base_path,
503 identifier = crate::apis::urlencode(identifier)
504 );
505 let mut local_var_req_builder =
506 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
507
508 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
509
510 let local_var_resp = local_var_req_builder.send().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::OrganizationAutoEnrollStatusResponseModel`",
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::OrganizationAutoEnrollStatusResponseModel`"
532 ))));
533 }
534 }
535 } else {
536 let local_var_entity: Option<GetAutoEnrollStatusError> =
537 serde_json::from_str(&local_var_content).ok();
538 let local_var_error = ResponseContent {
539 status: local_var_status,
540 content: local_var_content,
541 entity: local_var_entity,
542 };
543 Err(Error::ResponseError(local_var_error))
544 }
545 }
546
547 async fn get_license<'a>(
548 &self,
549 id: uuid::Uuid,
550 installation_id: Option<uuid::Uuid>,
551 ) -> Result<models::OrganizationLicense, Error<GetLicenseError>> {
552 let local_var_configuration = &self.configuration;
553
554 let local_var_client = &local_var_configuration.client;
555
556 let local_var_uri_str = format!(
557 "{}/organizations/{id}/license",
558 local_var_configuration.base_path,
559 id = id
560 );
561 let mut local_var_req_builder =
562 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
563
564 if let Some(ref param_value) = installation_id {
565 local_var_req_builder =
566 local_var_req_builder.query(&[("installationId", ¶m_value.to_string())]);
567 }
568 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
569
570 let local_var_resp = local_var_req_builder.send().await?;
571
572 let local_var_status = local_var_resp.status();
573 let local_var_content_type = local_var_resp
574 .headers()
575 .get("content-type")
576 .and_then(|v| v.to_str().ok())
577 .unwrap_or("application/octet-stream");
578 let local_var_content_type = super::ContentType::from(local_var_content_type);
579 let local_var_content = local_var_resp.text().await?;
580
581 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
582 match local_var_content_type {
583 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
584 ContentType::Text => {
585 return Err(Error::from(serde_json::Error::custom(
586 "Received `text/plain` content type response that cannot be converted to `models::OrganizationLicense`",
587 )));
588 }
589 ContentType::Unsupported(local_var_unknown_type) => {
590 return Err(Error::from(serde_json::Error::custom(format!(
591 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationLicense`"
592 ))));
593 }
594 }
595 } else {
596 let local_var_entity: Option<GetLicenseError> =
597 serde_json::from_str(&local_var_content).ok();
598 let local_var_error = ResponseContent {
599 status: local_var_status,
600 content: local_var_content,
601 entity: local_var_entity,
602 };
603 Err(Error::ResponseError(local_var_error))
604 }
605 }
606
607 async fn get_plan_type<'a>(
608 &self,
609 id: &'a str,
610 ) -> Result<models::PlanType, Error<GetPlanTypeError>> {
611 let local_var_configuration = &self.configuration;
612
613 let local_var_client = &local_var_configuration.client;
614
615 let local_var_uri_str = format!(
616 "{}/organizations/{id}/plan-type",
617 local_var_configuration.base_path,
618 id = crate::apis::urlencode(id)
619 );
620 let mut local_var_req_builder =
621 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
622
623 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
624
625 let local_var_resp = local_var_req_builder.send().await?;
626
627 let local_var_status = local_var_resp.status();
628 let local_var_content_type = local_var_resp
629 .headers()
630 .get("content-type")
631 .and_then(|v| v.to_str().ok())
632 .unwrap_or("application/octet-stream");
633 let local_var_content_type = super::ContentType::from(local_var_content_type);
634 let local_var_content = local_var_resp.text().await?;
635
636 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
637 match local_var_content_type {
638 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
639 ContentType::Text => {
640 return Err(Error::from(serde_json::Error::custom(
641 "Received `text/plain` content type response that cannot be converted to `models::PlanType`",
642 )));
643 }
644 ContentType::Unsupported(local_var_unknown_type) => {
645 return Err(Error::from(serde_json::Error::custom(format!(
646 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PlanType`"
647 ))));
648 }
649 }
650 } else {
651 let local_var_entity: Option<GetPlanTypeError> =
652 serde_json::from_str(&local_var_content).ok();
653 let local_var_error = ResponseContent {
654 status: local_var_status,
655 content: local_var_content,
656 entity: local_var_entity,
657 };
658 Err(Error::ResponseError(local_var_error))
659 }
660 }
661
662 async fn get_public_key<'a>(
663 &self,
664 id: &'a str,
665 ) -> Result<models::OrganizationPublicKeyResponseModel, Error<GetPublicKeyError>> {
666 let local_var_configuration = &self.configuration;
667
668 let local_var_client = &local_var_configuration.client;
669
670 let local_var_uri_str = format!(
671 "{}/organizations/{id}/public-key",
672 local_var_configuration.base_path,
673 id = crate::apis::urlencode(id)
674 );
675 let mut local_var_req_builder =
676 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
677
678 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
679
680 let local_var_resp = local_var_req_builder.send().await?;
681
682 let local_var_status = local_var_resp.status();
683 let local_var_content_type = local_var_resp
684 .headers()
685 .get("content-type")
686 .and_then(|v| v.to_str().ok())
687 .unwrap_or("application/octet-stream");
688 let local_var_content_type = super::ContentType::from(local_var_content_type);
689 let local_var_content = local_var_resp.text().await?;
690
691 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
692 match local_var_content_type {
693 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
694 ContentType::Text => {
695 return Err(Error::from(serde_json::Error::custom(
696 "Received `text/plain` content type response that cannot be converted to `models::OrganizationPublicKeyResponseModel`",
697 )));
698 }
699 ContentType::Unsupported(local_var_unknown_type) => {
700 return Err(Error::from(serde_json::Error::custom(format!(
701 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationPublicKeyResponseModel`"
702 ))));
703 }
704 }
705 } else {
706 let local_var_entity: Option<GetPublicKeyError> =
707 serde_json::from_str(&local_var_content).ok();
708 let local_var_error = ResponseContent {
709 status: local_var_status,
710 content: local_var_content,
711 entity: local_var_entity,
712 };
713 Err(Error::ResponseError(local_var_error))
714 }
715 }
716
717 async fn get_sso<'a>(
718 &self,
719 id: uuid::Uuid,
720 ) -> Result<models::OrganizationSsoResponseModel, Error<GetSsoError>> {
721 let local_var_configuration = &self.configuration;
722
723 let local_var_client = &local_var_configuration.client;
724
725 let local_var_uri_str = format!(
726 "{}/organizations/{id}/sso",
727 local_var_configuration.base_path,
728 id = id
729 );
730 let mut local_var_req_builder =
731 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
732
733 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
734
735 let local_var_resp = local_var_req_builder.send().await?;
736
737 let local_var_status = local_var_resp.status();
738 let local_var_content_type = local_var_resp
739 .headers()
740 .get("content-type")
741 .and_then(|v| v.to_str().ok())
742 .unwrap_or("application/octet-stream");
743 let local_var_content_type = super::ContentType::from(local_var_content_type);
744 let local_var_content = local_var_resp.text().await?;
745
746 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
747 match local_var_content_type {
748 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
749 ContentType::Text => {
750 return Err(Error::from(serde_json::Error::custom(
751 "Received `text/plain` content type response that cannot be converted to `models::OrganizationSsoResponseModel`",
752 )));
753 }
754 ContentType::Unsupported(local_var_unknown_type) => {
755 return Err(Error::from(serde_json::Error::custom(format!(
756 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationSsoResponseModel`"
757 ))));
758 }
759 }
760 } else {
761 let local_var_entity: Option<GetSsoError> =
762 serde_json::from_str(&local_var_content).ok();
763 let local_var_error = ResponseContent {
764 status: local_var_status,
765 content: local_var_content,
766 entity: local_var_entity,
767 };
768 Err(Error::ResponseError(local_var_error))
769 }
770 }
771
772 async fn get_subscription<'a>(
773 &self,
774 id: uuid::Uuid,
775 ) -> Result<models::OrganizationSubscriptionResponseModel, Error<GetSubscriptionError>> {
776 let local_var_configuration = &self.configuration;
777
778 let local_var_client = &local_var_configuration.client;
779
780 let local_var_uri_str = format!(
781 "{}/organizations/{id}/subscription",
782 local_var_configuration.base_path,
783 id = id
784 );
785 let mut local_var_req_builder =
786 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
787
788 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
789
790 let local_var_resp = local_var_req_builder.send().await?;
791
792 let local_var_status = local_var_resp.status();
793 let local_var_content_type = local_var_resp
794 .headers()
795 .get("content-type")
796 .and_then(|v| v.to_str().ok())
797 .unwrap_or("application/octet-stream");
798 let local_var_content_type = super::ContentType::from(local_var_content_type);
799 let local_var_content = local_var_resp.text().await?;
800
801 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
802 match local_var_content_type {
803 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
804 ContentType::Text => {
805 return Err(Error::from(serde_json::Error::custom(
806 "Received `text/plain` content type response that cannot be converted to `models::OrganizationSubscriptionResponseModel`",
807 )));
808 }
809 ContentType::Unsupported(local_var_unknown_type) => {
810 return Err(Error::from(serde_json::Error::custom(format!(
811 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationSubscriptionResponseModel`"
812 ))));
813 }
814 }
815 } else {
816 let local_var_entity: Option<GetSubscriptionError> =
817 serde_json::from_str(&local_var_content).ok();
818 let local_var_error = ResponseContent {
819 status: local_var_status,
820 content: local_var_content,
821 entity: local_var_entity,
822 };
823 Err(Error::ResponseError(local_var_error))
824 }
825 }
826
827 async fn get_user(
828 &self,
829 ) -> Result<models::ProfileOrganizationResponseModelListResponseModel, Error<GetUserError>>
830 {
831 let local_var_configuration = &self.configuration;
832
833 let local_var_client = &local_var_configuration.client;
834
835 let local_var_uri_str = format!("{}/organizations", local_var_configuration.base_path);
836 let mut local_var_req_builder =
837 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
838
839 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
840
841 let local_var_resp = local_var_req_builder.send().await?;
842
843 let local_var_status = local_var_resp.status();
844 let local_var_content_type = local_var_resp
845 .headers()
846 .get("content-type")
847 .and_then(|v| v.to_str().ok())
848 .unwrap_or("application/octet-stream");
849 let local_var_content_type = super::ContentType::from(local_var_content_type);
850 let local_var_content = local_var_resp.text().await?;
851
852 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
853 match local_var_content_type {
854 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
855 ContentType::Text => {
856 return Err(Error::from(serde_json::Error::custom(
857 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModelListResponseModel`",
858 )));
859 }
860 ContentType::Unsupported(local_var_unknown_type) => {
861 return Err(Error::from(serde_json::Error::custom(format!(
862 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModelListResponseModel`"
863 ))));
864 }
865 }
866 } else {
867 let local_var_entity: Option<GetUserError> =
868 serde_json::from_str(&local_var_content).ok();
869 let local_var_error = ResponseContent {
870 status: local_var_status,
871 content: local_var_content,
872 entity: local_var_entity,
873 };
874 Err(Error::ResponseError(local_var_error))
875 }
876 }
877
878 async fn leave<'a>(&self, id: uuid::Uuid) -> Result<(), Error<LeaveError>> {
879 let local_var_configuration = &self.configuration;
880
881 let local_var_client = &local_var_configuration.client;
882
883 let local_var_uri_str = format!(
884 "{}/organizations/{id}/leave",
885 local_var_configuration.base_path,
886 id = id
887 );
888 let mut local_var_req_builder =
889 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
890
891 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
892
893 let local_var_resp = local_var_req_builder.send().await?;
894
895 let local_var_status = local_var_resp.status();
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 Ok(())
900 } else {
901 let local_var_entity: Option<LeaveError> =
902 serde_json::from_str(&local_var_content).ok();
903 let local_var_error = ResponseContent {
904 status: local_var_status,
905 content: local_var_content,
906 entity: local_var_entity,
907 };
908 Err(Error::ResponseError(local_var_error))
909 }
910 }
911
912 async fn post<'a>(
913 &self,
914 organization_create_request_model: Option<models::OrganizationCreateRequestModel>,
915 ) -> Result<models::OrganizationResponseModel, Error<PostError>> {
916 let local_var_configuration = &self.configuration;
917
918 let local_var_client = &local_var_configuration.client;
919
920 let local_var_uri_str = format!("{}/organizations", local_var_configuration.base_path);
921 let mut local_var_req_builder =
922 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
923
924 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
925 local_var_req_builder = local_var_req_builder.json(&organization_create_request_model);
926
927 let local_var_resp = local_var_req_builder.send().await?;
928
929 let local_var_status = local_var_resp.status();
930 let local_var_content_type = local_var_resp
931 .headers()
932 .get("content-type")
933 .and_then(|v| v.to_str().ok())
934 .unwrap_or("application/octet-stream");
935 let local_var_content_type = super::ContentType::from(local_var_content_type);
936 let local_var_content = local_var_resp.text().await?;
937
938 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
939 match local_var_content_type {
940 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
941 ContentType::Text => {
942 return Err(Error::from(serde_json::Error::custom(
943 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
944 )));
945 }
946 ContentType::Unsupported(local_var_unknown_type) => {
947 return Err(Error::from(serde_json::Error::custom(format!(
948 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
949 ))));
950 }
951 }
952 } else {
953 let local_var_entity: Option<PostError> = serde_json::from_str(&local_var_content).ok();
954 let local_var_error = ResponseContent {
955 status: local_var_status,
956 content: local_var_content,
957 entity: local_var_entity,
958 };
959 Err(Error::ResponseError(local_var_error))
960 }
961 }
962
963 async fn post_cancel<'a>(
964 &self,
965 id: uuid::Uuid,
966 subscription_cancellation_request_model: Option<
967 models::SubscriptionCancellationRequestModel,
968 >,
969 ) -> Result<(), Error<PostCancelError>> {
970 let local_var_configuration = &self.configuration;
971
972 let local_var_client = &local_var_configuration.client;
973
974 let local_var_uri_str = format!(
975 "{}/organizations/{id}/cancel",
976 local_var_configuration.base_path,
977 id = id
978 );
979 let mut local_var_req_builder =
980 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
981
982 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
983 local_var_req_builder =
984 local_var_req_builder.json(&subscription_cancellation_request_model);
985
986 let local_var_resp = local_var_req_builder.send().await?;
987
988 let local_var_status = local_var_resp.status();
989 let local_var_content = local_var_resp.text().await?;
990
991 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
992 Ok(())
993 } else {
994 let local_var_entity: Option<PostCancelError> =
995 serde_json::from_str(&local_var_content).ok();
996 let local_var_error = ResponseContent {
997 status: local_var_status,
998 content: local_var_content,
999 entity: local_var_entity,
1000 };
1001 Err(Error::ResponseError(local_var_error))
1002 }
1003 }
1004
1005 async fn post_delete_recover_token<'a>(
1006 &self,
1007 id: uuid::Uuid,
1008 organization_verify_delete_recover_request_model: Option<
1009 models::OrganizationVerifyDeleteRecoverRequestModel,
1010 >,
1011 ) -> Result<(), Error<PostDeleteRecoverTokenError>> {
1012 let local_var_configuration = &self.configuration;
1013
1014 let local_var_client = &local_var_configuration.client;
1015
1016 let local_var_uri_str = format!(
1017 "{}/organizations/{id}/delete-recover-token",
1018 local_var_configuration.base_path,
1019 id = id
1020 );
1021 let mut local_var_req_builder =
1022 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1023
1024 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1025 local_var_req_builder =
1026 local_var_req_builder.json(&organization_verify_delete_recover_request_model);
1027
1028 let local_var_resp = local_var_req_builder.send().await?;
1029
1030 let local_var_status = local_var_resp.status();
1031 let local_var_content = local_var_resp.text().await?;
1032
1033 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1034 Ok(())
1035 } else {
1036 let local_var_entity: Option<PostDeleteRecoverTokenError> =
1037 serde_json::from_str(&local_var_content).ok();
1038 let local_var_error = ResponseContent {
1039 status: local_var_status,
1040 content: local_var_content,
1041 entity: local_var_entity,
1042 };
1043 Err(Error::ResponseError(local_var_error))
1044 }
1045 }
1046
1047 async fn post_keys<'a>(
1048 &self,
1049 id: uuid::Uuid,
1050 organization_keys_request_model: Option<models::OrganizationKeysRequestModel>,
1051 ) -> Result<models::OrganizationKeysResponseModel, Error<PostKeysError>> {
1052 let local_var_configuration = &self.configuration;
1053
1054 let local_var_client = &local_var_configuration.client;
1055
1056 let local_var_uri_str = format!(
1057 "{}/organizations/{id}/keys",
1058 local_var_configuration.base_path,
1059 id = id
1060 );
1061 let mut local_var_req_builder =
1062 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1063
1064 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1065 local_var_req_builder = local_var_req_builder.json(&organization_keys_request_model);
1066
1067 let local_var_resp = local_var_req_builder.send().await?;
1068
1069 let local_var_status = local_var_resp.status();
1070 let local_var_content_type = local_var_resp
1071 .headers()
1072 .get("content-type")
1073 .and_then(|v| v.to_str().ok())
1074 .unwrap_or("application/octet-stream");
1075 let local_var_content_type = super::ContentType::from(local_var_content_type);
1076 let local_var_content = local_var_resp.text().await?;
1077
1078 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1079 match local_var_content_type {
1080 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1081 ContentType::Text => {
1082 return Err(Error::from(serde_json::Error::custom(
1083 "Received `text/plain` content type response that cannot be converted to `models::OrganizationKeysResponseModel`",
1084 )));
1085 }
1086 ContentType::Unsupported(local_var_unknown_type) => {
1087 return Err(Error::from(serde_json::Error::custom(format!(
1088 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationKeysResponseModel`"
1089 ))));
1090 }
1091 }
1092 } else {
1093 let local_var_entity: Option<PostKeysError> =
1094 serde_json::from_str(&local_var_content).ok();
1095 let local_var_error = ResponseContent {
1096 status: local_var_status,
1097 content: local_var_content,
1098 entity: local_var_entity,
1099 };
1100 Err(Error::ResponseError(local_var_error))
1101 }
1102 }
1103
1104 async fn post_reinstate<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PostReinstateError>> {
1105 let local_var_configuration = &self.configuration;
1106
1107 let local_var_client = &local_var_configuration.client;
1108
1109 let local_var_uri_str = format!(
1110 "{}/organizations/{id}/reinstate",
1111 local_var_configuration.base_path,
1112 id = id
1113 );
1114 let mut local_var_req_builder =
1115 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1116
1117 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1118
1119 let local_var_resp = local_var_req_builder.send().await?;
1120
1121 let local_var_status = local_var_resp.status();
1122 let local_var_content = local_var_resp.text().await?;
1123
1124 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1125 Ok(())
1126 } else {
1127 let local_var_entity: Option<PostReinstateError> =
1128 serde_json::from_str(&local_var_content).ok();
1129 let local_var_error = ResponseContent {
1130 status: local_var_status,
1131 content: local_var_content,
1132 entity: local_var_entity,
1133 };
1134 Err(Error::ResponseError(local_var_error))
1135 }
1136 }
1137
1138 async fn post_seat<'a>(
1139 &self,
1140 id: uuid::Uuid,
1141 organization_seat_request_model: Option<models::OrganizationSeatRequestModel>,
1142 ) -> Result<models::PaymentResponseModel, Error<PostSeatError>> {
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}/seat",
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 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1156 local_var_req_builder = local_var_req_builder.json(&organization_seat_request_model);
1157
1158 let local_var_resp = local_var_req_builder.send().await?;
1159
1160 let local_var_status = local_var_resp.status();
1161 let local_var_content_type = local_var_resp
1162 .headers()
1163 .get("content-type")
1164 .and_then(|v| v.to_str().ok())
1165 .unwrap_or("application/octet-stream");
1166 let local_var_content_type = super::ContentType::from(local_var_content_type);
1167 let local_var_content = local_var_resp.text().await?;
1168
1169 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1170 match local_var_content_type {
1171 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1172 ContentType::Text => {
1173 return Err(Error::from(serde_json::Error::custom(
1174 "Received `text/plain` content type response that cannot be converted to `models::PaymentResponseModel`",
1175 )));
1176 }
1177 ContentType::Unsupported(local_var_unknown_type) => {
1178 return Err(Error::from(serde_json::Error::custom(format!(
1179 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PaymentResponseModel`"
1180 ))));
1181 }
1182 }
1183 } else {
1184 let local_var_entity: Option<PostSeatError> =
1185 serde_json::from_str(&local_var_content).ok();
1186 let local_var_error = ResponseContent {
1187 status: local_var_status,
1188 content: local_var_content,
1189 entity: local_var_entity,
1190 };
1191 Err(Error::ResponseError(local_var_error))
1192 }
1193 }
1194
1195 async fn post_sm_subscription<'a>(
1196 &self,
1197 id: uuid::Uuid,
1198 secrets_manager_subscription_update_request_model: Option<
1199 models::SecretsManagerSubscriptionUpdateRequestModel,
1200 >,
1201 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSmSubscriptionError>> {
1202 let local_var_configuration = &self.configuration;
1203
1204 let local_var_client = &local_var_configuration.client;
1205
1206 let local_var_uri_str = format!(
1207 "{}/organizations/{id}/sm-subscription",
1208 local_var_configuration.base_path,
1209 id = id
1210 );
1211 let mut local_var_req_builder =
1212 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1213
1214 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1215 local_var_req_builder =
1216 local_var_req_builder.json(&secrets_manager_subscription_update_request_model);
1217
1218 let local_var_resp = local_var_req_builder.send().await?;
1219
1220 let local_var_status = local_var_resp.status();
1221 let local_var_content_type = local_var_resp
1222 .headers()
1223 .get("content-type")
1224 .and_then(|v| v.to_str().ok())
1225 .unwrap_or("application/octet-stream");
1226 let local_var_content_type = super::ContentType::from(local_var_content_type);
1227 let local_var_content = local_var_resp.text().await?;
1228
1229 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1230 match local_var_content_type {
1231 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1232 ContentType::Text => {
1233 return Err(Error::from(serde_json::Error::custom(
1234 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`",
1235 )));
1236 }
1237 ContentType::Unsupported(local_var_unknown_type) => {
1238 return Err(Error::from(serde_json::Error::custom(format!(
1239 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`"
1240 ))));
1241 }
1242 }
1243 } else {
1244 let local_var_entity: Option<PostSmSubscriptionError> =
1245 serde_json::from_str(&local_var_content).ok();
1246 let local_var_error = ResponseContent {
1247 status: local_var_status,
1248 content: local_var_content,
1249 entity: local_var_entity,
1250 };
1251 Err(Error::ResponseError(local_var_error))
1252 }
1253 }
1254
1255 async fn post_sso<'a>(
1256 &self,
1257 id: uuid::Uuid,
1258 organization_sso_request_model: Option<models::OrganizationSsoRequestModel>,
1259 ) -> Result<models::OrganizationSsoResponseModel, Error<PostSsoError>> {
1260 let local_var_configuration = &self.configuration;
1261
1262 let local_var_client = &local_var_configuration.client;
1263
1264 let local_var_uri_str = format!(
1265 "{}/organizations/{id}/sso",
1266 local_var_configuration.base_path,
1267 id = id
1268 );
1269 let mut local_var_req_builder =
1270 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1271
1272 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1273 local_var_req_builder = local_var_req_builder.json(&organization_sso_request_model);
1274
1275 let local_var_resp = local_var_req_builder.send().await?;
1276
1277 let local_var_status = local_var_resp.status();
1278 let local_var_content_type = local_var_resp
1279 .headers()
1280 .get("content-type")
1281 .and_then(|v| v.to_str().ok())
1282 .unwrap_or("application/octet-stream");
1283 let local_var_content_type = super::ContentType::from(local_var_content_type);
1284 let local_var_content = local_var_resp.text().await?;
1285
1286 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1287 match local_var_content_type {
1288 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1289 ContentType::Text => {
1290 return Err(Error::from(serde_json::Error::custom(
1291 "Received `text/plain` content type response that cannot be converted to `models::OrganizationSsoResponseModel`",
1292 )));
1293 }
1294 ContentType::Unsupported(local_var_unknown_type) => {
1295 return Err(Error::from(serde_json::Error::custom(format!(
1296 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationSsoResponseModel`"
1297 ))));
1298 }
1299 }
1300 } else {
1301 let local_var_entity: Option<PostSsoError> =
1302 serde_json::from_str(&local_var_content).ok();
1303 let local_var_error = ResponseContent {
1304 status: local_var_status,
1305 content: local_var_content,
1306 entity: local_var_entity,
1307 };
1308 Err(Error::ResponseError(local_var_error))
1309 }
1310 }
1311
1312 async fn post_storage<'a>(
1313 &self,
1314 id: &'a str,
1315 storage_request_model: Option<models::StorageRequestModel>,
1316 ) -> Result<models::PaymentResponseModel, Error<PostStorageError>> {
1317 let local_var_configuration = &self.configuration;
1318
1319 let local_var_client = &local_var_configuration.client;
1320
1321 let local_var_uri_str = format!(
1322 "{}/organizations/{id}/storage",
1323 local_var_configuration.base_path,
1324 id = crate::apis::urlencode(id)
1325 );
1326 let mut local_var_req_builder =
1327 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1328
1329 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1330 local_var_req_builder = local_var_req_builder.json(&storage_request_model);
1331
1332 let local_var_resp = local_var_req_builder.send().await?;
1333
1334 let local_var_status = local_var_resp.status();
1335 let local_var_content_type = local_var_resp
1336 .headers()
1337 .get("content-type")
1338 .and_then(|v| v.to_str().ok())
1339 .unwrap_or("application/octet-stream");
1340 let local_var_content_type = super::ContentType::from(local_var_content_type);
1341 let local_var_content = local_var_resp.text().await?;
1342
1343 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1344 match local_var_content_type {
1345 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1346 ContentType::Text => {
1347 return Err(Error::from(serde_json::Error::custom(
1348 "Received `text/plain` content type response that cannot be converted to `models::PaymentResponseModel`",
1349 )));
1350 }
1351 ContentType::Unsupported(local_var_unknown_type) => {
1352 return Err(Error::from(serde_json::Error::custom(format!(
1353 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PaymentResponseModel`"
1354 ))));
1355 }
1356 }
1357 } else {
1358 let local_var_entity: Option<PostStorageError> =
1359 serde_json::from_str(&local_var_content).ok();
1360 let local_var_error = ResponseContent {
1361 status: local_var_status,
1362 content: local_var_content,
1363 entity: local_var_entity,
1364 };
1365 Err(Error::ResponseError(local_var_error))
1366 }
1367 }
1368
1369 async fn post_subscribe_secrets_manager<'a>(
1370 &self,
1371 id: uuid::Uuid,
1372 secrets_manager_subscribe_request_model: Option<
1373 models::SecretsManagerSubscribeRequestModel,
1374 >,
1375 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscribeSecretsManagerError>>
1376 {
1377 let local_var_configuration = &self.configuration;
1378
1379 let local_var_client = &local_var_configuration.client;
1380
1381 let local_var_uri_str = format!(
1382 "{}/organizations/{id}/subscribe-secrets-manager",
1383 local_var_configuration.base_path,
1384 id = id
1385 );
1386 let mut local_var_req_builder =
1387 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1388
1389 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1390 local_var_req_builder =
1391 local_var_req_builder.json(&secrets_manager_subscribe_request_model);
1392
1393 let local_var_resp = local_var_req_builder.send().await?;
1394
1395 let local_var_status = local_var_resp.status();
1396 let local_var_content_type = local_var_resp
1397 .headers()
1398 .get("content-type")
1399 .and_then(|v| v.to_str().ok())
1400 .unwrap_or("application/octet-stream");
1401 let local_var_content_type = super::ContentType::from(local_var_content_type);
1402 let local_var_content = local_var_resp.text().await?;
1403
1404 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1405 match local_var_content_type {
1406 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1407 ContentType::Text => {
1408 return Err(Error::from(serde_json::Error::custom(
1409 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`",
1410 )));
1411 }
1412 ContentType::Unsupported(local_var_unknown_type) => {
1413 return Err(Error::from(serde_json::Error::custom(format!(
1414 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`"
1415 ))));
1416 }
1417 }
1418 } else {
1419 let local_var_entity: Option<PostSubscribeSecretsManagerError> =
1420 serde_json::from_str(&local_var_content).ok();
1421 let local_var_error = ResponseContent {
1422 status: local_var_status,
1423 content: local_var_content,
1424 entity: local_var_entity,
1425 };
1426 Err(Error::ResponseError(local_var_error))
1427 }
1428 }
1429
1430 async fn post_subscription<'a>(
1431 &self,
1432 id: uuid::Uuid,
1433 organization_subscription_update_request_model: Option<
1434 models::OrganizationSubscriptionUpdateRequestModel,
1435 >,
1436 ) -> Result<models::ProfileOrganizationResponseModel, Error<PostSubscriptionError>> {
1437 let local_var_configuration = &self.configuration;
1438
1439 let local_var_client = &local_var_configuration.client;
1440
1441 let local_var_uri_str = format!(
1442 "{}/organizations/{id}/subscription",
1443 local_var_configuration.base_path,
1444 id = id
1445 );
1446 let mut local_var_req_builder =
1447 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1448
1449 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1450 local_var_req_builder =
1451 local_var_req_builder.json(&organization_subscription_update_request_model);
1452
1453 let local_var_resp = local_var_req_builder.send().await?;
1454
1455 let local_var_status = local_var_resp.status();
1456 let local_var_content_type = local_var_resp
1457 .headers()
1458 .get("content-type")
1459 .and_then(|v| v.to_str().ok())
1460 .unwrap_or("application/octet-stream");
1461 let local_var_content_type = super::ContentType::from(local_var_content_type);
1462 let local_var_content = local_var_resp.text().await?;
1463
1464 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1465 match local_var_content_type {
1466 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1467 ContentType::Text => {
1468 return Err(Error::from(serde_json::Error::custom(
1469 "Received `text/plain` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`",
1470 )));
1471 }
1472 ContentType::Unsupported(local_var_unknown_type) => {
1473 return Err(Error::from(serde_json::Error::custom(format!(
1474 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ProfileOrganizationResponseModel`"
1475 ))));
1476 }
1477 }
1478 } else {
1479 let local_var_entity: Option<PostSubscriptionError> =
1480 serde_json::from_str(&local_var_content).ok();
1481 let local_var_error = ResponseContent {
1482 status: local_var_status,
1483 content: local_var_content,
1484 entity: local_var_entity,
1485 };
1486 Err(Error::ResponseError(local_var_error))
1487 }
1488 }
1489
1490 async fn post_upgrade<'a>(
1491 &self,
1492 id: uuid::Uuid,
1493 organization_upgrade_request_model: Option<models::OrganizationUpgradeRequestModel>,
1494 ) -> Result<models::PaymentResponseModel, Error<PostUpgradeError>> {
1495 let local_var_configuration = &self.configuration;
1496
1497 let local_var_client = &local_var_configuration.client;
1498
1499 let local_var_uri_str = format!(
1500 "{}/organizations/{id}/upgrade",
1501 local_var_configuration.base_path,
1502 id = id
1503 );
1504 let mut local_var_req_builder =
1505 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1506
1507 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1508 local_var_req_builder = local_var_req_builder.json(&organization_upgrade_request_model);
1509
1510 let local_var_resp = local_var_req_builder.send().await?;
1511
1512 let local_var_status = local_var_resp.status();
1513 let local_var_content_type = local_var_resp
1514 .headers()
1515 .get("content-type")
1516 .and_then(|v| v.to_str().ok())
1517 .unwrap_or("application/octet-stream");
1518 let local_var_content_type = super::ContentType::from(local_var_content_type);
1519 let local_var_content = local_var_resp.text().await?;
1520
1521 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1522 match local_var_content_type {
1523 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1524 ContentType::Text => {
1525 return Err(Error::from(serde_json::Error::custom(
1526 "Received `text/plain` content type response that cannot be converted to `models::PaymentResponseModel`",
1527 )));
1528 }
1529 ContentType::Unsupported(local_var_unknown_type) => {
1530 return Err(Error::from(serde_json::Error::custom(format!(
1531 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::PaymentResponseModel`"
1532 ))));
1533 }
1534 }
1535 } else {
1536 let local_var_entity: Option<PostUpgradeError> =
1537 serde_json::from_str(&local_var_content).ok();
1538 let local_var_error = ResponseContent {
1539 status: local_var_status,
1540 content: local_var_content,
1541 entity: local_var_entity,
1542 };
1543 Err(Error::ResponseError(local_var_error))
1544 }
1545 }
1546
1547 async fn put<'a>(
1548 &self,
1549 organization_id: uuid::Uuid,
1550 organization_update_request_model: Option<models::OrganizationUpdateRequestModel>,
1551 ) -> Result<(), Error<PutError>> {
1552 let local_var_configuration = &self.configuration;
1553
1554 let local_var_client = &local_var_configuration.client;
1555
1556 let local_var_uri_str = format!(
1557 "{}/organizations/{organizationId}",
1558 local_var_configuration.base_path,
1559 organizationId = organization_id
1560 );
1561 let mut local_var_req_builder =
1562 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1563
1564 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1565 local_var_req_builder = local_var_req_builder.json(&organization_update_request_model);
1566
1567 let local_var_resp = local_var_req_builder.send().await?;
1568
1569 let local_var_status = local_var_resp.status();
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 Ok(())
1574 } else {
1575 let local_var_entity: Option<PutError> = serde_json::from_str(&local_var_content).ok();
1576 let local_var_error = ResponseContent {
1577 status: local_var_status,
1578 content: local_var_content,
1579 entity: local_var_entity,
1580 };
1581 Err(Error::ResponseError(local_var_error))
1582 }
1583 }
1584
1585 async fn put_collection_management<'a>(
1586 &self,
1587 id: uuid::Uuid,
1588 organization_collection_management_update_request_model: Option<
1589 models::OrganizationCollectionManagementUpdateRequestModel,
1590 >,
1591 ) -> Result<models::OrganizationResponseModel, Error<PutCollectionManagementError>> {
1592 let local_var_configuration = &self.configuration;
1593
1594 let local_var_client = &local_var_configuration.client;
1595
1596 let local_var_uri_str = format!(
1597 "{}/organizations/{id}/collection-management",
1598 local_var_configuration.base_path,
1599 id = id
1600 );
1601 let mut local_var_req_builder =
1602 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1603
1604 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1605 local_var_req_builder =
1606 local_var_req_builder.json(&organization_collection_management_update_request_model);
1607
1608 let local_var_resp = local_var_req_builder.send().await?;
1609
1610 let local_var_status = local_var_resp.status();
1611 let local_var_content_type = local_var_resp
1612 .headers()
1613 .get("content-type")
1614 .and_then(|v| v.to_str().ok())
1615 .unwrap_or("application/octet-stream");
1616 let local_var_content_type = super::ContentType::from(local_var_content_type);
1617 let local_var_content = local_var_resp.text().await?;
1618
1619 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1620 match local_var_content_type {
1621 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1622 ContentType::Text => {
1623 return Err(Error::from(serde_json::Error::custom(
1624 "Received `text/plain` content type response that cannot be converted to `models::OrganizationResponseModel`",
1625 )));
1626 }
1627 ContentType::Unsupported(local_var_unknown_type) => {
1628 return Err(Error::from(serde_json::Error::custom(format!(
1629 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationResponseModel`"
1630 ))));
1631 }
1632 }
1633 } else {
1634 let local_var_entity: Option<PutCollectionManagementError> =
1635 serde_json::from_str(&local_var_content).ok();
1636 let local_var_error = ResponseContent {
1637 status: local_var_status,
1638 content: local_var_content,
1639 entity: local_var_entity,
1640 };
1641 Err(Error::ResponseError(local_var_error))
1642 }
1643 }
1644
1645 async fn rotate_api_key<'a>(
1646 &self,
1647 id: &'a str,
1648 organization_api_key_request_model: Option<models::OrganizationApiKeyRequestModel>,
1649 ) -> Result<models::ApiKeyResponseModel, Error<RotateApiKeyError>> {
1650 let local_var_configuration = &self.configuration;
1651
1652 let local_var_client = &local_var_configuration.client;
1653
1654 let local_var_uri_str = format!(
1655 "{}/organizations/{id}/rotate-api-key",
1656 local_var_configuration.base_path,
1657 id = crate::apis::urlencode(id)
1658 );
1659 let mut local_var_req_builder =
1660 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1661
1662 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1663 local_var_req_builder = local_var_req_builder.json(&organization_api_key_request_model);
1664
1665 let local_var_resp = local_var_req_builder.send().await?;
1666
1667 let local_var_status = local_var_resp.status();
1668 let local_var_content_type = local_var_resp
1669 .headers()
1670 .get("content-type")
1671 .and_then(|v| v.to_str().ok())
1672 .unwrap_or("application/octet-stream");
1673 let local_var_content_type = super::ContentType::from(local_var_content_type);
1674 let local_var_content = local_var_resp.text().await?;
1675
1676 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1677 match local_var_content_type {
1678 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1679 ContentType::Text => {
1680 return Err(Error::from(serde_json::Error::custom(
1681 "Received `text/plain` content type response that cannot be converted to `models::ApiKeyResponseModel`",
1682 )));
1683 }
1684 ContentType::Unsupported(local_var_unknown_type) => {
1685 return Err(Error::from(serde_json::Error::custom(format!(
1686 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ApiKeyResponseModel`"
1687 ))));
1688 }
1689 }
1690 } else {
1691 let local_var_entity: Option<RotateApiKeyError> =
1692 serde_json::from_str(&local_var_content).ok();
1693 let local_var_error = ResponseContent {
1694 status: local_var_status,
1695 content: local_var_content,
1696 entity: local_var_entity,
1697 };
1698 Err(Error::ResponseError(local_var_error))
1699 }
1700 }
1701}
1702
1703#[derive(Debug, Clone, Serialize, Deserialize)]
1705#[serde(untagged)]
1706pub enum ApiKeyError {
1707 UnknownValue(serde_json::Value),
1708}
1709#[derive(Debug, Clone, Serialize, Deserialize)]
1711#[serde(untagged)]
1712pub enum ApiKeyInformationError {
1713 UnknownValue(serde_json::Value),
1714}
1715#[derive(Debug, Clone, Serialize, Deserialize)]
1717#[serde(untagged)]
1718pub enum CreateWithoutPaymentError {
1719 UnknownValue(serde_json::Value),
1720}
1721#[derive(Debug, Clone, Serialize, Deserialize)]
1723#[serde(untagged)]
1724pub enum DeleteError {
1725 UnknownValue(serde_json::Value),
1726}
1727#[derive(Debug, Clone, Serialize, Deserialize)]
1729#[serde(untagged)]
1730pub enum GetError {
1731 UnknownValue(serde_json::Value),
1732}
1733#[derive(Debug, Clone, Serialize, Deserialize)]
1735#[serde(untagged)]
1736pub enum GetAutoEnrollStatusError {
1737 UnknownValue(serde_json::Value),
1738}
1739#[derive(Debug, Clone, Serialize, Deserialize)]
1741#[serde(untagged)]
1742pub enum GetLicenseError {
1743 UnknownValue(serde_json::Value),
1744}
1745#[derive(Debug, Clone, Serialize, Deserialize)]
1747#[serde(untagged)]
1748pub enum GetPlanTypeError {
1749 UnknownValue(serde_json::Value),
1750}
1751#[derive(Debug, Clone, Serialize, Deserialize)]
1753#[serde(untagged)]
1754pub enum GetPublicKeyError {
1755 UnknownValue(serde_json::Value),
1756}
1757#[derive(Debug, Clone, Serialize, Deserialize)]
1759#[serde(untagged)]
1760pub enum GetSsoError {
1761 UnknownValue(serde_json::Value),
1762}
1763#[derive(Debug, Clone, Serialize, Deserialize)]
1765#[serde(untagged)]
1766pub enum GetSubscriptionError {
1767 UnknownValue(serde_json::Value),
1768}
1769#[derive(Debug, Clone, Serialize, Deserialize)]
1771#[serde(untagged)]
1772pub enum GetUserError {
1773 UnknownValue(serde_json::Value),
1774}
1775#[derive(Debug, Clone, Serialize, Deserialize)]
1777#[serde(untagged)]
1778pub enum LeaveError {
1779 UnknownValue(serde_json::Value),
1780}
1781#[derive(Debug, Clone, Serialize, Deserialize)]
1783#[serde(untagged)]
1784pub enum PostError {
1785 UnknownValue(serde_json::Value),
1786}
1787#[derive(Debug, Clone, Serialize, Deserialize)]
1789#[serde(untagged)]
1790pub enum PostCancelError {
1791 UnknownValue(serde_json::Value),
1792}
1793#[derive(Debug, Clone, Serialize, Deserialize)]
1795#[serde(untagged)]
1796pub enum PostDeleteRecoverTokenError {
1797 UnknownValue(serde_json::Value),
1798}
1799#[derive(Debug, Clone, Serialize, Deserialize)]
1801#[serde(untagged)]
1802pub enum PostKeysError {
1803 UnknownValue(serde_json::Value),
1804}
1805#[derive(Debug, Clone, Serialize, Deserialize)]
1807#[serde(untagged)]
1808pub enum PostReinstateError {
1809 UnknownValue(serde_json::Value),
1810}
1811#[derive(Debug, Clone, Serialize, Deserialize)]
1813#[serde(untagged)]
1814pub enum PostSeatError {
1815 UnknownValue(serde_json::Value),
1816}
1817#[derive(Debug, Clone, Serialize, Deserialize)]
1819#[serde(untagged)]
1820pub enum PostSmSubscriptionError {
1821 UnknownValue(serde_json::Value),
1822}
1823#[derive(Debug, Clone, Serialize, Deserialize)]
1825#[serde(untagged)]
1826pub enum PostSsoError {
1827 UnknownValue(serde_json::Value),
1828}
1829#[derive(Debug, Clone, Serialize, Deserialize)]
1831#[serde(untagged)]
1832pub enum PostStorageError {
1833 UnknownValue(serde_json::Value),
1834}
1835#[derive(Debug, Clone, Serialize, Deserialize)]
1837#[serde(untagged)]
1838pub enum PostSubscribeSecretsManagerError {
1839 UnknownValue(serde_json::Value),
1840}
1841#[derive(Debug, Clone, Serialize, Deserialize)]
1843#[serde(untagged)]
1844pub enum PostSubscriptionError {
1845 UnknownValue(serde_json::Value),
1846}
1847#[derive(Debug, Clone, Serialize, Deserialize)]
1849#[serde(untagged)]
1850pub enum PostUpgradeError {
1851 UnknownValue(serde_json::Value),
1852}
1853#[derive(Debug, Clone, Serialize, Deserialize)]
1855#[serde(untagged)]
1856pub enum PutError {
1857 UnknownValue(serde_json::Value),
1858}
1859#[derive(Debug, Clone, Serialize, Deserialize)]
1861#[serde(untagged)]
1862pub enum PutCollectionManagementError {
1863 UnknownValue(serde_json::Value),
1864}
1865#[derive(Debug, Clone, Serialize, Deserialize)]
1867#[serde(untagged)]
1868pub enum RotateApiKeyError {
1869 UnknownValue(serde_json::Value),
1870}