bitwarden_api_api/apis/
collections_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::{Deserialize, Serialize};
13
14use super::{configuration, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`collections_get`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum CollectionsGetError {
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`organizations_org_id_collections_bulk_access_post`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum OrganizationsOrgIdCollectionsBulkAccessPostError {
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`organizations_org_id_collections_delete`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum OrganizationsOrgIdCollectionsDeleteError {
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`organizations_org_id_collections_delete_post`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum OrganizationsOrgIdCollectionsDeletePostError {
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`organizations_org_id_collections_details_get`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum OrganizationsOrgIdCollectionsDetailsGetError {
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`organizations_org_id_collections_get`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum OrganizationsOrgIdCollectionsGetError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`organizations_org_id_collections_id_delete`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum OrganizationsOrgIdCollectionsIdDeleteError {
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`organizations_org_id_collections_id_delete_post`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum OrganizationsOrgIdCollectionsIdDeletePostError {
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method
74/// [`organizations_org_id_collections_id_delete_user_org_user_id_post`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum OrganizationsOrgIdCollectionsIdDeleteUserOrgUserIdPostError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`organizations_org_id_collections_id_details_get`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum OrganizationsOrgIdCollectionsIdDetailsGetError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`organizations_org_id_collections_id_get`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum OrganizationsOrgIdCollectionsIdGetError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`organizations_org_id_collections_id_post`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum OrganizationsOrgIdCollectionsIdPostError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`organizations_org_id_collections_id_put`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum OrganizationsOrgIdCollectionsIdPutError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method
110/// [`organizations_org_id_collections_id_user_org_user_id_delete`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum OrganizationsOrgIdCollectionsIdUserOrgUserIdDeleteError {
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`organizations_org_id_collections_id_users_get`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum OrganizationsOrgIdCollectionsIdUsersGetError {
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`organizations_org_id_collections_id_users_put`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum OrganizationsOrgIdCollectionsIdUsersPutError {
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`organizations_org_id_collections_post`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum OrganizationsOrgIdCollectionsPostError {
135    UnknownValue(serde_json::Value),
136}
137
138pub async fn collections_get(
139    configuration: &configuration::Configuration,
140) -> Result<models::CollectionDetailsResponseModelListResponseModel, Error<CollectionsGetError>> {
141    let local_var_configuration = configuration;
142
143    let local_var_client = &local_var_configuration.client;
144
145    let local_var_uri_str = format!("{}/collections", local_var_configuration.base_path);
146    let mut local_var_req_builder =
147        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
148
149    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
150        local_var_req_builder =
151            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
152    }
153    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
154        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
155    };
156
157    let local_var_req = local_var_req_builder.build()?;
158    let local_var_resp = local_var_client.execute(local_var_req).await?;
159
160    let local_var_status = local_var_resp.status();
161    let local_var_content = local_var_resp.text().await?;
162
163    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
164        serde_json::from_str(&local_var_content).map_err(Error::from)
165    } else {
166        let local_var_entity: Option<CollectionsGetError> =
167            serde_json::from_str(&local_var_content).ok();
168        let local_var_error = ResponseContent {
169            status: local_var_status,
170            content: local_var_content,
171            entity: local_var_entity,
172        };
173        Err(Error::ResponseError(local_var_error))
174    }
175}
176
177pub async fn organizations_org_id_collections_bulk_access_post(
178    configuration: &configuration::Configuration,
179    org_id: uuid::Uuid,
180    bulk_collection_access_request_model: Option<models::BulkCollectionAccessRequestModel>,
181) -> Result<(), Error<OrganizationsOrgIdCollectionsBulkAccessPostError>> {
182    let local_var_configuration = configuration;
183
184    let local_var_client = &local_var_configuration.client;
185
186    let local_var_uri_str = format!(
187        "{}/organizations/{orgId}/collections/bulk-access",
188        local_var_configuration.base_path,
189        orgId = crate::apis::urlencode(org_id.to_string())
190    );
191    let mut local_var_req_builder =
192        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
193
194    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
195        local_var_req_builder =
196            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
197    }
198    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
199        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
200    };
201    local_var_req_builder = local_var_req_builder.json(&bulk_collection_access_request_model);
202
203    let local_var_req = local_var_req_builder.build()?;
204    let local_var_resp = local_var_client.execute(local_var_req).await?;
205
206    let local_var_status = local_var_resp.status();
207    let local_var_content = local_var_resp.text().await?;
208
209    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
210        Ok(())
211    } else {
212        let local_var_entity: Option<OrganizationsOrgIdCollectionsBulkAccessPostError> =
213            serde_json::from_str(&local_var_content).ok();
214        let local_var_error = ResponseContent {
215            status: local_var_status,
216            content: local_var_content,
217            entity: local_var_entity,
218        };
219        Err(Error::ResponseError(local_var_error))
220    }
221}
222
223pub async fn organizations_org_id_collections_delete(
224    configuration: &configuration::Configuration,
225    org_id: uuid::Uuid,
226    collection_bulk_delete_request_model: Option<models::CollectionBulkDeleteRequestModel>,
227) -> Result<(), Error<OrganizationsOrgIdCollectionsDeleteError>> {
228    let local_var_configuration = configuration;
229
230    let local_var_client = &local_var_configuration.client;
231
232    let local_var_uri_str = format!(
233        "{}/organizations/{orgId}/collections",
234        local_var_configuration.base_path,
235        orgId = crate::apis::urlencode(org_id.to_string())
236    );
237    let mut local_var_req_builder =
238        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
239
240    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
241        local_var_req_builder =
242            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
243    }
244    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
245        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
246    };
247    local_var_req_builder = local_var_req_builder.json(&collection_bulk_delete_request_model);
248
249    let local_var_req = local_var_req_builder.build()?;
250    let local_var_resp = local_var_client.execute(local_var_req).await?;
251
252    let local_var_status = local_var_resp.status();
253    let local_var_content = local_var_resp.text().await?;
254
255    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
256        Ok(())
257    } else {
258        let local_var_entity: Option<OrganizationsOrgIdCollectionsDeleteError> =
259            serde_json::from_str(&local_var_content).ok();
260        let local_var_error = ResponseContent {
261            status: local_var_status,
262            content: local_var_content,
263            entity: local_var_entity,
264        };
265        Err(Error::ResponseError(local_var_error))
266    }
267}
268
269pub async fn organizations_org_id_collections_delete_post(
270    configuration: &configuration::Configuration,
271    org_id: uuid::Uuid,
272    collection_bulk_delete_request_model: Option<models::CollectionBulkDeleteRequestModel>,
273) -> Result<(), Error<OrganizationsOrgIdCollectionsDeletePostError>> {
274    let local_var_configuration = configuration;
275
276    let local_var_client = &local_var_configuration.client;
277
278    let local_var_uri_str = format!(
279        "{}/organizations/{orgId}/collections/delete",
280        local_var_configuration.base_path,
281        orgId = crate::apis::urlencode(org_id.to_string())
282    );
283    let mut local_var_req_builder =
284        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
285
286    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
287        local_var_req_builder =
288            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
289    }
290    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
291        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
292    };
293    local_var_req_builder = local_var_req_builder.json(&collection_bulk_delete_request_model);
294
295    let local_var_req = local_var_req_builder.build()?;
296    let local_var_resp = local_var_client.execute(local_var_req).await?;
297
298    let local_var_status = local_var_resp.status();
299    let local_var_content = local_var_resp.text().await?;
300
301    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
302        Ok(())
303    } else {
304        let local_var_entity: Option<OrganizationsOrgIdCollectionsDeletePostError> =
305            serde_json::from_str(&local_var_content).ok();
306        let local_var_error = ResponseContent {
307            status: local_var_status,
308            content: local_var_content,
309            entity: local_var_entity,
310        };
311        Err(Error::ResponseError(local_var_error))
312    }
313}
314
315pub async fn organizations_org_id_collections_details_get(
316    configuration: &configuration::Configuration,
317    org_id: uuid::Uuid,
318) -> Result<
319    models::CollectionAccessDetailsResponseModelListResponseModel,
320    Error<OrganizationsOrgIdCollectionsDetailsGetError>,
321> {
322    let local_var_configuration = configuration;
323
324    let local_var_client = &local_var_configuration.client;
325
326    let local_var_uri_str = format!(
327        "{}/organizations/{orgId}/collections/details",
328        local_var_configuration.base_path,
329        orgId = crate::apis::urlencode(org_id.to_string())
330    );
331    let mut local_var_req_builder =
332        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
333
334    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
335        local_var_req_builder =
336            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
337    }
338    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
339        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
340    };
341
342    let local_var_req = local_var_req_builder.build()?;
343    let local_var_resp = local_var_client.execute(local_var_req).await?;
344
345    let local_var_status = local_var_resp.status();
346    let local_var_content = local_var_resp.text().await?;
347
348    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
349        serde_json::from_str(&local_var_content).map_err(Error::from)
350    } else {
351        let local_var_entity: Option<OrganizationsOrgIdCollectionsDetailsGetError> =
352            serde_json::from_str(&local_var_content).ok();
353        let local_var_error = ResponseContent {
354            status: local_var_status,
355            content: local_var_content,
356            entity: local_var_entity,
357        };
358        Err(Error::ResponseError(local_var_error))
359    }
360}
361
362pub async fn organizations_org_id_collections_get(
363    configuration: &configuration::Configuration,
364    org_id: uuid::Uuid,
365) -> Result<
366    models::CollectionResponseModelListResponseModel,
367    Error<OrganizationsOrgIdCollectionsGetError>,
368> {
369    let local_var_configuration = configuration;
370
371    let local_var_client = &local_var_configuration.client;
372
373    let local_var_uri_str = format!(
374        "{}/organizations/{orgId}/collections",
375        local_var_configuration.base_path,
376        orgId = crate::apis::urlencode(org_id.to_string())
377    );
378    let mut local_var_req_builder =
379        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
380
381    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
382        local_var_req_builder =
383            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
384    }
385    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
386        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
387    };
388
389    let local_var_req = local_var_req_builder.build()?;
390    let local_var_resp = local_var_client.execute(local_var_req).await?;
391
392    let local_var_status = local_var_resp.status();
393    let local_var_content = local_var_resp.text().await?;
394
395    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
396        serde_json::from_str(&local_var_content).map_err(Error::from)
397    } else {
398        let local_var_entity: Option<OrganizationsOrgIdCollectionsGetError> =
399            serde_json::from_str(&local_var_content).ok();
400        let local_var_error = ResponseContent {
401            status: local_var_status,
402            content: local_var_content,
403            entity: local_var_entity,
404        };
405        Err(Error::ResponseError(local_var_error))
406    }
407}
408
409pub async fn organizations_org_id_collections_id_delete(
410    configuration: &configuration::Configuration,
411    org_id: uuid::Uuid,
412    id: uuid::Uuid,
413) -> Result<(), Error<OrganizationsOrgIdCollectionsIdDeleteError>> {
414    let local_var_configuration = configuration;
415
416    let local_var_client = &local_var_configuration.client;
417
418    let local_var_uri_str = format!(
419        "{}/organizations/{orgId}/collections/{id}",
420        local_var_configuration.base_path,
421        orgId = crate::apis::urlencode(org_id.to_string()),
422        id = crate::apis::urlencode(id.to_string())
423    );
424    let mut local_var_req_builder =
425        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
426
427    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
428        local_var_req_builder =
429            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
430    }
431    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
432        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
433    };
434
435    let local_var_req = local_var_req_builder.build()?;
436    let local_var_resp = local_var_client.execute(local_var_req).await?;
437
438    let local_var_status = local_var_resp.status();
439    let local_var_content = local_var_resp.text().await?;
440
441    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
442        Ok(())
443    } else {
444        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdDeleteError> =
445            serde_json::from_str(&local_var_content).ok();
446        let local_var_error = ResponseContent {
447            status: local_var_status,
448            content: local_var_content,
449            entity: local_var_entity,
450        };
451        Err(Error::ResponseError(local_var_error))
452    }
453}
454
455pub async fn organizations_org_id_collections_id_delete_post(
456    configuration: &configuration::Configuration,
457    org_id: uuid::Uuid,
458    id: uuid::Uuid,
459) -> Result<(), Error<OrganizationsOrgIdCollectionsIdDeletePostError>> {
460    let local_var_configuration = configuration;
461
462    let local_var_client = &local_var_configuration.client;
463
464    let local_var_uri_str = format!(
465        "{}/organizations/{orgId}/collections/{id}/delete",
466        local_var_configuration.base_path,
467        orgId = crate::apis::urlencode(org_id.to_string()),
468        id = crate::apis::urlencode(id.to_string())
469    );
470    let mut local_var_req_builder =
471        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
472
473    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
474        local_var_req_builder =
475            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
476    }
477    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
478        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
479    };
480
481    let local_var_req = local_var_req_builder.build()?;
482    let local_var_resp = local_var_client.execute(local_var_req).await?;
483
484    let local_var_status = local_var_resp.status();
485    let local_var_content = local_var_resp.text().await?;
486
487    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
488        Ok(())
489    } else {
490        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdDeletePostError> =
491            serde_json::from_str(&local_var_content).ok();
492        let local_var_error = ResponseContent {
493            status: local_var_status,
494            content: local_var_content,
495            entity: local_var_entity,
496        };
497        Err(Error::ResponseError(local_var_error))
498    }
499}
500
501pub async fn organizations_org_id_collections_id_delete_user_org_user_id_post(
502    configuration: &configuration::Configuration,
503    org_id: uuid::Uuid,
504    id: uuid::Uuid,
505    org_user_id: uuid::Uuid,
506) -> Result<(), Error<OrganizationsOrgIdCollectionsIdDeleteUserOrgUserIdPostError>> {
507    let local_var_configuration = configuration;
508
509    let local_var_client = &local_var_configuration.client;
510
511    let local_var_uri_str = format!(
512        "{}/organizations/{orgId}/collections/{id}/delete-user/{orgUserId}",
513        local_var_configuration.base_path,
514        orgId = crate::apis::urlencode(org_id.to_string()),
515        id = crate::apis::urlencode(id.to_string()),
516        orgUserId = crate::apis::urlencode(org_user_id.to_string())
517    );
518    let mut local_var_req_builder =
519        local_var_client.request(reqwest::Method::POST, 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 =
523            local_var_req_builder.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 = local_var_resp.text().await?;
534
535    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
536        Ok(())
537    } else {
538        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdDeleteUserOrgUserIdPostError> =
539            serde_json::from_str(&local_var_content).ok();
540        let local_var_error = ResponseContent {
541            status: local_var_status,
542            content: local_var_content,
543            entity: local_var_entity,
544        };
545        Err(Error::ResponseError(local_var_error))
546    }
547}
548
549pub async fn organizations_org_id_collections_id_details_get(
550    configuration: &configuration::Configuration,
551    org_id: uuid::Uuid,
552    id: uuid::Uuid,
553) -> Result<
554    models::CollectionAccessDetailsResponseModel,
555    Error<OrganizationsOrgIdCollectionsIdDetailsGetError>,
556> {
557    let local_var_configuration = configuration;
558
559    let local_var_client = &local_var_configuration.client;
560
561    let local_var_uri_str = format!(
562        "{}/organizations/{orgId}/collections/{id}/details",
563        local_var_configuration.base_path,
564        orgId = crate::apis::urlencode(org_id.to_string()),
565        id = crate::apis::urlencode(id.to_string())
566    );
567    let mut local_var_req_builder =
568        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
569
570    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
571        local_var_req_builder =
572            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
573    }
574    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
575        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
576    };
577
578    let local_var_req = local_var_req_builder.build()?;
579    let local_var_resp = local_var_client.execute(local_var_req).await?;
580
581    let local_var_status = local_var_resp.status();
582    let local_var_content = local_var_resp.text().await?;
583
584    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
585        serde_json::from_str(&local_var_content).map_err(Error::from)
586    } else {
587        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdDetailsGetError> =
588            serde_json::from_str(&local_var_content).ok();
589        let local_var_error = ResponseContent {
590            status: local_var_status,
591            content: local_var_content,
592            entity: local_var_entity,
593        };
594        Err(Error::ResponseError(local_var_error))
595    }
596}
597
598pub async fn organizations_org_id_collections_id_get(
599    configuration: &configuration::Configuration,
600    org_id: uuid::Uuid,
601    id: uuid::Uuid,
602) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsIdGetError>> {
603    let local_var_configuration = configuration;
604
605    let local_var_client = &local_var_configuration.client;
606
607    let local_var_uri_str = format!(
608        "{}/organizations/{orgId}/collections/{id}",
609        local_var_configuration.base_path,
610        orgId = crate::apis::urlencode(org_id.to_string()),
611        id = crate::apis::urlencode(id.to_string())
612    );
613    let mut local_var_req_builder =
614        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
615
616    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
617        local_var_req_builder =
618            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
619    }
620    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
621        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
622    };
623
624    let local_var_req = local_var_req_builder.build()?;
625    let local_var_resp = local_var_client.execute(local_var_req).await?;
626
627    let local_var_status = local_var_resp.status();
628    let local_var_content = local_var_resp.text().await?;
629
630    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
631        serde_json::from_str(&local_var_content).map_err(Error::from)
632    } else {
633        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdGetError> =
634            serde_json::from_str(&local_var_content).ok();
635        let local_var_error = ResponseContent {
636            status: local_var_status,
637            content: local_var_content,
638            entity: local_var_entity,
639        };
640        Err(Error::ResponseError(local_var_error))
641    }
642}
643
644pub async fn organizations_org_id_collections_id_post(
645    configuration: &configuration::Configuration,
646    org_id: uuid::Uuid,
647    id: uuid::Uuid,
648    collection_request_model: Option<models::CollectionRequestModel>,
649) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsIdPostError>> {
650    let local_var_configuration = configuration;
651
652    let local_var_client = &local_var_configuration.client;
653
654    let local_var_uri_str = format!(
655        "{}/organizations/{orgId}/collections/{id}",
656        local_var_configuration.base_path,
657        orgId = crate::apis::urlencode(org_id.to_string()),
658        id = crate::apis::urlencode(id.to_string())
659    );
660    let mut local_var_req_builder =
661        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
662
663    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
664        local_var_req_builder =
665            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
666    }
667    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
668        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
669    };
670    local_var_req_builder = local_var_req_builder.json(&collection_request_model);
671
672    let local_var_req = local_var_req_builder.build()?;
673    let local_var_resp = local_var_client.execute(local_var_req).await?;
674
675    let local_var_status = local_var_resp.status();
676    let local_var_content = local_var_resp.text().await?;
677
678    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
679        serde_json::from_str(&local_var_content).map_err(Error::from)
680    } else {
681        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdPostError> =
682            serde_json::from_str(&local_var_content).ok();
683        let local_var_error = ResponseContent {
684            status: local_var_status,
685            content: local_var_content,
686            entity: local_var_entity,
687        };
688        Err(Error::ResponseError(local_var_error))
689    }
690}
691
692pub async fn organizations_org_id_collections_id_put(
693    configuration: &configuration::Configuration,
694    org_id: uuid::Uuid,
695    id: uuid::Uuid,
696    collection_request_model: Option<models::CollectionRequestModel>,
697) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsIdPutError>> {
698    let local_var_configuration = configuration;
699
700    let local_var_client = &local_var_configuration.client;
701
702    let local_var_uri_str = format!(
703        "{}/organizations/{orgId}/collections/{id}",
704        local_var_configuration.base_path,
705        orgId = crate::apis::urlencode(org_id.to_string()),
706        id = crate::apis::urlencode(id.to_string())
707    );
708    let mut local_var_req_builder =
709        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
710
711    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
712        local_var_req_builder =
713            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
714    }
715    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
716        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
717    };
718    local_var_req_builder = local_var_req_builder.json(&collection_request_model);
719
720    let local_var_req = local_var_req_builder.build()?;
721    let local_var_resp = local_var_client.execute(local_var_req).await?;
722
723    let local_var_status = local_var_resp.status();
724    let local_var_content = local_var_resp.text().await?;
725
726    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
727        serde_json::from_str(&local_var_content).map_err(Error::from)
728    } else {
729        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdPutError> =
730            serde_json::from_str(&local_var_content).ok();
731        let local_var_error = ResponseContent {
732            status: local_var_status,
733            content: local_var_content,
734            entity: local_var_entity,
735        };
736        Err(Error::ResponseError(local_var_error))
737    }
738}
739
740pub async fn organizations_org_id_collections_id_user_org_user_id_delete(
741    configuration: &configuration::Configuration,
742    org_id: uuid::Uuid,
743    id: uuid::Uuid,
744    org_user_id: uuid::Uuid,
745) -> Result<(), Error<OrganizationsOrgIdCollectionsIdUserOrgUserIdDeleteError>> {
746    let local_var_configuration = configuration;
747
748    let local_var_client = &local_var_configuration.client;
749
750    let local_var_uri_str = format!(
751        "{}/organizations/{orgId}/collections/{id}/user/{orgUserId}",
752        local_var_configuration.base_path,
753        orgId = crate::apis::urlencode(org_id.to_string()),
754        id = crate::apis::urlencode(id.to_string()),
755        orgUserId = crate::apis::urlencode(org_user_id.to_string())
756    );
757    let mut local_var_req_builder =
758        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
759
760    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
761        local_var_req_builder =
762            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
763    }
764    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
765        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
766    };
767
768    let local_var_req = local_var_req_builder.build()?;
769    let local_var_resp = local_var_client.execute(local_var_req).await?;
770
771    let local_var_status = local_var_resp.status();
772    let local_var_content = local_var_resp.text().await?;
773
774    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
775        Ok(())
776    } else {
777        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdUserOrgUserIdDeleteError> =
778            serde_json::from_str(&local_var_content).ok();
779        let local_var_error = ResponseContent {
780            status: local_var_status,
781            content: local_var_content,
782            entity: local_var_entity,
783        };
784        Err(Error::ResponseError(local_var_error))
785    }
786}
787
788pub async fn organizations_org_id_collections_id_users_get(
789    configuration: &configuration::Configuration,
790    org_id: uuid::Uuid,
791    id: uuid::Uuid,
792) -> Result<
793    Vec<models::SelectionReadOnlyResponseModel>,
794    Error<OrganizationsOrgIdCollectionsIdUsersGetError>,
795> {
796    let local_var_configuration = configuration;
797
798    let local_var_client = &local_var_configuration.client;
799
800    let local_var_uri_str = format!(
801        "{}/organizations/{orgId}/collections/{id}/users",
802        local_var_configuration.base_path,
803        orgId = crate::apis::urlencode(org_id.to_string()),
804        id = crate::apis::urlencode(id.to_string())
805    );
806    let mut local_var_req_builder =
807        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
808
809    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
810        local_var_req_builder =
811            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
812    }
813    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
814        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
815    };
816
817    let local_var_req = local_var_req_builder.build()?;
818    let local_var_resp = local_var_client.execute(local_var_req).await?;
819
820    let local_var_status = local_var_resp.status();
821    let local_var_content = local_var_resp.text().await?;
822
823    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
824        serde_json::from_str(&local_var_content).map_err(Error::from)
825    } else {
826        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdUsersGetError> =
827            serde_json::from_str(&local_var_content).ok();
828        let local_var_error = ResponseContent {
829            status: local_var_status,
830            content: local_var_content,
831            entity: local_var_entity,
832        };
833        Err(Error::ResponseError(local_var_error))
834    }
835}
836
837pub async fn organizations_org_id_collections_id_users_put(
838    configuration: &configuration::Configuration,
839    org_id: uuid::Uuid,
840    id: uuid::Uuid,
841    selection_read_only_request_model: Option<Vec<models::SelectionReadOnlyRequestModel>>,
842) -> Result<(), Error<OrganizationsOrgIdCollectionsIdUsersPutError>> {
843    let local_var_configuration = configuration;
844
845    let local_var_client = &local_var_configuration.client;
846
847    let local_var_uri_str = format!(
848        "{}/organizations/{orgId}/collections/{id}/users",
849        local_var_configuration.base_path,
850        orgId = crate::apis::urlencode(org_id.to_string()),
851        id = crate::apis::urlencode(id.to_string())
852    );
853    let mut local_var_req_builder =
854        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
855
856    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
857        local_var_req_builder =
858            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
859    }
860    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
861        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
862    };
863    local_var_req_builder = local_var_req_builder.json(&selection_read_only_request_model);
864
865    let local_var_req = local_var_req_builder.build()?;
866    let local_var_resp = local_var_client.execute(local_var_req).await?;
867
868    let local_var_status = local_var_resp.status();
869    let local_var_content = local_var_resp.text().await?;
870
871    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
872        Ok(())
873    } else {
874        let local_var_entity: Option<OrganizationsOrgIdCollectionsIdUsersPutError> =
875            serde_json::from_str(&local_var_content).ok();
876        let local_var_error = ResponseContent {
877            status: local_var_status,
878            content: local_var_content,
879            entity: local_var_entity,
880        };
881        Err(Error::ResponseError(local_var_error))
882    }
883}
884
885pub async fn organizations_org_id_collections_post(
886    configuration: &configuration::Configuration,
887    org_id: uuid::Uuid,
888    collection_request_model: Option<models::CollectionRequestModel>,
889) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsPostError>> {
890    let local_var_configuration = configuration;
891
892    let local_var_client = &local_var_configuration.client;
893
894    let local_var_uri_str = format!(
895        "{}/organizations/{orgId}/collections",
896        local_var_configuration.base_path,
897        orgId = crate::apis::urlencode(org_id.to_string())
898    );
899    let mut local_var_req_builder =
900        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
901
902    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
903        local_var_req_builder =
904            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
905    }
906    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
907        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
908    };
909    local_var_req_builder = local_var_req_builder.json(&collection_request_model);
910
911    let local_var_req = local_var_req_builder.build()?;
912    let local_var_resp = local_var_client.execute(local_var_req).await?;
913
914    let local_var_status = local_var_resp.status();
915    let local_var_content = local_var_resp.text().await?;
916
917    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
918        serde_json::from_str(&local_var_content).map_err(Error::from)
919    } else {
920        let local_var_entity: Option<OrganizationsOrgIdCollectionsPostError> =
921            serde_json::from_str(&local_var_content).ok();
922        let local_var_error = ResponseContent {
923            status: local_var_status,
924            content: local_var_content,
925            entity: local_var_entity,
926        };
927        Err(Error::ResponseError(local_var_error))
928    }
929}