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 reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`organizations_org_id_groups_delete`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum OrganizationsOrgIdGroupsDeleteError {
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`organizations_org_id_groups_delete_post`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum OrganizationsOrgIdGroupsDeletePostError {
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`organizations_org_id_groups_details_get`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum OrganizationsOrgIdGroupsDetailsGetError {
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`organizations_org_id_groups_get`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum OrganizationsOrgIdGroupsGetError {
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`organizations_org_id_groups_id_delete`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum OrganizationsOrgIdGroupsIdDeleteError {
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`organizations_org_id_groups_id_delete_post`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum OrganizationsOrgIdGroupsIdDeletePostError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method
60/// [`organizations_org_id_groups_id_delete_user_org_user_id_post`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum OrganizationsOrgIdGroupsIdDeleteUserOrgUserIdPostError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`organizations_org_id_groups_id_details_get`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum OrganizationsOrgIdGroupsIdDetailsGetError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`organizations_org_id_groups_id_get`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum OrganizationsOrgIdGroupsIdGetError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`organizations_org_id_groups_id_post`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum OrganizationsOrgIdGroupsIdPostError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`organizations_org_id_groups_id_put`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum OrganizationsOrgIdGroupsIdPutError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`organizations_org_id_groups_id_user_org_user_id_delete`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum OrganizationsOrgIdGroupsIdUserOrgUserIdDeleteError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`organizations_org_id_groups_id_users_get`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum OrganizationsOrgIdGroupsIdUsersGetError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`organizations_org_id_groups_post`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum OrganizationsOrgIdGroupsPostError {
113    UnknownValue(serde_json::Value),
114}
115
116pub async fn organizations_org_id_groups_delete(
117    configuration: &configuration::Configuration,
118    org_id: &str,
119    group_bulk_request_model: Option<models::GroupBulkRequestModel>,
120) -> Result<(), Error<OrganizationsOrgIdGroupsDeleteError>> {
121    // add a prefix to parameters to efficiently prevent name collisions
122    let p_org_id = org_id;
123    let p_group_bulk_request_model = group_bulk_request_model;
124
125    let uri_str = format!(
126        "{}/organizations/{orgId}/groups",
127        configuration.base_path,
128        orgId = crate::apis::urlencode(p_org_id)
129    );
130    let mut req_builder = configuration
131        .client
132        .request(reqwest::Method::DELETE, &uri_str);
133
134    if let Some(ref user_agent) = configuration.user_agent {
135        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
136    }
137    if let Some(ref token) = configuration.oauth_access_token {
138        req_builder = req_builder.bearer_auth(token.to_owned());
139    };
140    req_builder = req_builder.json(&p_group_bulk_request_model);
141
142    let req = req_builder.build()?;
143    let resp = configuration.client.execute(req).await?;
144
145    let status = resp.status();
146
147    if !status.is_client_error() && !status.is_server_error() {
148        Ok(())
149    } else {
150        let content = resp.text().await?;
151        let entity: Option<OrganizationsOrgIdGroupsDeleteError> =
152            serde_json::from_str(&content).ok();
153        Err(Error::ResponseError(ResponseContent {
154            status,
155            content,
156            entity,
157        }))
158    }
159}
160
161pub async fn organizations_org_id_groups_delete_post(
162    configuration: &configuration::Configuration,
163    org_id: &str,
164    group_bulk_request_model: Option<models::GroupBulkRequestModel>,
165) -> Result<(), Error<OrganizationsOrgIdGroupsDeletePostError>> {
166    // add a prefix to parameters to efficiently prevent name collisions
167    let p_org_id = org_id;
168    let p_group_bulk_request_model = group_bulk_request_model;
169
170    let uri_str = format!(
171        "{}/organizations/{orgId}/groups/delete",
172        configuration.base_path,
173        orgId = crate::apis::urlencode(p_org_id)
174    );
175    let mut req_builder = configuration
176        .client
177        .request(reqwest::Method::POST, &uri_str);
178
179    if let Some(ref user_agent) = configuration.user_agent {
180        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
181    }
182    if let Some(ref token) = configuration.oauth_access_token {
183        req_builder = req_builder.bearer_auth(token.to_owned());
184    };
185    req_builder = req_builder.json(&p_group_bulk_request_model);
186
187    let req = req_builder.build()?;
188    let resp = configuration.client.execute(req).await?;
189
190    let status = resp.status();
191
192    if !status.is_client_error() && !status.is_server_error() {
193        Ok(())
194    } else {
195        let content = resp.text().await?;
196        let entity: Option<OrganizationsOrgIdGroupsDeletePostError> =
197            serde_json::from_str(&content).ok();
198        Err(Error::ResponseError(ResponseContent {
199            status,
200            content,
201            entity,
202        }))
203    }
204}
205
206pub async fn organizations_org_id_groups_details_get(
207    configuration: &configuration::Configuration,
208    org_id: uuid::Uuid,
209) -> Result<
210    models::GroupDetailsResponseModelListResponseModel,
211    Error<OrganizationsOrgIdGroupsDetailsGetError>,
212> {
213    // add a prefix to parameters to efficiently prevent name collisions
214    let p_org_id = org_id;
215
216    let uri_str = format!(
217        "{}/organizations/{orgId}/groups/details",
218        configuration.base_path,
219        orgId = crate::apis::urlencode(p_org_id.to_string())
220    );
221    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
222
223    if let Some(ref user_agent) = configuration.user_agent {
224        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
225    }
226    if let Some(ref token) = configuration.oauth_access_token {
227        req_builder = req_builder.bearer_auth(token.to_owned());
228    };
229
230    let req = req_builder.build()?;
231    let resp = configuration.client.execute(req).await?;
232
233    let status = resp.status();
234    let content_type = resp
235        .headers()
236        .get("content-type")
237        .and_then(|v| v.to_str().ok())
238        .unwrap_or("application/octet-stream");
239    let content_type = super::ContentType::from(content_type);
240
241    if !status.is_client_error() && !status.is_server_error() {
242        let content = resp.text().await?;
243        match content_type {
244            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
245            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupDetailsResponseModelListResponseModel`"))),
246            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupDetailsResponseModelListResponseModel`")))),
247        }
248    } else {
249        let content = resp.text().await?;
250        let entity: Option<OrganizationsOrgIdGroupsDetailsGetError> =
251            serde_json::from_str(&content).ok();
252        Err(Error::ResponseError(ResponseContent {
253            status,
254            content,
255            entity,
256        }))
257    }
258}
259
260pub async fn organizations_org_id_groups_get(
261    configuration: &configuration::Configuration,
262    org_id: uuid::Uuid,
263) -> Result<models::GroupResponseModelListResponseModel, Error<OrganizationsOrgIdGroupsGetError>> {
264    // add a prefix to parameters to efficiently prevent name collisions
265    let p_org_id = org_id;
266
267    let uri_str = format!(
268        "{}/organizations/{orgId}/groups",
269        configuration.base_path,
270        orgId = crate::apis::urlencode(p_org_id.to_string())
271    );
272    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
273
274    if let Some(ref user_agent) = configuration.user_agent {
275        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
276    }
277    if let Some(ref token) = configuration.oauth_access_token {
278        req_builder = req_builder.bearer_auth(token.to_owned());
279    };
280
281    let req = req_builder.build()?;
282    let resp = configuration.client.execute(req).await?;
283
284    let status = resp.status();
285    let content_type = resp
286        .headers()
287        .get("content-type")
288        .and_then(|v| v.to_str().ok())
289        .unwrap_or("application/octet-stream");
290    let content_type = super::ContentType::from(content_type);
291
292    if !status.is_client_error() && !status.is_server_error() {
293        let content = resp.text().await?;
294        match content_type {
295            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
296            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupResponseModelListResponseModel`"))),
297            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupResponseModelListResponseModel`")))),
298        }
299    } else {
300        let content = resp.text().await?;
301        let entity: Option<OrganizationsOrgIdGroupsGetError> = serde_json::from_str(&content).ok();
302        Err(Error::ResponseError(ResponseContent {
303            status,
304            content,
305            entity,
306        }))
307    }
308}
309
310pub async fn organizations_org_id_groups_id_delete(
311    configuration: &configuration::Configuration,
312    org_id: &str,
313    id: &str,
314) -> Result<(), Error<OrganizationsOrgIdGroupsIdDeleteError>> {
315    // add a prefix to parameters to efficiently prevent name collisions
316    let p_org_id = org_id;
317    let p_id = id;
318
319    let uri_str = format!(
320        "{}/organizations/{orgId}/groups/{id}",
321        configuration.base_path,
322        orgId = crate::apis::urlencode(p_org_id),
323        id = crate::apis::urlencode(p_id)
324    );
325    let mut req_builder = configuration
326        .client
327        .request(reqwest::Method::DELETE, &uri_str);
328
329    if let Some(ref user_agent) = configuration.user_agent {
330        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
331    }
332    if let Some(ref token) = configuration.oauth_access_token {
333        req_builder = req_builder.bearer_auth(token.to_owned());
334    };
335
336    let req = req_builder.build()?;
337    let resp = configuration.client.execute(req).await?;
338
339    let status = resp.status();
340
341    if !status.is_client_error() && !status.is_server_error() {
342        Ok(())
343    } else {
344        let content = resp.text().await?;
345        let entity: Option<OrganizationsOrgIdGroupsIdDeleteError> =
346            serde_json::from_str(&content).ok();
347        Err(Error::ResponseError(ResponseContent {
348            status,
349            content,
350            entity,
351        }))
352    }
353}
354
355pub async fn organizations_org_id_groups_id_delete_post(
356    configuration: &configuration::Configuration,
357    org_id: &str,
358    id: &str,
359) -> Result<(), Error<OrganizationsOrgIdGroupsIdDeletePostError>> {
360    // add a prefix to parameters to efficiently prevent name collisions
361    let p_org_id = org_id;
362    let p_id = id;
363
364    let uri_str = format!(
365        "{}/organizations/{orgId}/groups/{id}/delete",
366        configuration.base_path,
367        orgId = crate::apis::urlencode(p_org_id),
368        id = crate::apis::urlencode(p_id)
369    );
370    let mut req_builder = configuration
371        .client
372        .request(reqwest::Method::POST, &uri_str);
373
374    if let Some(ref user_agent) = configuration.user_agent {
375        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
376    }
377    if let Some(ref token) = configuration.oauth_access_token {
378        req_builder = req_builder.bearer_auth(token.to_owned());
379    };
380
381    let req = req_builder.build()?;
382    let resp = configuration.client.execute(req).await?;
383
384    let status = resp.status();
385
386    if !status.is_client_error() && !status.is_server_error() {
387        Ok(())
388    } else {
389        let content = resp.text().await?;
390        let entity: Option<OrganizationsOrgIdGroupsIdDeletePostError> =
391            serde_json::from_str(&content).ok();
392        Err(Error::ResponseError(ResponseContent {
393            status,
394            content,
395            entity,
396        }))
397    }
398}
399
400pub async fn organizations_org_id_groups_id_delete_user_org_user_id_post(
401    configuration: &configuration::Configuration,
402    org_id: &str,
403    id: &str,
404    org_user_id: &str,
405) -> Result<(), Error<OrganizationsOrgIdGroupsIdDeleteUserOrgUserIdPostError>> {
406    // add a prefix to parameters to efficiently prevent name collisions
407    let p_org_id = org_id;
408    let p_id = id;
409    let p_org_user_id = org_user_id;
410
411    let uri_str = format!(
412        "{}/organizations/{orgId}/groups/{id}/delete-user/{orgUserId}",
413        configuration.base_path,
414        orgId = crate::apis::urlencode(p_org_id),
415        id = crate::apis::urlencode(p_id),
416        orgUserId = crate::apis::urlencode(p_org_user_id)
417    );
418    let mut req_builder = configuration
419        .client
420        .request(reqwest::Method::POST, &uri_str);
421
422    if let Some(ref user_agent) = configuration.user_agent {
423        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
424    }
425    if let Some(ref token) = configuration.oauth_access_token {
426        req_builder = req_builder.bearer_auth(token.to_owned());
427    };
428
429    let req = req_builder.build()?;
430    let resp = configuration.client.execute(req).await?;
431
432    let status = resp.status();
433
434    if !status.is_client_error() && !status.is_server_error() {
435        Ok(())
436    } else {
437        let content = resp.text().await?;
438        let entity: Option<OrganizationsOrgIdGroupsIdDeleteUserOrgUserIdPostError> =
439            serde_json::from_str(&content).ok();
440        Err(Error::ResponseError(ResponseContent {
441            status,
442            content,
443            entity,
444        }))
445    }
446}
447
448pub async fn organizations_org_id_groups_id_details_get(
449    configuration: &configuration::Configuration,
450    org_id: &str,
451    id: &str,
452) -> Result<models::GroupDetailsResponseModel, Error<OrganizationsOrgIdGroupsIdDetailsGetError>> {
453    // add a prefix to parameters to efficiently prevent name collisions
454    let p_org_id = org_id;
455    let p_id = id;
456
457    let uri_str = format!(
458        "{}/organizations/{orgId}/groups/{id}/details",
459        configuration.base_path,
460        orgId = crate::apis::urlencode(p_org_id),
461        id = crate::apis::urlencode(p_id)
462    );
463    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
464
465    if let Some(ref user_agent) = configuration.user_agent {
466        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
467    }
468    if let Some(ref token) = configuration.oauth_access_token {
469        req_builder = req_builder.bearer_auth(token.to_owned());
470    };
471
472    let req = req_builder.build()?;
473    let resp = configuration.client.execute(req).await?;
474
475    let status = resp.status();
476    let content_type = resp
477        .headers()
478        .get("content-type")
479        .and_then(|v| v.to_str().ok())
480        .unwrap_or("application/octet-stream");
481    let content_type = super::ContentType::from(content_type);
482
483    if !status.is_client_error() && !status.is_server_error() {
484        let content = resp.text().await?;
485        match content_type {
486            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
487            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupDetailsResponseModel`"))),
488            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupDetailsResponseModel`")))),
489        }
490    } else {
491        let content = resp.text().await?;
492        let entity: Option<OrganizationsOrgIdGroupsIdDetailsGetError> =
493            serde_json::from_str(&content).ok();
494        Err(Error::ResponseError(ResponseContent {
495            status,
496            content,
497            entity,
498        }))
499    }
500}
501
502pub async fn organizations_org_id_groups_id_get(
503    configuration: &configuration::Configuration,
504    org_id: &str,
505    id: &str,
506) -> Result<models::GroupResponseModel, Error<OrganizationsOrgIdGroupsIdGetError>> {
507    // add a prefix to parameters to efficiently prevent name collisions
508    let p_org_id = org_id;
509    let p_id = id;
510
511    let uri_str = format!(
512        "{}/organizations/{orgId}/groups/{id}",
513        configuration.base_path,
514        orgId = crate::apis::urlencode(p_org_id),
515        id = crate::apis::urlencode(p_id)
516    );
517    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
518
519    if let Some(ref user_agent) = configuration.user_agent {
520        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
521    }
522    if let Some(ref token) = configuration.oauth_access_token {
523        req_builder = req_builder.bearer_auth(token.to_owned());
524    };
525
526    let req = req_builder.build()?;
527    let resp = configuration.client.execute(req).await?;
528
529    let status = resp.status();
530    let content_type = resp
531        .headers()
532        .get("content-type")
533        .and_then(|v| v.to_str().ok())
534        .unwrap_or("application/octet-stream");
535    let content_type = super::ContentType::from(content_type);
536
537    if !status.is_client_error() && !status.is_server_error() {
538        let content = resp.text().await?;
539        match content_type {
540            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
541            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`"))),
542            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`")))),
543        }
544    } else {
545        let content = resp.text().await?;
546        let entity: Option<OrganizationsOrgIdGroupsIdGetError> =
547            serde_json::from_str(&content).ok();
548        Err(Error::ResponseError(ResponseContent {
549            status,
550            content,
551            entity,
552        }))
553    }
554}
555
556pub async fn organizations_org_id_groups_id_post(
557    configuration: &configuration::Configuration,
558    org_id: uuid::Uuid,
559    id: uuid::Uuid,
560    group_request_model: Option<models::GroupRequestModel>,
561) -> Result<models::GroupResponseModel, Error<OrganizationsOrgIdGroupsIdPostError>> {
562    // add a prefix to parameters to efficiently prevent name collisions
563    let p_org_id = org_id;
564    let p_id = id;
565    let p_group_request_model = group_request_model;
566
567    let uri_str = format!(
568        "{}/organizations/{orgId}/groups/{id}",
569        configuration.base_path,
570        orgId = crate::apis::urlencode(p_org_id.to_string()),
571        id = crate::apis::urlencode(p_id.to_string())
572    );
573    let mut req_builder = configuration
574        .client
575        .request(reqwest::Method::POST, &uri_str);
576
577    if let Some(ref user_agent) = configuration.user_agent {
578        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
579    }
580    if let Some(ref token) = configuration.oauth_access_token {
581        req_builder = req_builder.bearer_auth(token.to_owned());
582    };
583    req_builder = req_builder.json(&p_group_request_model);
584
585    let req = req_builder.build()?;
586    let resp = configuration.client.execute(req).await?;
587
588    let status = resp.status();
589    let content_type = resp
590        .headers()
591        .get("content-type")
592        .and_then(|v| v.to_str().ok())
593        .unwrap_or("application/octet-stream");
594    let content_type = super::ContentType::from(content_type);
595
596    if !status.is_client_error() && !status.is_server_error() {
597        let content = resp.text().await?;
598        match content_type {
599            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
600            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`"))),
601            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`")))),
602        }
603    } else {
604        let content = resp.text().await?;
605        let entity: Option<OrganizationsOrgIdGroupsIdPostError> =
606            serde_json::from_str(&content).ok();
607        Err(Error::ResponseError(ResponseContent {
608            status,
609            content,
610            entity,
611        }))
612    }
613}
614
615pub async fn organizations_org_id_groups_id_put(
616    configuration: &configuration::Configuration,
617    org_id: uuid::Uuid,
618    id: uuid::Uuid,
619    group_request_model: Option<models::GroupRequestModel>,
620) -> Result<models::GroupResponseModel, Error<OrganizationsOrgIdGroupsIdPutError>> {
621    // add a prefix to parameters to efficiently prevent name collisions
622    let p_org_id = org_id;
623    let p_id = id;
624    let p_group_request_model = group_request_model;
625
626    let uri_str = format!(
627        "{}/organizations/{orgId}/groups/{id}",
628        configuration.base_path,
629        orgId = crate::apis::urlencode(p_org_id.to_string()),
630        id = crate::apis::urlencode(p_id.to_string())
631    );
632    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
633
634    if let Some(ref user_agent) = configuration.user_agent {
635        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
636    }
637    if let Some(ref token) = configuration.oauth_access_token {
638        req_builder = req_builder.bearer_auth(token.to_owned());
639    };
640    req_builder = req_builder.json(&p_group_request_model);
641
642    let req = req_builder.build()?;
643    let resp = configuration.client.execute(req).await?;
644
645    let status = resp.status();
646    let content_type = resp
647        .headers()
648        .get("content-type")
649        .and_then(|v| v.to_str().ok())
650        .unwrap_or("application/octet-stream");
651    let content_type = super::ContentType::from(content_type);
652
653    if !status.is_client_error() && !status.is_server_error() {
654        let content = resp.text().await?;
655        match content_type {
656            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
657            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`"))),
658            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`")))),
659        }
660    } else {
661        let content = resp.text().await?;
662        let entity: Option<OrganizationsOrgIdGroupsIdPutError> =
663            serde_json::from_str(&content).ok();
664        Err(Error::ResponseError(ResponseContent {
665            status,
666            content,
667            entity,
668        }))
669    }
670}
671
672pub async fn organizations_org_id_groups_id_user_org_user_id_delete(
673    configuration: &configuration::Configuration,
674    org_id: &str,
675    id: &str,
676    org_user_id: &str,
677) -> Result<(), Error<OrganizationsOrgIdGroupsIdUserOrgUserIdDeleteError>> {
678    // add a prefix to parameters to efficiently prevent name collisions
679    let p_org_id = org_id;
680    let p_id = id;
681    let p_org_user_id = org_user_id;
682
683    let uri_str = format!(
684        "{}/organizations/{orgId}/groups/{id}/user/{orgUserId}",
685        configuration.base_path,
686        orgId = crate::apis::urlencode(p_org_id),
687        id = crate::apis::urlencode(p_id),
688        orgUserId = crate::apis::urlencode(p_org_user_id)
689    );
690    let mut req_builder = configuration
691        .client
692        .request(reqwest::Method::DELETE, &uri_str);
693
694    if let Some(ref user_agent) = configuration.user_agent {
695        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
696    }
697    if let Some(ref token) = configuration.oauth_access_token {
698        req_builder = req_builder.bearer_auth(token.to_owned());
699    };
700
701    let req = req_builder.build()?;
702    let resp = configuration.client.execute(req).await?;
703
704    let status = resp.status();
705
706    if !status.is_client_error() && !status.is_server_error() {
707        Ok(())
708    } else {
709        let content = resp.text().await?;
710        let entity: Option<OrganizationsOrgIdGroupsIdUserOrgUserIdDeleteError> =
711            serde_json::from_str(&content).ok();
712        Err(Error::ResponseError(ResponseContent {
713            status,
714            content,
715            entity,
716        }))
717    }
718}
719
720pub async fn organizations_org_id_groups_id_users_get(
721    configuration: &configuration::Configuration,
722    org_id: &str,
723    id: &str,
724) -> Result<Vec<uuid::Uuid>, Error<OrganizationsOrgIdGroupsIdUsersGetError>> {
725    // add a prefix to parameters to efficiently prevent name collisions
726    let p_org_id = org_id;
727    let p_id = id;
728
729    let uri_str = format!(
730        "{}/organizations/{orgId}/groups/{id}/users",
731        configuration.base_path,
732        orgId = crate::apis::urlencode(p_org_id),
733        id = crate::apis::urlencode(p_id)
734    );
735    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
736
737    if let Some(ref user_agent) = configuration.user_agent {
738        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
739    }
740    if let Some(ref token) = configuration.oauth_access_token {
741        req_builder = req_builder.bearer_auth(token.to_owned());
742    };
743
744    let req = req_builder.build()?;
745    let resp = configuration.client.execute(req).await?;
746
747    let status = resp.status();
748    let content_type = resp
749        .headers()
750        .get("content-type")
751        .and_then(|v| v.to_str().ok())
752        .unwrap_or("application/octet-stream");
753    let content_type = super::ContentType::from(content_type);
754
755    if !status.is_client_error() && !status.is_server_error() {
756        let content = resp.text().await?;
757        match content_type {
758            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
759            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;uuid::Uuid&gt;`"))),
760            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;uuid::Uuid&gt;`")))),
761        }
762    } else {
763        let content = resp.text().await?;
764        let entity: Option<OrganizationsOrgIdGroupsIdUsersGetError> =
765            serde_json::from_str(&content).ok();
766        Err(Error::ResponseError(ResponseContent {
767            status,
768            content,
769            entity,
770        }))
771    }
772}
773
774pub async fn organizations_org_id_groups_post(
775    configuration: &configuration::Configuration,
776    org_id: uuid::Uuid,
777    group_request_model: Option<models::GroupRequestModel>,
778) -> Result<models::GroupResponseModel, Error<OrganizationsOrgIdGroupsPostError>> {
779    // add a prefix to parameters to efficiently prevent name collisions
780    let p_org_id = org_id;
781    let p_group_request_model = group_request_model;
782
783    let uri_str = format!(
784        "{}/organizations/{orgId}/groups",
785        configuration.base_path,
786        orgId = crate::apis::urlencode(p_org_id.to_string())
787    );
788    let mut req_builder = configuration
789        .client
790        .request(reqwest::Method::POST, &uri_str);
791
792    if let Some(ref user_agent) = configuration.user_agent {
793        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
794    }
795    if let Some(ref token) = configuration.oauth_access_token {
796        req_builder = req_builder.bearer_auth(token.to_owned());
797    };
798    req_builder = req_builder.json(&p_group_request_model);
799
800    let req = req_builder.build()?;
801    let resp = configuration.client.execute(req).await?;
802
803    let status = resp.status();
804    let content_type = resp
805        .headers()
806        .get("content-type")
807        .and_then(|v| v.to_str().ok())
808        .unwrap_or("application/octet-stream");
809    let content_type = super::ContentType::from(content_type);
810
811    if !status.is_client_error() && !status.is_server_error() {
812        let content = resp.text().await?;
813        match content_type {
814            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
815            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupResponseModel`"))),
816            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupResponseModel`")))),
817        }
818    } else {
819        let content = resp.text().await?;
820        let entity: Option<OrganizationsOrgIdGroupsPostError> = serde_json::from_str(&content).ok();
821        Err(Error::ResponseError(ResponseContent {
822            status,
823            content,
824            entity,
825        }))
826    }
827}