1use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum CollectionsGetError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum OrganizationsOrgIdCollectionsBulkAccessPostError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum OrganizationsOrgIdCollectionsDeleteError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum OrganizationsOrgIdCollectionsDeletePostError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum OrganizationsOrgIdCollectionsDetailsGetError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum OrganizationsOrgIdCollectionsGetError {
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum OrganizationsOrgIdCollectionsIdDeleteError {
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum OrganizationsOrgIdCollectionsIdDeletePostError {
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum OrganizationsOrgIdCollectionsIdDetailsGetError {
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum OrganizationsOrgIdCollectionsIdGetError {
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum OrganizationsOrgIdCollectionsIdPostError {
91 UnknownValue(serde_json::Value),
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum OrganizationsOrgIdCollectionsIdPutError {
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum OrganizationsOrgIdCollectionsIdUsersGetError {
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum OrganizationsOrgIdCollectionsPostError {
112 UnknownValue(serde_json::Value),
113}
114
115pub async fn collections_get(
116 configuration: &configuration::Configuration,
117) -> Result<models::CollectionDetailsResponseModelListResponseModel, Error<CollectionsGetError>> {
118 let uri_str = format!("{}/collections", configuration.base_path);
119 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
120
121 if let Some(ref user_agent) = configuration.user_agent {
122 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
123 }
124 if let Some(ref token) = configuration.oauth_access_token {
125 req_builder = req_builder.bearer_auth(token.to_owned());
126 };
127
128 let req = req_builder.build()?;
129 let resp = configuration.client.execute(req).await?;
130
131 let status = resp.status();
132 let content_type = resp
133 .headers()
134 .get("content-type")
135 .and_then(|v| v.to_str().ok())
136 .unwrap_or("application/octet-stream");
137 let content_type = super::ContentType::from(content_type);
138
139 if !status.is_client_error() && !status.is_server_error() {
140 let content = resp.text().await?;
141 match content_type {
142 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
143 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionDetailsResponseModelListResponseModel`"))),
144 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::CollectionDetailsResponseModelListResponseModel`")))),
145 }
146 } else {
147 let content = resp.text().await?;
148 let entity: Option<CollectionsGetError> = serde_json::from_str(&content).ok();
149 Err(Error::ResponseError(ResponseContent {
150 status,
151 content,
152 entity,
153 }))
154 }
155}
156
157pub async fn organizations_org_id_collections_bulk_access_post(
158 configuration: &configuration::Configuration,
159 org_id: uuid::Uuid,
160 bulk_collection_access_request_model: Option<models::BulkCollectionAccessRequestModel>,
161) -> Result<(), Error<OrganizationsOrgIdCollectionsBulkAccessPostError>> {
162 let p_org_id = org_id;
164 let p_bulk_collection_access_request_model = bulk_collection_access_request_model;
165
166 let uri_str = format!(
167 "{}/organizations/{orgId}/collections/bulk-access",
168 configuration.base_path,
169 orgId = crate::apis::urlencode(p_org_id.to_string())
170 );
171 let mut req_builder = configuration
172 .client
173 .request(reqwest::Method::POST, &uri_str);
174
175 if let Some(ref user_agent) = configuration.user_agent {
176 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
177 }
178 if let Some(ref token) = configuration.oauth_access_token {
179 req_builder = req_builder.bearer_auth(token.to_owned());
180 };
181 req_builder = req_builder.json(&p_bulk_collection_access_request_model);
182
183 let req = req_builder.build()?;
184 let resp = configuration.client.execute(req).await?;
185
186 let status = resp.status();
187
188 if !status.is_client_error() && !status.is_server_error() {
189 Ok(())
190 } else {
191 let content = resp.text().await?;
192 let entity: Option<OrganizationsOrgIdCollectionsBulkAccessPostError> =
193 serde_json::from_str(&content).ok();
194 Err(Error::ResponseError(ResponseContent {
195 status,
196 content,
197 entity,
198 }))
199 }
200}
201
202pub async fn organizations_org_id_collections_delete(
203 configuration: &configuration::Configuration,
204 org_id: uuid::Uuid,
205 collection_bulk_delete_request_model: Option<models::CollectionBulkDeleteRequestModel>,
206) -> Result<(), Error<OrganizationsOrgIdCollectionsDeleteError>> {
207 let p_org_id = org_id;
209 let p_collection_bulk_delete_request_model = collection_bulk_delete_request_model;
210
211 let uri_str = format!(
212 "{}/organizations/{orgId}/collections",
213 configuration.base_path,
214 orgId = crate::apis::urlencode(p_org_id.to_string())
215 );
216 let mut req_builder = configuration
217 .client
218 .request(reqwest::Method::DELETE, &uri_str);
219
220 if let Some(ref user_agent) = configuration.user_agent {
221 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
222 }
223 if let Some(ref token) = configuration.oauth_access_token {
224 req_builder = req_builder.bearer_auth(token.to_owned());
225 };
226 req_builder = req_builder.json(&p_collection_bulk_delete_request_model);
227
228 let req = req_builder.build()?;
229 let resp = configuration.client.execute(req).await?;
230
231 let status = resp.status();
232
233 if !status.is_client_error() && !status.is_server_error() {
234 Ok(())
235 } else {
236 let content = resp.text().await?;
237 let entity: Option<OrganizationsOrgIdCollectionsDeleteError> =
238 serde_json::from_str(&content).ok();
239 Err(Error::ResponseError(ResponseContent {
240 status,
241 content,
242 entity,
243 }))
244 }
245}
246
247pub async fn organizations_org_id_collections_delete_post(
248 configuration: &configuration::Configuration,
249 org_id: uuid::Uuid,
250 collection_bulk_delete_request_model: Option<models::CollectionBulkDeleteRequestModel>,
251) -> Result<(), Error<OrganizationsOrgIdCollectionsDeletePostError>> {
252 let p_org_id = org_id;
254 let p_collection_bulk_delete_request_model = collection_bulk_delete_request_model;
255
256 let uri_str = format!(
257 "{}/organizations/{orgId}/collections/delete",
258 configuration.base_path,
259 orgId = crate::apis::urlencode(p_org_id.to_string())
260 );
261 let mut req_builder = configuration
262 .client
263 .request(reqwest::Method::POST, &uri_str);
264
265 if let Some(ref user_agent) = configuration.user_agent {
266 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
267 }
268 if let Some(ref token) = configuration.oauth_access_token {
269 req_builder = req_builder.bearer_auth(token.to_owned());
270 };
271 req_builder = req_builder.json(&p_collection_bulk_delete_request_model);
272
273 let req = req_builder.build()?;
274 let resp = configuration.client.execute(req).await?;
275
276 let status = resp.status();
277
278 if !status.is_client_error() && !status.is_server_error() {
279 Ok(())
280 } else {
281 let content = resp.text().await?;
282 let entity: Option<OrganizationsOrgIdCollectionsDeletePostError> =
283 serde_json::from_str(&content).ok();
284 Err(Error::ResponseError(ResponseContent {
285 status,
286 content,
287 entity,
288 }))
289 }
290}
291
292pub async fn organizations_org_id_collections_details_get(
293 configuration: &configuration::Configuration,
294 org_id: uuid::Uuid,
295) -> Result<
296 models::CollectionAccessDetailsResponseModelListResponseModel,
297 Error<OrganizationsOrgIdCollectionsDetailsGetError>,
298> {
299 let p_org_id = org_id;
301
302 let uri_str = format!(
303 "{}/organizations/{orgId}/collections/details",
304 configuration.base_path,
305 orgId = crate::apis::urlencode(p_org_id.to_string())
306 );
307 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
308
309 if let Some(ref user_agent) = configuration.user_agent {
310 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
311 }
312 if let Some(ref token) = configuration.oauth_access_token {
313 req_builder = req_builder.bearer_auth(token.to_owned());
314 };
315
316 let req = req_builder.build()?;
317 let resp = configuration.client.execute(req).await?;
318
319 let status = resp.status();
320 let content_type = resp
321 .headers()
322 .get("content-type")
323 .and_then(|v| v.to_str().ok())
324 .unwrap_or("application/octet-stream");
325 let content_type = super::ContentType::from(content_type);
326
327 if !status.is_client_error() && !status.is_server_error() {
328 let content = resp.text().await?;
329 match content_type {
330 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
331 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionAccessDetailsResponseModelListResponseModel`"))),
332 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::CollectionAccessDetailsResponseModelListResponseModel`")))),
333 }
334 } else {
335 let content = resp.text().await?;
336 let entity: Option<OrganizationsOrgIdCollectionsDetailsGetError> =
337 serde_json::from_str(&content).ok();
338 Err(Error::ResponseError(ResponseContent {
339 status,
340 content,
341 entity,
342 }))
343 }
344}
345
346pub async fn organizations_org_id_collections_get(
347 configuration: &configuration::Configuration,
348 org_id: uuid::Uuid,
349) -> Result<
350 models::CollectionResponseModelListResponseModel,
351 Error<OrganizationsOrgIdCollectionsGetError>,
352> {
353 let p_org_id = org_id;
355
356 let uri_str = format!(
357 "{}/organizations/{orgId}/collections",
358 configuration.base_path,
359 orgId = crate::apis::urlencode(p_org_id.to_string())
360 );
361 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
362
363 if let Some(ref user_agent) = configuration.user_agent {
364 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
365 }
366 if let Some(ref token) = configuration.oauth_access_token {
367 req_builder = req_builder.bearer_auth(token.to_owned());
368 };
369
370 let req = req_builder.build()?;
371 let resp = configuration.client.execute(req).await?;
372
373 let status = resp.status();
374 let content_type = resp
375 .headers()
376 .get("content-type")
377 .and_then(|v| v.to_str().ok())
378 .unwrap_or("application/octet-stream");
379 let content_type = super::ContentType::from(content_type);
380
381 if !status.is_client_error() && !status.is_server_error() {
382 let content = resp.text().await?;
383 match content_type {
384 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
385 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionResponseModelListResponseModel`"))),
386 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::CollectionResponseModelListResponseModel`")))),
387 }
388 } else {
389 let content = resp.text().await?;
390 let entity: Option<OrganizationsOrgIdCollectionsGetError> =
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_collections_id_delete(
401 configuration: &configuration::Configuration,
402 org_id: uuid::Uuid,
403 id: uuid::Uuid,
404) -> Result<(), Error<OrganizationsOrgIdCollectionsIdDeleteError>> {
405 let p_org_id = org_id;
407 let p_id = id;
408
409 let uri_str = format!(
410 "{}/organizations/{orgId}/collections/{id}",
411 configuration.base_path,
412 orgId = crate::apis::urlencode(p_org_id.to_string()),
413 id = crate::apis::urlencode(p_id.to_string())
414 );
415 let mut req_builder = configuration
416 .client
417 .request(reqwest::Method::DELETE, &uri_str);
418
419 if let Some(ref user_agent) = configuration.user_agent {
420 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
421 }
422 if let Some(ref token) = configuration.oauth_access_token {
423 req_builder = req_builder.bearer_auth(token.to_owned());
424 };
425
426 let req = req_builder.build()?;
427 let resp = configuration.client.execute(req).await?;
428
429 let status = resp.status();
430
431 if !status.is_client_error() && !status.is_server_error() {
432 Ok(())
433 } else {
434 let content = resp.text().await?;
435 let entity: Option<OrganizationsOrgIdCollectionsIdDeleteError> =
436 serde_json::from_str(&content).ok();
437 Err(Error::ResponseError(ResponseContent {
438 status,
439 content,
440 entity,
441 }))
442 }
443}
444
445pub async fn organizations_org_id_collections_id_delete_post(
446 configuration: &configuration::Configuration,
447 org_id: uuid::Uuid,
448 id: uuid::Uuid,
449) -> Result<(), Error<OrganizationsOrgIdCollectionsIdDeletePostError>> {
450 let p_org_id = org_id;
452 let p_id = id;
453
454 let uri_str = format!(
455 "{}/organizations/{orgId}/collections/{id}/delete",
456 configuration.base_path,
457 orgId = crate::apis::urlencode(p_org_id.to_string()),
458 id = crate::apis::urlencode(p_id.to_string())
459 );
460 let mut req_builder = configuration
461 .client
462 .request(reqwest::Method::POST, &uri_str);
463
464 if let Some(ref user_agent) = configuration.user_agent {
465 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
466 }
467 if let Some(ref token) = configuration.oauth_access_token {
468 req_builder = req_builder.bearer_auth(token.to_owned());
469 };
470
471 let req = req_builder.build()?;
472 let resp = configuration.client.execute(req).await?;
473
474 let status = resp.status();
475
476 if !status.is_client_error() && !status.is_server_error() {
477 Ok(())
478 } else {
479 let content = resp.text().await?;
480 let entity: Option<OrganizationsOrgIdCollectionsIdDeletePostError> =
481 serde_json::from_str(&content).ok();
482 Err(Error::ResponseError(ResponseContent {
483 status,
484 content,
485 entity,
486 }))
487 }
488}
489
490pub async fn organizations_org_id_collections_id_details_get(
491 configuration: &configuration::Configuration,
492 org_id: uuid::Uuid,
493 id: uuid::Uuid,
494) -> Result<
495 models::CollectionAccessDetailsResponseModel,
496 Error<OrganizationsOrgIdCollectionsIdDetailsGetError>,
497> {
498 let p_org_id = org_id;
500 let p_id = id;
501
502 let uri_str = format!(
503 "{}/organizations/{orgId}/collections/{id}/details",
504 configuration.base_path,
505 orgId = crate::apis::urlencode(p_org_id.to_string()),
506 id = crate::apis::urlencode(p_id.to_string())
507 );
508 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
509
510 if let Some(ref user_agent) = configuration.user_agent {
511 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
512 }
513 if let Some(ref token) = configuration.oauth_access_token {
514 req_builder = req_builder.bearer_auth(token.to_owned());
515 };
516
517 let req = req_builder.build()?;
518 let resp = configuration.client.execute(req).await?;
519
520 let status = resp.status();
521 let content_type = resp
522 .headers()
523 .get("content-type")
524 .and_then(|v| v.to_str().ok())
525 .unwrap_or("application/octet-stream");
526 let content_type = super::ContentType::from(content_type);
527
528 if !status.is_client_error() && !status.is_server_error() {
529 let content = resp.text().await?;
530 match content_type {
531 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
532 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionAccessDetailsResponseModel`"))),
533 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::CollectionAccessDetailsResponseModel`")))),
534 }
535 } else {
536 let content = resp.text().await?;
537 let entity: Option<OrganizationsOrgIdCollectionsIdDetailsGetError> =
538 serde_json::from_str(&content).ok();
539 Err(Error::ResponseError(ResponseContent {
540 status,
541 content,
542 entity,
543 }))
544 }
545}
546
547pub async fn organizations_org_id_collections_id_get(
548 configuration: &configuration::Configuration,
549 org_id: uuid::Uuid,
550 id: uuid::Uuid,
551) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsIdGetError>> {
552 let p_org_id = org_id;
554 let p_id = id;
555
556 let uri_str = format!(
557 "{}/organizations/{orgId}/collections/{id}",
558 configuration.base_path,
559 orgId = crate::apis::urlencode(p_org_id.to_string()),
560 id = crate::apis::urlencode(p_id.to_string())
561 );
562 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
563
564 if let Some(ref user_agent) = configuration.user_agent {
565 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
566 }
567 if let Some(ref token) = configuration.oauth_access_token {
568 req_builder = req_builder.bearer_auth(token.to_owned());
569 };
570
571 let req = req_builder.build()?;
572 let resp = configuration.client.execute(req).await?;
573
574 let status = resp.status();
575 let content_type = resp
576 .headers()
577 .get("content-type")
578 .and_then(|v| v.to_str().ok())
579 .unwrap_or("application/octet-stream");
580 let content_type = super::ContentType::from(content_type);
581
582 if !status.is_client_error() && !status.is_server_error() {
583 let content = resp.text().await?;
584 match content_type {
585 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
586 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionResponseModel`"))),
587 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::CollectionResponseModel`")))),
588 }
589 } else {
590 let content = resp.text().await?;
591 let entity: Option<OrganizationsOrgIdCollectionsIdGetError> =
592 serde_json::from_str(&content).ok();
593 Err(Error::ResponseError(ResponseContent {
594 status,
595 content,
596 entity,
597 }))
598 }
599}
600
601pub async fn organizations_org_id_collections_id_post(
602 configuration: &configuration::Configuration,
603 org_id: uuid::Uuid,
604 id: uuid::Uuid,
605 collection_request_model: Option<models::CollectionRequestModel>,
606) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsIdPostError>> {
607 let p_org_id = org_id;
609 let p_id = id;
610 let p_collection_request_model = collection_request_model;
611
612 let uri_str = format!(
613 "{}/organizations/{orgId}/collections/{id}",
614 configuration.base_path,
615 orgId = crate::apis::urlencode(p_org_id.to_string()),
616 id = crate::apis::urlencode(p_id.to_string())
617 );
618 let mut req_builder = configuration
619 .client
620 .request(reqwest::Method::POST, &uri_str);
621
622 if let Some(ref user_agent) = configuration.user_agent {
623 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
624 }
625 if let Some(ref token) = configuration.oauth_access_token {
626 req_builder = req_builder.bearer_auth(token.to_owned());
627 };
628 req_builder = req_builder.json(&p_collection_request_model);
629
630 let req = req_builder.build()?;
631 let resp = configuration.client.execute(req).await?;
632
633 let status = resp.status();
634 let content_type = resp
635 .headers()
636 .get("content-type")
637 .and_then(|v| v.to_str().ok())
638 .unwrap_or("application/octet-stream");
639 let content_type = super::ContentType::from(content_type);
640
641 if !status.is_client_error() && !status.is_server_error() {
642 let content = resp.text().await?;
643 match content_type {
644 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
645 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionResponseModel`"))),
646 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::CollectionResponseModel`")))),
647 }
648 } else {
649 let content = resp.text().await?;
650 let entity: Option<OrganizationsOrgIdCollectionsIdPostError> =
651 serde_json::from_str(&content).ok();
652 Err(Error::ResponseError(ResponseContent {
653 status,
654 content,
655 entity,
656 }))
657 }
658}
659
660pub async fn organizations_org_id_collections_id_put(
661 configuration: &configuration::Configuration,
662 org_id: uuid::Uuid,
663 id: uuid::Uuid,
664 collection_request_model: Option<models::CollectionRequestModel>,
665) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsIdPutError>> {
666 let p_org_id = org_id;
668 let p_id = id;
669 let p_collection_request_model = collection_request_model;
670
671 let uri_str = format!(
672 "{}/organizations/{orgId}/collections/{id}",
673 configuration.base_path,
674 orgId = crate::apis::urlencode(p_org_id.to_string()),
675 id = crate::apis::urlencode(p_id.to_string())
676 );
677 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
678
679 if let Some(ref user_agent) = configuration.user_agent {
680 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
681 }
682 if let Some(ref token) = configuration.oauth_access_token {
683 req_builder = req_builder.bearer_auth(token.to_owned());
684 };
685 req_builder = req_builder.json(&p_collection_request_model);
686
687 let req = req_builder.build()?;
688 let resp = configuration.client.execute(req).await?;
689
690 let status = resp.status();
691 let content_type = resp
692 .headers()
693 .get("content-type")
694 .and_then(|v| v.to_str().ok())
695 .unwrap_or("application/octet-stream");
696 let content_type = super::ContentType::from(content_type);
697
698 if !status.is_client_error() && !status.is_server_error() {
699 let content = resp.text().await?;
700 match content_type {
701 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
702 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CollectionResponseModel`"))),
703 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::CollectionResponseModel`")))),
704 }
705 } else {
706 let content = resp.text().await?;
707 let entity: Option<OrganizationsOrgIdCollectionsIdPutError> =
708 serde_json::from_str(&content).ok();
709 Err(Error::ResponseError(ResponseContent {
710 status,
711 content,
712 entity,
713 }))
714 }
715}
716
717pub async fn organizations_org_id_collections_id_users_get(
718 configuration: &configuration::Configuration,
719 org_id: uuid::Uuid,
720 id: uuid::Uuid,
721) -> Result<
722 Vec<models::SelectionReadOnlyResponseModel>,
723 Error<OrganizationsOrgIdCollectionsIdUsersGetError>,
724> {
725 let p_org_id = org_id;
727 let p_id = id;
728
729 let uri_str = format!(
730 "{}/organizations/{orgId}/collections/{id}/users",
731 configuration.base_path,
732 orgId = crate::apis::urlencode(p_org_id.to_string()),
733 id = crate::apis::urlencode(p_id.to_string())
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<models::SelectionReadOnlyResponseModel>`"))),
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<models::SelectionReadOnlyResponseModel>`")))),
761 }
762 } else {
763 let content = resp.text().await?;
764 let entity: Option<OrganizationsOrgIdCollectionsIdUsersGetError> =
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_collections_post(
775 configuration: &configuration::Configuration,
776 org_id: uuid::Uuid,
777 collection_request_model: Option<models::CollectionRequestModel>,
778) -> Result<models::CollectionResponseModel, Error<OrganizationsOrgIdCollectionsPostError>> {
779 let p_org_id = org_id;
781 let p_collection_request_model = collection_request_model;
782
783 let uri_str = format!(
784 "{}/organizations/{orgId}/collections",
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_collection_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::CollectionResponseModel`"))),
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::CollectionResponseModel`")))),
817 }
818 } else {
819 let content = resp.text().await?;
820 let entity: Option<OrganizationsOrgIdCollectionsPostError> =
821 serde_json::from_str(&content).ok();
822 Err(Error::ResponseError(ResponseContent {
823 status,
824 content,
825 entity,
826 }))
827 }
828}