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