Skip to main content

bitwarden_api_api/apis/
organization_users_api.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use 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 OrganizationUsersApi: Send + Sync {
29    /// POST /organizations/{orgId}/users/{organizationUserId}/accept
30    async fn accept<'a>(
31        &self,
32        org_id: uuid::Uuid,
33        organization_user_id: uuid::Uuid,
34        organization_user_accept_request_model: Option<models::OrganizationUserAcceptRequestModel>,
35    ) -> Result<(), Error<AcceptError>>;
36
37    /// POST /organizations/{orgId}/users/{organizationUserId}/accept-init
38    async fn accept_init<'a>(
39        &self,
40        org_id: uuid::Uuid,
41        organization_user_id: uuid::Uuid,
42        organization_user_accept_init_request_model: Option<
43            models::OrganizationUserAcceptInitRequestModel,
44        >,
45    ) -> Result<(), Error<AcceptInitError>>;
46
47    /// POST /organizations/{orgId}/users/{id}/auto-confirm
48    async fn automatically_confirm_organization_user<'a>(
49        &self,
50        org_id: uuid::Uuid,
51        id: uuid::Uuid,
52        organization_user_confirm_request_model: Option<
53            models::OrganizationUserConfirmRequestModel,
54        >,
55    ) -> Result<(), Error<AutomaticallyConfirmOrganizationUserError>>;
56
57    /// POST /organizations/{orgId}/users/confirm
58    async fn bulk_confirm<'a>(
59        &self,
60        org_id: uuid::Uuid,
61        organization_user_bulk_confirm_request_model: Option<
62            models::OrganizationUserBulkConfirmRequestModel,
63        >,
64    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkConfirmError>>;
65
66    /// DELETE /organizations/{orgId}/users/delete-account
67    async fn bulk_delete_account<'a>(
68        &self,
69        org_id: uuid::Uuid,
70        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
71    ) -> Result<
72        models::OrganizationUserBulkResponseModelListResponseModel,
73        Error<BulkDeleteAccountError>,
74    >;
75
76    /// PUT /organizations/{orgId}/users/enable-secrets-manager
77    async fn bulk_enable_secrets_manager<'a>(
78        &self,
79        org_id: uuid::Uuid,
80        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
81    ) -> Result<(), Error<BulkEnableSecretsManagerError>>;
82
83    /// POST /organizations/{orgId}/users/reinvite
84    async fn bulk_reinvite<'a>(
85        &self,
86        org_id: uuid::Uuid,
87        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
88    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkReinviteError>>;
89
90    /// DELETE /organizations/{orgId}/users
91    async fn bulk_remove<'a>(
92        &self,
93        org_id: uuid::Uuid,
94        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
95    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkRemoveError>>;
96
97    /// PUT /organizations/{orgId}/users/restore
98    async fn bulk_restore<'a>(
99        &self,
100        org_id: uuid::Uuid,
101        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
102    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkRestoreError>>;
103
104    /// PUT /organizations/{orgId}/users/revoke
105    async fn bulk_revoke<'a>(
106        &self,
107        org_id: uuid::Uuid,
108        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
109    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkRevokeError>>;
110
111    /// POST /organizations/{orgId}/users/{id}/confirm
112    async fn confirm<'a>(
113        &self,
114        org_id: uuid::Uuid,
115        id: uuid::Uuid,
116        organization_user_confirm_request_model: Option<
117            models::OrganizationUserConfirmRequestModel,
118        >,
119    ) -> Result<(), Error<ConfirmError>>;
120
121    /// DELETE /organizations/{orgId}/users/{id}/delete-account
122    async fn delete_account<'a>(
123        &self,
124        org_id: uuid::Uuid,
125        id: uuid::Uuid,
126    ) -> Result<(), Error<DeleteAccountError>>;
127
128    /// GET /organizations/{orgId}/users/{id}
129    async fn get<'a>(
130        &self,
131        org_id: uuid::Uuid,
132        id: uuid::Uuid,
133        include_groups: Option<bool>,
134    ) -> Result<models::OrganizationUserDetailsResponseModel, Error<GetError>>;
135
136    /// POST /organizations/{orgId}/users/account-recovery-details
137    async fn get_account_recovery_details<'a>(
138        &self,
139        org_id: uuid::Uuid,
140        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
141    ) -> Result<
142        models::OrganizationUserResetPasswordDetailsResponseModelListResponseModel,
143        Error<GetAccountRecoveryDetailsError>,
144    >;
145
146    /// GET /organizations/{orgId}/users
147    async fn get_all<'a>(
148        &self,
149        org_id: uuid::Uuid,
150        include_groups: Option<bool>,
151        include_collections: Option<bool>,
152    ) -> Result<models::OrganizationUserUserDetailsResponseModelListResponseModel, Error<GetAllError>>;
153
154    /// GET /organizations/{orgId}/users/mini-details
155    async fn get_mini_details<'a>(
156        &self,
157        org_id: uuid::Uuid,
158    ) -> Result<
159        models::OrganizationUserUserMiniDetailsResponseModelListResponseModel,
160        Error<GetMiniDetailsError>,
161    >;
162
163    /// GET /organizations/{orgId}/users/{id}/reset-password-details
164    async fn get_reset_password_details<'a>(
165        &self,
166        org_id: uuid::Uuid,
167        id: uuid::Uuid,
168    ) -> Result<
169        models::OrganizationUserResetPasswordDetailsResponseModel,
170        Error<GetResetPasswordDetailsError>,
171    >;
172
173    /// POST /organizations/{orgId}/users/invite
174    async fn invite<'a>(
175        &self,
176        org_id: uuid::Uuid,
177        organization_user_invite_request_model: Option<models::OrganizationUserInviteRequestModel>,
178    ) -> Result<(), Error<InviteError>>;
179
180    /// PUT /organizations/{orgId}/users/{id}
181    async fn put<'a>(
182        &self,
183        org_id: uuid::Uuid,
184        id: uuid::Uuid,
185        organization_user_update_request_model: Option<models::OrganizationUserUpdateRequestModel>,
186    ) -> Result<(), Error<PutError>>;
187
188    /// PUT /organizations/{orgId}/users/{id}/reset-password
189    async fn put_reset_password<'a>(
190        &self,
191        org_id: uuid::Uuid,
192        id: uuid::Uuid,
193        organization_user_reset_password_request_model: Option<
194            models::OrganizationUserResetPasswordRequestModel,
195        >,
196    ) -> Result<(), Error<PutResetPasswordError>>;
197
198    /// PUT /organizations/{orgId}/users/{userId}/reset-password-enrollment
199    async fn put_reset_password_enrollment<'a>(
200        &self,
201        org_id: uuid::Uuid,
202        user_id: uuid::Uuid,
203        organization_user_reset_password_enrollment_request_model: Option<
204            models::OrganizationUserResetPasswordEnrollmentRequestModel,
205        >,
206    ) -> Result<(), Error<PutResetPasswordEnrollmentError>>;
207
208    /// POST /organizations/{orgId}/users/{id}/reinvite
209    async fn reinvite<'a>(
210        &self,
211        org_id: uuid::Uuid,
212        id: uuid::Uuid,
213    ) -> Result<(), Error<ReinviteError>>;
214
215    /// DELETE /organizations/{orgId}/users/{id}
216    async fn remove<'a>(
217        &self,
218        org_id: uuid::Uuid,
219        id: uuid::Uuid,
220    ) -> Result<(), Error<RemoveError>>;
221
222    /// PUT /organizations/{orgId}/users/{id}/restore/vnext
223    async fn restore_async_v_next<'a>(
224        &self,
225        org_id: uuid::Uuid,
226        id: uuid::Uuid,
227        organization_user_restore_request: Option<models::OrganizationUserRestoreRequest>,
228    ) -> Result<(), Error<RestoreAsync_vNextError>>;
229
230    /// PUT /organizations/{orgId}/users/{id}/revoke
231    async fn revoke<'a>(
232        &self,
233        org_id: uuid::Uuid,
234        id: uuid::Uuid,
235    ) -> Result<(), Error<RevokeError>>;
236
237    /// PUT /organizations/{orgId}/users/revoke-self
238    async fn revoke_self<'a>(&self, org_id: uuid::Uuid) -> Result<(), Error<RevokeSelfError>>;
239
240    /// POST /organizations/{orgId}/users/public-keys
241    async fn user_public_keys<'a>(
242        &self,
243        org_id: uuid::Uuid,
244        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
245    ) -> Result<
246        models::OrganizationUserPublicKeyResponseModelListResponseModel,
247        Error<UserPublicKeysError>,
248    >;
249}
250
251pub struct OrganizationUsersApiClient {
252    configuration: Arc<configuration::Configuration>,
253}
254
255impl OrganizationUsersApiClient {
256    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
257        Self { configuration }
258    }
259}
260
261#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
262#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
263impl OrganizationUsersApi for OrganizationUsersApiClient {
264    async fn accept<'a>(
265        &self,
266        org_id: uuid::Uuid,
267        organization_user_id: uuid::Uuid,
268        organization_user_accept_request_model: Option<models::OrganizationUserAcceptRequestModel>,
269    ) -> Result<(), Error<AcceptError>> {
270        let local_var_configuration = &self.configuration;
271
272        let local_var_client = &local_var_configuration.client;
273
274        let local_var_uri_str = format!(
275            "{}/organizations/{orgId}/users/{organizationUserId}/accept",
276            local_var_configuration.base_path,
277            orgId = org_id,
278            organizationUserId = organization_user_id
279        );
280        let mut local_var_req_builder =
281            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
282
283        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
284        local_var_req_builder = local_var_req_builder.json(&organization_user_accept_request_model);
285
286        let local_var_resp = local_var_req_builder.send().await?;
287
288        let local_var_status = local_var_resp.status();
289        let local_var_content = local_var_resp.text().await?;
290
291        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
292            Ok(())
293        } else {
294            let local_var_entity: Option<AcceptError> =
295                serde_json::from_str(&local_var_content).ok();
296            let local_var_error = ResponseContent {
297                status: local_var_status,
298                content: local_var_content,
299                entity: local_var_entity,
300            };
301            Err(Error::ResponseError(local_var_error))
302        }
303    }
304
305    async fn accept_init<'a>(
306        &self,
307        org_id: uuid::Uuid,
308        organization_user_id: uuid::Uuid,
309        organization_user_accept_init_request_model: Option<
310            models::OrganizationUserAcceptInitRequestModel,
311        >,
312    ) -> Result<(), Error<AcceptInitError>> {
313        let local_var_configuration = &self.configuration;
314
315        let local_var_client = &local_var_configuration.client;
316
317        let local_var_uri_str = format!(
318            "{}/organizations/{orgId}/users/{organizationUserId}/accept-init",
319            local_var_configuration.base_path,
320            orgId = org_id,
321            organizationUserId = organization_user_id
322        );
323        let mut local_var_req_builder =
324            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
325
326        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
327        local_var_req_builder =
328            local_var_req_builder.json(&organization_user_accept_init_request_model);
329
330        let local_var_resp = local_var_req_builder.send().await?;
331
332        let local_var_status = local_var_resp.status();
333        let local_var_content = local_var_resp.text().await?;
334
335        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
336            Ok(())
337        } else {
338            let local_var_entity: Option<AcceptInitError> =
339                serde_json::from_str(&local_var_content).ok();
340            let local_var_error = ResponseContent {
341                status: local_var_status,
342                content: local_var_content,
343                entity: local_var_entity,
344            };
345            Err(Error::ResponseError(local_var_error))
346        }
347    }
348
349    async fn automatically_confirm_organization_user<'a>(
350        &self,
351        org_id: uuid::Uuid,
352        id: uuid::Uuid,
353        organization_user_confirm_request_model: Option<
354            models::OrganizationUserConfirmRequestModel,
355        >,
356    ) -> Result<(), Error<AutomaticallyConfirmOrganizationUserError>> {
357        let local_var_configuration = &self.configuration;
358
359        let local_var_client = &local_var_configuration.client;
360
361        let local_var_uri_str = format!(
362            "{}/organizations/{orgId}/users/{id}/auto-confirm",
363            local_var_configuration.base_path,
364            orgId = org_id,
365            id = id
366        );
367        let mut local_var_req_builder =
368            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
369
370        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
371        local_var_req_builder =
372            local_var_req_builder.json(&organization_user_confirm_request_model);
373
374        let local_var_resp = local_var_req_builder.send().await?;
375
376        let local_var_status = local_var_resp.status();
377        let local_var_content = local_var_resp.text().await?;
378
379        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
380            Ok(())
381        } else {
382            let local_var_entity: Option<AutomaticallyConfirmOrganizationUserError> =
383                serde_json::from_str(&local_var_content).ok();
384            let local_var_error = ResponseContent {
385                status: local_var_status,
386                content: local_var_content,
387                entity: local_var_entity,
388            };
389            Err(Error::ResponseError(local_var_error))
390        }
391    }
392
393    async fn bulk_confirm<'a>(
394        &self,
395        org_id: uuid::Uuid,
396        organization_user_bulk_confirm_request_model: Option<
397            models::OrganizationUserBulkConfirmRequestModel,
398        >,
399    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkConfirmError>>
400    {
401        let local_var_configuration = &self.configuration;
402
403        let local_var_client = &local_var_configuration.client;
404
405        let local_var_uri_str = format!(
406            "{}/organizations/{orgId}/users/confirm",
407            local_var_configuration.base_path,
408            orgId = org_id
409        );
410        let mut local_var_req_builder =
411            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
412
413        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
414        local_var_req_builder =
415            local_var_req_builder.json(&organization_user_bulk_confirm_request_model);
416
417        let local_var_resp = local_var_req_builder.send().await?;
418
419        let local_var_status = local_var_resp.status();
420        let local_var_content_type = local_var_resp
421            .headers()
422            .get("content-type")
423            .and_then(|v| v.to_str().ok())
424            .unwrap_or("application/octet-stream");
425        let local_var_content_type = super::ContentType::from(local_var_content_type);
426        let local_var_content = local_var_resp.text().await?;
427
428        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
429            match local_var_content_type {
430                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
431                ContentType::Text => {
432                    return Err(Error::from(serde_json::Error::custom(
433                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`",
434                    )));
435                }
436                ContentType::Unsupported(local_var_unknown_type) => {
437                    return Err(Error::from(serde_json::Error::custom(format!(
438                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`"
439                    ))));
440                }
441            }
442        } else {
443            let local_var_entity: Option<BulkConfirmError> =
444                serde_json::from_str(&local_var_content).ok();
445            let local_var_error = ResponseContent {
446                status: local_var_status,
447                content: local_var_content,
448                entity: local_var_entity,
449            };
450            Err(Error::ResponseError(local_var_error))
451        }
452    }
453
454    async fn bulk_delete_account<'a>(
455        &self,
456        org_id: uuid::Uuid,
457        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
458    ) -> Result<
459        models::OrganizationUserBulkResponseModelListResponseModel,
460        Error<BulkDeleteAccountError>,
461    > {
462        let local_var_configuration = &self.configuration;
463
464        let local_var_client = &local_var_configuration.client;
465
466        let local_var_uri_str = format!(
467            "{}/organizations/{orgId}/users/delete-account",
468            local_var_configuration.base_path,
469            orgId = org_id
470        );
471        let mut local_var_req_builder =
472            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
473
474        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
475        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
476
477        let local_var_resp = local_var_req_builder.send().await?;
478
479        let local_var_status = local_var_resp.status();
480        let local_var_content_type = local_var_resp
481            .headers()
482            .get("content-type")
483            .and_then(|v| v.to_str().ok())
484            .unwrap_or("application/octet-stream");
485        let local_var_content_type = super::ContentType::from(local_var_content_type);
486        let local_var_content = local_var_resp.text().await?;
487
488        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
489            match local_var_content_type {
490                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
491                ContentType::Text => {
492                    return Err(Error::from(serde_json::Error::custom(
493                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`",
494                    )));
495                }
496                ContentType::Unsupported(local_var_unknown_type) => {
497                    return Err(Error::from(serde_json::Error::custom(format!(
498                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`"
499                    ))));
500                }
501            }
502        } else {
503            let local_var_entity: Option<BulkDeleteAccountError> =
504                serde_json::from_str(&local_var_content).ok();
505            let local_var_error = ResponseContent {
506                status: local_var_status,
507                content: local_var_content,
508                entity: local_var_entity,
509            };
510            Err(Error::ResponseError(local_var_error))
511        }
512    }
513
514    async fn bulk_enable_secrets_manager<'a>(
515        &self,
516        org_id: uuid::Uuid,
517        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
518    ) -> Result<(), Error<BulkEnableSecretsManagerError>> {
519        let local_var_configuration = &self.configuration;
520
521        let local_var_client = &local_var_configuration.client;
522
523        let local_var_uri_str = format!(
524            "{}/organizations/{orgId}/users/enable-secrets-manager",
525            local_var_configuration.base_path,
526            orgId = org_id
527        );
528        let mut local_var_req_builder =
529            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
530
531        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
532        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
533
534        let local_var_resp = local_var_req_builder.send().await?;
535
536        let local_var_status = local_var_resp.status();
537        let local_var_content = local_var_resp.text().await?;
538
539        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
540            Ok(())
541        } else {
542            let local_var_entity: Option<BulkEnableSecretsManagerError> =
543                serde_json::from_str(&local_var_content).ok();
544            let local_var_error = ResponseContent {
545                status: local_var_status,
546                content: local_var_content,
547                entity: local_var_entity,
548            };
549            Err(Error::ResponseError(local_var_error))
550        }
551    }
552
553    async fn bulk_reinvite<'a>(
554        &self,
555        org_id: uuid::Uuid,
556        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
557    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkReinviteError>>
558    {
559        let local_var_configuration = &self.configuration;
560
561        let local_var_client = &local_var_configuration.client;
562
563        let local_var_uri_str = format!(
564            "{}/organizations/{orgId}/users/reinvite",
565            local_var_configuration.base_path,
566            orgId = org_id
567        );
568        let mut local_var_req_builder =
569            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
570
571        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
572        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
573
574        let local_var_resp = local_var_req_builder.send().await?;
575
576        let local_var_status = local_var_resp.status();
577        let local_var_content_type = local_var_resp
578            .headers()
579            .get("content-type")
580            .and_then(|v| v.to_str().ok())
581            .unwrap_or("application/octet-stream");
582        let local_var_content_type = super::ContentType::from(local_var_content_type);
583        let local_var_content = local_var_resp.text().await?;
584
585        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
586            match local_var_content_type {
587                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
588                ContentType::Text => {
589                    return Err(Error::from(serde_json::Error::custom(
590                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`",
591                    )));
592                }
593                ContentType::Unsupported(local_var_unknown_type) => {
594                    return Err(Error::from(serde_json::Error::custom(format!(
595                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`"
596                    ))));
597                }
598            }
599        } else {
600            let local_var_entity: Option<BulkReinviteError> =
601                serde_json::from_str(&local_var_content).ok();
602            let local_var_error = ResponseContent {
603                status: local_var_status,
604                content: local_var_content,
605                entity: local_var_entity,
606            };
607            Err(Error::ResponseError(local_var_error))
608        }
609    }
610
611    async fn bulk_remove<'a>(
612        &self,
613        org_id: uuid::Uuid,
614        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
615    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkRemoveError>>
616    {
617        let local_var_configuration = &self.configuration;
618
619        let local_var_client = &local_var_configuration.client;
620
621        let local_var_uri_str = format!(
622            "{}/organizations/{orgId}/users",
623            local_var_configuration.base_path,
624            orgId = org_id
625        );
626        let mut local_var_req_builder =
627            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
628
629        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
630        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
631
632        let local_var_resp = local_var_req_builder.send().await?;
633
634        let local_var_status = local_var_resp.status();
635        let local_var_content_type = local_var_resp
636            .headers()
637            .get("content-type")
638            .and_then(|v| v.to_str().ok())
639            .unwrap_or("application/octet-stream");
640        let local_var_content_type = super::ContentType::from(local_var_content_type);
641        let local_var_content = local_var_resp.text().await?;
642
643        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
644            match local_var_content_type {
645                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
646                ContentType::Text => {
647                    return Err(Error::from(serde_json::Error::custom(
648                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`",
649                    )));
650                }
651                ContentType::Unsupported(local_var_unknown_type) => {
652                    return Err(Error::from(serde_json::Error::custom(format!(
653                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`"
654                    ))));
655                }
656            }
657        } else {
658            let local_var_entity: Option<BulkRemoveError> =
659                serde_json::from_str(&local_var_content).ok();
660            let local_var_error = ResponseContent {
661                status: local_var_status,
662                content: local_var_content,
663                entity: local_var_entity,
664            };
665            Err(Error::ResponseError(local_var_error))
666        }
667    }
668
669    async fn bulk_restore<'a>(
670        &self,
671        org_id: uuid::Uuid,
672        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
673    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkRestoreError>>
674    {
675        let local_var_configuration = &self.configuration;
676
677        let local_var_client = &local_var_configuration.client;
678
679        let local_var_uri_str = format!(
680            "{}/organizations/{orgId}/users/restore",
681            local_var_configuration.base_path,
682            orgId = org_id
683        );
684        let mut local_var_req_builder =
685            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
686
687        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
688        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
689
690        let local_var_resp = local_var_req_builder.send().await?;
691
692        let local_var_status = local_var_resp.status();
693        let local_var_content_type = local_var_resp
694            .headers()
695            .get("content-type")
696            .and_then(|v| v.to_str().ok())
697            .unwrap_or("application/octet-stream");
698        let local_var_content_type = super::ContentType::from(local_var_content_type);
699        let local_var_content = local_var_resp.text().await?;
700
701        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
702            match local_var_content_type {
703                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
704                ContentType::Text => {
705                    return Err(Error::from(serde_json::Error::custom(
706                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`",
707                    )));
708                }
709                ContentType::Unsupported(local_var_unknown_type) => {
710                    return Err(Error::from(serde_json::Error::custom(format!(
711                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`"
712                    ))));
713                }
714            }
715        } else {
716            let local_var_entity: Option<BulkRestoreError> =
717                serde_json::from_str(&local_var_content).ok();
718            let local_var_error = ResponseContent {
719                status: local_var_status,
720                content: local_var_content,
721                entity: local_var_entity,
722            };
723            Err(Error::ResponseError(local_var_error))
724        }
725    }
726
727    async fn bulk_revoke<'a>(
728        &self,
729        org_id: uuid::Uuid,
730        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
731    ) -> Result<models::OrganizationUserBulkResponseModelListResponseModel, Error<BulkRevokeError>>
732    {
733        let local_var_configuration = &self.configuration;
734
735        let local_var_client = &local_var_configuration.client;
736
737        let local_var_uri_str = format!(
738            "{}/organizations/{orgId}/users/revoke",
739            local_var_configuration.base_path,
740            orgId = org_id
741        );
742        let mut local_var_req_builder =
743            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
744
745        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
746        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
747
748        let local_var_resp = local_var_req_builder.send().await?;
749
750        let local_var_status = local_var_resp.status();
751        let local_var_content_type = local_var_resp
752            .headers()
753            .get("content-type")
754            .and_then(|v| v.to_str().ok())
755            .unwrap_or("application/octet-stream");
756        let local_var_content_type = super::ContentType::from(local_var_content_type);
757        let local_var_content = local_var_resp.text().await?;
758
759        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
760            match local_var_content_type {
761                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
762                ContentType::Text => {
763                    return Err(Error::from(serde_json::Error::custom(
764                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`",
765                    )));
766                }
767                ContentType::Unsupported(local_var_unknown_type) => {
768                    return Err(Error::from(serde_json::Error::custom(format!(
769                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserBulkResponseModelListResponseModel`"
770                    ))));
771                }
772            }
773        } else {
774            let local_var_entity: Option<BulkRevokeError> =
775                serde_json::from_str(&local_var_content).ok();
776            let local_var_error = ResponseContent {
777                status: local_var_status,
778                content: local_var_content,
779                entity: local_var_entity,
780            };
781            Err(Error::ResponseError(local_var_error))
782        }
783    }
784
785    async fn confirm<'a>(
786        &self,
787        org_id: uuid::Uuid,
788        id: uuid::Uuid,
789        organization_user_confirm_request_model: Option<
790            models::OrganizationUserConfirmRequestModel,
791        >,
792    ) -> Result<(), Error<ConfirmError>> {
793        let local_var_configuration = &self.configuration;
794
795        let local_var_client = &local_var_configuration.client;
796
797        let local_var_uri_str = format!(
798            "{}/organizations/{orgId}/users/{id}/confirm",
799            local_var_configuration.base_path,
800            orgId = org_id,
801            id = id
802        );
803        let mut local_var_req_builder =
804            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
805
806        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
807        local_var_req_builder =
808            local_var_req_builder.json(&organization_user_confirm_request_model);
809
810        let local_var_resp = local_var_req_builder.send().await?;
811
812        let local_var_status = local_var_resp.status();
813        let local_var_content = local_var_resp.text().await?;
814
815        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
816            Ok(())
817        } else {
818            let local_var_entity: Option<ConfirmError> =
819                serde_json::from_str(&local_var_content).ok();
820            let local_var_error = ResponseContent {
821                status: local_var_status,
822                content: local_var_content,
823                entity: local_var_entity,
824            };
825            Err(Error::ResponseError(local_var_error))
826        }
827    }
828
829    async fn delete_account<'a>(
830        &self,
831        org_id: uuid::Uuid,
832        id: uuid::Uuid,
833    ) -> Result<(), Error<DeleteAccountError>> {
834        let local_var_configuration = &self.configuration;
835
836        let local_var_client = &local_var_configuration.client;
837
838        let local_var_uri_str = format!(
839            "{}/organizations/{orgId}/users/{id}/delete-account",
840            local_var_configuration.base_path,
841            orgId = org_id,
842            id = id
843        );
844        let mut local_var_req_builder =
845            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
846
847        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
848
849        let local_var_resp = local_var_req_builder.send().await?;
850
851        let local_var_status = local_var_resp.status();
852        let local_var_content = local_var_resp.text().await?;
853
854        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
855            Ok(())
856        } else {
857            let local_var_entity: Option<DeleteAccountError> =
858                serde_json::from_str(&local_var_content).ok();
859            let local_var_error = ResponseContent {
860                status: local_var_status,
861                content: local_var_content,
862                entity: local_var_entity,
863            };
864            Err(Error::ResponseError(local_var_error))
865        }
866    }
867
868    async fn get<'a>(
869        &self,
870        org_id: uuid::Uuid,
871        id: uuid::Uuid,
872        include_groups: Option<bool>,
873    ) -> Result<models::OrganizationUserDetailsResponseModel, Error<GetError>> {
874        let local_var_configuration = &self.configuration;
875
876        let local_var_client = &local_var_configuration.client;
877
878        let local_var_uri_str = format!(
879            "{}/organizations/{orgId}/users/{id}",
880            local_var_configuration.base_path,
881            orgId = org_id,
882            id = id
883        );
884        let mut local_var_req_builder =
885            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
886
887        if let Some(ref param_value) = include_groups {
888            local_var_req_builder =
889                local_var_req_builder.query(&[("includeGroups", &param_value.to_string())]);
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_type = local_var_resp
897            .headers()
898            .get("content-type")
899            .and_then(|v| v.to_str().ok())
900            .unwrap_or("application/octet-stream");
901        let local_var_content_type = super::ContentType::from(local_var_content_type);
902        let local_var_content = local_var_resp.text().await?;
903
904        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
905            match local_var_content_type {
906                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
907                ContentType::Text => {
908                    return Err(Error::from(serde_json::Error::custom(
909                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserDetailsResponseModel`",
910                    )));
911                }
912                ContentType::Unsupported(local_var_unknown_type) => {
913                    return Err(Error::from(serde_json::Error::custom(format!(
914                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserDetailsResponseModel`"
915                    ))));
916                }
917            }
918        } else {
919            let local_var_entity: Option<GetError> = serde_json::from_str(&local_var_content).ok();
920            let local_var_error = ResponseContent {
921                status: local_var_status,
922                content: local_var_content,
923                entity: local_var_entity,
924            };
925            Err(Error::ResponseError(local_var_error))
926        }
927    }
928
929    async fn get_account_recovery_details<'a>(
930        &self,
931        org_id: uuid::Uuid,
932        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
933    ) -> Result<
934        models::OrganizationUserResetPasswordDetailsResponseModelListResponseModel,
935        Error<GetAccountRecoveryDetailsError>,
936    > {
937        let local_var_configuration = &self.configuration;
938
939        let local_var_client = &local_var_configuration.client;
940
941        let local_var_uri_str = format!(
942            "{}/organizations/{orgId}/users/account-recovery-details",
943            local_var_configuration.base_path,
944            orgId = org_id
945        );
946        let mut local_var_req_builder =
947            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
948
949        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
950        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
951
952        let local_var_resp = local_var_req_builder.send().await?;
953
954        let local_var_status = local_var_resp.status();
955        let local_var_content_type = local_var_resp
956            .headers()
957            .get("content-type")
958            .and_then(|v| v.to_str().ok())
959            .unwrap_or("application/octet-stream");
960        let local_var_content_type = super::ContentType::from(local_var_content_type);
961        let local_var_content = local_var_resp.text().await?;
962
963        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
964            match local_var_content_type {
965                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
966                ContentType::Text => {
967                    return Err(Error::from(serde_json::Error::custom(
968                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserResetPasswordDetailsResponseModelListResponseModel`",
969                    )));
970                }
971                ContentType::Unsupported(local_var_unknown_type) => {
972                    return Err(Error::from(serde_json::Error::custom(format!(
973                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserResetPasswordDetailsResponseModelListResponseModel`"
974                    ))));
975                }
976            }
977        } else {
978            let local_var_entity: Option<GetAccountRecoveryDetailsError> =
979                serde_json::from_str(&local_var_content).ok();
980            let local_var_error = ResponseContent {
981                status: local_var_status,
982                content: local_var_content,
983                entity: local_var_entity,
984            };
985            Err(Error::ResponseError(local_var_error))
986        }
987    }
988
989    async fn get_all<'a>(
990        &self,
991        org_id: uuid::Uuid,
992        include_groups: Option<bool>,
993        include_collections: Option<bool>,
994    ) -> Result<models::OrganizationUserUserDetailsResponseModelListResponseModel, Error<GetAllError>>
995    {
996        let local_var_configuration = &self.configuration;
997
998        let local_var_client = &local_var_configuration.client;
999
1000        let local_var_uri_str = format!(
1001            "{}/organizations/{orgId}/users",
1002            local_var_configuration.base_path,
1003            orgId = org_id
1004        );
1005        let mut local_var_req_builder =
1006            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1007
1008        if let Some(ref param_value) = include_groups {
1009            local_var_req_builder =
1010                local_var_req_builder.query(&[("includeGroups", &param_value.to_string())]);
1011        }
1012        if let Some(ref param_value) = include_collections {
1013            local_var_req_builder =
1014                local_var_req_builder.query(&[("includeCollections", &param_value.to_string())]);
1015        }
1016        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1017
1018        let local_var_resp = local_var_req_builder.send().await?;
1019
1020        let local_var_status = local_var_resp.status();
1021        let local_var_content_type = local_var_resp
1022            .headers()
1023            .get("content-type")
1024            .and_then(|v| v.to_str().ok())
1025            .unwrap_or("application/octet-stream");
1026        let local_var_content_type = super::ContentType::from(local_var_content_type);
1027        let local_var_content = local_var_resp.text().await?;
1028
1029        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1030            match local_var_content_type {
1031                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1032                ContentType::Text => {
1033                    return Err(Error::from(serde_json::Error::custom(
1034                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserUserDetailsResponseModelListResponseModel`",
1035                    )));
1036                }
1037                ContentType::Unsupported(local_var_unknown_type) => {
1038                    return Err(Error::from(serde_json::Error::custom(format!(
1039                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserUserDetailsResponseModelListResponseModel`"
1040                    ))));
1041                }
1042            }
1043        } else {
1044            let local_var_entity: Option<GetAllError> =
1045                serde_json::from_str(&local_var_content).ok();
1046            let local_var_error = ResponseContent {
1047                status: local_var_status,
1048                content: local_var_content,
1049                entity: local_var_entity,
1050            };
1051            Err(Error::ResponseError(local_var_error))
1052        }
1053    }
1054
1055    async fn get_mini_details<'a>(
1056        &self,
1057        org_id: uuid::Uuid,
1058    ) -> Result<
1059        models::OrganizationUserUserMiniDetailsResponseModelListResponseModel,
1060        Error<GetMiniDetailsError>,
1061    > {
1062        let local_var_configuration = &self.configuration;
1063
1064        let local_var_client = &local_var_configuration.client;
1065
1066        let local_var_uri_str = format!(
1067            "{}/organizations/{orgId}/users/mini-details",
1068            local_var_configuration.base_path,
1069            orgId = org_id
1070        );
1071        let mut local_var_req_builder =
1072            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1073
1074        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1075
1076        let local_var_resp = local_var_req_builder.send().await?;
1077
1078        let local_var_status = local_var_resp.status();
1079        let local_var_content_type = local_var_resp
1080            .headers()
1081            .get("content-type")
1082            .and_then(|v| v.to_str().ok())
1083            .unwrap_or("application/octet-stream");
1084        let local_var_content_type = super::ContentType::from(local_var_content_type);
1085        let local_var_content = local_var_resp.text().await?;
1086
1087        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1088            match local_var_content_type {
1089                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1090                ContentType::Text => {
1091                    return Err(Error::from(serde_json::Error::custom(
1092                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserUserMiniDetailsResponseModelListResponseModel`",
1093                    )));
1094                }
1095                ContentType::Unsupported(local_var_unknown_type) => {
1096                    return Err(Error::from(serde_json::Error::custom(format!(
1097                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserUserMiniDetailsResponseModelListResponseModel`"
1098                    ))));
1099                }
1100            }
1101        } else {
1102            let local_var_entity: Option<GetMiniDetailsError> =
1103                serde_json::from_str(&local_var_content).ok();
1104            let local_var_error = ResponseContent {
1105                status: local_var_status,
1106                content: local_var_content,
1107                entity: local_var_entity,
1108            };
1109            Err(Error::ResponseError(local_var_error))
1110        }
1111    }
1112
1113    async fn get_reset_password_details<'a>(
1114        &self,
1115        org_id: uuid::Uuid,
1116        id: uuid::Uuid,
1117    ) -> Result<
1118        models::OrganizationUserResetPasswordDetailsResponseModel,
1119        Error<GetResetPasswordDetailsError>,
1120    > {
1121        let local_var_configuration = &self.configuration;
1122
1123        let local_var_client = &local_var_configuration.client;
1124
1125        let local_var_uri_str = format!(
1126            "{}/organizations/{orgId}/users/{id}/reset-password-details",
1127            local_var_configuration.base_path,
1128            orgId = org_id,
1129            id = id
1130        );
1131        let mut local_var_req_builder =
1132            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1133
1134        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1135
1136        let local_var_resp = local_var_req_builder.send().await?;
1137
1138        let local_var_status = local_var_resp.status();
1139        let local_var_content_type = local_var_resp
1140            .headers()
1141            .get("content-type")
1142            .and_then(|v| v.to_str().ok())
1143            .unwrap_or("application/octet-stream");
1144        let local_var_content_type = super::ContentType::from(local_var_content_type);
1145        let local_var_content = local_var_resp.text().await?;
1146
1147        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1148            match local_var_content_type {
1149                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1150                ContentType::Text => {
1151                    return Err(Error::from(serde_json::Error::custom(
1152                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserResetPasswordDetailsResponseModel`",
1153                    )));
1154                }
1155                ContentType::Unsupported(local_var_unknown_type) => {
1156                    return Err(Error::from(serde_json::Error::custom(format!(
1157                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserResetPasswordDetailsResponseModel`"
1158                    ))));
1159                }
1160            }
1161        } else {
1162            let local_var_entity: Option<GetResetPasswordDetailsError> =
1163                serde_json::from_str(&local_var_content).ok();
1164            let local_var_error = ResponseContent {
1165                status: local_var_status,
1166                content: local_var_content,
1167                entity: local_var_entity,
1168            };
1169            Err(Error::ResponseError(local_var_error))
1170        }
1171    }
1172
1173    async fn invite<'a>(
1174        &self,
1175        org_id: uuid::Uuid,
1176        organization_user_invite_request_model: Option<models::OrganizationUserInviteRequestModel>,
1177    ) -> Result<(), Error<InviteError>> {
1178        let local_var_configuration = &self.configuration;
1179
1180        let local_var_client = &local_var_configuration.client;
1181
1182        let local_var_uri_str = format!(
1183            "{}/organizations/{orgId}/users/invite",
1184            local_var_configuration.base_path,
1185            orgId = org_id
1186        );
1187        let mut local_var_req_builder =
1188            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1189
1190        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1191        local_var_req_builder = local_var_req_builder.json(&organization_user_invite_request_model);
1192
1193        let local_var_resp = local_var_req_builder.send().await?;
1194
1195        let local_var_status = local_var_resp.status();
1196        let local_var_content = local_var_resp.text().await?;
1197
1198        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1199            Ok(())
1200        } else {
1201            let local_var_entity: Option<InviteError> =
1202                serde_json::from_str(&local_var_content).ok();
1203            let local_var_error = ResponseContent {
1204                status: local_var_status,
1205                content: local_var_content,
1206                entity: local_var_entity,
1207            };
1208            Err(Error::ResponseError(local_var_error))
1209        }
1210    }
1211
1212    async fn put<'a>(
1213        &self,
1214        org_id: uuid::Uuid,
1215        id: uuid::Uuid,
1216        organization_user_update_request_model: Option<models::OrganizationUserUpdateRequestModel>,
1217    ) -> Result<(), Error<PutError>> {
1218        let local_var_configuration = &self.configuration;
1219
1220        let local_var_client = &local_var_configuration.client;
1221
1222        let local_var_uri_str = format!(
1223            "{}/organizations/{orgId}/users/{id}",
1224            local_var_configuration.base_path,
1225            orgId = org_id,
1226            id = id
1227        );
1228        let mut local_var_req_builder =
1229            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1230
1231        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1232        local_var_req_builder = local_var_req_builder.json(&organization_user_update_request_model);
1233
1234        let local_var_resp = local_var_req_builder.send().await?;
1235
1236        let local_var_status = local_var_resp.status();
1237        let local_var_content = local_var_resp.text().await?;
1238
1239        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1240            Ok(())
1241        } else {
1242            let local_var_entity: Option<PutError> = serde_json::from_str(&local_var_content).ok();
1243            let local_var_error = ResponseContent {
1244                status: local_var_status,
1245                content: local_var_content,
1246                entity: local_var_entity,
1247            };
1248            Err(Error::ResponseError(local_var_error))
1249        }
1250    }
1251
1252    async fn put_reset_password<'a>(
1253        &self,
1254        org_id: uuid::Uuid,
1255        id: uuid::Uuid,
1256        organization_user_reset_password_request_model: Option<
1257            models::OrganizationUserResetPasswordRequestModel,
1258        >,
1259    ) -> Result<(), Error<PutResetPasswordError>> {
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/{orgId}/users/{id}/reset-password",
1266            local_var_configuration.base_path,
1267            orgId = org_id,
1268            id = id
1269        );
1270        let mut local_var_req_builder =
1271            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1272
1273        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1274        local_var_req_builder =
1275            local_var_req_builder.json(&organization_user_reset_password_request_model);
1276
1277        let local_var_resp = local_var_req_builder.send().await?;
1278
1279        let local_var_status = local_var_resp.status();
1280        let local_var_content = local_var_resp.text().await?;
1281
1282        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1283            Ok(())
1284        } else {
1285            let local_var_entity: Option<PutResetPasswordError> =
1286                serde_json::from_str(&local_var_content).ok();
1287            let local_var_error = ResponseContent {
1288                status: local_var_status,
1289                content: local_var_content,
1290                entity: local_var_entity,
1291            };
1292            Err(Error::ResponseError(local_var_error))
1293        }
1294    }
1295
1296    async fn put_reset_password_enrollment<'a>(
1297        &self,
1298        org_id: uuid::Uuid,
1299        user_id: uuid::Uuid,
1300        organization_user_reset_password_enrollment_request_model: Option<
1301            models::OrganizationUserResetPasswordEnrollmentRequestModel,
1302        >,
1303    ) -> Result<(), Error<PutResetPasswordEnrollmentError>> {
1304        let local_var_configuration = &self.configuration;
1305
1306        let local_var_client = &local_var_configuration.client;
1307
1308        let local_var_uri_str = format!(
1309            "{}/organizations/{orgId}/users/{userId}/reset-password-enrollment",
1310            local_var_configuration.base_path,
1311            orgId = org_id,
1312            userId = user_id
1313        );
1314        let mut local_var_req_builder =
1315            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1316
1317        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1318        local_var_req_builder =
1319            local_var_req_builder.json(&organization_user_reset_password_enrollment_request_model);
1320
1321        let local_var_resp = local_var_req_builder.send().await?;
1322
1323        let local_var_status = local_var_resp.status();
1324        let local_var_content = local_var_resp.text().await?;
1325
1326        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1327            Ok(())
1328        } else {
1329            let local_var_entity: Option<PutResetPasswordEnrollmentError> =
1330                serde_json::from_str(&local_var_content).ok();
1331            let local_var_error = ResponseContent {
1332                status: local_var_status,
1333                content: local_var_content,
1334                entity: local_var_entity,
1335            };
1336            Err(Error::ResponseError(local_var_error))
1337        }
1338    }
1339
1340    async fn reinvite<'a>(
1341        &self,
1342        org_id: uuid::Uuid,
1343        id: uuid::Uuid,
1344    ) -> Result<(), Error<ReinviteError>> {
1345        let local_var_configuration = &self.configuration;
1346
1347        let local_var_client = &local_var_configuration.client;
1348
1349        let local_var_uri_str = format!(
1350            "{}/organizations/{orgId}/users/{id}/reinvite",
1351            local_var_configuration.base_path,
1352            orgId = org_id,
1353            id = id
1354        );
1355        let mut local_var_req_builder =
1356            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1357
1358        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1359
1360        let local_var_resp = local_var_req_builder.send().await?;
1361
1362        let local_var_status = local_var_resp.status();
1363        let local_var_content = local_var_resp.text().await?;
1364
1365        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1366            Ok(())
1367        } else {
1368            let local_var_entity: Option<ReinviteError> =
1369                serde_json::from_str(&local_var_content).ok();
1370            let local_var_error = ResponseContent {
1371                status: local_var_status,
1372                content: local_var_content,
1373                entity: local_var_entity,
1374            };
1375            Err(Error::ResponseError(local_var_error))
1376        }
1377    }
1378
1379    async fn remove<'a>(
1380        &self,
1381        org_id: uuid::Uuid,
1382        id: uuid::Uuid,
1383    ) -> Result<(), Error<RemoveError>> {
1384        let local_var_configuration = &self.configuration;
1385
1386        let local_var_client = &local_var_configuration.client;
1387
1388        let local_var_uri_str = format!(
1389            "{}/organizations/{orgId}/users/{id}",
1390            local_var_configuration.base_path,
1391            orgId = org_id,
1392            id = id
1393        );
1394        let mut local_var_req_builder =
1395            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1396
1397        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1398
1399        let local_var_resp = local_var_req_builder.send().await?;
1400
1401        let local_var_status = local_var_resp.status();
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            Ok(())
1406        } else {
1407            let local_var_entity: Option<RemoveError> =
1408                serde_json::from_str(&local_var_content).ok();
1409            let local_var_error = ResponseContent {
1410                status: local_var_status,
1411                content: local_var_content,
1412                entity: local_var_entity,
1413            };
1414            Err(Error::ResponseError(local_var_error))
1415        }
1416    }
1417
1418    async fn restore_async_v_next<'a>(
1419        &self,
1420        org_id: uuid::Uuid,
1421        id: uuid::Uuid,
1422        organization_user_restore_request: Option<models::OrganizationUserRestoreRequest>,
1423    ) -> Result<(), Error<RestoreAsync_vNextError>> {
1424        let local_var_configuration = &self.configuration;
1425
1426        let local_var_client = &local_var_configuration.client;
1427
1428        let local_var_uri_str = format!(
1429            "{}/organizations/{orgId}/users/{id}/restore/vnext",
1430            local_var_configuration.base_path,
1431            orgId = org_id,
1432            id = id
1433        );
1434        let mut local_var_req_builder =
1435            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1436
1437        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1438        local_var_req_builder = local_var_req_builder.json(&organization_user_restore_request);
1439
1440        let local_var_resp = local_var_req_builder.send().await?;
1441
1442        let local_var_status = local_var_resp.status();
1443        let local_var_content = local_var_resp.text().await?;
1444
1445        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1446            Ok(())
1447        } else {
1448            let local_var_entity: Option<RestoreAsync_vNextError> =
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 revoke<'a>(
1460        &self,
1461        org_id: uuid::Uuid,
1462        id: uuid::Uuid,
1463    ) -> Result<(), Error<RevokeError>> {
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/{orgId}/users/{id}/revoke",
1470            local_var_configuration.base_path,
1471            orgId = org_id,
1472            id = id
1473        );
1474        let mut local_var_req_builder =
1475            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1476
1477        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1478
1479        let local_var_resp = local_var_req_builder.send().await?;
1480
1481        let local_var_status = local_var_resp.status();
1482        let local_var_content = local_var_resp.text().await?;
1483
1484        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1485            Ok(())
1486        } else {
1487            let local_var_entity: Option<RevokeError> =
1488                serde_json::from_str(&local_var_content).ok();
1489            let local_var_error = ResponseContent {
1490                status: local_var_status,
1491                content: local_var_content,
1492                entity: local_var_entity,
1493            };
1494            Err(Error::ResponseError(local_var_error))
1495        }
1496    }
1497
1498    async fn revoke_self<'a>(&self, org_id: uuid::Uuid) -> Result<(), Error<RevokeSelfError>> {
1499        let local_var_configuration = &self.configuration;
1500
1501        let local_var_client = &local_var_configuration.client;
1502
1503        let local_var_uri_str = format!(
1504            "{}/organizations/{orgId}/users/revoke-self",
1505            local_var_configuration.base_path,
1506            orgId = org_id
1507        );
1508        let mut local_var_req_builder =
1509            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1510
1511        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1512
1513        let local_var_resp = local_var_req_builder.send().await?;
1514
1515        let local_var_status = local_var_resp.status();
1516        let local_var_content = local_var_resp.text().await?;
1517
1518        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1519            Ok(())
1520        } else {
1521            let local_var_entity: Option<RevokeSelfError> =
1522                serde_json::from_str(&local_var_content).ok();
1523            let local_var_error = ResponseContent {
1524                status: local_var_status,
1525                content: local_var_content,
1526                entity: local_var_entity,
1527            };
1528            Err(Error::ResponseError(local_var_error))
1529        }
1530    }
1531
1532    async fn user_public_keys<'a>(
1533        &self,
1534        org_id: uuid::Uuid,
1535        organization_user_bulk_request_model: Option<models::OrganizationUserBulkRequestModel>,
1536    ) -> Result<
1537        models::OrganizationUserPublicKeyResponseModelListResponseModel,
1538        Error<UserPublicKeysError>,
1539    > {
1540        let local_var_configuration = &self.configuration;
1541
1542        let local_var_client = &local_var_configuration.client;
1543
1544        let local_var_uri_str = format!(
1545            "{}/organizations/{orgId}/users/public-keys",
1546            local_var_configuration.base_path,
1547            orgId = org_id
1548        );
1549        let mut local_var_req_builder =
1550            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1551
1552        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1553        local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model);
1554
1555        let local_var_resp = local_var_req_builder.send().await?;
1556
1557        let local_var_status = local_var_resp.status();
1558        let local_var_content_type = local_var_resp
1559            .headers()
1560            .get("content-type")
1561            .and_then(|v| v.to_str().ok())
1562            .unwrap_or("application/octet-stream");
1563        let local_var_content_type = super::ContentType::from(local_var_content_type);
1564        let local_var_content = local_var_resp.text().await?;
1565
1566        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1567            match local_var_content_type {
1568                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1569                ContentType::Text => {
1570                    return Err(Error::from(serde_json::Error::custom(
1571                        "Received `text/plain` content type response that cannot be converted to `models::OrganizationUserPublicKeyResponseModelListResponseModel`",
1572                    )));
1573                }
1574                ContentType::Unsupported(local_var_unknown_type) => {
1575                    return Err(Error::from(serde_json::Error::custom(format!(
1576                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OrganizationUserPublicKeyResponseModelListResponseModel`"
1577                    ))));
1578                }
1579            }
1580        } else {
1581            let local_var_entity: Option<UserPublicKeysError> =
1582                serde_json::from_str(&local_var_content).ok();
1583            let local_var_error = ResponseContent {
1584                status: local_var_status,
1585                content: local_var_content,
1586                entity: local_var_entity,
1587            };
1588            Err(Error::ResponseError(local_var_error))
1589        }
1590    }
1591}
1592
1593/// struct for typed errors of method [`OrganizationUsersApi::accept`]
1594#[derive(Debug, Clone, Serialize, Deserialize)]
1595#[serde(untagged)]
1596pub enum AcceptError {
1597    UnknownValue(serde_json::Value),
1598}
1599/// struct for typed errors of method [`OrganizationUsersApi::accept_init`]
1600#[derive(Debug, Clone, Serialize, Deserialize)]
1601#[serde(untagged)]
1602pub enum AcceptInitError {
1603    UnknownValue(serde_json::Value),
1604}
1605/// struct for typed errors of method
1606/// [`OrganizationUsersApi::automatically_confirm_organization_user`]
1607#[derive(Debug, Clone, Serialize, Deserialize)]
1608#[serde(untagged)]
1609pub enum AutomaticallyConfirmOrganizationUserError {
1610    UnknownValue(serde_json::Value),
1611}
1612/// struct for typed errors of method [`OrganizationUsersApi::bulk_confirm`]
1613#[derive(Debug, Clone, Serialize, Deserialize)]
1614#[serde(untagged)]
1615pub enum BulkConfirmError {
1616    UnknownValue(serde_json::Value),
1617}
1618/// struct for typed errors of method [`OrganizationUsersApi::bulk_delete_account`]
1619#[derive(Debug, Clone, Serialize, Deserialize)]
1620#[serde(untagged)]
1621pub enum BulkDeleteAccountError {
1622    UnknownValue(serde_json::Value),
1623}
1624/// struct for typed errors of method [`OrganizationUsersApi::bulk_enable_secrets_manager`]
1625#[derive(Debug, Clone, Serialize, Deserialize)]
1626#[serde(untagged)]
1627pub enum BulkEnableSecretsManagerError {
1628    UnknownValue(serde_json::Value),
1629}
1630/// struct for typed errors of method [`OrganizationUsersApi::bulk_reinvite`]
1631#[derive(Debug, Clone, Serialize, Deserialize)]
1632#[serde(untagged)]
1633pub enum BulkReinviteError {
1634    UnknownValue(serde_json::Value),
1635}
1636/// struct for typed errors of method [`OrganizationUsersApi::bulk_remove`]
1637#[derive(Debug, Clone, Serialize, Deserialize)]
1638#[serde(untagged)]
1639pub enum BulkRemoveError {
1640    UnknownValue(serde_json::Value),
1641}
1642/// struct for typed errors of method [`OrganizationUsersApi::bulk_restore`]
1643#[derive(Debug, Clone, Serialize, Deserialize)]
1644#[serde(untagged)]
1645pub enum BulkRestoreError {
1646    UnknownValue(serde_json::Value),
1647}
1648/// struct for typed errors of method [`OrganizationUsersApi::bulk_revoke`]
1649#[derive(Debug, Clone, Serialize, Deserialize)]
1650#[serde(untagged)]
1651pub enum BulkRevokeError {
1652    UnknownValue(serde_json::Value),
1653}
1654/// struct for typed errors of method [`OrganizationUsersApi::confirm`]
1655#[derive(Debug, Clone, Serialize, Deserialize)]
1656#[serde(untagged)]
1657pub enum ConfirmError {
1658    UnknownValue(serde_json::Value),
1659}
1660/// struct for typed errors of method [`OrganizationUsersApi::delete_account`]
1661#[derive(Debug, Clone, Serialize, Deserialize)]
1662#[serde(untagged)]
1663pub enum DeleteAccountError {
1664    UnknownValue(serde_json::Value),
1665}
1666/// struct for typed errors of method [`OrganizationUsersApi::get`]
1667#[derive(Debug, Clone, Serialize, Deserialize)]
1668#[serde(untagged)]
1669pub enum GetError {
1670    UnknownValue(serde_json::Value),
1671}
1672/// struct for typed errors of method [`OrganizationUsersApi::get_account_recovery_details`]
1673#[derive(Debug, Clone, Serialize, Deserialize)]
1674#[serde(untagged)]
1675pub enum GetAccountRecoveryDetailsError {
1676    UnknownValue(serde_json::Value),
1677}
1678/// struct for typed errors of method [`OrganizationUsersApi::get_all`]
1679#[derive(Debug, Clone, Serialize, Deserialize)]
1680#[serde(untagged)]
1681pub enum GetAllError {
1682    UnknownValue(serde_json::Value),
1683}
1684/// struct for typed errors of method [`OrganizationUsersApi::get_mini_details`]
1685#[derive(Debug, Clone, Serialize, Deserialize)]
1686#[serde(untagged)]
1687pub enum GetMiniDetailsError {
1688    UnknownValue(serde_json::Value),
1689}
1690/// struct for typed errors of method [`OrganizationUsersApi::get_reset_password_details`]
1691#[derive(Debug, Clone, Serialize, Deserialize)]
1692#[serde(untagged)]
1693pub enum GetResetPasswordDetailsError {
1694    UnknownValue(serde_json::Value),
1695}
1696/// struct for typed errors of method [`OrganizationUsersApi::invite`]
1697#[derive(Debug, Clone, Serialize, Deserialize)]
1698#[serde(untagged)]
1699pub enum InviteError {
1700    UnknownValue(serde_json::Value),
1701}
1702/// struct for typed errors of method [`OrganizationUsersApi::put`]
1703#[derive(Debug, Clone, Serialize, Deserialize)]
1704#[serde(untagged)]
1705pub enum PutError {
1706    UnknownValue(serde_json::Value),
1707}
1708/// struct for typed errors of method [`OrganizationUsersApi::put_reset_password`]
1709#[derive(Debug, Clone, Serialize, Deserialize)]
1710#[serde(untagged)]
1711pub enum PutResetPasswordError {
1712    UnknownValue(serde_json::Value),
1713}
1714/// struct for typed errors of method [`OrganizationUsersApi::put_reset_password_enrollment`]
1715#[derive(Debug, Clone, Serialize, Deserialize)]
1716#[serde(untagged)]
1717pub enum PutResetPasswordEnrollmentError {
1718    UnknownValue(serde_json::Value),
1719}
1720/// struct for typed errors of method [`OrganizationUsersApi::reinvite`]
1721#[derive(Debug, Clone, Serialize, Deserialize)]
1722#[serde(untagged)]
1723pub enum ReinviteError {
1724    UnknownValue(serde_json::Value),
1725}
1726/// struct for typed errors of method [`OrganizationUsersApi::remove`]
1727#[derive(Debug, Clone, Serialize, Deserialize)]
1728#[serde(untagged)]
1729pub enum RemoveError {
1730    UnknownValue(serde_json::Value),
1731}
1732/// struct for typed errors of method [`OrganizationUsersApi::restore_async_v_next`]
1733#[derive(Debug, Clone, Serialize, Deserialize)]
1734#[serde(untagged)]
1735pub enum RestoreAsync_vNextError {
1736    UnknownValue(serde_json::Value),
1737}
1738/// struct for typed errors of method [`OrganizationUsersApi::revoke`]
1739#[derive(Debug, Clone, Serialize, Deserialize)]
1740#[serde(untagged)]
1741pub enum RevokeError {
1742    UnknownValue(serde_json::Value),
1743}
1744/// struct for typed errors of method [`OrganizationUsersApi::revoke_self`]
1745#[derive(Debug, Clone, Serialize, Deserialize)]
1746#[serde(untagged)]
1747pub enum RevokeSelfError {
1748    UnknownValue(serde_json::Value),
1749}
1750/// struct for typed errors of method [`OrganizationUsersApi::user_public_keys`]
1751#[derive(Debug, Clone, Serialize, Deserialize)]
1752#[serde(untagged)]
1753pub enum UserPublicKeysError {
1754    UnknownValue(serde_json::Value),
1755}