bitwarden_api_api/apis/
groups_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 GroupsApi: Send + Sync {
29    /// DELETE /organizations/{orgId}/groups
30    async fn bulk_delete<'a>(
31        &self,
32        org_id: &'a str,
33        group_bulk_request_model: Option<models::GroupBulkRequestModel>,
34    ) -> Result<(), Error<BulkDeleteError>>;
35
36    /// DELETE /organizations/{orgId}/groups/{id}
37    async fn delete<'a>(&self, org_id: &'a str, id: &'a str) -> Result<(), Error<DeleteError>>;
38
39    /// DELETE /organizations/{orgId}/groups/{id}/user/{orgUserId}
40    async fn delete_user<'a>(
41        &self,
42        org_id: &'a str,
43        id: &'a str,
44        org_user_id: &'a str,
45    ) -> Result<(), Error<DeleteUserError>>;
46
47    /// GET /organizations/{orgId}/groups/{id}
48    async fn get<'a>(
49        &self,
50        org_id: &'a str,
51        id: &'a str,
52    ) -> Result<models::GroupResponseModel, Error<GetError>>;
53
54    /// GET /organizations/{orgId}/groups/{id}/details
55    async fn get_details<'a>(
56        &self,
57        org_id: &'a str,
58        id: &'a str,
59    ) -> Result<models::GroupDetailsResponseModel, Error<GetDetailsError>>;
60
61    /// GET /organizations/{orgId}/groups/details
62    async fn get_organization_group_details<'a>(
63        &self,
64        org_id: uuid::Uuid,
65    ) -> Result<
66        models::GroupDetailsResponseModelListResponseModel,
67        Error<GetOrganizationGroupDetailsError>,
68    >;
69
70    /// GET /organizations/{orgId}/groups
71    async fn get_organization_groups<'a>(
72        &self,
73        org_id: uuid::Uuid,
74    ) -> Result<models::GroupResponseModelListResponseModel, Error<GetOrganizationGroupsError>>;
75
76    /// GET /organizations/{orgId}/groups/{id}/users
77    async fn get_users<'a>(
78        &self,
79        org_id: &'a str,
80        id: &'a str,
81    ) -> Result<Vec<uuid::Uuid>, Error<GetUsersError>>;
82
83    /// POST /organizations/{orgId}/groups
84    async fn post<'a>(
85        &self,
86        org_id: uuid::Uuid,
87        group_request_model: Option<models::GroupRequestModel>,
88    ) -> Result<models::GroupResponseModel, Error<PostError>>;
89
90    /// PUT /organizations/{orgId}/groups/{id}
91    async fn put<'a>(
92        &self,
93        org_id: uuid::Uuid,
94        id: uuid::Uuid,
95        group_request_model: Option<models::GroupRequestModel>,
96    ) -> Result<models::GroupResponseModel, Error<PutError>>;
97}
98
99pub struct GroupsApiClient {
100    configuration: Arc<configuration::Configuration>,
101}
102
103impl GroupsApiClient {
104    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
105        Self { configuration }
106    }
107}
108
109#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
110#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
111impl GroupsApi for GroupsApiClient {
112    async fn bulk_delete<'a>(
113        &self,
114        org_id: &'a str,
115        group_bulk_request_model: Option<models::GroupBulkRequestModel>,
116    ) -> Result<(), Error<BulkDeleteError>> {
117        let local_var_configuration = &self.configuration;
118
119        let local_var_client = &local_var_configuration.client;
120
121        let local_var_uri_str = format!(
122            "{}/organizations/{orgId}/groups",
123            local_var_configuration.base_path,
124            orgId = crate::apis::urlencode(org_id)
125        );
126        let mut local_var_req_builder =
127            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
128
129        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
130            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
131        };
132        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
133        local_var_req_builder = local_var_req_builder.json(&group_bulk_request_model);
134
135        let local_var_req = local_var_req_builder.build()?;
136        let local_var_resp = local_var_client.execute(local_var_req).await?;
137
138        let local_var_status = local_var_resp.status();
139        let local_var_content = local_var_resp.text().await?;
140
141        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
142            Ok(())
143        } else {
144            let local_var_entity: Option<BulkDeleteError> =
145                serde_json::from_str(&local_var_content).ok();
146            let local_var_error = ResponseContent {
147                status: local_var_status,
148                content: local_var_content,
149                entity: local_var_entity,
150            };
151            Err(Error::ResponseError(local_var_error))
152        }
153    }
154
155    async fn delete<'a>(&self, org_id: &'a str, id: &'a str) -> Result<(), Error<DeleteError>> {
156        let local_var_configuration = &self.configuration;
157
158        let local_var_client = &local_var_configuration.client;
159
160        let local_var_uri_str = format!(
161            "{}/organizations/{orgId}/groups/{id}",
162            local_var_configuration.base_path,
163            orgId = crate::apis::urlencode(org_id),
164            id = crate::apis::urlencode(id)
165        );
166        let mut local_var_req_builder =
167            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
168
169        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
170            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
171        };
172        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
173
174        let local_var_req = local_var_req_builder.build()?;
175        let local_var_resp = local_var_client.execute(local_var_req).await?;
176
177        let local_var_status = local_var_resp.status();
178        let local_var_content = local_var_resp.text().await?;
179
180        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
181            Ok(())
182        } else {
183            let local_var_entity: Option<DeleteError> =
184                serde_json::from_str(&local_var_content).ok();
185            let local_var_error = ResponseContent {
186                status: local_var_status,
187                content: local_var_content,
188                entity: local_var_entity,
189            };
190            Err(Error::ResponseError(local_var_error))
191        }
192    }
193
194    async fn delete_user<'a>(
195        &self,
196        org_id: &'a str,
197        id: &'a str,
198        org_user_id: &'a str,
199    ) -> Result<(), Error<DeleteUserError>> {
200        let local_var_configuration = &self.configuration;
201
202        let local_var_client = &local_var_configuration.client;
203
204        let local_var_uri_str = format!(
205            "{}/organizations/{orgId}/groups/{id}/user/{orgUserId}",
206            local_var_configuration.base_path,
207            orgId = crate::apis::urlencode(org_id),
208            id = crate::apis::urlencode(id),
209            orgUserId = crate::apis::urlencode(org_user_id)
210        );
211        let mut local_var_req_builder =
212            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
213
214        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
215            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
216        };
217        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
218
219        let local_var_req = local_var_req_builder.build()?;
220        let local_var_resp = local_var_client.execute(local_var_req).await?;
221
222        let local_var_status = local_var_resp.status();
223        let local_var_content = local_var_resp.text().await?;
224
225        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
226            Ok(())
227        } else {
228            let local_var_entity: Option<DeleteUserError> =
229                serde_json::from_str(&local_var_content).ok();
230            let local_var_error = ResponseContent {
231                status: local_var_status,
232                content: local_var_content,
233                entity: local_var_entity,
234            };
235            Err(Error::ResponseError(local_var_error))
236        }
237    }
238
239    async fn get<'a>(
240        &self,
241        org_id: &'a str,
242        id: &'a str,
243    ) -> Result<models::GroupResponseModel, Error<GetError>> {
244        let local_var_configuration = &self.configuration;
245
246        let local_var_client = &local_var_configuration.client;
247
248        let local_var_uri_str = format!(
249            "{}/organizations/{orgId}/groups/{id}",
250            local_var_configuration.base_path,
251            orgId = crate::apis::urlencode(org_id),
252            id = crate::apis::urlencode(id)
253        );
254        let mut local_var_req_builder =
255            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
256
257        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
258            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
259        };
260        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
261
262        let local_var_req = local_var_req_builder.build()?;
263        let local_var_resp = local_var_client.execute(local_var_req).await?;
264
265        let local_var_status = local_var_resp.status();
266        let local_var_content_type = local_var_resp
267            .headers()
268            .get("content-type")
269            .and_then(|v| v.to_str().ok())
270            .unwrap_or("application/octet-stream");
271        let local_var_content_type = super::ContentType::from(local_var_content_type);
272        let local_var_content = local_var_resp.text().await?;
273
274        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
275            match local_var_content_type {
276                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
277                ContentType::Text => {
278                    return Err(Error::from(serde_json::Error::custom(
279                        "Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`",
280                    )));
281                }
282                ContentType::Unsupported(local_var_unknown_type) => {
283                    return Err(Error::from(serde_json::Error::custom(format!(
284                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`"
285                    ))));
286                }
287            }
288        } else {
289            let local_var_entity: Option<GetError> = serde_json::from_str(&local_var_content).ok();
290            let local_var_error = ResponseContent {
291                status: local_var_status,
292                content: local_var_content,
293                entity: local_var_entity,
294            };
295            Err(Error::ResponseError(local_var_error))
296        }
297    }
298
299    async fn get_details<'a>(
300        &self,
301        org_id: &'a str,
302        id: &'a str,
303    ) -> Result<models::GroupDetailsResponseModel, Error<GetDetailsError>> {
304        let local_var_configuration = &self.configuration;
305
306        let local_var_client = &local_var_configuration.client;
307
308        let local_var_uri_str = format!(
309            "{}/organizations/{orgId}/groups/{id}/details",
310            local_var_configuration.base_path,
311            orgId = crate::apis::urlencode(org_id),
312            id = crate::apis::urlencode(id)
313        );
314        let mut local_var_req_builder =
315            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
316
317        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
318            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
319        };
320        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
321
322        let local_var_req = local_var_req_builder.build()?;
323        let local_var_resp = local_var_client.execute(local_var_req).await?;
324
325        let local_var_status = local_var_resp.status();
326        let local_var_content_type = local_var_resp
327            .headers()
328            .get("content-type")
329            .and_then(|v| v.to_str().ok())
330            .unwrap_or("application/octet-stream");
331        let local_var_content_type = super::ContentType::from(local_var_content_type);
332        let local_var_content = local_var_resp.text().await?;
333
334        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
335            match local_var_content_type {
336                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
337                ContentType::Text => {
338                    return Err(Error::from(serde_json::Error::custom(
339                        "Received `text/plain` content type response that cannot be converted to `models::GroupDetailsResponseModel`",
340                    )));
341                }
342                ContentType::Unsupported(local_var_unknown_type) => {
343                    return Err(Error::from(serde_json::Error::custom(format!(
344                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GroupDetailsResponseModel`"
345                    ))));
346                }
347            }
348        } else {
349            let local_var_entity: Option<GetDetailsError> =
350                serde_json::from_str(&local_var_content).ok();
351            let local_var_error = ResponseContent {
352                status: local_var_status,
353                content: local_var_content,
354                entity: local_var_entity,
355            };
356            Err(Error::ResponseError(local_var_error))
357        }
358    }
359
360    async fn get_organization_group_details<'a>(
361        &self,
362        org_id: uuid::Uuid,
363    ) -> Result<
364        models::GroupDetailsResponseModelListResponseModel,
365        Error<GetOrganizationGroupDetailsError>,
366    > {
367        let local_var_configuration = &self.configuration;
368
369        let local_var_client = &local_var_configuration.client;
370
371        let local_var_uri_str = format!(
372            "{}/organizations/{orgId}/groups/details",
373            local_var_configuration.base_path,
374            orgId = org_id
375        );
376        let mut local_var_req_builder =
377            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
378
379        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
380            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
381        };
382        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
383
384        let local_var_req = local_var_req_builder.build()?;
385        let local_var_resp = local_var_client.execute(local_var_req).await?;
386
387        let local_var_status = local_var_resp.status();
388        let local_var_content_type = local_var_resp
389            .headers()
390            .get("content-type")
391            .and_then(|v| v.to_str().ok())
392            .unwrap_or("application/octet-stream");
393        let local_var_content_type = super::ContentType::from(local_var_content_type);
394        let local_var_content = local_var_resp.text().await?;
395
396        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
397            match local_var_content_type {
398                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
399                ContentType::Text => {
400                    return Err(Error::from(serde_json::Error::custom(
401                        "Received `text/plain` content type response that cannot be converted to `models::GroupDetailsResponseModelListResponseModel`",
402                    )));
403                }
404                ContentType::Unsupported(local_var_unknown_type) => {
405                    return Err(Error::from(serde_json::Error::custom(format!(
406                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GroupDetailsResponseModelListResponseModel`"
407                    ))));
408                }
409            }
410        } else {
411            let local_var_entity: Option<GetOrganizationGroupDetailsError> =
412                serde_json::from_str(&local_var_content).ok();
413            let local_var_error = ResponseContent {
414                status: local_var_status,
415                content: local_var_content,
416                entity: local_var_entity,
417            };
418            Err(Error::ResponseError(local_var_error))
419        }
420    }
421
422    async fn get_organization_groups<'a>(
423        &self,
424        org_id: uuid::Uuid,
425    ) -> Result<models::GroupResponseModelListResponseModel, Error<GetOrganizationGroupsError>>
426    {
427        let local_var_configuration = &self.configuration;
428
429        let local_var_client = &local_var_configuration.client;
430
431        let local_var_uri_str = format!(
432            "{}/organizations/{orgId}/groups",
433            local_var_configuration.base_path,
434            orgId = org_id
435        );
436        let mut local_var_req_builder =
437            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
438
439        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
440            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
441        };
442        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
443
444        let local_var_req = local_var_req_builder.build()?;
445        let local_var_resp = local_var_client.execute(local_var_req).await?;
446
447        let local_var_status = local_var_resp.status();
448        let local_var_content_type = local_var_resp
449            .headers()
450            .get("content-type")
451            .and_then(|v| v.to_str().ok())
452            .unwrap_or("application/octet-stream");
453        let local_var_content_type = super::ContentType::from(local_var_content_type);
454        let local_var_content = local_var_resp.text().await?;
455
456        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
457            match local_var_content_type {
458                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
459                ContentType::Text => {
460                    return Err(Error::from(serde_json::Error::custom(
461                        "Received `text/plain` content type response that cannot be converted to `models::GroupResponseModelListResponseModel`",
462                    )));
463                }
464                ContentType::Unsupported(local_var_unknown_type) => {
465                    return Err(Error::from(serde_json::Error::custom(format!(
466                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GroupResponseModelListResponseModel`"
467                    ))));
468                }
469            }
470        } else {
471            let local_var_entity: Option<GetOrganizationGroupsError> =
472                serde_json::from_str(&local_var_content).ok();
473            let local_var_error = ResponseContent {
474                status: local_var_status,
475                content: local_var_content,
476                entity: local_var_entity,
477            };
478            Err(Error::ResponseError(local_var_error))
479        }
480    }
481
482    async fn get_users<'a>(
483        &self,
484        org_id: &'a str,
485        id: &'a str,
486    ) -> Result<Vec<uuid::Uuid>, Error<GetUsersError>> {
487        let local_var_configuration = &self.configuration;
488
489        let local_var_client = &local_var_configuration.client;
490
491        let local_var_uri_str = format!(
492            "{}/organizations/{orgId}/groups/{id}/users",
493            local_var_configuration.base_path,
494            orgId = crate::apis::urlencode(org_id),
495            id = crate::apis::urlencode(id)
496        );
497        let mut local_var_req_builder =
498            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
499
500        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
501            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
502        };
503        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
504
505        let local_var_req = local_var_req_builder.build()?;
506        let local_var_resp = local_var_client.execute(local_var_req).await?;
507
508        let local_var_status = local_var_resp.status();
509        let local_var_content_type = local_var_resp
510            .headers()
511            .get("content-type")
512            .and_then(|v| v.to_str().ok())
513            .unwrap_or("application/octet-stream");
514        let local_var_content_type = super::ContentType::from(local_var_content_type);
515        let local_var_content = local_var_resp.text().await?;
516
517        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
518            match local_var_content_type {
519                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
520                ContentType::Text => {
521                    return Err(Error::from(serde_json::Error::custom(
522                        "Received `text/plain` content type response that cannot be converted to `Vec&lt;uuid::Uuid&gt;`",
523                    )));
524                }
525                ContentType::Unsupported(local_var_unknown_type) => {
526                    return Err(Error::from(serde_json::Error::custom(format!(
527                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec&lt;uuid::Uuid&gt;`"
528                    ))));
529                }
530            }
531        } else {
532            let local_var_entity: Option<GetUsersError> =
533                serde_json::from_str(&local_var_content).ok();
534            let local_var_error = ResponseContent {
535                status: local_var_status,
536                content: local_var_content,
537                entity: local_var_entity,
538            };
539            Err(Error::ResponseError(local_var_error))
540        }
541    }
542
543    async fn post<'a>(
544        &self,
545        org_id: uuid::Uuid,
546        group_request_model: Option<models::GroupRequestModel>,
547    ) -> Result<models::GroupResponseModel, Error<PostError>> {
548        let local_var_configuration = &self.configuration;
549
550        let local_var_client = &local_var_configuration.client;
551
552        let local_var_uri_str = format!(
553            "{}/organizations/{orgId}/groups",
554            local_var_configuration.base_path,
555            orgId = org_id
556        );
557        let mut local_var_req_builder =
558            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
559
560        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
561            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
562        };
563        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
564        local_var_req_builder = local_var_req_builder.json(&group_request_model);
565
566        let local_var_req = local_var_req_builder.build()?;
567        let local_var_resp = local_var_client.execute(local_var_req).await?;
568
569        let local_var_status = local_var_resp.status();
570        let local_var_content_type = local_var_resp
571            .headers()
572            .get("content-type")
573            .and_then(|v| v.to_str().ok())
574            .unwrap_or("application/octet-stream");
575        let local_var_content_type = super::ContentType::from(local_var_content_type);
576        let local_var_content = local_var_resp.text().await?;
577
578        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
579            match local_var_content_type {
580                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
581                ContentType::Text => {
582                    return Err(Error::from(serde_json::Error::custom(
583                        "Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`",
584                    )));
585                }
586                ContentType::Unsupported(local_var_unknown_type) => {
587                    return Err(Error::from(serde_json::Error::custom(format!(
588                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`"
589                    ))));
590                }
591            }
592        } else {
593            let local_var_entity: Option<PostError> = serde_json::from_str(&local_var_content).ok();
594            let local_var_error = ResponseContent {
595                status: local_var_status,
596                content: local_var_content,
597                entity: local_var_entity,
598            };
599            Err(Error::ResponseError(local_var_error))
600        }
601    }
602
603    async fn put<'a>(
604        &self,
605        org_id: uuid::Uuid,
606        id: uuid::Uuid,
607        group_request_model: Option<models::GroupRequestModel>,
608    ) -> Result<models::GroupResponseModel, Error<PutError>> {
609        let local_var_configuration = &self.configuration;
610
611        let local_var_client = &local_var_configuration.client;
612
613        let local_var_uri_str = format!(
614            "{}/organizations/{orgId}/groups/{id}",
615            local_var_configuration.base_path,
616            orgId = org_id,
617            id = id
618        );
619        let mut local_var_req_builder =
620            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
621
622        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
623            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
624        };
625        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
626        local_var_req_builder = local_var_req_builder.json(&group_request_model);
627
628        let local_var_req = local_var_req_builder.build()?;
629        let local_var_resp = local_var_client.execute(local_var_req).await?;
630
631        let local_var_status = local_var_resp.status();
632        let local_var_content_type = local_var_resp
633            .headers()
634            .get("content-type")
635            .and_then(|v| v.to_str().ok())
636            .unwrap_or("application/octet-stream");
637        let local_var_content_type = super::ContentType::from(local_var_content_type);
638        let local_var_content = local_var_resp.text().await?;
639
640        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
641            match local_var_content_type {
642                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
643                ContentType::Text => {
644                    return Err(Error::from(serde_json::Error::custom(
645                        "Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`",
646                    )));
647                }
648                ContentType::Unsupported(local_var_unknown_type) => {
649                    return Err(Error::from(serde_json::Error::custom(format!(
650                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`"
651                    ))));
652                }
653            }
654        } else {
655            let local_var_entity: Option<PutError> = serde_json::from_str(&local_var_content).ok();
656            let local_var_error = ResponseContent {
657                status: local_var_status,
658                content: local_var_content,
659                entity: local_var_entity,
660            };
661            Err(Error::ResponseError(local_var_error))
662        }
663    }
664}
665
666/// struct for typed errors of method [`GroupsApi::bulk_delete`]
667#[derive(Debug, Clone, Serialize, Deserialize)]
668#[serde(untagged)]
669pub enum BulkDeleteError {
670    UnknownValue(serde_json::Value),
671}
672/// struct for typed errors of method [`GroupsApi::delete`]
673#[derive(Debug, Clone, Serialize, Deserialize)]
674#[serde(untagged)]
675pub enum DeleteError {
676    UnknownValue(serde_json::Value),
677}
678/// struct for typed errors of method [`GroupsApi::delete_user`]
679#[derive(Debug, Clone, Serialize, Deserialize)]
680#[serde(untagged)]
681pub enum DeleteUserError {
682    UnknownValue(serde_json::Value),
683}
684/// struct for typed errors of method [`GroupsApi::get`]
685#[derive(Debug, Clone, Serialize, Deserialize)]
686#[serde(untagged)]
687pub enum GetError {
688    UnknownValue(serde_json::Value),
689}
690/// struct for typed errors of method [`GroupsApi::get_details`]
691#[derive(Debug, Clone, Serialize, Deserialize)]
692#[serde(untagged)]
693pub enum GetDetailsError {
694    UnknownValue(serde_json::Value),
695}
696/// struct for typed errors of method [`GroupsApi::get_organization_group_details`]
697#[derive(Debug, Clone, Serialize, Deserialize)]
698#[serde(untagged)]
699pub enum GetOrganizationGroupDetailsError {
700    UnknownValue(serde_json::Value),
701}
702/// struct for typed errors of method [`GroupsApi::get_organization_groups`]
703#[derive(Debug, Clone, Serialize, Deserialize)]
704#[serde(untagged)]
705pub enum GetOrganizationGroupsError {
706    UnknownValue(serde_json::Value),
707}
708/// struct for typed errors of method [`GroupsApi::get_users`]
709#[derive(Debug, Clone, Serialize, Deserialize)]
710#[serde(untagged)]
711pub enum GetUsersError {
712    UnknownValue(serde_json::Value),
713}
714/// struct for typed errors of method [`GroupsApi::post`]
715#[derive(Debug, Clone, Serialize, Deserialize)]
716#[serde(untagged)]
717pub enum PostError {
718    UnknownValue(serde_json::Value),
719}
720/// struct for typed errors of method [`GroupsApi::put`]
721#[derive(Debug, Clone, Serialize, Deserialize)]
722#[serde(untagged)]
723pub enum PutError {
724    UnknownValue(serde_json::Value),
725}