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