1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum TenantsDomainsCreateError {
20 Status400(models::ValidationError),
21 Status403(models::GenericError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum TenantsDomainsDestroyError {
29 Status400(models::ValidationError),
30 Status403(models::GenericError),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum TenantsDomainsListError {
38 Status400(models::ValidationError),
39 Status403(models::GenericError),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum TenantsDomainsPartialUpdateError {
47 Status400(models::ValidationError),
48 Status403(models::GenericError),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum TenantsDomainsRetrieveError {
56 Status400(models::ValidationError),
57 Status403(models::GenericError),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum TenantsDomainsUpdateError {
65 Status400(models::ValidationError),
66 Status403(models::GenericError),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum TenantsTenantsCreateError {
74 Status400(models::ValidationError),
75 Status403(models::GenericError),
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum TenantsTenantsCreateAdminGroupCreateError {
83 Status400(),
84 Status404(),
85 Status403(models::GenericError),
86 UnknownValue(serde_json::Value),
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum TenantsTenantsCreateRecoveryKeyCreateError {
93 Status400(),
94 Status404(),
95 Status403(models::GenericError),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum TenantsTenantsDestroyError {
103 Status400(models::ValidationError),
104 Status403(models::GenericError),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum TenantsTenantsListError {
112 Status400(models::ValidationError),
113 Status403(models::GenericError),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum TenantsTenantsPartialUpdateError {
121 Status400(models::ValidationError),
122 Status403(models::GenericError),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum TenantsTenantsRetrieveError {
130 Status400(models::ValidationError),
131 Status403(models::GenericError),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum TenantsTenantsUpdateError {
139 Status400(models::ValidationError),
140 Status403(models::GenericError),
141 UnknownValue(serde_json::Value),
142}
143
144pub async fn tenants_domains_create(
146 configuration: &configuration::Configuration,
147 domain_request: models::DomainRequest,
148) -> Result<models::Domain, Error<TenantsDomainsCreateError>> {
149 let p_body_domain_request = domain_request;
151
152 let uri_str = format!("{}/tenants/domains/", configuration.base_path);
153 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
154
155 if let Some(ref user_agent) = configuration.user_agent {
156 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
157 }
158 req_builder = req_builder.json(&p_body_domain_request);
159
160 let req = req_builder.build()?;
161 let resp = configuration.client.execute(req).await?;
162
163 let status = resp.status();
164 let content_type = resp
165 .headers()
166 .get("content-type")
167 .and_then(|v| v.to_str().ok())
168 .unwrap_or("application/octet-stream");
169 let content_type = super::ContentType::from(content_type);
170
171 if !status.is_client_error() && !status.is_server_error() {
172 let content = resp.text().await?;
173 match content_type {
174 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
175 ContentType::Text => {
176 return Err(Error::from(serde_json::Error::custom(
177 "Received `text/plain` content type response that cannot be converted to `models::Domain`",
178 )))
179 }
180 ContentType::Unsupported(unknown_type) => {
181 return Err(Error::from(serde_json::Error::custom(format!(
182 "Received `{unknown_type}` content type response that cannot be converted to `models::Domain`"
183 ))))
184 }
185 }
186 } else {
187 let content = resp.text().await?;
188 let entity: Option<TenantsDomainsCreateError> = serde_json::from_str(&content).ok();
189 Err(Error::ResponseError(ResponseContent {
190 status,
191 content,
192 entity,
193 }))
194 }
195}
196
197pub async fn tenants_domains_destroy(
199 configuration: &configuration::Configuration,
200 id: i32,
201) -> Result<(), Error<TenantsDomainsDestroyError>> {
202 let p_path_id = id;
204
205 let uri_str = format!("{}/tenants/domains/{id}/", configuration.base_path, id = p_path_id);
206 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
207
208 if let Some(ref user_agent) = configuration.user_agent {
209 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
210 }
211
212 let req = req_builder.build()?;
213 let resp = configuration.client.execute(req).await?;
214
215 let status = resp.status();
216
217 if !status.is_client_error() && !status.is_server_error() {
218 Ok(())
219 } else {
220 let content = resp.text().await?;
221 let entity: Option<TenantsDomainsDestroyError> = serde_json::from_str(&content).ok();
222 Err(Error::ResponseError(ResponseContent {
223 status,
224 content,
225 entity,
226 }))
227 }
228}
229
230pub async fn tenants_domains_list(
232 configuration: &configuration::Configuration,
233 ordering: Option<&str>,
234 page: Option<i32>,
235 page_size: Option<i32>,
236 search: Option<&str>,
237) -> Result<models::PaginatedDomainList, Error<TenantsDomainsListError>> {
238 let p_query_ordering = ordering;
240 let p_query_page = page;
241 let p_query_page_size = page_size;
242 let p_query_search = search;
243
244 let uri_str = format!("{}/tenants/domains/", configuration.base_path);
245 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
246
247 if let Some(ref param_value) = p_query_ordering {
248 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
249 }
250 if let Some(ref param_value) = p_query_page {
251 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
252 }
253 if let Some(ref param_value) = p_query_page_size {
254 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
255 }
256 if let Some(ref param_value) = p_query_search {
257 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
258 }
259 if let Some(ref user_agent) = configuration.user_agent {
260 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
261 }
262
263 let req = req_builder.build()?;
264 let resp = configuration.client.execute(req).await?;
265
266 let status = resp.status();
267 let content_type = resp
268 .headers()
269 .get("content-type")
270 .and_then(|v| v.to_str().ok())
271 .unwrap_or("application/octet-stream");
272 let content_type = super::ContentType::from(content_type);
273
274 if !status.is_client_error() && !status.is_server_error() {
275 let content = resp.text().await?;
276 match content_type {
277 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
278 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDomainList`"))),
279 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::PaginatedDomainList`")))),
280 }
281 } else {
282 let content = resp.text().await?;
283 let entity: Option<TenantsDomainsListError> = serde_json::from_str(&content).ok();
284 Err(Error::ResponseError(ResponseContent {
285 status,
286 content,
287 entity,
288 }))
289 }
290}
291
292pub async fn tenants_domains_partial_update(
294 configuration: &configuration::Configuration,
295 id: i32,
296 patched_domain_request: Option<models::PatchedDomainRequest>,
297) -> Result<models::Domain, Error<TenantsDomainsPartialUpdateError>> {
298 let p_path_id = id;
300 let p_body_patched_domain_request = patched_domain_request;
301
302 let uri_str = format!("{}/tenants/domains/{id}/", configuration.base_path, id = p_path_id);
303 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
304
305 if let Some(ref user_agent) = configuration.user_agent {
306 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
307 }
308 req_builder = req_builder.json(&p_body_patched_domain_request);
309
310 let req = req_builder.build()?;
311 let resp = configuration.client.execute(req).await?;
312
313 let status = resp.status();
314 let content_type = resp
315 .headers()
316 .get("content-type")
317 .and_then(|v| v.to_str().ok())
318 .unwrap_or("application/octet-stream");
319 let content_type = super::ContentType::from(content_type);
320
321 if !status.is_client_error() && !status.is_server_error() {
322 let content = resp.text().await?;
323 match content_type {
324 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
325 ContentType::Text => {
326 return Err(Error::from(serde_json::Error::custom(
327 "Received `text/plain` content type response that cannot be converted to `models::Domain`",
328 )))
329 }
330 ContentType::Unsupported(unknown_type) => {
331 return Err(Error::from(serde_json::Error::custom(format!(
332 "Received `{unknown_type}` content type response that cannot be converted to `models::Domain`"
333 ))))
334 }
335 }
336 } else {
337 let content = resp.text().await?;
338 let entity: Option<TenantsDomainsPartialUpdateError> = serde_json::from_str(&content).ok();
339 Err(Error::ResponseError(ResponseContent {
340 status,
341 content,
342 entity,
343 }))
344 }
345}
346
347pub async fn tenants_domains_retrieve(
349 configuration: &configuration::Configuration,
350 id: i32,
351) -> Result<models::Domain, Error<TenantsDomainsRetrieveError>> {
352 let p_path_id = id;
354
355 let uri_str = format!("{}/tenants/domains/{id}/", configuration.base_path, id = p_path_id);
356 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
357
358 if let Some(ref user_agent) = configuration.user_agent {
359 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
360 }
361
362 let req = req_builder.build()?;
363 let resp = configuration.client.execute(req).await?;
364
365 let status = resp.status();
366 let content_type = resp
367 .headers()
368 .get("content-type")
369 .and_then(|v| v.to_str().ok())
370 .unwrap_or("application/octet-stream");
371 let content_type = super::ContentType::from(content_type);
372
373 if !status.is_client_error() && !status.is_server_error() {
374 let content = resp.text().await?;
375 match content_type {
376 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
377 ContentType::Text => {
378 return Err(Error::from(serde_json::Error::custom(
379 "Received `text/plain` content type response that cannot be converted to `models::Domain`",
380 )))
381 }
382 ContentType::Unsupported(unknown_type) => {
383 return Err(Error::from(serde_json::Error::custom(format!(
384 "Received `{unknown_type}` content type response that cannot be converted to `models::Domain`"
385 ))))
386 }
387 }
388 } else {
389 let content = resp.text().await?;
390 let entity: Option<TenantsDomainsRetrieveError> = serde_json::from_str(&content).ok();
391 Err(Error::ResponseError(ResponseContent {
392 status,
393 content,
394 entity,
395 }))
396 }
397}
398
399pub async fn tenants_domains_update(
401 configuration: &configuration::Configuration,
402 id: i32,
403 domain_request: models::DomainRequest,
404) -> Result<models::Domain, Error<TenantsDomainsUpdateError>> {
405 let p_path_id = id;
407 let p_body_domain_request = domain_request;
408
409 let uri_str = format!("{}/tenants/domains/{id}/", configuration.base_path, id = p_path_id);
410 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
411
412 if let Some(ref user_agent) = configuration.user_agent {
413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
414 }
415 req_builder = req_builder.json(&p_body_domain_request);
416
417 let req = req_builder.build()?;
418 let resp = configuration.client.execute(req).await?;
419
420 let status = resp.status();
421 let content_type = resp
422 .headers()
423 .get("content-type")
424 .and_then(|v| v.to_str().ok())
425 .unwrap_or("application/octet-stream");
426 let content_type = super::ContentType::from(content_type);
427
428 if !status.is_client_error() && !status.is_server_error() {
429 let content = resp.text().await?;
430 match content_type {
431 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
432 ContentType::Text => {
433 return Err(Error::from(serde_json::Error::custom(
434 "Received `text/plain` content type response that cannot be converted to `models::Domain`",
435 )))
436 }
437 ContentType::Unsupported(unknown_type) => {
438 return Err(Error::from(serde_json::Error::custom(format!(
439 "Received `{unknown_type}` content type response that cannot be converted to `models::Domain`"
440 ))))
441 }
442 }
443 } else {
444 let content = resp.text().await?;
445 let entity: Option<TenantsDomainsUpdateError> = serde_json::from_str(&content).ok();
446 Err(Error::ResponseError(ResponseContent {
447 status,
448 content,
449 entity,
450 }))
451 }
452}
453
454pub async fn tenants_tenants_create(
456 configuration: &configuration::Configuration,
457 tenant_request: models::TenantRequest,
458) -> Result<models::Tenant, Error<TenantsTenantsCreateError>> {
459 let p_body_tenant_request = tenant_request;
461
462 let uri_str = format!("{}/tenants/tenants/", configuration.base_path);
463 let mut req_builder = configuration.client.request(reqwest::Method::POST, &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 req_builder = req_builder.json(&p_body_tenant_request);
469
470 let req = req_builder.build()?;
471 let resp = configuration.client.execute(req).await?;
472
473 let status = resp.status();
474 let content_type = resp
475 .headers()
476 .get("content-type")
477 .and_then(|v| v.to_str().ok())
478 .unwrap_or("application/octet-stream");
479 let content_type = super::ContentType::from(content_type);
480
481 if !status.is_client_error() && !status.is_server_error() {
482 let content = resp.text().await?;
483 match content_type {
484 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
485 ContentType::Text => {
486 return Err(Error::from(serde_json::Error::custom(
487 "Received `text/plain` content type response that cannot be converted to `models::Tenant`",
488 )))
489 }
490 ContentType::Unsupported(unknown_type) => {
491 return Err(Error::from(serde_json::Error::custom(format!(
492 "Received `{unknown_type}` content type response that cannot be converted to `models::Tenant`"
493 ))))
494 }
495 }
496 } else {
497 let content = resp.text().await?;
498 let entity: Option<TenantsTenantsCreateError> = serde_json::from_str(&content).ok();
499 Err(Error::ResponseError(ResponseContent {
500 status,
501 content,
502 entity,
503 }))
504 }
505}
506
507pub async fn tenants_tenants_create_admin_group_create(
509 configuration: &configuration::Configuration,
510 tenant_uuid: &str,
511 tenant_admin_group_request_request: models::TenantAdminGroupRequestRequest,
512) -> Result<(), Error<TenantsTenantsCreateAdminGroupCreateError>> {
513 let p_path_tenant_uuid = tenant_uuid;
515 let p_body_tenant_admin_group_request_request = tenant_admin_group_request_request;
516
517 let uri_str = format!(
518 "{}/tenants/tenants/{tenant_uuid}/create_admin_group/",
519 configuration.base_path,
520 tenant_uuid = crate::apis::urlencode(p_path_tenant_uuid)
521 );
522 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
523
524 if let Some(ref user_agent) = configuration.user_agent {
525 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
526 }
527 req_builder = req_builder.json(&p_body_tenant_admin_group_request_request);
528
529 let req = req_builder.build()?;
530 let resp = configuration.client.execute(req).await?;
531
532 let status = resp.status();
533
534 if !status.is_client_error() && !status.is_server_error() {
535 Ok(())
536 } else {
537 let content = resp.text().await?;
538 let entity: Option<TenantsTenantsCreateAdminGroupCreateError> = serde_json::from_str(&content).ok();
539 Err(Error::ResponseError(ResponseContent {
540 status,
541 content,
542 entity,
543 }))
544 }
545}
546
547pub async fn tenants_tenants_create_recovery_key_create(
549 configuration: &configuration::Configuration,
550 tenant_uuid: &str,
551 tenant_recovery_key_request_request: models::TenantRecoveryKeyRequestRequest,
552) -> Result<models::TenantRecoveryKeyResponse, Error<TenantsTenantsCreateRecoveryKeyCreateError>> {
553 let p_path_tenant_uuid = tenant_uuid;
555 let p_body_tenant_recovery_key_request_request = tenant_recovery_key_request_request;
556
557 let uri_str = format!(
558 "{}/tenants/tenants/{tenant_uuid}/create_recovery_key/",
559 configuration.base_path,
560 tenant_uuid = crate::apis::urlencode(p_path_tenant_uuid)
561 );
562 let mut req_builder = configuration.client.request(reqwest::Method::POST, &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 req_builder = req_builder.json(&p_body_tenant_recovery_key_request_request);
568
569 let req = req_builder.build()?;
570 let resp = configuration.client.execute(req).await?;
571
572 let status = resp.status();
573 let content_type = resp
574 .headers()
575 .get("content-type")
576 .and_then(|v| v.to_str().ok())
577 .unwrap_or("application/octet-stream");
578 let content_type = super::ContentType::from(content_type);
579
580 if !status.is_client_error() && !status.is_server_error() {
581 let content = resp.text().await?;
582 match content_type {
583 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
584 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TenantRecoveryKeyResponse`"))),
585 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::TenantRecoveryKeyResponse`")))),
586 }
587 } else {
588 let content = resp.text().await?;
589 let entity: Option<TenantsTenantsCreateRecoveryKeyCreateError> = serde_json::from_str(&content).ok();
590 Err(Error::ResponseError(ResponseContent {
591 status,
592 content,
593 entity,
594 }))
595 }
596}
597
598pub async fn tenants_tenants_destroy(
600 configuration: &configuration::Configuration,
601 tenant_uuid: &str,
602) -> Result<(), Error<TenantsTenantsDestroyError>> {
603 let p_path_tenant_uuid = tenant_uuid;
605
606 let uri_str = format!(
607 "{}/tenants/tenants/{tenant_uuid}/",
608 configuration.base_path,
609 tenant_uuid = crate::apis::urlencode(p_path_tenant_uuid)
610 );
611 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
612
613 if let Some(ref user_agent) = configuration.user_agent {
614 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
615 }
616
617 let req = req_builder.build()?;
618 let resp = configuration.client.execute(req).await?;
619
620 let status = resp.status();
621
622 if !status.is_client_error() && !status.is_server_error() {
623 Ok(())
624 } else {
625 let content = resp.text().await?;
626 let entity: Option<TenantsTenantsDestroyError> = serde_json::from_str(&content).ok();
627 Err(Error::ResponseError(ResponseContent {
628 status,
629 content,
630 entity,
631 }))
632 }
633}
634
635pub async fn tenants_tenants_list(
637 configuration: &configuration::Configuration,
638 ordering: Option<&str>,
639 page: Option<i32>,
640 page_size: Option<i32>,
641 search: Option<&str>,
642) -> Result<models::PaginatedTenantList, Error<TenantsTenantsListError>> {
643 let p_query_ordering = ordering;
645 let p_query_page = page;
646 let p_query_page_size = page_size;
647 let p_query_search = search;
648
649 let uri_str = format!("{}/tenants/tenants/", configuration.base_path);
650 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
651
652 if let Some(ref param_value) = p_query_ordering {
653 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
654 }
655 if let Some(ref param_value) = p_query_page {
656 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
657 }
658 if let Some(ref param_value) = p_query_page_size {
659 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
660 }
661 if let Some(ref param_value) = p_query_search {
662 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
663 }
664 if let Some(ref user_agent) = configuration.user_agent {
665 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
666 }
667
668 let req = req_builder.build()?;
669 let resp = configuration.client.execute(req).await?;
670
671 let status = resp.status();
672 let content_type = resp
673 .headers()
674 .get("content-type")
675 .and_then(|v| v.to_str().ok())
676 .unwrap_or("application/octet-stream");
677 let content_type = super::ContentType::from(content_type);
678
679 if !status.is_client_error() && !status.is_server_error() {
680 let content = resp.text().await?;
681 match content_type {
682 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
683 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTenantList`"))),
684 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::PaginatedTenantList`")))),
685 }
686 } else {
687 let content = resp.text().await?;
688 let entity: Option<TenantsTenantsListError> = serde_json::from_str(&content).ok();
689 Err(Error::ResponseError(ResponseContent {
690 status,
691 content,
692 entity,
693 }))
694 }
695}
696
697pub async fn tenants_tenants_partial_update(
699 configuration: &configuration::Configuration,
700 tenant_uuid: &str,
701 patched_tenant_request: Option<models::PatchedTenantRequest>,
702) -> Result<models::Tenant, Error<TenantsTenantsPartialUpdateError>> {
703 let p_path_tenant_uuid = tenant_uuid;
705 let p_body_patched_tenant_request = patched_tenant_request;
706
707 let uri_str = format!(
708 "{}/tenants/tenants/{tenant_uuid}/",
709 configuration.base_path,
710 tenant_uuid = crate::apis::urlencode(p_path_tenant_uuid)
711 );
712 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
713
714 if let Some(ref user_agent) = configuration.user_agent {
715 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
716 }
717 req_builder = req_builder.json(&p_body_patched_tenant_request);
718
719 let req = req_builder.build()?;
720 let resp = configuration.client.execute(req).await?;
721
722 let status = resp.status();
723 let content_type = resp
724 .headers()
725 .get("content-type")
726 .and_then(|v| v.to_str().ok())
727 .unwrap_or("application/octet-stream");
728 let content_type = super::ContentType::from(content_type);
729
730 if !status.is_client_error() && !status.is_server_error() {
731 let content = resp.text().await?;
732 match content_type {
733 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
734 ContentType::Text => {
735 return Err(Error::from(serde_json::Error::custom(
736 "Received `text/plain` content type response that cannot be converted to `models::Tenant`",
737 )))
738 }
739 ContentType::Unsupported(unknown_type) => {
740 return Err(Error::from(serde_json::Error::custom(format!(
741 "Received `{unknown_type}` content type response that cannot be converted to `models::Tenant`"
742 ))))
743 }
744 }
745 } else {
746 let content = resp.text().await?;
747 let entity: Option<TenantsTenantsPartialUpdateError> = serde_json::from_str(&content).ok();
748 Err(Error::ResponseError(ResponseContent {
749 status,
750 content,
751 entity,
752 }))
753 }
754}
755
756pub async fn tenants_tenants_retrieve(
758 configuration: &configuration::Configuration,
759 tenant_uuid: &str,
760) -> Result<models::Tenant, Error<TenantsTenantsRetrieveError>> {
761 let p_path_tenant_uuid = tenant_uuid;
763
764 let uri_str = format!(
765 "{}/tenants/tenants/{tenant_uuid}/",
766 configuration.base_path,
767 tenant_uuid = crate::apis::urlencode(p_path_tenant_uuid)
768 );
769 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
770
771 if let Some(ref user_agent) = configuration.user_agent {
772 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
773 }
774
775 let req = req_builder.build()?;
776 let resp = configuration.client.execute(req).await?;
777
778 let status = resp.status();
779 let content_type = resp
780 .headers()
781 .get("content-type")
782 .and_then(|v| v.to_str().ok())
783 .unwrap_or("application/octet-stream");
784 let content_type = super::ContentType::from(content_type);
785
786 if !status.is_client_error() && !status.is_server_error() {
787 let content = resp.text().await?;
788 match content_type {
789 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
790 ContentType::Text => {
791 return Err(Error::from(serde_json::Error::custom(
792 "Received `text/plain` content type response that cannot be converted to `models::Tenant`",
793 )))
794 }
795 ContentType::Unsupported(unknown_type) => {
796 return Err(Error::from(serde_json::Error::custom(format!(
797 "Received `{unknown_type}` content type response that cannot be converted to `models::Tenant`"
798 ))))
799 }
800 }
801 } else {
802 let content = resp.text().await?;
803 let entity: Option<TenantsTenantsRetrieveError> = serde_json::from_str(&content).ok();
804 Err(Error::ResponseError(ResponseContent {
805 status,
806 content,
807 entity,
808 }))
809 }
810}
811
812pub async fn tenants_tenants_update(
814 configuration: &configuration::Configuration,
815 tenant_uuid: &str,
816 tenant_request: models::TenantRequest,
817) -> Result<models::Tenant, Error<TenantsTenantsUpdateError>> {
818 let p_path_tenant_uuid = tenant_uuid;
820 let p_body_tenant_request = tenant_request;
821
822 let uri_str = format!(
823 "{}/tenants/tenants/{tenant_uuid}/",
824 configuration.base_path,
825 tenant_uuid = crate::apis::urlencode(p_path_tenant_uuid)
826 );
827 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
828
829 if let Some(ref user_agent) = configuration.user_agent {
830 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
831 }
832 req_builder = req_builder.json(&p_body_tenant_request);
833
834 let req = req_builder.build()?;
835 let resp = configuration.client.execute(req).await?;
836
837 let status = resp.status();
838 let content_type = resp
839 .headers()
840 .get("content-type")
841 .and_then(|v| v.to_str().ok())
842 .unwrap_or("application/octet-stream");
843 let content_type = super::ContentType::from(content_type);
844
845 if !status.is_client_error() && !status.is_server_error() {
846 let content = resp.text().await?;
847 match content_type {
848 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
849 ContentType::Text => {
850 return Err(Error::from(serde_json::Error::custom(
851 "Received `text/plain` content type response that cannot be converted to `models::Tenant`",
852 )))
853 }
854 ContentType::Unsupported(unknown_type) => {
855 return Err(Error::from(serde_json::Error::custom(format!(
856 "Received `{unknown_type}` content type response that cannot be converted to `models::Tenant`"
857 ))))
858 }
859 }
860 } else {
861 let content = resp.text().await?;
862 let entity: Option<TenantsTenantsUpdateError> = serde_json::from_str(&content).ok();
863 Err(Error::ResponseError(ResponseContent {
864 status,
865 content,
866 entity,
867 }))
868 }
869}