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 CoreApplicationEntitlementsCreateError {
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 CoreApplicationEntitlementsDestroyError {
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 CoreApplicationEntitlementsListError {
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 CoreApplicationEntitlementsPartialUpdateError {
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 CoreApplicationEntitlementsRetrieveError {
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 CoreApplicationEntitlementsUpdateError {
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 CoreApplicationEntitlementsUsedByListError {
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 CoreApplicationsCheckAccessRetrieveError {
83 Status400(models::ValidationError),
84 Status403(models::GenericError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum CoreApplicationsCreateError {
92 Status400(models::ValidationError),
93 Status403(models::GenericError),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum CoreApplicationsDestroyError {
101 Status400(models::ValidationError),
102 Status403(models::GenericError),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum CoreApplicationsListError {
110 Status400(models::ValidationError),
111 Status403(models::GenericError),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum CoreApplicationsPartialUpdateError {
119 Status400(models::ValidationError),
120 Status403(models::GenericError),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum CoreApplicationsRetrieveError {
128 Status400(models::ValidationError),
129 Status403(models::GenericError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum CoreApplicationsUpdateError {
137 Status400(models::ValidationError),
138 Status403(models::GenericError),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum CoreApplicationsUsedByListError {
146 Status400(models::ValidationError),
147 Status403(models::GenericError),
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum CoreAuthenticatedSessionsBulkDeleteDestroyError {
155 Status400(models::ValidationError),
156 Status403(models::GenericError),
157 UnknownValue(serde_json::Value),
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum CoreAuthenticatedSessionsDestroyError {
164 Status400(models::ValidationError),
165 Status403(models::GenericError),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum CoreAuthenticatedSessionsListError {
173 Status400(models::ValidationError),
174 Status403(models::GenericError),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum CoreAuthenticatedSessionsRetrieveError {
182 Status400(models::ValidationError),
183 Status403(models::GenericError),
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum CoreAuthenticatedSessionsUsedByListError {
191 Status400(models::ValidationError),
192 Status403(models::GenericError),
193 UnknownValue(serde_json::Value),
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum CoreBrandsCreateError {
200 Status400(models::ValidationError),
201 Status403(models::GenericError),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum CoreBrandsCurrentRetrieveError {
209 Status400(models::ValidationError),
210 Status403(models::GenericError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum CoreBrandsDestroyError {
218 Status400(models::ValidationError),
219 Status403(models::GenericError),
220 UnknownValue(serde_json::Value),
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum CoreBrandsListError {
227 Status400(models::ValidationError),
228 Status403(models::GenericError),
229 UnknownValue(serde_json::Value),
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum CoreBrandsPartialUpdateError {
236 Status400(models::ValidationError),
237 Status403(models::GenericError),
238 UnknownValue(serde_json::Value),
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum CoreBrandsRetrieveError {
245 Status400(models::ValidationError),
246 Status403(models::GenericError),
247 UnknownValue(serde_json::Value),
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum CoreBrandsUpdateError {
254 Status400(models::ValidationError),
255 Status403(models::GenericError),
256 UnknownValue(serde_json::Value),
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum CoreBrandsUsedByListError {
263 Status400(models::ValidationError),
264 Status403(models::GenericError),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum CoreGroupsAddUserCreateError {
272 Status404(),
273 Status400(models::ValidationError),
274 Status403(models::GenericError),
275 UnknownValue(serde_json::Value),
276}
277
278#[derive(Debug, Clone, Serialize, Deserialize)]
280#[serde(untagged)]
281pub enum CoreGroupsCreateError {
282 Status400(models::ValidationError),
283 Status403(models::GenericError),
284 UnknownValue(serde_json::Value),
285}
286
287#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum CoreGroupsDestroyError {
291 Status400(models::ValidationError),
292 Status403(models::GenericError),
293 UnknownValue(serde_json::Value),
294}
295
296#[derive(Debug, Clone, Serialize, Deserialize)]
298#[serde(untagged)]
299pub enum CoreGroupsListError {
300 Status400(models::ValidationError),
301 Status403(models::GenericError),
302 UnknownValue(serde_json::Value),
303}
304
305#[derive(Debug, Clone, Serialize, Deserialize)]
307#[serde(untagged)]
308pub enum CoreGroupsPartialUpdateError {
309 Status400(models::ValidationError),
310 Status403(models::GenericError),
311 UnknownValue(serde_json::Value),
312}
313
314#[derive(Debug, Clone, Serialize, Deserialize)]
316#[serde(untagged)]
317pub enum CoreGroupsRemoveUserCreateError {
318 Status404(),
319 Status400(models::ValidationError),
320 Status403(models::GenericError),
321 UnknownValue(serde_json::Value),
322}
323
324#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum CoreGroupsRetrieveError {
328 Status400(models::ValidationError),
329 Status403(models::GenericError),
330 UnknownValue(serde_json::Value),
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize)]
335#[serde(untagged)]
336pub enum CoreGroupsUpdateError {
337 Status400(models::ValidationError),
338 Status403(models::GenericError),
339 UnknownValue(serde_json::Value),
340}
341
342#[derive(Debug, Clone, Serialize, Deserialize)]
344#[serde(untagged)]
345pub enum CoreGroupsUsedByListError {
346 Status400(models::ValidationError),
347 Status403(models::GenericError),
348 UnknownValue(serde_json::Value),
349}
350
351#[derive(Debug, Clone, Serialize, Deserialize)]
353#[serde(untagged)]
354pub enum CoreTokensCreateError {
355 Status400(models::ValidationError),
356 Status403(models::GenericError),
357 UnknownValue(serde_json::Value),
358}
359
360#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum CoreTokensDestroyError {
364 Status400(models::ValidationError),
365 Status403(models::GenericError),
366 UnknownValue(serde_json::Value),
367}
368
369#[derive(Debug, Clone, Serialize, Deserialize)]
371#[serde(untagged)]
372pub enum CoreTokensListError {
373 Status400(models::ValidationError),
374 Status403(models::GenericError),
375 UnknownValue(serde_json::Value),
376}
377
378#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum CoreTokensPartialUpdateError {
382 Status400(models::ValidationError),
383 Status403(models::GenericError),
384 UnknownValue(serde_json::Value),
385}
386
387#[derive(Debug, Clone, Serialize, Deserialize)]
389#[serde(untagged)]
390pub enum CoreTokensRetrieveError {
391 Status400(models::ValidationError),
392 Status403(models::GenericError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum CoreTokensSetKeyCreateError {
400 Status400(),
401 Status404(),
402 Status403(models::GenericError),
403 UnknownValue(serde_json::Value),
404}
405
406#[derive(Debug, Clone, Serialize, Deserialize)]
408#[serde(untagged)]
409pub enum CoreTokensUpdateError {
410 Status400(models::ValidationError),
411 Status403(models::GenericError),
412 UnknownValue(serde_json::Value),
413}
414
415#[derive(Debug, Clone, Serialize, Deserialize)]
417#[serde(untagged)]
418pub enum CoreTokensUsedByListError {
419 Status400(models::ValidationError),
420 Status403(models::GenericError),
421 UnknownValue(serde_json::Value),
422}
423
424#[derive(Debug, Clone, Serialize, Deserialize)]
426#[serde(untagged)]
427pub enum CoreTokensViewKeyRetrieveError {
428 Status404(),
429 Status400(models::ValidationError),
430 Status403(models::GenericError),
431 UnknownValue(serde_json::Value),
432}
433
434#[derive(Debug, Clone, Serialize, Deserialize)]
436#[serde(untagged)]
437pub enum CoreTransactionalApplicationsUpdateError {
438 Status400(models::ValidationError),
439 Status403(models::GenericError),
440 UnknownValue(serde_json::Value),
441}
442
443#[derive(Debug, Clone, Serialize, Deserialize)]
445#[serde(untagged)]
446pub enum CoreUserConsentDestroyError {
447 Status400(models::ValidationError),
448 Status403(models::GenericError),
449 UnknownValue(serde_json::Value),
450}
451
452#[derive(Debug, Clone, Serialize, Deserialize)]
454#[serde(untagged)]
455pub enum CoreUserConsentListError {
456 Status400(models::ValidationError),
457 Status403(models::GenericError),
458 UnknownValue(serde_json::Value),
459}
460
461#[derive(Debug, Clone, Serialize, Deserialize)]
463#[serde(untagged)]
464pub enum CoreUserConsentRetrieveError {
465 Status400(models::ValidationError),
466 Status403(models::GenericError),
467 UnknownValue(serde_json::Value),
468}
469
470#[derive(Debug, Clone, Serialize, Deserialize)]
472#[serde(untagged)]
473pub enum CoreUserConsentUsedByListError {
474 Status400(models::ValidationError),
475 Status403(models::GenericError),
476 UnknownValue(serde_json::Value),
477}
478
479#[derive(Debug, Clone, Serialize, Deserialize)]
481#[serde(untagged)]
482pub enum CoreUsersCreateError {
483 Status400(models::ValidationError),
484 Status403(models::GenericError),
485 UnknownValue(serde_json::Value),
486}
487
488#[derive(Debug, Clone, Serialize, Deserialize)]
490#[serde(untagged)]
491pub enum CoreUsersDestroyError {
492 Status400(models::ValidationError),
493 Status403(models::GenericError),
494 UnknownValue(serde_json::Value),
495}
496
497#[derive(Debug, Clone, Serialize, Deserialize)]
499#[serde(untagged)]
500pub enum CoreUsersExportCreateError {
501 Status400(models::ValidationError),
502 Status403(models::GenericError),
503 UnknownValue(serde_json::Value),
504}
505
506#[derive(Debug, Clone, Serialize, Deserialize)]
508#[serde(untagged)]
509pub enum CoreUsersImpersonateCreateError {
510 Status400(models::ValidationError),
511 Status403(models::GenericError),
512 UnknownValue(serde_json::Value),
513}
514
515#[derive(Debug, Clone, Serialize, Deserialize)]
517#[serde(untagged)]
518pub enum CoreUsersImpersonateEndRetrieveError {
519 Status400(models::ValidationError),
520 Status403(models::GenericError),
521 UnknownValue(serde_json::Value),
522}
523
524#[derive(Debug, Clone, Serialize, Deserialize)]
526#[serde(untagged)]
527pub enum CoreUsersListError {
528 Status400(models::ValidationError),
529 Status403(models::GenericError),
530 UnknownValue(serde_json::Value),
531}
532
533#[derive(Debug, Clone, Serialize, Deserialize)]
535#[serde(untagged)]
536pub enum CoreUsersMeRetrieveError {
537 Status400(models::ValidationError),
538 Status403(models::GenericError),
539 UnknownValue(serde_json::Value),
540}
541
542#[derive(Debug, Clone, Serialize, Deserialize)]
544#[serde(untagged)]
545pub enum CoreUsersPartialUpdateError {
546 Status400(models::ValidationError),
547 Status403(models::GenericError),
548 UnknownValue(serde_json::Value),
549}
550
551#[derive(Debug, Clone, Serialize, Deserialize)]
553#[serde(untagged)]
554pub enum CoreUsersPathsRetrieveError {
555 Status400(models::ValidationError),
556 Status403(models::GenericError),
557 UnknownValue(serde_json::Value),
558}
559
560#[derive(Debug, Clone, Serialize, Deserialize)]
562#[serde(untagged)]
563pub enum CoreUsersRecoveryCreateError {
564 Status400(models::ValidationError),
565 Status403(models::GenericError),
566 UnknownValue(serde_json::Value),
567}
568
569#[derive(Debug, Clone, Serialize, Deserialize)]
571#[serde(untagged)]
572pub enum CoreUsersRecoveryEmailCreateError {
573 Status400(models::ValidationError),
574 Status403(models::GenericError),
575 UnknownValue(serde_json::Value),
576}
577
578#[derive(Debug, Clone, Serialize, Deserialize)]
580#[serde(untagged)]
581pub enum CoreUsersRetrieveError {
582 Status400(models::ValidationError),
583 Status403(models::GenericError),
584 UnknownValue(serde_json::Value),
585}
586
587#[derive(Debug, Clone, Serialize, Deserialize)]
589#[serde(untagged)]
590pub enum CoreUsersServiceAccountCreateError {
591 Status400(models::ValidationError),
592 Status403(models::GenericError),
593 UnknownValue(serde_json::Value),
594}
595
596#[derive(Debug, Clone, Serialize, Deserialize)]
598#[serde(untagged)]
599pub enum CoreUsersSetPasswordCreateError {
600 Status400(),
601 Status403(models::GenericError),
602 UnknownValue(serde_json::Value),
603}
604
605#[derive(Debug, Clone, Serialize, Deserialize)]
607#[serde(untagged)]
608pub enum CoreUsersUpdateError {
609 Status400(models::ValidationError),
610 Status403(models::GenericError),
611 UnknownValue(serde_json::Value),
612}
613
614#[derive(Debug, Clone, Serialize, Deserialize)]
616#[serde(untagged)]
617pub enum CoreUsersUsedByListError {
618 Status400(models::ValidationError),
619 Status403(models::GenericError),
620 UnknownValue(serde_json::Value),
621}
622
623pub async fn core_application_entitlements_create(
625 configuration: &configuration::Configuration,
626 application_entitlement_request: models::ApplicationEntitlementRequest,
627) -> Result<models::ApplicationEntitlement, Error<CoreApplicationEntitlementsCreateError>> {
628 let p_body_application_entitlement_request = application_entitlement_request;
630
631 let uri_str = format!("{}/core/application_entitlements/", configuration.base_path);
632 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
633
634 if let Some(ref user_agent) = configuration.user_agent {
635 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
636 }
637 if let Some(ref token) = configuration.bearer_access_token {
638 req_builder = req_builder.bearer_auth(token.to_owned());
639 };
640 req_builder = req_builder.json(&p_body_application_entitlement_request);
641
642 let req = req_builder.build()?;
643 let resp = configuration.client.execute(req).await?;
644
645 let status = resp.status();
646 let content_type = resp
647 .headers()
648 .get("content-type")
649 .and_then(|v| v.to_str().ok())
650 .unwrap_or("application/octet-stream");
651 let content_type = super::ContentType::from(content_type);
652
653 if !status.is_client_error() && !status.is_server_error() {
654 let content = resp.text().await?;
655 match content_type {
656 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
657 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationEntitlement`"))),
658 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApplicationEntitlement`")))),
659 }
660 } else {
661 let content = resp.text().await?;
662 let entity: Option<CoreApplicationEntitlementsCreateError> = serde_json::from_str(&content).ok();
663 Err(Error::ResponseError(ResponseContent {
664 status,
665 content,
666 entity,
667 }))
668 }
669}
670
671pub async fn core_application_entitlements_destroy(
673 configuration: &configuration::Configuration,
674 pbm_uuid: &str,
675) -> Result<(), Error<CoreApplicationEntitlementsDestroyError>> {
676 let p_path_pbm_uuid = pbm_uuid;
678
679 let uri_str = format!(
680 "{}/core/application_entitlements/{pbm_uuid}/",
681 configuration.base_path,
682 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
683 );
684 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
685
686 if let Some(ref user_agent) = configuration.user_agent {
687 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
688 }
689 if let Some(ref token) = configuration.bearer_access_token {
690 req_builder = req_builder.bearer_auth(token.to_owned());
691 };
692
693 let req = req_builder.build()?;
694 let resp = configuration.client.execute(req).await?;
695
696 let status = resp.status();
697
698 if !status.is_client_error() && !status.is_server_error() {
699 Ok(())
700 } else {
701 let content = resp.text().await?;
702 let entity: Option<CoreApplicationEntitlementsDestroyError> = serde_json::from_str(&content).ok();
703 Err(Error::ResponseError(ResponseContent {
704 status,
705 content,
706 entity,
707 }))
708 }
709}
710
711pub async fn core_application_entitlements_list(
713 configuration: &configuration::Configuration,
714 app: Option<&str>,
715 name: Option<&str>,
716 ordering: Option<&str>,
717 page: Option<i32>,
718 page_size: Option<i32>,
719 pbm_uuid: Option<&str>,
720 search: Option<&str>,
721) -> Result<models::PaginatedApplicationEntitlementList, Error<CoreApplicationEntitlementsListError>> {
722 let p_query_app = app;
724 let p_query_name = name;
725 let p_query_ordering = ordering;
726 let p_query_page = page;
727 let p_query_page_size = page_size;
728 let p_query_pbm_uuid = pbm_uuid;
729 let p_query_search = search;
730
731 let uri_str = format!("{}/core/application_entitlements/", configuration.base_path);
732 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
733
734 if let Some(ref param_value) = p_query_app {
735 req_builder = req_builder.query(&[("app", ¶m_value.to_string())]);
736 }
737 if let Some(ref param_value) = p_query_name {
738 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
739 }
740 if let Some(ref param_value) = p_query_ordering {
741 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
742 }
743 if let Some(ref param_value) = p_query_page {
744 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
745 }
746 if let Some(ref param_value) = p_query_page_size {
747 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
748 }
749 if let Some(ref param_value) = p_query_pbm_uuid {
750 req_builder = req_builder.query(&[("pbm_uuid", ¶m_value.to_string())]);
751 }
752 if let Some(ref param_value) = p_query_search {
753 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
754 }
755 if let Some(ref user_agent) = configuration.user_agent {
756 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
757 }
758 if let Some(ref token) = configuration.bearer_access_token {
759 req_builder = req_builder.bearer_auth(token.to_owned());
760 };
761
762 let req = req_builder.build()?;
763 let resp = configuration.client.execute(req).await?;
764
765 let status = resp.status();
766 let content_type = resp
767 .headers()
768 .get("content-type")
769 .and_then(|v| v.to_str().ok())
770 .unwrap_or("application/octet-stream");
771 let content_type = super::ContentType::from(content_type);
772
773 if !status.is_client_error() && !status.is_server_error() {
774 let content = resp.text().await?;
775 match content_type {
776 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
777 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedApplicationEntitlementList`"))),
778 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::PaginatedApplicationEntitlementList`")))),
779 }
780 } else {
781 let content = resp.text().await?;
782 let entity: Option<CoreApplicationEntitlementsListError> = serde_json::from_str(&content).ok();
783 Err(Error::ResponseError(ResponseContent {
784 status,
785 content,
786 entity,
787 }))
788 }
789}
790
791pub async fn core_application_entitlements_partial_update(
793 configuration: &configuration::Configuration,
794 pbm_uuid: &str,
795 patched_application_entitlement_request: Option<models::PatchedApplicationEntitlementRequest>,
796) -> Result<models::ApplicationEntitlement, Error<CoreApplicationEntitlementsPartialUpdateError>> {
797 let p_path_pbm_uuid = pbm_uuid;
799 let p_body_patched_application_entitlement_request = patched_application_entitlement_request;
800
801 let uri_str = format!(
802 "{}/core/application_entitlements/{pbm_uuid}/",
803 configuration.base_path,
804 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
805 );
806 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
807
808 if let Some(ref user_agent) = configuration.user_agent {
809 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
810 }
811 if let Some(ref token) = configuration.bearer_access_token {
812 req_builder = req_builder.bearer_auth(token.to_owned());
813 };
814 req_builder = req_builder.json(&p_body_patched_application_entitlement_request);
815
816 let req = req_builder.build()?;
817 let resp = configuration.client.execute(req).await?;
818
819 let status = resp.status();
820 let content_type = resp
821 .headers()
822 .get("content-type")
823 .and_then(|v| v.to_str().ok())
824 .unwrap_or("application/octet-stream");
825 let content_type = super::ContentType::from(content_type);
826
827 if !status.is_client_error() && !status.is_server_error() {
828 let content = resp.text().await?;
829 match content_type {
830 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
831 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationEntitlement`"))),
832 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::ApplicationEntitlement`")))),
833 }
834 } else {
835 let content = resp.text().await?;
836 let entity: Option<CoreApplicationEntitlementsPartialUpdateError> = serde_json::from_str(&content).ok();
837 Err(Error::ResponseError(ResponseContent {
838 status,
839 content,
840 entity,
841 }))
842 }
843}
844
845pub async fn core_application_entitlements_retrieve(
847 configuration: &configuration::Configuration,
848 pbm_uuid: &str,
849) -> Result<models::ApplicationEntitlement, Error<CoreApplicationEntitlementsRetrieveError>> {
850 let p_path_pbm_uuid = pbm_uuid;
852
853 let uri_str = format!(
854 "{}/core/application_entitlements/{pbm_uuid}/",
855 configuration.base_path,
856 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
857 );
858 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
859
860 if let Some(ref user_agent) = configuration.user_agent {
861 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
862 }
863 if let Some(ref token) = configuration.bearer_access_token {
864 req_builder = req_builder.bearer_auth(token.to_owned());
865 };
866
867 let req = req_builder.build()?;
868 let resp = configuration.client.execute(req).await?;
869
870 let status = resp.status();
871 let content_type = resp
872 .headers()
873 .get("content-type")
874 .and_then(|v| v.to_str().ok())
875 .unwrap_or("application/octet-stream");
876 let content_type = super::ContentType::from(content_type);
877
878 if !status.is_client_error() && !status.is_server_error() {
879 let content = resp.text().await?;
880 match content_type {
881 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
882 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationEntitlement`"))),
883 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::ApplicationEntitlement`")))),
884 }
885 } else {
886 let content = resp.text().await?;
887 let entity: Option<CoreApplicationEntitlementsRetrieveError> = serde_json::from_str(&content).ok();
888 Err(Error::ResponseError(ResponseContent {
889 status,
890 content,
891 entity,
892 }))
893 }
894}
895
896pub async fn core_application_entitlements_update(
898 configuration: &configuration::Configuration,
899 pbm_uuid: &str,
900 application_entitlement_request: models::ApplicationEntitlementRequest,
901) -> Result<models::ApplicationEntitlement, Error<CoreApplicationEntitlementsUpdateError>> {
902 let p_path_pbm_uuid = pbm_uuid;
904 let p_body_application_entitlement_request = application_entitlement_request;
905
906 let uri_str = format!(
907 "{}/core/application_entitlements/{pbm_uuid}/",
908 configuration.base_path,
909 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
910 );
911 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
912
913 if let Some(ref user_agent) = configuration.user_agent {
914 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
915 }
916 if let Some(ref token) = configuration.bearer_access_token {
917 req_builder = req_builder.bearer_auth(token.to_owned());
918 };
919 req_builder = req_builder.json(&p_body_application_entitlement_request);
920
921 let req = req_builder.build()?;
922 let resp = configuration.client.execute(req).await?;
923
924 let status = resp.status();
925 let content_type = resp
926 .headers()
927 .get("content-type")
928 .and_then(|v| v.to_str().ok())
929 .unwrap_or("application/octet-stream");
930 let content_type = super::ContentType::from(content_type);
931
932 if !status.is_client_error() && !status.is_server_error() {
933 let content = resp.text().await?;
934 match content_type {
935 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
936 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationEntitlement`"))),
937 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::ApplicationEntitlement`")))),
938 }
939 } else {
940 let content = resp.text().await?;
941 let entity: Option<CoreApplicationEntitlementsUpdateError> = serde_json::from_str(&content).ok();
942 Err(Error::ResponseError(ResponseContent {
943 status,
944 content,
945 entity,
946 }))
947 }
948}
949
950pub async fn core_application_entitlements_used_by_list(
952 configuration: &configuration::Configuration,
953 pbm_uuid: &str,
954) -> Result<Vec<models::UsedBy>, Error<CoreApplicationEntitlementsUsedByListError>> {
955 let p_path_pbm_uuid = pbm_uuid;
957
958 let uri_str = format!(
959 "{}/core/application_entitlements/{pbm_uuid}/used_by/",
960 configuration.base_path,
961 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
962 );
963 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
964
965 if let Some(ref user_agent) = configuration.user_agent {
966 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
967 }
968 if let Some(ref token) = configuration.bearer_access_token {
969 req_builder = req_builder.bearer_auth(token.to_owned());
970 };
971
972 let req = req_builder.build()?;
973 let resp = configuration.client.execute(req).await?;
974
975 let status = resp.status();
976 let content_type = resp
977 .headers()
978 .get("content-type")
979 .and_then(|v| v.to_str().ok())
980 .unwrap_or("application/octet-stream");
981 let content_type = super::ContentType::from(content_type);
982
983 if !status.is_client_error() && !status.is_server_error() {
984 let content = resp.text().await?;
985 match content_type {
986 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
987 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
988 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::UsedBy>`")))),
989 }
990 } else {
991 let content = resp.text().await?;
992 let entity: Option<CoreApplicationEntitlementsUsedByListError> = serde_json::from_str(&content).ok();
993 Err(Error::ResponseError(ResponseContent {
994 status,
995 content,
996 entity,
997 }))
998 }
999}
1000
1001pub async fn core_applications_check_access_retrieve(
1003 configuration: &configuration::Configuration,
1004 slug: &str,
1005 for_user: Option<i32>,
1006) -> Result<models::PolicyTestResult, Error<CoreApplicationsCheckAccessRetrieveError>> {
1007 let p_path_slug = slug;
1009 let p_query_for_user = for_user;
1010
1011 let uri_str = format!(
1012 "{}/core/applications/{slug}/check_access/",
1013 configuration.base_path,
1014 slug = crate::apis::urlencode(p_path_slug)
1015 );
1016 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1017
1018 if let Some(ref param_value) = p_query_for_user {
1019 req_builder = req_builder.query(&[("for_user", ¶m_value.to_string())]);
1020 }
1021 if let Some(ref user_agent) = configuration.user_agent {
1022 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1023 }
1024 if let Some(ref token) = configuration.bearer_access_token {
1025 req_builder = req_builder.bearer_auth(token.to_owned());
1026 };
1027
1028 let req = req_builder.build()?;
1029 let resp = configuration.client.execute(req).await?;
1030
1031 let status = resp.status();
1032 let content_type = resp
1033 .headers()
1034 .get("content-type")
1035 .and_then(|v| v.to_str().ok())
1036 .unwrap_or("application/octet-stream");
1037 let content_type = super::ContentType::from(content_type);
1038
1039 if !status.is_client_error() && !status.is_server_error() {
1040 let content = resp.text().await?;
1041 match content_type {
1042 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1043 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PolicyTestResult`"))),
1044 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::PolicyTestResult`")))),
1045 }
1046 } else {
1047 let content = resp.text().await?;
1048 let entity: Option<CoreApplicationsCheckAccessRetrieveError> = serde_json::from_str(&content).ok();
1049 Err(Error::ResponseError(ResponseContent {
1050 status,
1051 content,
1052 entity,
1053 }))
1054 }
1055}
1056
1057pub async fn core_applications_create(
1059 configuration: &configuration::Configuration,
1060 application_request: models::ApplicationRequest,
1061) -> Result<models::Application, Error<CoreApplicationsCreateError>> {
1062 let p_body_application_request = application_request;
1064
1065 let uri_str = format!("{}/core/applications/", configuration.base_path);
1066 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1067
1068 if let Some(ref user_agent) = configuration.user_agent {
1069 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1070 }
1071 if let Some(ref token) = configuration.bearer_access_token {
1072 req_builder = req_builder.bearer_auth(token.to_owned());
1073 };
1074 req_builder = req_builder.json(&p_body_application_request);
1075
1076 let req = req_builder.build()?;
1077 let resp = configuration.client.execute(req).await?;
1078
1079 let status = resp.status();
1080 let content_type = resp
1081 .headers()
1082 .get("content-type")
1083 .and_then(|v| v.to_str().ok())
1084 .unwrap_or("application/octet-stream");
1085 let content_type = super::ContentType::from(content_type);
1086
1087 if !status.is_client_error() && !status.is_server_error() {
1088 let content = resp.text().await?;
1089 match content_type {
1090 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1091 ContentType::Text => {
1092 return Err(Error::from(serde_json::Error::custom(
1093 "Received `text/plain` content type response that cannot be converted to `models::Application`",
1094 )))
1095 }
1096 ContentType::Unsupported(unknown_type) => {
1097 return Err(Error::from(serde_json::Error::custom(format!(
1098 "Received `{unknown_type}` content type response that cannot be converted to `models::Application`"
1099 ))))
1100 }
1101 }
1102 } else {
1103 let content = resp.text().await?;
1104 let entity: Option<CoreApplicationsCreateError> = serde_json::from_str(&content).ok();
1105 Err(Error::ResponseError(ResponseContent {
1106 status,
1107 content,
1108 entity,
1109 }))
1110 }
1111}
1112
1113pub async fn core_applications_destroy(
1115 configuration: &configuration::Configuration,
1116 slug: &str,
1117) -> Result<(), Error<CoreApplicationsDestroyError>> {
1118 let p_path_slug = slug;
1120
1121 let uri_str = format!(
1122 "{}/core/applications/{slug}/",
1123 configuration.base_path,
1124 slug = crate::apis::urlencode(p_path_slug)
1125 );
1126 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1127
1128 if let Some(ref user_agent) = configuration.user_agent {
1129 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1130 }
1131 if let Some(ref token) = configuration.bearer_access_token {
1132 req_builder = req_builder.bearer_auth(token.to_owned());
1133 };
1134
1135 let req = req_builder.build()?;
1136 let resp = configuration.client.execute(req).await?;
1137
1138 let status = resp.status();
1139
1140 if !status.is_client_error() && !status.is_server_error() {
1141 Ok(())
1142 } else {
1143 let content = resp.text().await?;
1144 let entity: Option<CoreApplicationsDestroyError> = serde_json::from_str(&content).ok();
1145 Err(Error::ResponseError(ResponseContent {
1146 status,
1147 content,
1148 entity,
1149 }))
1150 }
1151}
1152
1153pub async fn core_applications_list(
1155 configuration: &configuration::Configuration,
1156 for_user: Option<i32>,
1157 group: Option<&str>,
1158 meta_description: Option<&str>,
1159 meta_launch_url: Option<&str>,
1160 meta_publisher: Option<&str>,
1161 name: Option<&str>,
1162 only_with_launch_url: Option<bool>,
1163 ordering: Option<&str>,
1164 page: Option<i32>,
1165 page_size: Option<i32>,
1166 search: Option<&str>,
1167 slug: Option<&str>,
1168 superuser_full_list: Option<bool>,
1169) -> Result<models::PaginatedApplicationList, Error<CoreApplicationsListError>> {
1170 let p_query_for_user = for_user;
1172 let p_query_group = group;
1173 let p_query_meta_description = meta_description;
1174 let p_query_meta_launch_url = meta_launch_url;
1175 let p_query_meta_publisher = meta_publisher;
1176 let p_query_name = name;
1177 let p_query_only_with_launch_url = only_with_launch_url;
1178 let p_query_ordering = ordering;
1179 let p_query_page = page;
1180 let p_query_page_size = page_size;
1181 let p_query_search = search;
1182 let p_query_slug = slug;
1183 let p_query_superuser_full_list = superuser_full_list;
1184
1185 let uri_str = format!("{}/core/applications/", configuration.base_path);
1186 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1187
1188 if let Some(ref param_value) = p_query_for_user {
1189 req_builder = req_builder.query(&[("for_user", ¶m_value.to_string())]);
1190 }
1191 if let Some(ref param_value) = p_query_group {
1192 req_builder = req_builder.query(&[("group", ¶m_value.to_string())]);
1193 }
1194 if let Some(ref param_value) = p_query_meta_description {
1195 req_builder = req_builder.query(&[("meta_description", ¶m_value.to_string())]);
1196 }
1197 if let Some(ref param_value) = p_query_meta_launch_url {
1198 req_builder = req_builder.query(&[("meta_launch_url", ¶m_value.to_string())]);
1199 }
1200 if let Some(ref param_value) = p_query_meta_publisher {
1201 req_builder = req_builder.query(&[("meta_publisher", ¶m_value.to_string())]);
1202 }
1203 if let Some(ref param_value) = p_query_name {
1204 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1205 }
1206 if let Some(ref param_value) = p_query_only_with_launch_url {
1207 req_builder = req_builder.query(&[("only_with_launch_url", ¶m_value.to_string())]);
1208 }
1209 if let Some(ref param_value) = p_query_ordering {
1210 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1211 }
1212 if let Some(ref param_value) = p_query_page {
1213 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1214 }
1215 if let Some(ref param_value) = p_query_page_size {
1216 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1217 }
1218 if let Some(ref param_value) = p_query_search {
1219 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1220 }
1221 if let Some(ref param_value) = p_query_slug {
1222 req_builder = req_builder.query(&[("slug", ¶m_value.to_string())]);
1223 }
1224 if let Some(ref param_value) = p_query_superuser_full_list {
1225 req_builder = req_builder.query(&[("superuser_full_list", ¶m_value.to_string())]);
1226 }
1227 if let Some(ref user_agent) = configuration.user_agent {
1228 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1229 }
1230 if let Some(ref token) = configuration.bearer_access_token {
1231 req_builder = req_builder.bearer_auth(token.to_owned());
1232 };
1233
1234 let req = req_builder.build()?;
1235 let resp = configuration.client.execute(req).await?;
1236
1237 let status = resp.status();
1238 let content_type = resp
1239 .headers()
1240 .get("content-type")
1241 .and_then(|v| v.to_str().ok())
1242 .unwrap_or("application/octet-stream");
1243 let content_type = super::ContentType::from(content_type);
1244
1245 if !status.is_client_error() && !status.is_server_error() {
1246 let content = resp.text().await?;
1247 match content_type {
1248 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1249 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedApplicationList`"))),
1250 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::PaginatedApplicationList`")))),
1251 }
1252 } else {
1253 let content = resp.text().await?;
1254 let entity: Option<CoreApplicationsListError> = serde_json::from_str(&content).ok();
1255 Err(Error::ResponseError(ResponseContent {
1256 status,
1257 content,
1258 entity,
1259 }))
1260 }
1261}
1262
1263pub async fn core_applications_partial_update(
1265 configuration: &configuration::Configuration,
1266 slug: &str,
1267 patched_application_request: Option<models::PatchedApplicationRequest>,
1268) -> Result<models::Application, Error<CoreApplicationsPartialUpdateError>> {
1269 let p_path_slug = slug;
1271 let p_body_patched_application_request = patched_application_request;
1272
1273 let uri_str = format!(
1274 "{}/core/applications/{slug}/",
1275 configuration.base_path,
1276 slug = crate::apis::urlencode(p_path_slug)
1277 );
1278 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1279
1280 if let Some(ref user_agent) = configuration.user_agent {
1281 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1282 }
1283 if let Some(ref token) = configuration.bearer_access_token {
1284 req_builder = req_builder.bearer_auth(token.to_owned());
1285 };
1286 req_builder = req_builder.json(&p_body_patched_application_request);
1287
1288 let req = req_builder.build()?;
1289 let resp = configuration.client.execute(req).await?;
1290
1291 let status = resp.status();
1292 let content_type = resp
1293 .headers()
1294 .get("content-type")
1295 .and_then(|v| v.to_str().ok())
1296 .unwrap_or("application/octet-stream");
1297 let content_type = super::ContentType::from(content_type);
1298
1299 if !status.is_client_error() && !status.is_server_error() {
1300 let content = resp.text().await?;
1301 match content_type {
1302 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1303 ContentType::Text => {
1304 return Err(Error::from(serde_json::Error::custom(
1305 "Received `text/plain` content type response that cannot be converted to `models::Application`",
1306 )))
1307 }
1308 ContentType::Unsupported(unknown_type) => {
1309 return Err(Error::from(serde_json::Error::custom(format!(
1310 "Received `{unknown_type}` content type response that cannot be converted to `models::Application`"
1311 ))))
1312 }
1313 }
1314 } else {
1315 let content = resp.text().await?;
1316 let entity: Option<CoreApplicationsPartialUpdateError> = serde_json::from_str(&content).ok();
1317 Err(Error::ResponseError(ResponseContent {
1318 status,
1319 content,
1320 entity,
1321 }))
1322 }
1323}
1324
1325pub async fn core_applications_retrieve(
1327 configuration: &configuration::Configuration,
1328 slug: &str,
1329) -> Result<models::Application, Error<CoreApplicationsRetrieveError>> {
1330 let p_path_slug = slug;
1332
1333 let uri_str = format!(
1334 "{}/core/applications/{slug}/",
1335 configuration.base_path,
1336 slug = crate::apis::urlencode(p_path_slug)
1337 );
1338 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1339
1340 if let Some(ref user_agent) = configuration.user_agent {
1341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1342 }
1343 if let Some(ref token) = configuration.bearer_access_token {
1344 req_builder = req_builder.bearer_auth(token.to_owned());
1345 };
1346
1347 let req = req_builder.build()?;
1348 let resp = configuration.client.execute(req).await?;
1349
1350 let status = resp.status();
1351 let content_type = resp
1352 .headers()
1353 .get("content-type")
1354 .and_then(|v| v.to_str().ok())
1355 .unwrap_or("application/octet-stream");
1356 let content_type = super::ContentType::from(content_type);
1357
1358 if !status.is_client_error() && !status.is_server_error() {
1359 let content = resp.text().await?;
1360 match content_type {
1361 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1362 ContentType::Text => {
1363 return Err(Error::from(serde_json::Error::custom(
1364 "Received `text/plain` content type response that cannot be converted to `models::Application`",
1365 )))
1366 }
1367 ContentType::Unsupported(unknown_type) => {
1368 return Err(Error::from(serde_json::Error::custom(format!(
1369 "Received `{unknown_type}` content type response that cannot be converted to `models::Application`"
1370 ))))
1371 }
1372 }
1373 } else {
1374 let content = resp.text().await?;
1375 let entity: Option<CoreApplicationsRetrieveError> = serde_json::from_str(&content).ok();
1376 Err(Error::ResponseError(ResponseContent {
1377 status,
1378 content,
1379 entity,
1380 }))
1381 }
1382}
1383
1384pub async fn core_applications_update(
1386 configuration: &configuration::Configuration,
1387 slug: &str,
1388 application_request: models::ApplicationRequest,
1389) -> Result<models::Application, Error<CoreApplicationsUpdateError>> {
1390 let p_path_slug = slug;
1392 let p_body_application_request = application_request;
1393
1394 let uri_str = format!(
1395 "{}/core/applications/{slug}/",
1396 configuration.base_path,
1397 slug = crate::apis::urlencode(p_path_slug)
1398 );
1399 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1400
1401 if let Some(ref user_agent) = configuration.user_agent {
1402 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1403 }
1404 if let Some(ref token) = configuration.bearer_access_token {
1405 req_builder = req_builder.bearer_auth(token.to_owned());
1406 };
1407 req_builder = req_builder.json(&p_body_application_request);
1408
1409 let req = req_builder.build()?;
1410 let resp = configuration.client.execute(req).await?;
1411
1412 let status = resp.status();
1413 let content_type = resp
1414 .headers()
1415 .get("content-type")
1416 .and_then(|v| v.to_str().ok())
1417 .unwrap_or("application/octet-stream");
1418 let content_type = super::ContentType::from(content_type);
1419
1420 if !status.is_client_error() && !status.is_server_error() {
1421 let content = resp.text().await?;
1422 match content_type {
1423 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1424 ContentType::Text => {
1425 return Err(Error::from(serde_json::Error::custom(
1426 "Received `text/plain` content type response that cannot be converted to `models::Application`",
1427 )))
1428 }
1429 ContentType::Unsupported(unknown_type) => {
1430 return Err(Error::from(serde_json::Error::custom(format!(
1431 "Received `{unknown_type}` content type response that cannot be converted to `models::Application`"
1432 ))))
1433 }
1434 }
1435 } else {
1436 let content = resp.text().await?;
1437 let entity: Option<CoreApplicationsUpdateError> = serde_json::from_str(&content).ok();
1438 Err(Error::ResponseError(ResponseContent {
1439 status,
1440 content,
1441 entity,
1442 }))
1443 }
1444}
1445
1446pub async fn core_applications_used_by_list(
1448 configuration: &configuration::Configuration,
1449 slug: &str,
1450) -> Result<Vec<models::UsedBy>, Error<CoreApplicationsUsedByListError>> {
1451 let p_path_slug = slug;
1453
1454 let uri_str = format!(
1455 "{}/core/applications/{slug}/used_by/",
1456 configuration.base_path,
1457 slug = crate::apis::urlencode(p_path_slug)
1458 );
1459 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1460
1461 if let Some(ref user_agent) = configuration.user_agent {
1462 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1463 }
1464 if let Some(ref token) = configuration.bearer_access_token {
1465 req_builder = req_builder.bearer_auth(token.to_owned());
1466 };
1467
1468 let req = req_builder.build()?;
1469 let resp = configuration.client.execute(req).await?;
1470
1471 let status = resp.status();
1472 let content_type = resp
1473 .headers()
1474 .get("content-type")
1475 .and_then(|v| v.to_str().ok())
1476 .unwrap_or("application/octet-stream");
1477 let content_type = super::ContentType::from(content_type);
1478
1479 if !status.is_client_error() && !status.is_server_error() {
1480 let content = resp.text().await?;
1481 match content_type {
1482 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1483 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1484 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::UsedBy>`")))),
1485 }
1486 } else {
1487 let content = resp.text().await?;
1488 let entity: Option<CoreApplicationsUsedByListError> = serde_json::from_str(&content).ok();
1489 Err(Error::ResponseError(ResponseContent {
1490 status,
1491 content,
1492 entity,
1493 }))
1494 }
1495}
1496
1497pub async fn core_authenticated_sessions_bulk_delete_destroy(
1499 configuration: &configuration::Configuration,
1500 user_pks: Vec<i32>,
1501) -> Result<models::BulkDeleteSessionResponse, Error<CoreAuthenticatedSessionsBulkDeleteDestroyError>> {
1502 let p_query_user_pks = user_pks;
1504
1505 let uri_str = format!("{}/core/authenticated_sessions/bulk_delete/", configuration.base_path);
1506 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1507
1508 req_builder = match "multi" {
1509 "multi" => req_builder.query(
1510 &p_query_user_pks
1511 .into_iter()
1512 .map(|p| ("user_pks".to_owned(), p.to_string()))
1513 .collect::<Vec<(std::string::String, std::string::String)>>(),
1514 ),
1515 _ => req_builder.query(&[(
1516 "user_pks",
1517 &p_query_user_pks
1518 .into_iter()
1519 .map(|p| p.to_string())
1520 .collect::<Vec<String>>()
1521 .join(",")
1522 .to_string(),
1523 )]),
1524 };
1525 if let Some(ref user_agent) = configuration.user_agent {
1526 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1527 }
1528 if let Some(ref token) = configuration.bearer_access_token {
1529 req_builder = req_builder.bearer_auth(token.to_owned());
1530 };
1531
1532 let req = req_builder.build()?;
1533 let resp = configuration.client.execute(req).await?;
1534
1535 let status = resp.status();
1536 let content_type = resp
1537 .headers()
1538 .get("content-type")
1539 .and_then(|v| v.to_str().ok())
1540 .unwrap_or("application/octet-stream");
1541 let content_type = super::ContentType::from(content_type);
1542
1543 if !status.is_client_error() && !status.is_server_error() {
1544 let content = resp.text().await?;
1545 match content_type {
1546 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1547 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BulkDeleteSessionResponse`"))),
1548 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::BulkDeleteSessionResponse`")))),
1549 }
1550 } else {
1551 let content = resp.text().await?;
1552 let entity: Option<CoreAuthenticatedSessionsBulkDeleteDestroyError> = serde_json::from_str(&content).ok();
1553 Err(Error::ResponseError(ResponseContent {
1554 status,
1555 content,
1556 entity,
1557 }))
1558 }
1559}
1560
1561pub async fn core_authenticated_sessions_destroy(
1563 configuration: &configuration::Configuration,
1564 uuid: &str,
1565) -> Result<(), Error<CoreAuthenticatedSessionsDestroyError>> {
1566 let p_path_uuid = uuid;
1568
1569 let uri_str = format!(
1570 "{}/core/authenticated_sessions/{uuid}/",
1571 configuration.base_path,
1572 uuid = crate::apis::urlencode(p_path_uuid)
1573 );
1574 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1575
1576 if let Some(ref user_agent) = configuration.user_agent {
1577 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1578 }
1579 if let Some(ref token) = configuration.bearer_access_token {
1580 req_builder = req_builder.bearer_auth(token.to_owned());
1581 };
1582
1583 let req = req_builder.build()?;
1584 let resp = configuration.client.execute(req).await?;
1585
1586 let status = resp.status();
1587
1588 if !status.is_client_error() && !status.is_server_error() {
1589 Ok(())
1590 } else {
1591 let content = resp.text().await?;
1592 let entity: Option<CoreAuthenticatedSessionsDestroyError> = serde_json::from_str(&content).ok();
1593 Err(Error::ResponseError(ResponseContent {
1594 status,
1595 content,
1596 entity,
1597 }))
1598 }
1599}
1600
1601pub async fn core_authenticated_sessions_list(
1603 configuration: &configuration::Configuration,
1604 ordering: Option<&str>,
1605 page: Option<i32>,
1606 page_size: Option<i32>,
1607 search: Option<&str>,
1608 session__last_ip: Option<&str>,
1609 session__last_user_agent: Option<&str>,
1610 user__username: Option<&str>,
1611) -> Result<models::PaginatedAuthenticatedSessionList, Error<CoreAuthenticatedSessionsListError>> {
1612 let p_query_ordering = ordering;
1614 let p_query_page = page;
1615 let p_query_page_size = page_size;
1616 let p_query_search = search;
1617 let p_query_session__last_ip = session__last_ip;
1618 let p_query_session__last_user_agent = session__last_user_agent;
1619 let p_query_user__username = user__username;
1620
1621 let uri_str = format!("{}/core/authenticated_sessions/", configuration.base_path);
1622 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1623
1624 if let Some(ref param_value) = p_query_ordering {
1625 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1626 }
1627 if let Some(ref param_value) = p_query_page {
1628 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1629 }
1630 if let Some(ref param_value) = p_query_page_size {
1631 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1632 }
1633 if let Some(ref param_value) = p_query_search {
1634 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1635 }
1636 if let Some(ref param_value) = p_query_session__last_ip {
1637 req_builder = req_builder.query(&[("session__last_ip", ¶m_value.to_string())]);
1638 }
1639 if let Some(ref param_value) = p_query_session__last_user_agent {
1640 req_builder = req_builder.query(&[("session__last_user_agent", ¶m_value.to_string())]);
1641 }
1642 if let Some(ref param_value) = p_query_user__username {
1643 req_builder = req_builder.query(&[("user__username", ¶m_value.to_string())]);
1644 }
1645 if let Some(ref user_agent) = configuration.user_agent {
1646 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1647 }
1648 if let Some(ref token) = configuration.bearer_access_token {
1649 req_builder = req_builder.bearer_auth(token.to_owned());
1650 };
1651
1652 let req = req_builder.build()?;
1653 let resp = configuration.client.execute(req).await?;
1654
1655 let status = resp.status();
1656 let content_type = resp
1657 .headers()
1658 .get("content-type")
1659 .and_then(|v| v.to_str().ok())
1660 .unwrap_or("application/octet-stream");
1661 let content_type = super::ContentType::from(content_type);
1662
1663 if !status.is_client_error() && !status.is_server_error() {
1664 let content = resp.text().await?;
1665 match content_type {
1666 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1667 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedAuthenticatedSessionList`"))),
1668 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::PaginatedAuthenticatedSessionList`")))),
1669 }
1670 } else {
1671 let content = resp.text().await?;
1672 let entity: Option<CoreAuthenticatedSessionsListError> = serde_json::from_str(&content).ok();
1673 Err(Error::ResponseError(ResponseContent {
1674 status,
1675 content,
1676 entity,
1677 }))
1678 }
1679}
1680
1681pub async fn core_authenticated_sessions_retrieve(
1683 configuration: &configuration::Configuration,
1684 uuid: &str,
1685) -> Result<models::AuthenticatedSession, Error<CoreAuthenticatedSessionsRetrieveError>> {
1686 let p_path_uuid = uuid;
1688
1689 let uri_str = format!(
1690 "{}/core/authenticated_sessions/{uuid}/",
1691 configuration.base_path,
1692 uuid = crate::apis::urlencode(p_path_uuid)
1693 );
1694 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1695
1696 if let Some(ref user_agent) = configuration.user_agent {
1697 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1698 }
1699 if let Some(ref token) = configuration.bearer_access_token {
1700 req_builder = req_builder.bearer_auth(token.to_owned());
1701 };
1702
1703 let req = req_builder.build()?;
1704 let resp = configuration.client.execute(req).await?;
1705
1706 let status = resp.status();
1707 let content_type = resp
1708 .headers()
1709 .get("content-type")
1710 .and_then(|v| v.to_str().ok())
1711 .unwrap_or("application/octet-stream");
1712 let content_type = super::ContentType::from(content_type);
1713
1714 if !status.is_client_error() && !status.is_server_error() {
1715 let content = resp.text().await?;
1716 match content_type {
1717 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1718 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AuthenticatedSession`"))),
1719 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::AuthenticatedSession`")))),
1720 }
1721 } else {
1722 let content = resp.text().await?;
1723 let entity: Option<CoreAuthenticatedSessionsRetrieveError> = serde_json::from_str(&content).ok();
1724 Err(Error::ResponseError(ResponseContent {
1725 status,
1726 content,
1727 entity,
1728 }))
1729 }
1730}
1731
1732pub async fn core_authenticated_sessions_used_by_list(
1734 configuration: &configuration::Configuration,
1735 uuid: &str,
1736) -> Result<Vec<models::UsedBy>, Error<CoreAuthenticatedSessionsUsedByListError>> {
1737 let p_path_uuid = uuid;
1739
1740 let uri_str = format!(
1741 "{}/core/authenticated_sessions/{uuid}/used_by/",
1742 configuration.base_path,
1743 uuid = crate::apis::urlencode(p_path_uuid)
1744 );
1745 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1746
1747 if let Some(ref user_agent) = configuration.user_agent {
1748 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1749 }
1750 if let Some(ref token) = configuration.bearer_access_token {
1751 req_builder = req_builder.bearer_auth(token.to_owned());
1752 };
1753
1754 let req = req_builder.build()?;
1755 let resp = configuration.client.execute(req).await?;
1756
1757 let status = resp.status();
1758 let content_type = resp
1759 .headers()
1760 .get("content-type")
1761 .and_then(|v| v.to_str().ok())
1762 .unwrap_or("application/octet-stream");
1763 let content_type = super::ContentType::from(content_type);
1764
1765 if !status.is_client_error() && !status.is_server_error() {
1766 let content = resp.text().await?;
1767 match content_type {
1768 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1769 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1770 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::UsedBy>`")))),
1771 }
1772 } else {
1773 let content = resp.text().await?;
1774 let entity: Option<CoreAuthenticatedSessionsUsedByListError> = serde_json::from_str(&content).ok();
1775 Err(Error::ResponseError(ResponseContent {
1776 status,
1777 content,
1778 entity,
1779 }))
1780 }
1781}
1782
1783pub async fn core_brands_create(
1785 configuration: &configuration::Configuration,
1786 brand_request: models::BrandRequest,
1787) -> Result<models::Brand, Error<CoreBrandsCreateError>> {
1788 let p_body_brand_request = brand_request;
1790
1791 let uri_str = format!("{}/core/brands/", configuration.base_path);
1792 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1793
1794 if let Some(ref user_agent) = configuration.user_agent {
1795 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1796 }
1797 if let Some(ref token) = configuration.bearer_access_token {
1798 req_builder = req_builder.bearer_auth(token.to_owned());
1799 };
1800 req_builder = req_builder.json(&p_body_brand_request);
1801
1802 let req = req_builder.build()?;
1803 let resp = configuration.client.execute(req).await?;
1804
1805 let status = resp.status();
1806 let content_type = resp
1807 .headers()
1808 .get("content-type")
1809 .and_then(|v| v.to_str().ok())
1810 .unwrap_or("application/octet-stream");
1811 let content_type = super::ContentType::from(content_type);
1812
1813 if !status.is_client_error() && !status.is_server_error() {
1814 let content = resp.text().await?;
1815 match content_type {
1816 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1817 ContentType::Text => {
1818 return Err(Error::from(serde_json::Error::custom(
1819 "Received `text/plain` content type response that cannot be converted to `models::Brand`",
1820 )))
1821 }
1822 ContentType::Unsupported(unknown_type) => {
1823 return Err(Error::from(serde_json::Error::custom(format!(
1824 "Received `{unknown_type}` content type response that cannot be converted to `models::Brand`"
1825 ))))
1826 }
1827 }
1828 } else {
1829 let content = resp.text().await?;
1830 let entity: Option<CoreBrandsCreateError> = serde_json::from_str(&content).ok();
1831 Err(Error::ResponseError(ResponseContent {
1832 status,
1833 content,
1834 entity,
1835 }))
1836 }
1837}
1838
1839pub async fn core_brands_current_retrieve(
1841 configuration: &configuration::Configuration,
1842) -> Result<models::CurrentBrand, Error<CoreBrandsCurrentRetrieveError>> {
1843 let uri_str = format!("{}/core/brands/current/", configuration.base_path);
1844 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1845
1846 if let Some(ref user_agent) = configuration.user_agent {
1847 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1848 }
1849 if let Some(ref token) = configuration.bearer_access_token {
1850 req_builder = req_builder.bearer_auth(token.to_owned());
1851 };
1852
1853 let req = req_builder.build()?;
1854 let resp = configuration.client.execute(req).await?;
1855
1856 let status = resp.status();
1857 let content_type = resp
1858 .headers()
1859 .get("content-type")
1860 .and_then(|v| v.to_str().ok())
1861 .unwrap_or("application/octet-stream");
1862 let content_type = super::ContentType::from(content_type);
1863
1864 if !status.is_client_error() && !status.is_server_error() {
1865 let content = resp.text().await?;
1866 match content_type {
1867 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1868 ContentType::Text => {
1869 return Err(Error::from(serde_json::Error::custom(
1870 "Received `text/plain` content type response that cannot be converted to `models::CurrentBrand`",
1871 )))
1872 }
1873 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1874 "Received `{unknown_type}` content type response that cannot be converted to `models::CurrentBrand`"
1875 )))),
1876 }
1877 } else {
1878 let content = resp.text().await?;
1879 let entity: Option<CoreBrandsCurrentRetrieveError> = serde_json::from_str(&content).ok();
1880 Err(Error::ResponseError(ResponseContent {
1881 status,
1882 content,
1883 entity,
1884 }))
1885 }
1886}
1887
1888pub async fn core_brands_destroy(
1890 configuration: &configuration::Configuration,
1891 brand_uuid: &str,
1892) -> Result<(), Error<CoreBrandsDestroyError>> {
1893 let p_path_brand_uuid = brand_uuid;
1895
1896 let uri_str = format!(
1897 "{}/core/brands/{brand_uuid}/",
1898 configuration.base_path,
1899 brand_uuid = crate::apis::urlencode(p_path_brand_uuid)
1900 );
1901 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1902
1903 if let Some(ref user_agent) = configuration.user_agent {
1904 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1905 }
1906 if let Some(ref token) = configuration.bearer_access_token {
1907 req_builder = req_builder.bearer_auth(token.to_owned());
1908 };
1909
1910 let req = req_builder.build()?;
1911 let resp = configuration.client.execute(req).await?;
1912
1913 let status = resp.status();
1914
1915 if !status.is_client_error() && !status.is_server_error() {
1916 Ok(())
1917 } else {
1918 let content = resp.text().await?;
1919 let entity: Option<CoreBrandsDestroyError> = serde_json::from_str(&content).ok();
1920 Err(Error::ResponseError(ResponseContent {
1921 status,
1922 content,
1923 entity,
1924 }))
1925 }
1926}
1927
1928pub async fn core_brands_list(
1930 configuration: &configuration::Configuration,
1931 brand_uuid: Option<&str>,
1932 branding_default_flow_background: Option<&str>,
1933 branding_favicon: Option<&str>,
1934 branding_logo: Option<&str>,
1935 branding_title: Option<&str>,
1936 client_certificates: Option<Vec<uuid::Uuid>>,
1937 default: Option<bool>,
1938 domain: Option<&str>,
1939 flow_authentication: Option<&str>,
1940 flow_device_code: Option<&str>,
1941 flow_invalidation: Option<&str>,
1942 flow_recovery: Option<&str>,
1943 flow_unenrollment: Option<&str>,
1944 flow_user_settings: Option<&str>,
1945 ordering: Option<&str>,
1946 page: Option<i32>,
1947 page_size: Option<i32>,
1948 search: Option<&str>,
1949 web_certificate: Option<&str>,
1950) -> Result<models::PaginatedBrandList, Error<CoreBrandsListError>> {
1951 let p_query_brand_uuid = brand_uuid;
1953 let p_query_branding_default_flow_background = branding_default_flow_background;
1954 let p_query_branding_favicon = branding_favicon;
1955 let p_query_branding_logo = branding_logo;
1956 let p_query_branding_title = branding_title;
1957 let p_query_client_certificates = client_certificates;
1958 let p_query_default = default;
1959 let p_query_domain = domain;
1960 let p_query_flow_authentication = flow_authentication;
1961 let p_query_flow_device_code = flow_device_code;
1962 let p_query_flow_invalidation = flow_invalidation;
1963 let p_query_flow_recovery = flow_recovery;
1964 let p_query_flow_unenrollment = flow_unenrollment;
1965 let p_query_flow_user_settings = flow_user_settings;
1966 let p_query_ordering = ordering;
1967 let p_query_page = page;
1968 let p_query_page_size = page_size;
1969 let p_query_search = search;
1970 let p_query_web_certificate = web_certificate;
1971
1972 let uri_str = format!("{}/core/brands/", configuration.base_path);
1973 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1974
1975 if let Some(ref param_value) = p_query_brand_uuid {
1976 req_builder = req_builder.query(&[("brand_uuid", ¶m_value.to_string())]);
1977 }
1978 if let Some(ref param_value) = p_query_branding_default_flow_background {
1979 req_builder = req_builder.query(&[("branding_default_flow_background", ¶m_value.to_string())]);
1980 }
1981 if let Some(ref param_value) = p_query_branding_favicon {
1982 req_builder = req_builder.query(&[("branding_favicon", ¶m_value.to_string())]);
1983 }
1984 if let Some(ref param_value) = p_query_branding_logo {
1985 req_builder = req_builder.query(&[("branding_logo", ¶m_value.to_string())]);
1986 }
1987 if let Some(ref param_value) = p_query_branding_title {
1988 req_builder = req_builder.query(&[("branding_title", ¶m_value.to_string())]);
1989 }
1990 if let Some(ref param_value) = p_query_client_certificates {
1991 req_builder = match "multi" {
1992 "multi" => req_builder.query(
1993 ¶m_value
1994 .into_iter()
1995 .map(|p| ("client_certificates".to_owned(), p.to_string()))
1996 .collect::<Vec<(std::string::String, std::string::String)>>(),
1997 ),
1998 _ => req_builder.query(&[(
1999 "client_certificates",
2000 ¶m_value
2001 .into_iter()
2002 .map(|p| p.to_string())
2003 .collect::<Vec<String>>()
2004 .join(",")
2005 .to_string(),
2006 )]),
2007 };
2008 }
2009 if let Some(ref param_value) = p_query_default {
2010 req_builder = req_builder.query(&[("default", ¶m_value.to_string())]);
2011 }
2012 if let Some(ref param_value) = p_query_domain {
2013 req_builder = req_builder.query(&[("domain", ¶m_value.to_string())]);
2014 }
2015 if let Some(ref param_value) = p_query_flow_authentication {
2016 req_builder = req_builder.query(&[("flow_authentication", ¶m_value.to_string())]);
2017 }
2018 if let Some(ref param_value) = p_query_flow_device_code {
2019 req_builder = req_builder.query(&[("flow_device_code", ¶m_value.to_string())]);
2020 }
2021 if let Some(ref param_value) = p_query_flow_invalidation {
2022 req_builder = req_builder.query(&[("flow_invalidation", ¶m_value.to_string())]);
2023 }
2024 if let Some(ref param_value) = p_query_flow_recovery {
2025 req_builder = req_builder.query(&[("flow_recovery", ¶m_value.to_string())]);
2026 }
2027 if let Some(ref param_value) = p_query_flow_unenrollment {
2028 req_builder = req_builder.query(&[("flow_unenrollment", ¶m_value.to_string())]);
2029 }
2030 if let Some(ref param_value) = p_query_flow_user_settings {
2031 req_builder = req_builder.query(&[("flow_user_settings", ¶m_value.to_string())]);
2032 }
2033 if let Some(ref param_value) = p_query_ordering {
2034 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2035 }
2036 if let Some(ref param_value) = p_query_page {
2037 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2038 }
2039 if let Some(ref param_value) = p_query_page_size {
2040 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2041 }
2042 if let Some(ref param_value) = p_query_search {
2043 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2044 }
2045 if let Some(ref param_value) = p_query_web_certificate {
2046 req_builder = req_builder.query(&[("web_certificate", ¶m_value.to_string())]);
2047 }
2048 if let Some(ref user_agent) = configuration.user_agent {
2049 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2050 }
2051 if let Some(ref token) = configuration.bearer_access_token {
2052 req_builder = req_builder.bearer_auth(token.to_owned());
2053 };
2054
2055 let req = req_builder.build()?;
2056 let resp = configuration.client.execute(req).await?;
2057
2058 let status = resp.status();
2059 let content_type = resp
2060 .headers()
2061 .get("content-type")
2062 .and_then(|v| v.to_str().ok())
2063 .unwrap_or("application/octet-stream");
2064 let content_type = super::ContentType::from(content_type);
2065
2066 if !status.is_client_error() && !status.is_server_error() {
2067 let content = resp.text().await?;
2068 match content_type {
2069 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2070 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedBrandList`"))),
2071 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::PaginatedBrandList`")))),
2072 }
2073 } else {
2074 let content = resp.text().await?;
2075 let entity: Option<CoreBrandsListError> = serde_json::from_str(&content).ok();
2076 Err(Error::ResponseError(ResponseContent {
2077 status,
2078 content,
2079 entity,
2080 }))
2081 }
2082}
2083
2084pub async fn core_brands_partial_update(
2086 configuration: &configuration::Configuration,
2087 brand_uuid: &str,
2088 patched_brand_request: Option<models::PatchedBrandRequest>,
2089) -> Result<models::Brand, Error<CoreBrandsPartialUpdateError>> {
2090 let p_path_brand_uuid = brand_uuid;
2092 let p_body_patched_brand_request = patched_brand_request;
2093
2094 let uri_str = format!(
2095 "{}/core/brands/{brand_uuid}/",
2096 configuration.base_path,
2097 brand_uuid = crate::apis::urlencode(p_path_brand_uuid)
2098 );
2099 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2100
2101 if let Some(ref user_agent) = configuration.user_agent {
2102 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2103 }
2104 if let Some(ref token) = configuration.bearer_access_token {
2105 req_builder = req_builder.bearer_auth(token.to_owned());
2106 };
2107 req_builder = req_builder.json(&p_body_patched_brand_request);
2108
2109 let req = req_builder.build()?;
2110 let resp = configuration.client.execute(req).await?;
2111
2112 let status = resp.status();
2113 let content_type = resp
2114 .headers()
2115 .get("content-type")
2116 .and_then(|v| v.to_str().ok())
2117 .unwrap_or("application/octet-stream");
2118 let content_type = super::ContentType::from(content_type);
2119
2120 if !status.is_client_error() && !status.is_server_error() {
2121 let content = resp.text().await?;
2122 match content_type {
2123 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2124 ContentType::Text => {
2125 return Err(Error::from(serde_json::Error::custom(
2126 "Received `text/plain` content type response that cannot be converted to `models::Brand`",
2127 )))
2128 }
2129 ContentType::Unsupported(unknown_type) => {
2130 return Err(Error::from(serde_json::Error::custom(format!(
2131 "Received `{unknown_type}` content type response that cannot be converted to `models::Brand`"
2132 ))))
2133 }
2134 }
2135 } else {
2136 let content = resp.text().await?;
2137 let entity: Option<CoreBrandsPartialUpdateError> = serde_json::from_str(&content).ok();
2138 Err(Error::ResponseError(ResponseContent {
2139 status,
2140 content,
2141 entity,
2142 }))
2143 }
2144}
2145
2146pub async fn core_brands_retrieve(
2148 configuration: &configuration::Configuration,
2149 brand_uuid: &str,
2150) -> Result<models::Brand, Error<CoreBrandsRetrieveError>> {
2151 let p_path_brand_uuid = brand_uuid;
2153
2154 let uri_str = format!(
2155 "{}/core/brands/{brand_uuid}/",
2156 configuration.base_path,
2157 brand_uuid = crate::apis::urlencode(p_path_brand_uuid)
2158 );
2159 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2160
2161 if let Some(ref user_agent) = configuration.user_agent {
2162 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2163 }
2164 if let Some(ref token) = configuration.bearer_access_token {
2165 req_builder = req_builder.bearer_auth(token.to_owned());
2166 };
2167
2168 let req = req_builder.build()?;
2169 let resp = configuration.client.execute(req).await?;
2170
2171 let status = resp.status();
2172 let content_type = resp
2173 .headers()
2174 .get("content-type")
2175 .and_then(|v| v.to_str().ok())
2176 .unwrap_or("application/octet-stream");
2177 let content_type = super::ContentType::from(content_type);
2178
2179 if !status.is_client_error() && !status.is_server_error() {
2180 let content = resp.text().await?;
2181 match content_type {
2182 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2183 ContentType::Text => {
2184 return Err(Error::from(serde_json::Error::custom(
2185 "Received `text/plain` content type response that cannot be converted to `models::Brand`",
2186 )))
2187 }
2188 ContentType::Unsupported(unknown_type) => {
2189 return Err(Error::from(serde_json::Error::custom(format!(
2190 "Received `{unknown_type}` content type response that cannot be converted to `models::Brand`"
2191 ))))
2192 }
2193 }
2194 } else {
2195 let content = resp.text().await?;
2196 let entity: Option<CoreBrandsRetrieveError> = serde_json::from_str(&content).ok();
2197 Err(Error::ResponseError(ResponseContent {
2198 status,
2199 content,
2200 entity,
2201 }))
2202 }
2203}
2204
2205pub async fn core_brands_update(
2207 configuration: &configuration::Configuration,
2208 brand_uuid: &str,
2209 brand_request: models::BrandRequest,
2210) -> Result<models::Brand, Error<CoreBrandsUpdateError>> {
2211 let p_path_brand_uuid = brand_uuid;
2213 let p_body_brand_request = brand_request;
2214
2215 let uri_str = format!(
2216 "{}/core/brands/{brand_uuid}/",
2217 configuration.base_path,
2218 brand_uuid = crate::apis::urlencode(p_path_brand_uuid)
2219 );
2220 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2221
2222 if let Some(ref user_agent) = configuration.user_agent {
2223 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2224 }
2225 if let Some(ref token) = configuration.bearer_access_token {
2226 req_builder = req_builder.bearer_auth(token.to_owned());
2227 };
2228 req_builder = req_builder.json(&p_body_brand_request);
2229
2230 let req = req_builder.build()?;
2231 let resp = configuration.client.execute(req).await?;
2232
2233 let status = resp.status();
2234 let content_type = resp
2235 .headers()
2236 .get("content-type")
2237 .and_then(|v| v.to_str().ok())
2238 .unwrap_or("application/octet-stream");
2239 let content_type = super::ContentType::from(content_type);
2240
2241 if !status.is_client_error() && !status.is_server_error() {
2242 let content = resp.text().await?;
2243 match content_type {
2244 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2245 ContentType::Text => {
2246 return Err(Error::from(serde_json::Error::custom(
2247 "Received `text/plain` content type response that cannot be converted to `models::Brand`",
2248 )))
2249 }
2250 ContentType::Unsupported(unknown_type) => {
2251 return Err(Error::from(serde_json::Error::custom(format!(
2252 "Received `{unknown_type}` content type response that cannot be converted to `models::Brand`"
2253 ))))
2254 }
2255 }
2256 } else {
2257 let content = resp.text().await?;
2258 let entity: Option<CoreBrandsUpdateError> = serde_json::from_str(&content).ok();
2259 Err(Error::ResponseError(ResponseContent {
2260 status,
2261 content,
2262 entity,
2263 }))
2264 }
2265}
2266
2267pub async fn core_brands_used_by_list(
2269 configuration: &configuration::Configuration,
2270 brand_uuid: &str,
2271) -> Result<Vec<models::UsedBy>, Error<CoreBrandsUsedByListError>> {
2272 let p_path_brand_uuid = brand_uuid;
2274
2275 let uri_str = format!(
2276 "{}/core/brands/{brand_uuid}/used_by/",
2277 configuration.base_path,
2278 brand_uuid = crate::apis::urlencode(p_path_brand_uuid)
2279 );
2280 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2281
2282 if let Some(ref user_agent) = configuration.user_agent {
2283 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2284 }
2285 if let Some(ref token) = configuration.bearer_access_token {
2286 req_builder = req_builder.bearer_auth(token.to_owned());
2287 };
2288
2289 let req = req_builder.build()?;
2290 let resp = configuration.client.execute(req).await?;
2291
2292 let status = resp.status();
2293 let content_type = resp
2294 .headers()
2295 .get("content-type")
2296 .and_then(|v| v.to_str().ok())
2297 .unwrap_or("application/octet-stream");
2298 let content_type = super::ContentType::from(content_type);
2299
2300 if !status.is_client_error() && !status.is_server_error() {
2301 let content = resp.text().await?;
2302 match content_type {
2303 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2304 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2305 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::UsedBy>`")))),
2306 }
2307 } else {
2308 let content = resp.text().await?;
2309 let entity: Option<CoreBrandsUsedByListError> = serde_json::from_str(&content).ok();
2310 Err(Error::ResponseError(ResponseContent {
2311 status,
2312 content,
2313 entity,
2314 }))
2315 }
2316}
2317
2318pub async fn core_groups_add_user_create(
2320 configuration: &configuration::Configuration,
2321 group_uuid: &str,
2322 user_account_request: models::UserAccountRequest,
2323) -> Result<(), Error<CoreGroupsAddUserCreateError>> {
2324 let p_path_group_uuid = group_uuid;
2326 let p_body_user_account_request = user_account_request;
2327
2328 let uri_str = format!(
2329 "{}/core/groups/{group_uuid}/add_user/",
2330 configuration.base_path,
2331 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2332 );
2333 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2334
2335 if let Some(ref user_agent) = configuration.user_agent {
2336 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2337 }
2338 if let Some(ref token) = configuration.bearer_access_token {
2339 req_builder = req_builder.bearer_auth(token.to_owned());
2340 };
2341 req_builder = req_builder.json(&p_body_user_account_request);
2342
2343 let req = req_builder.build()?;
2344 let resp = configuration.client.execute(req).await?;
2345
2346 let status = resp.status();
2347
2348 if !status.is_client_error() && !status.is_server_error() {
2349 Ok(())
2350 } else {
2351 let content = resp.text().await?;
2352 let entity: Option<CoreGroupsAddUserCreateError> = serde_json::from_str(&content).ok();
2353 Err(Error::ResponseError(ResponseContent {
2354 status,
2355 content,
2356 entity,
2357 }))
2358 }
2359}
2360
2361pub async fn core_groups_create(
2363 configuration: &configuration::Configuration,
2364 group_request: models::GroupRequest,
2365) -> Result<models::Group, Error<CoreGroupsCreateError>> {
2366 let p_body_group_request = group_request;
2368
2369 let uri_str = format!("{}/core/groups/", configuration.base_path);
2370 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2371
2372 if let Some(ref user_agent) = configuration.user_agent {
2373 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2374 }
2375 if let Some(ref token) = configuration.bearer_access_token {
2376 req_builder = req_builder.bearer_auth(token.to_owned());
2377 };
2378 req_builder = req_builder.json(&p_body_group_request);
2379
2380 let req = req_builder.build()?;
2381 let resp = configuration.client.execute(req).await?;
2382
2383 let status = resp.status();
2384 let content_type = resp
2385 .headers()
2386 .get("content-type")
2387 .and_then(|v| v.to_str().ok())
2388 .unwrap_or("application/octet-stream");
2389 let content_type = super::ContentType::from(content_type);
2390
2391 if !status.is_client_error() && !status.is_server_error() {
2392 let content = resp.text().await?;
2393 match content_type {
2394 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2395 ContentType::Text => {
2396 return Err(Error::from(serde_json::Error::custom(
2397 "Received `text/plain` content type response that cannot be converted to `models::Group`",
2398 )))
2399 }
2400 ContentType::Unsupported(unknown_type) => {
2401 return Err(Error::from(serde_json::Error::custom(format!(
2402 "Received `{unknown_type}` content type response that cannot be converted to `models::Group`"
2403 ))))
2404 }
2405 }
2406 } else {
2407 let content = resp.text().await?;
2408 let entity: Option<CoreGroupsCreateError> = serde_json::from_str(&content).ok();
2409 Err(Error::ResponseError(ResponseContent {
2410 status,
2411 content,
2412 entity,
2413 }))
2414 }
2415}
2416
2417pub async fn core_groups_destroy(
2419 configuration: &configuration::Configuration,
2420 group_uuid: &str,
2421) -> Result<(), Error<CoreGroupsDestroyError>> {
2422 let p_path_group_uuid = group_uuid;
2424
2425 let uri_str = format!(
2426 "{}/core/groups/{group_uuid}/",
2427 configuration.base_path,
2428 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2429 );
2430 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2431
2432 if let Some(ref user_agent) = configuration.user_agent {
2433 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2434 }
2435 if let Some(ref token) = configuration.bearer_access_token {
2436 req_builder = req_builder.bearer_auth(token.to_owned());
2437 };
2438
2439 let req = req_builder.build()?;
2440 let resp = configuration.client.execute(req).await?;
2441
2442 let status = resp.status();
2443
2444 if !status.is_client_error() && !status.is_server_error() {
2445 Ok(())
2446 } else {
2447 let content = resp.text().await?;
2448 let entity: Option<CoreGroupsDestroyError> = serde_json::from_str(&content).ok();
2449 Err(Error::ResponseError(ResponseContent {
2450 status,
2451 content,
2452 entity,
2453 }))
2454 }
2455}
2456
2457pub async fn core_groups_list(
2459 configuration: &configuration::Configuration,
2460 attributes: Option<&str>,
2461 include_children: Option<bool>,
2462 include_inherited_roles: Option<bool>,
2463 include_parents: Option<bool>,
2464 include_users: Option<bool>,
2465 is_superuser: Option<bool>,
2466 members_by_pk: Option<Vec<i32>>,
2467 members_by_username: Option<Vec<String>>,
2468 name: Option<&str>,
2469 ordering: Option<&str>,
2470 page: Option<i32>,
2471 page_size: Option<i32>,
2472 search: Option<&str>,
2473) -> Result<models::PaginatedGroupList, Error<CoreGroupsListError>> {
2474 let p_query_attributes = attributes;
2476 let p_query_include_children = include_children;
2477 let p_query_include_inherited_roles = include_inherited_roles;
2478 let p_query_include_parents = include_parents;
2479 let p_query_include_users = include_users;
2480 let p_query_is_superuser = is_superuser;
2481 let p_query_members_by_pk = members_by_pk;
2482 let p_query_members_by_username = members_by_username;
2483 let p_query_name = name;
2484 let p_query_ordering = ordering;
2485 let p_query_page = page;
2486 let p_query_page_size = page_size;
2487 let p_query_search = search;
2488
2489 let uri_str = format!("{}/core/groups/", configuration.base_path);
2490 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2491
2492 if let Some(ref param_value) = p_query_attributes {
2493 req_builder = req_builder.query(&[("attributes", ¶m_value.to_string())]);
2494 }
2495 if let Some(ref param_value) = p_query_include_children {
2496 req_builder = req_builder.query(&[("include_children", ¶m_value.to_string())]);
2497 }
2498 if let Some(ref param_value) = p_query_include_inherited_roles {
2499 req_builder = req_builder.query(&[("include_inherited_roles", ¶m_value.to_string())]);
2500 }
2501 if let Some(ref param_value) = p_query_include_parents {
2502 req_builder = req_builder.query(&[("include_parents", ¶m_value.to_string())]);
2503 }
2504 if let Some(ref param_value) = p_query_include_users {
2505 req_builder = req_builder.query(&[("include_users", ¶m_value.to_string())]);
2506 }
2507 if let Some(ref param_value) = p_query_is_superuser {
2508 req_builder = req_builder.query(&[("is_superuser", ¶m_value.to_string())]);
2509 }
2510 if let Some(ref param_value) = p_query_members_by_pk {
2511 req_builder = match "multi" {
2512 "multi" => req_builder.query(
2513 ¶m_value
2514 .into_iter()
2515 .map(|p| ("members_by_pk".to_owned(), p.to_string()))
2516 .collect::<Vec<(std::string::String, std::string::String)>>(),
2517 ),
2518 _ => req_builder.query(&[(
2519 "members_by_pk",
2520 ¶m_value
2521 .into_iter()
2522 .map(|p| p.to_string())
2523 .collect::<Vec<String>>()
2524 .join(",")
2525 .to_string(),
2526 )]),
2527 };
2528 }
2529 if let Some(ref param_value) = p_query_members_by_username {
2530 req_builder = match "multi" {
2531 "multi" => req_builder.query(
2532 ¶m_value
2533 .into_iter()
2534 .map(|p| ("members_by_username".to_owned(), p.to_string()))
2535 .collect::<Vec<(std::string::String, std::string::String)>>(),
2536 ),
2537 _ => req_builder.query(&[(
2538 "members_by_username",
2539 ¶m_value
2540 .into_iter()
2541 .map(|p| p.to_string())
2542 .collect::<Vec<String>>()
2543 .join(",")
2544 .to_string(),
2545 )]),
2546 };
2547 }
2548 if let Some(ref param_value) = p_query_name {
2549 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2550 }
2551 if let Some(ref param_value) = p_query_ordering {
2552 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2553 }
2554 if let Some(ref param_value) = p_query_page {
2555 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2556 }
2557 if let Some(ref param_value) = p_query_page_size {
2558 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2559 }
2560 if let Some(ref param_value) = p_query_search {
2561 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2562 }
2563 if let Some(ref user_agent) = configuration.user_agent {
2564 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2565 }
2566 if let Some(ref token) = configuration.bearer_access_token {
2567 req_builder = req_builder.bearer_auth(token.to_owned());
2568 };
2569
2570 let req = req_builder.build()?;
2571 let resp = configuration.client.execute(req).await?;
2572
2573 let status = resp.status();
2574 let content_type = resp
2575 .headers()
2576 .get("content-type")
2577 .and_then(|v| v.to_str().ok())
2578 .unwrap_or("application/octet-stream");
2579 let content_type = super::ContentType::from(content_type);
2580
2581 if !status.is_client_error() && !status.is_server_error() {
2582 let content = resp.text().await?;
2583 match content_type {
2584 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2585 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedGroupList`"))),
2586 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::PaginatedGroupList`")))),
2587 }
2588 } else {
2589 let content = resp.text().await?;
2590 let entity: Option<CoreGroupsListError> = serde_json::from_str(&content).ok();
2591 Err(Error::ResponseError(ResponseContent {
2592 status,
2593 content,
2594 entity,
2595 }))
2596 }
2597}
2598
2599pub async fn core_groups_partial_update(
2601 configuration: &configuration::Configuration,
2602 group_uuid: &str,
2603 patched_group_request: Option<models::PatchedGroupRequest>,
2604) -> Result<models::Group, Error<CoreGroupsPartialUpdateError>> {
2605 let p_path_group_uuid = group_uuid;
2607 let p_body_patched_group_request = patched_group_request;
2608
2609 let uri_str = format!(
2610 "{}/core/groups/{group_uuid}/",
2611 configuration.base_path,
2612 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2613 );
2614 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2615
2616 if let Some(ref user_agent) = configuration.user_agent {
2617 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2618 }
2619 if let Some(ref token) = configuration.bearer_access_token {
2620 req_builder = req_builder.bearer_auth(token.to_owned());
2621 };
2622 req_builder = req_builder.json(&p_body_patched_group_request);
2623
2624 let req = req_builder.build()?;
2625 let resp = configuration.client.execute(req).await?;
2626
2627 let status = resp.status();
2628 let content_type = resp
2629 .headers()
2630 .get("content-type")
2631 .and_then(|v| v.to_str().ok())
2632 .unwrap_or("application/octet-stream");
2633 let content_type = super::ContentType::from(content_type);
2634
2635 if !status.is_client_error() && !status.is_server_error() {
2636 let content = resp.text().await?;
2637 match content_type {
2638 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2639 ContentType::Text => {
2640 return Err(Error::from(serde_json::Error::custom(
2641 "Received `text/plain` content type response that cannot be converted to `models::Group`",
2642 )))
2643 }
2644 ContentType::Unsupported(unknown_type) => {
2645 return Err(Error::from(serde_json::Error::custom(format!(
2646 "Received `{unknown_type}` content type response that cannot be converted to `models::Group`"
2647 ))))
2648 }
2649 }
2650 } else {
2651 let content = resp.text().await?;
2652 let entity: Option<CoreGroupsPartialUpdateError> = serde_json::from_str(&content).ok();
2653 Err(Error::ResponseError(ResponseContent {
2654 status,
2655 content,
2656 entity,
2657 }))
2658 }
2659}
2660
2661pub async fn core_groups_remove_user_create(
2663 configuration: &configuration::Configuration,
2664 group_uuid: &str,
2665 user_account_request: models::UserAccountRequest,
2666) -> Result<(), Error<CoreGroupsRemoveUserCreateError>> {
2667 let p_path_group_uuid = group_uuid;
2669 let p_body_user_account_request = user_account_request;
2670
2671 let uri_str = format!(
2672 "{}/core/groups/{group_uuid}/remove_user/",
2673 configuration.base_path,
2674 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2675 );
2676 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2677
2678 if let Some(ref user_agent) = configuration.user_agent {
2679 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2680 }
2681 if let Some(ref token) = configuration.bearer_access_token {
2682 req_builder = req_builder.bearer_auth(token.to_owned());
2683 };
2684 req_builder = req_builder.json(&p_body_user_account_request);
2685
2686 let req = req_builder.build()?;
2687 let resp = configuration.client.execute(req).await?;
2688
2689 let status = resp.status();
2690
2691 if !status.is_client_error() && !status.is_server_error() {
2692 Ok(())
2693 } else {
2694 let content = resp.text().await?;
2695 let entity: Option<CoreGroupsRemoveUserCreateError> = serde_json::from_str(&content).ok();
2696 Err(Error::ResponseError(ResponseContent {
2697 status,
2698 content,
2699 entity,
2700 }))
2701 }
2702}
2703
2704pub async fn core_groups_retrieve(
2706 configuration: &configuration::Configuration,
2707 group_uuid: &str,
2708 include_children: Option<bool>,
2709 include_inherited_roles: Option<bool>,
2710 include_parents: Option<bool>,
2711 include_users: Option<bool>,
2712) -> Result<models::Group, Error<CoreGroupsRetrieveError>> {
2713 let p_path_group_uuid = group_uuid;
2715 let p_query_include_children = include_children;
2716 let p_query_include_inherited_roles = include_inherited_roles;
2717 let p_query_include_parents = include_parents;
2718 let p_query_include_users = include_users;
2719
2720 let uri_str = format!(
2721 "{}/core/groups/{group_uuid}/",
2722 configuration.base_path,
2723 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2724 );
2725 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2726
2727 if let Some(ref param_value) = p_query_include_children {
2728 req_builder = req_builder.query(&[("include_children", ¶m_value.to_string())]);
2729 }
2730 if let Some(ref param_value) = p_query_include_inherited_roles {
2731 req_builder = req_builder.query(&[("include_inherited_roles", ¶m_value.to_string())]);
2732 }
2733 if let Some(ref param_value) = p_query_include_parents {
2734 req_builder = req_builder.query(&[("include_parents", ¶m_value.to_string())]);
2735 }
2736 if let Some(ref param_value) = p_query_include_users {
2737 req_builder = req_builder.query(&[("include_users", ¶m_value.to_string())]);
2738 }
2739 if let Some(ref user_agent) = configuration.user_agent {
2740 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2741 }
2742 if let Some(ref token) = configuration.bearer_access_token {
2743 req_builder = req_builder.bearer_auth(token.to_owned());
2744 };
2745
2746 let req = req_builder.build()?;
2747 let resp = configuration.client.execute(req).await?;
2748
2749 let status = resp.status();
2750 let content_type = resp
2751 .headers()
2752 .get("content-type")
2753 .and_then(|v| v.to_str().ok())
2754 .unwrap_or("application/octet-stream");
2755 let content_type = super::ContentType::from(content_type);
2756
2757 if !status.is_client_error() && !status.is_server_error() {
2758 let content = resp.text().await?;
2759 match content_type {
2760 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2761 ContentType::Text => {
2762 return Err(Error::from(serde_json::Error::custom(
2763 "Received `text/plain` content type response that cannot be converted to `models::Group`",
2764 )))
2765 }
2766 ContentType::Unsupported(unknown_type) => {
2767 return Err(Error::from(serde_json::Error::custom(format!(
2768 "Received `{unknown_type}` content type response that cannot be converted to `models::Group`"
2769 ))))
2770 }
2771 }
2772 } else {
2773 let content = resp.text().await?;
2774 let entity: Option<CoreGroupsRetrieveError> = serde_json::from_str(&content).ok();
2775 Err(Error::ResponseError(ResponseContent {
2776 status,
2777 content,
2778 entity,
2779 }))
2780 }
2781}
2782
2783pub async fn core_groups_update(
2785 configuration: &configuration::Configuration,
2786 group_uuid: &str,
2787 group_request: models::GroupRequest,
2788) -> Result<models::Group, Error<CoreGroupsUpdateError>> {
2789 let p_path_group_uuid = group_uuid;
2791 let p_body_group_request = group_request;
2792
2793 let uri_str = format!(
2794 "{}/core/groups/{group_uuid}/",
2795 configuration.base_path,
2796 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2797 );
2798 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2799
2800 if let Some(ref user_agent) = configuration.user_agent {
2801 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2802 }
2803 if let Some(ref token) = configuration.bearer_access_token {
2804 req_builder = req_builder.bearer_auth(token.to_owned());
2805 };
2806 req_builder = req_builder.json(&p_body_group_request);
2807
2808 let req = req_builder.build()?;
2809 let resp = configuration.client.execute(req).await?;
2810
2811 let status = resp.status();
2812 let content_type = resp
2813 .headers()
2814 .get("content-type")
2815 .and_then(|v| v.to_str().ok())
2816 .unwrap_or("application/octet-stream");
2817 let content_type = super::ContentType::from(content_type);
2818
2819 if !status.is_client_error() && !status.is_server_error() {
2820 let content = resp.text().await?;
2821 match content_type {
2822 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2823 ContentType::Text => {
2824 return Err(Error::from(serde_json::Error::custom(
2825 "Received `text/plain` content type response that cannot be converted to `models::Group`",
2826 )))
2827 }
2828 ContentType::Unsupported(unknown_type) => {
2829 return Err(Error::from(serde_json::Error::custom(format!(
2830 "Received `{unknown_type}` content type response that cannot be converted to `models::Group`"
2831 ))))
2832 }
2833 }
2834 } else {
2835 let content = resp.text().await?;
2836 let entity: Option<CoreGroupsUpdateError> = serde_json::from_str(&content).ok();
2837 Err(Error::ResponseError(ResponseContent {
2838 status,
2839 content,
2840 entity,
2841 }))
2842 }
2843}
2844
2845pub async fn core_groups_used_by_list(
2847 configuration: &configuration::Configuration,
2848 group_uuid: &str,
2849) -> Result<Vec<models::UsedBy>, Error<CoreGroupsUsedByListError>> {
2850 let p_path_group_uuid = group_uuid;
2852
2853 let uri_str = format!(
2854 "{}/core/groups/{group_uuid}/used_by/",
2855 configuration.base_path,
2856 group_uuid = crate::apis::urlencode(p_path_group_uuid)
2857 );
2858 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2859
2860 if let Some(ref user_agent) = configuration.user_agent {
2861 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2862 }
2863 if let Some(ref token) = configuration.bearer_access_token {
2864 req_builder = req_builder.bearer_auth(token.to_owned());
2865 };
2866
2867 let req = req_builder.build()?;
2868 let resp = configuration.client.execute(req).await?;
2869
2870 let status = resp.status();
2871 let content_type = resp
2872 .headers()
2873 .get("content-type")
2874 .and_then(|v| v.to_str().ok())
2875 .unwrap_or("application/octet-stream");
2876 let content_type = super::ContentType::from(content_type);
2877
2878 if !status.is_client_error() && !status.is_server_error() {
2879 let content = resp.text().await?;
2880 match content_type {
2881 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2882 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2883 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::UsedBy>`")))),
2884 }
2885 } else {
2886 let content = resp.text().await?;
2887 let entity: Option<CoreGroupsUsedByListError> = serde_json::from_str(&content).ok();
2888 Err(Error::ResponseError(ResponseContent {
2889 status,
2890 content,
2891 entity,
2892 }))
2893 }
2894}
2895
2896pub async fn core_tokens_create(
2898 configuration: &configuration::Configuration,
2899 token_request: models::TokenRequest,
2900) -> Result<models::Token, Error<CoreTokensCreateError>> {
2901 let p_body_token_request = token_request;
2903
2904 let uri_str = format!("{}/core/tokens/", configuration.base_path);
2905 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2906
2907 if let Some(ref user_agent) = configuration.user_agent {
2908 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2909 }
2910 if let Some(ref token) = configuration.bearer_access_token {
2911 req_builder = req_builder.bearer_auth(token.to_owned());
2912 };
2913 req_builder = req_builder.json(&p_body_token_request);
2914
2915 let req = req_builder.build()?;
2916 let resp = configuration.client.execute(req).await?;
2917
2918 let status = resp.status();
2919 let content_type = resp
2920 .headers()
2921 .get("content-type")
2922 .and_then(|v| v.to_str().ok())
2923 .unwrap_or("application/octet-stream");
2924 let content_type = super::ContentType::from(content_type);
2925
2926 if !status.is_client_error() && !status.is_server_error() {
2927 let content = resp.text().await?;
2928 match content_type {
2929 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2930 ContentType::Text => {
2931 return Err(Error::from(serde_json::Error::custom(
2932 "Received `text/plain` content type response that cannot be converted to `models::Token`",
2933 )))
2934 }
2935 ContentType::Unsupported(unknown_type) => {
2936 return Err(Error::from(serde_json::Error::custom(format!(
2937 "Received `{unknown_type}` content type response that cannot be converted to `models::Token`"
2938 ))))
2939 }
2940 }
2941 } else {
2942 let content = resp.text().await?;
2943 let entity: Option<CoreTokensCreateError> = serde_json::from_str(&content).ok();
2944 Err(Error::ResponseError(ResponseContent {
2945 status,
2946 content,
2947 entity,
2948 }))
2949 }
2950}
2951
2952pub async fn core_tokens_destroy(
2954 configuration: &configuration::Configuration,
2955 identifier: &str,
2956) -> Result<(), Error<CoreTokensDestroyError>> {
2957 let p_path_identifier = identifier;
2959
2960 let uri_str = format!(
2961 "{}/core/tokens/{identifier}/",
2962 configuration.base_path,
2963 identifier = crate::apis::urlencode(p_path_identifier)
2964 );
2965 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2966
2967 if let Some(ref user_agent) = configuration.user_agent {
2968 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2969 }
2970 if let Some(ref token) = configuration.bearer_access_token {
2971 req_builder = req_builder.bearer_auth(token.to_owned());
2972 };
2973
2974 let req = req_builder.build()?;
2975 let resp = configuration.client.execute(req).await?;
2976
2977 let status = resp.status();
2978
2979 if !status.is_client_error() && !status.is_server_error() {
2980 Ok(())
2981 } else {
2982 let content = resp.text().await?;
2983 let entity: Option<CoreTokensDestroyError> = serde_json::from_str(&content).ok();
2984 Err(Error::ResponseError(ResponseContent {
2985 status,
2986 content,
2987 entity,
2988 }))
2989 }
2990}
2991
2992pub async fn core_tokens_list(
2994 configuration: &configuration::Configuration,
2995 description: Option<&str>,
2996 expires: Option<String>,
2997 expiring: Option<bool>,
2998 identifier: Option<&str>,
2999 intent: Option<&str>,
3000 managed: Option<&str>,
3001 ordering: Option<&str>,
3002 page: Option<i32>,
3003 page_size: Option<i32>,
3004 search: Option<&str>,
3005 user__username: Option<&str>,
3006) -> Result<models::PaginatedTokenList, Error<CoreTokensListError>> {
3007 let p_query_description = description;
3009 let p_query_expires = expires;
3010 let p_query_expiring = expiring;
3011 let p_query_identifier = identifier;
3012 let p_query_intent = intent;
3013 let p_query_managed = managed;
3014 let p_query_ordering = ordering;
3015 let p_query_page = page;
3016 let p_query_page_size = page_size;
3017 let p_query_search = search;
3018 let p_query_user__username = user__username;
3019
3020 let uri_str = format!("{}/core/tokens/", configuration.base_path);
3021 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3022
3023 if let Some(ref param_value) = p_query_description {
3024 req_builder = req_builder.query(&[("description", ¶m_value.to_string())]);
3025 }
3026 if let Some(ref param_value) = p_query_expires {
3027 req_builder = req_builder.query(&[("expires", ¶m_value.to_string())]);
3028 }
3029 if let Some(ref param_value) = p_query_expiring {
3030 req_builder = req_builder.query(&[("expiring", ¶m_value.to_string())]);
3031 }
3032 if let Some(ref param_value) = p_query_identifier {
3033 req_builder = req_builder.query(&[("identifier", ¶m_value.to_string())]);
3034 }
3035 if let Some(ref param_value) = p_query_intent {
3036 req_builder = req_builder.query(&[("intent", ¶m_value.to_string())]);
3037 }
3038 if let Some(ref param_value) = p_query_managed {
3039 req_builder = req_builder.query(&[("managed", ¶m_value.to_string())]);
3040 }
3041 if let Some(ref param_value) = p_query_ordering {
3042 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
3043 }
3044 if let Some(ref param_value) = p_query_page {
3045 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3046 }
3047 if let Some(ref param_value) = p_query_page_size {
3048 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
3049 }
3050 if let Some(ref param_value) = p_query_search {
3051 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
3052 }
3053 if let Some(ref param_value) = p_query_user__username {
3054 req_builder = req_builder.query(&[("user__username", ¶m_value.to_string())]);
3055 }
3056 if let Some(ref user_agent) = configuration.user_agent {
3057 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3058 }
3059 if let Some(ref token) = configuration.bearer_access_token {
3060 req_builder = req_builder.bearer_auth(token.to_owned());
3061 };
3062
3063 let req = req_builder.build()?;
3064 let resp = configuration.client.execute(req).await?;
3065
3066 let status = resp.status();
3067 let content_type = resp
3068 .headers()
3069 .get("content-type")
3070 .and_then(|v| v.to_str().ok())
3071 .unwrap_or("application/octet-stream");
3072 let content_type = super::ContentType::from(content_type);
3073
3074 if !status.is_client_error() && !status.is_server_error() {
3075 let content = resp.text().await?;
3076 match content_type {
3077 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3078 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTokenList`"))),
3079 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::PaginatedTokenList`")))),
3080 }
3081 } else {
3082 let content = resp.text().await?;
3083 let entity: Option<CoreTokensListError> = serde_json::from_str(&content).ok();
3084 Err(Error::ResponseError(ResponseContent {
3085 status,
3086 content,
3087 entity,
3088 }))
3089 }
3090}
3091
3092pub async fn core_tokens_partial_update(
3094 configuration: &configuration::Configuration,
3095 identifier: &str,
3096 patched_token_request: Option<models::PatchedTokenRequest>,
3097) -> Result<models::Token, Error<CoreTokensPartialUpdateError>> {
3098 let p_path_identifier = identifier;
3100 let p_body_patched_token_request = patched_token_request;
3101
3102 let uri_str = format!(
3103 "{}/core/tokens/{identifier}/",
3104 configuration.base_path,
3105 identifier = crate::apis::urlencode(p_path_identifier)
3106 );
3107 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3108
3109 if let Some(ref user_agent) = configuration.user_agent {
3110 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3111 }
3112 if let Some(ref token) = configuration.bearer_access_token {
3113 req_builder = req_builder.bearer_auth(token.to_owned());
3114 };
3115 req_builder = req_builder.json(&p_body_patched_token_request);
3116
3117 let req = req_builder.build()?;
3118 let resp = configuration.client.execute(req).await?;
3119
3120 let status = resp.status();
3121 let content_type = resp
3122 .headers()
3123 .get("content-type")
3124 .and_then(|v| v.to_str().ok())
3125 .unwrap_or("application/octet-stream");
3126 let content_type = super::ContentType::from(content_type);
3127
3128 if !status.is_client_error() && !status.is_server_error() {
3129 let content = resp.text().await?;
3130 match content_type {
3131 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3132 ContentType::Text => {
3133 return Err(Error::from(serde_json::Error::custom(
3134 "Received `text/plain` content type response that cannot be converted to `models::Token`",
3135 )))
3136 }
3137 ContentType::Unsupported(unknown_type) => {
3138 return Err(Error::from(serde_json::Error::custom(format!(
3139 "Received `{unknown_type}` content type response that cannot be converted to `models::Token`"
3140 ))))
3141 }
3142 }
3143 } else {
3144 let content = resp.text().await?;
3145 let entity: Option<CoreTokensPartialUpdateError> = serde_json::from_str(&content).ok();
3146 Err(Error::ResponseError(ResponseContent {
3147 status,
3148 content,
3149 entity,
3150 }))
3151 }
3152}
3153
3154pub async fn core_tokens_retrieve(
3156 configuration: &configuration::Configuration,
3157 identifier: &str,
3158) -> Result<models::Token, Error<CoreTokensRetrieveError>> {
3159 let p_path_identifier = identifier;
3161
3162 let uri_str = format!(
3163 "{}/core/tokens/{identifier}/",
3164 configuration.base_path,
3165 identifier = crate::apis::urlencode(p_path_identifier)
3166 );
3167 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3168
3169 if let Some(ref user_agent) = configuration.user_agent {
3170 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3171 }
3172 if let Some(ref token) = configuration.bearer_access_token {
3173 req_builder = req_builder.bearer_auth(token.to_owned());
3174 };
3175
3176 let req = req_builder.build()?;
3177 let resp = configuration.client.execute(req).await?;
3178
3179 let status = resp.status();
3180 let content_type = resp
3181 .headers()
3182 .get("content-type")
3183 .and_then(|v| v.to_str().ok())
3184 .unwrap_or("application/octet-stream");
3185 let content_type = super::ContentType::from(content_type);
3186
3187 if !status.is_client_error() && !status.is_server_error() {
3188 let content = resp.text().await?;
3189 match content_type {
3190 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3191 ContentType::Text => {
3192 return Err(Error::from(serde_json::Error::custom(
3193 "Received `text/plain` content type response that cannot be converted to `models::Token`",
3194 )))
3195 }
3196 ContentType::Unsupported(unknown_type) => {
3197 return Err(Error::from(serde_json::Error::custom(format!(
3198 "Received `{unknown_type}` content type response that cannot be converted to `models::Token`"
3199 ))))
3200 }
3201 }
3202 } else {
3203 let content = resp.text().await?;
3204 let entity: Option<CoreTokensRetrieveError> = serde_json::from_str(&content).ok();
3205 Err(Error::ResponseError(ResponseContent {
3206 status,
3207 content,
3208 entity,
3209 }))
3210 }
3211}
3212
3213pub async fn core_tokens_set_key_create(
3215 configuration: &configuration::Configuration,
3216 identifier: &str,
3217 token_set_key_request: models::TokenSetKeyRequest,
3218) -> Result<(), Error<CoreTokensSetKeyCreateError>> {
3219 let p_path_identifier = identifier;
3221 let p_body_token_set_key_request = token_set_key_request;
3222
3223 let uri_str = format!(
3224 "{}/core/tokens/{identifier}/set_key/",
3225 configuration.base_path,
3226 identifier = crate::apis::urlencode(p_path_identifier)
3227 );
3228 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3229
3230 if let Some(ref user_agent) = configuration.user_agent {
3231 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3232 }
3233 if let Some(ref token) = configuration.bearer_access_token {
3234 req_builder = req_builder.bearer_auth(token.to_owned());
3235 };
3236 req_builder = req_builder.json(&p_body_token_set_key_request);
3237
3238 let req = req_builder.build()?;
3239 let resp = configuration.client.execute(req).await?;
3240
3241 let status = resp.status();
3242
3243 if !status.is_client_error() && !status.is_server_error() {
3244 Ok(())
3245 } else {
3246 let content = resp.text().await?;
3247 let entity: Option<CoreTokensSetKeyCreateError> = serde_json::from_str(&content).ok();
3248 Err(Error::ResponseError(ResponseContent {
3249 status,
3250 content,
3251 entity,
3252 }))
3253 }
3254}
3255
3256pub async fn core_tokens_update(
3258 configuration: &configuration::Configuration,
3259 identifier: &str,
3260 token_request: models::TokenRequest,
3261) -> Result<models::Token, Error<CoreTokensUpdateError>> {
3262 let p_path_identifier = identifier;
3264 let p_body_token_request = token_request;
3265
3266 let uri_str = format!(
3267 "{}/core/tokens/{identifier}/",
3268 configuration.base_path,
3269 identifier = crate::apis::urlencode(p_path_identifier)
3270 );
3271 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3272
3273 if let Some(ref user_agent) = configuration.user_agent {
3274 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3275 }
3276 if let Some(ref token) = configuration.bearer_access_token {
3277 req_builder = req_builder.bearer_auth(token.to_owned());
3278 };
3279 req_builder = req_builder.json(&p_body_token_request);
3280
3281 let req = req_builder.build()?;
3282 let resp = configuration.client.execute(req).await?;
3283
3284 let status = resp.status();
3285 let content_type = resp
3286 .headers()
3287 .get("content-type")
3288 .and_then(|v| v.to_str().ok())
3289 .unwrap_or("application/octet-stream");
3290 let content_type = super::ContentType::from(content_type);
3291
3292 if !status.is_client_error() && !status.is_server_error() {
3293 let content = resp.text().await?;
3294 match content_type {
3295 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3296 ContentType::Text => {
3297 return Err(Error::from(serde_json::Error::custom(
3298 "Received `text/plain` content type response that cannot be converted to `models::Token`",
3299 )))
3300 }
3301 ContentType::Unsupported(unknown_type) => {
3302 return Err(Error::from(serde_json::Error::custom(format!(
3303 "Received `{unknown_type}` content type response that cannot be converted to `models::Token`"
3304 ))))
3305 }
3306 }
3307 } else {
3308 let content = resp.text().await?;
3309 let entity: Option<CoreTokensUpdateError> = serde_json::from_str(&content).ok();
3310 Err(Error::ResponseError(ResponseContent {
3311 status,
3312 content,
3313 entity,
3314 }))
3315 }
3316}
3317
3318pub async fn core_tokens_used_by_list(
3320 configuration: &configuration::Configuration,
3321 identifier: &str,
3322) -> Result<Vec<models::UsedBy>, Error<CoreTokensUsedByListError>> {
3323 let p_path_identifier = identifier;
3325
3326 let uri_str = format!(
3327 "{}/core/tokens/{identifier}/used_by/",
3328 configuration.base_path,
3329 identifier = crate::apis::urlencode(p_path_identifier)
3330 );
3331 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3332
3333 if let Some(ref user_agent) = configuration.user_agent {
3334 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3335 }
3336 if let Some(ref token) = configuration.bearer_access_token {
3337 req_builder = req_builder.bearer_auth(token.to_owned());
3338 };
3339
3340 let req = req_builder.build()?;
3341 let resp = configuration.client.execute(req).await?;
3342
3343 let status = resp.status();
3344 let content_type = resp
3345 .headers()
3346 .get("content-type")
3347 .and_then(|v| v.to_str().ok())
3348 .unwrap_or("application/octet-stream");
3349 let content_type = super::ContentType::from(content_type);
3350
3351 if !status.is_client_error() && !status.is_server_error() {
3352 let content = resp.text().await?;
3353 match content_type {
3354 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3355 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3356 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::UsedBy>`")))),
3357 }
3358 } else {
3359 let content = resp.text().await?;
3360 let entity: Option<CoreTokensUsedByListError> = serde_json::from_str(&content).ok();
3361 Err(Error::ResponseError(ResponseContent {
3362 status,
3363 content,
3364 entity,
3365 }))
3366 }
3367}
3368
3369pub async fn core_tokens_view_key_retrieve(
3371 configuration: &configuration::Configuration,
3372 identifier: &str,
3373) -> Result<models::TokenView, Error<CoreTokensViewKeyRetrieveError>> {
3374 let p_path_identifier = identifier;
3376
3377 let uri_str = format!(
3378 "{}/core/tokens/{identifier}/view_key/",
3379 configuration.base_path,
3380 identifier = crate::apis::urlencode(p_path_identifier)
3381 );
3382 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3383
3384 if let Some(ref user_agent) = configuration.user_agent {
3385 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3386 }
3387 if let Some(ref token) = configuration.bearer_access_token {
3388 req_builder = req_builder.bearer_auth(token.to_owned());
3389 };
3390
3391 let req = req_builder.build()?;
3392 let resp = configuration.client.execute(req).await?;
3393
3394 let status = resp.status();
3395 let content_type = resp
3396 .headers()
3397 .get("content-type")
3398 .and_then(|v| v.to_str().ok())
3399 .unwrap_or("application/octet-stream");
3400 let content_type = super::ContentType::from(content_type);
3401
3402 if !status.is_client_error() && !status.is_server_error() {
3403 let content = resp.text().await?;
3404 match content_type {
3405 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3406 ContentType::Text => {
3407 return Err(Error::from(serde_json::Error::custom(
3408 "Received `text/plain` content type response that cannot be converted to `models::TokenView`",
3409 )))
3410 }
3411 ContentType::Unsupported(unknown_type) => {
3412 return Err(Error::from(serde_json::Error::custom(format!(
3413 "Received `{unknown_type}` content type response that cannot be converted to `models::TokenView`"
3414 ))))
3415 }
3416 }
3417 } else {
3418 let content = resp.text().await?;
3419 let entity: Option<CoreTokensViewKeyRetrieveError> = serde_json::from_str(&content).ok();
3420 Err(Error::ResponseError(ResponseContent {
3421 status,
3422 content,
3423 entity,
3424 }))
3425 }
3426}
3427
3428pub async fn core_transactional_applications_update(
3430 configuration: &configuration::Configuration,
3431 transaction_application_request: models::TransactionApplicationRequest,
3432) -> Result<models::TransactionApplicationResponse, Error<CoreTransactionalApplicationsUpdateError>> {
3433 let p_body_transaction_application_request = transaction_application_request;
3435
3436 let uri_str = format!("{}/core/transactional/applications/", configuration.base_path);
3437 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3438
3439 if let Some(ref user_agent) = configuration.user_agent {
3440 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3441 }
3442 if let Some(ref token) = configuration.bearer_access_token {
3443 req_builder = req_builder.bearer_auth(token.to_owned());
3444 };
3445 req_builder = req_builder.json(&p_body_transaction_application_request);
3446
3447 let req = req_builder.build()?;
3448 let resp = configuration.client.execute(req).await?;
3449
3450 let status = resp.status();
3451 let content_type = resp
3452 .headers()
3453 .get("content-type")
3454 .and_then(|v| v.to_str().ok())
3455 .unwrap_or("application/octet-stream");
3456 let content_type = super::ContentType::from(content_type);
3457
3458 if !status.is_client_error() && !status.is_server_error() {
3459 let content = resp.text().await?;
3460 match content_type {
3461 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3462 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TransactionApplicationResponse`"))),
3463 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::TransactionApplicationResponse`")))),
3464 }
3465 } else {
3466 let content = resp.text().await?;
3467 let entity: Option<CoreTransactionalApplicationsUpdateError> = serde_json::from_str(&content).ok();
3468 Err(Error::ResponseError(ResponseContent {
3469 status,
3470 content,
3471 entity,
3472 }))
3473 }
3474}
3475
3476pub async fn core_user_consent_destroy(
3478 configuration: &configuration::Configuration,
3479 id: i32,
3480) -> Result<(), Error<CoreUserConsentDestroyError>> {
3481 let p_path_id = id;
3483
3484 let uri_str = format!("{}/core/user_consent/{id}/", configuration.base_path, id = p_path_id);
3485 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3486
3487 if let Some(ref user_agent) = configuration.user_agent {
3488 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3489 }
3490 if let Some(ref token) = configuration.bearer_access_token {
3491 req_builder = req_builder.bearer_auth(token.to_owned());
3492 };
3493
3494 let req = req_builder.build()?;
3495 let resp = configuration.client.execute(req).await?;
3496
3497 let status = resp.status();
3498
3499 if !status.is_client_error() && !status.is_server_error() {
3500 Ok(())
3501 } else {
3502 let content = resp.text().await?;
3503 let entity: Option<CoreUserConsentDestroyError> = serde_json::from_str(&content).ok();
3504 Err(Error::ResponseError(ResponseContent {
3505 status,
3506 content,
3507 entity,
3508 }))
3509 }
3510}
3511
3512pub async fn core_user_consent_list(
3514 configuration: &configuration::Configuration,
3515 application: Option<&str>,
3516 ordering: Option<&str>,
3517 page: Option<i32>,
3518 page_size: Option<i32>,
3519 search: Option<&str>,
3520 user: Option<i32>,
3521) -> Result<models::PaginatedUserConsentList, Error<CoreUserConsentListError>> {
3522 let p_query_application = application;
3524 let p_query_ordering = ordering;
3525 let p_query_page = page;
3526 let p_query_page_size = page_size;
3527 let p_query_search = search;
3528 let p_query_user = user;
3529
3530 let uri_str = format!("{}/core/user_consent/", configuration.base_path);
3531 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3532
3533 if let Some(ref param_value) = p_query_application {
3534 req_builder = req_builder.query(&[("application", ¶m_value.to_string())]);
3535 }
3536 if let Some(ref param_value) = p_query_ordering {
3537 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
3538 }
3539 if let Some(ref param_value) = p_query_page {
3540 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3541 }
3542 if let Some(ref param_value) = p_query_page_size {
3543 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
3544 }
3545 if let Some(ref param_value) = p_query_search {
3546 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
3547 }
3548 if let Some(ref param_value) = p_query_user {
3549 req_builder = req_builder.query(&[("user", ¶m_value.to_string())]);
3550 }
3551 if let Some(ref user_agent) = configuration.user_agent {
3552 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3553 }
3554 if let Some(ref token) = configuration.bearer_access_token {
3555 req_builder = req_builder.bearer_auth(token.to_owned());
3556 };
3557
3558 let req = req_builder.build()?;
3559 let resp = configuration.client.execute(req).await?;
3560
3561 let status = resp.status();
3562 let content_type = resp
3563 .headers()
3564 .get("content-type")
3565 .and_then(|v| v.to_str().ok())
3566 .unwrap_or("application/octet-stream");
3567 let content_type = super::ContentType::from(content_type);
3568
3569 if !status.is_client_error() && !status.is_server_error() {
3570 let content = resp.text().await?;
3571 match content_type {
3572 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3573 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedUserConsentList`"))),
3574 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::PaginatedUserConsentList`")))),
3575 }
3576 } else {
3577 let content = resp.text().await?;
3578 let entity: Option<CoreUserConsentListError> = serde_json::from_str(&content).ok();
3579 Err(Error::ResponseError(ResponseContent {
3580 status,
3581 content,
3582 entity,
3583 }))
3584 }
3585}
3586
3587pub async fn core_user_consent_retrieve(
3589 configuration: &configuration::Configuration,
3590 id: i32,
3591) -> Result<models::UserConsent, Error<CoreUserConsentRetrieveError>> {
3592 let p_path_id = id;
3594
3595 let uri_str = format!("{}/core/user_consent/{id}/", configuration.base_path, id = p_path_id);
3596 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3597
3598 if let Some(ref user_agent) = configuration.user_agent {
3599 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3600 }
3601 if let Some(ref token) = configuration.bearer_access_token {
3602 req_builder = req_builder.bearer_auth(token.to_owned());
3603 };
3604
3605 let req = req_builder.build()?;
3606 let resp = configuration.client.execute(req).await?;
3607
3608 let status = resp.status();
3609 let content_type = resp
3610 .headers()
3611 .get("content-type")
3612 .and_then(|v| v.to_str().ok())
3613 .unwrap_or("application/octet-stream");
3614 let content_type = super::ContentType::from(content_type);
3615
3616 if !status.is_client_error() && !status.is_server_error() {
3617 let content = resp.text().await?;
3618 match content_type {
3619 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3620 ContentType::Text => {
3621 return Err(Error::from(serde_json::Error::custom(
3622 "Received `text/plain` content type response that cannot be converted to `models::UserConsent`",
3623 )))
3624 }
3625 ContentType::Unsupported(unknown_type) => {
3626 return Err(Error::from(serde_json::Error::custom(format!(
3627 "Received `{unknown_type}` content type response that cannot be converted to `models::UserConsent`"
3628 ))))
3629 }
3630 }
3631 } else {
3632 let content = resp.text().await?;
3633 let entity: Option<CoreUserConsentRetrieveError> = serde_json::from_str(&content).ok();
3634 Err(Error::ResponseError(ResponseContent {
3635 status,
3636 content,
3637 entity,
3638 }))
3639 }
3640}
3641
3642pub async fn core_user_consent_used_by_list(
3644 configuration: &configuration::Configuration,
3645 id: i32,
3646) -> Result<Vec<models::UsedBy>, Error<CoreUserConsentUsedByListError>> {
3647 let p_path_id = id;
3649
3650 let uri_str = format!(
3651 "{}/core/user_consent/{id}/used_by/",
3652 configuration.base_path,
3653 id = p_path_id
3654 );
3655 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3656
3657 if let Some(ref user_agent) = configuration.user_agent {
3658 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3659 }
3660 if let Some(ref token) = configuration.bearer_access_token {
3661 req_builder = req_builder.bearer_auth(token.to_owned());
3662 };
3663
3664 let req = req_builder.build()?;
3665 let resp = configuration.client.execute(req).await?;
3666
3667 let status = resp.status();
3668 let content_type = resp
3669 .headers()
3670 .get("content-type")
3671 .and_then(|v| v.to_str().ok())
3672 .unwrap_or("application/octet-stream");
3673 let content_type = super::ContentType::from(content_type);
3674
3675 if !status.is_client_error() && !status.is_server_error() {
3676 let content = resp.text().await?;
3677 match content_type {
3678 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3679 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3680 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::UsedBy>`")))),
3681 }
3682 } else {
3683 let content = resp.text().await?;
3684 let entity: Option<CoreUserConsentUsedByListError> = serde_json::from_str(&content).ok();
3685 Err(Error::ResponseError(ResponseContent {
3686 status,
3687 content,
3688 entity,
3689 }))
3690 }
3691}
3692
3693pub async fn core_users_create(
3695 configuration: &configuration::Configuration,
3696 user_request: models::UserRequest,
3697) -> Result<models::User, Error<CoreUsersCreateError>> {
3698 let p_body_user_request = user_request;
3700
3701 let uri_str = format!("{}/core/users/", configuration.base_path);
3702 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3703
3704 if let Some(ref user_agent) = configuration.user_agent {
3705 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3706 }
3707 if let Some(ref token) = configuration.bearer_access_token {
3708 req_builder = req_builder.bearer_auth(token.to_owned());
3709 };
3710 req_builder = req_builder.json(&p_body_user_request);
3711
3712 let req = req_builder.build()?;
3713 let resp = configuration.client.execute(req).await?;
3714
3715 let status = resp.status();
3716 let content_type = resp
3717 .headers()
3718 .get("content-type")
3719 .and_then(|v| v.to_str().ok())
3720 .unwrap_or("application/octet-stream");
3721 let content_type = super::ContentType::from(content_type);
3722
3723 if !status.is_client_error() && !status.is_server_error() {
3724 let content = resp.text().await?;
3725 match content_type {
3726 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3727 ContentType::Text => {
3728 return Err(Error::from(serde_json::Error::custom(
3729 "Received `text/plain` content type response that cannot be converted to `models::User`",
3730 )))
3731 }
3732 ContentType::Unsupported(unknown_type) => {
3733 return Err(Error::from(serde_json::Error::custom(format!(
3734 "Received `{unknown_type}` content type response that cannot be converted to `models::User`"
3735 ))))
3736 }
3737 }
3738 } else {
3739 let content = resp.text().await?;
3740 let entity: Option<CoreUsersCreateError> = serde_json::from_str(&content).ok();
3741 Err(Error::ResponseError(ResponseContent {
3742 status,
3743 content,
3744 entity,
3745 }))
3746 }
3747}
3748
3749pub async fn core_users_destroy(
3751 configuration: &configuration::Configuration,
3752 id: i32,
3753) -> Result<(), Error<CoreUsersDestroyError>> {
3754 let p_path_id = id;
3756
3757 let uri_str = format!("{}/core/users/{id}/", configuration.base_path, id = p_path_id);
3758 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3759
3760 if let Some(ref user_agent) = configuration.user_agent {
3761 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3762 }
3763 if let Some(ref token) = configuration.bearer_access_token {
3764 req_builder = req_builder.bearer_auth(token.to_owned());
3765 };
3766
3767 let req = req_builder.build()?;
3768 let resp = configuration.client.execute(req).await?;
3769
3770 let status = resp.status();
3771
3772 if !status.is_client_error() && !status.is_server_error() {
3773 Ok(())
3774 } else {
3775 let content = resp.text().await?;
3776 let entity: Option<CoreUsersDestroyError> = serde_json::from_str(&content).ok();
3777 Err(Error::ResponseError(ResponseContent {
3778 status,
3779 content,
3780 entity,
3781 }))
3782 }
3783}
3784
3785pub async fn core_users_export_create(
3787 configuration: &configuration::Configuration,
3788 attributes: Option<&str>,
3789 date_joined: Option<String>,
3790 date_joined__gt: Option<String>,
3791 date_joined__lt: Option<String>,
3792 email: Option<&str>,
3793 groups_by_name: Option<Vec<String>>,
3794 groups_by_pk: Option<Vec<uuid::Uuid>>,
3795 is_active: Option<bool>,
3796 is_superuser: Option<bool>,
3797 last_login: Option<String>,
3798 last_login__gt: Option<String>,
3799 last_login__isnull: Option<bool>,
3800 last_login__lt: Option<String>,
3801 last_updated: Option<String>,
3802 last_updated__gt: Option<String>,
3803 last_updated__lt: Option<String>,
3804 name: Option<&str>,
3805 ordering: Option<&str>,
3806 path: Option<&str>,
3807 path_startswith: Option<&str>,
3808 roles_by_name: Option<Vec<String>>,
3809 roles_by_pk: Option<Vec<uuid::Uuid>>,
3810 search: Option<&str>,
3811 r#type: Option<Vec<String>>,
3812 username: Option<&str>,
3813 uuid: Option<&str>,
3814) -> Result<models::DataExport, Error<CoreUsersExportCreateError>> {
3815 let p_query_attributes = attributes;
3817 let p_query_date_joined = date_joined;
3818 let p_query_date_joined__gt = date_joined__gt;
3819 let p_query_date_joined__lt = date_joined__lt;
3820 let p_query_email = email;
3821 let p_query_groups_by_name = groups_by_name;
3822 let p_query_groups_by_pk = groups_by_pk;
3823 let p_query_is_active = is_active;
3824 let p_query_is_superuser = is_superuser;
3825 let p_query_last_login = last_login;
3826 let p_query_last_login__gt = last_login__gt;
3827 let p_query_last_login__isnull = last_login__isnull;
3828 let p_query_last_login__lt = last_login__lt;
3829 let p_query_last_updated = last_updated;
3830 let p_query_last_updated__gt = last_updated__gt;
3831 let p_query_last_updated__lt = last_updated__lt;
3832 let p_query_name = name;
3833 let p_query_ordering = ordering;
3834 let p_query_path = path;
3835 let p_query_path_startswith = path_startswith;
3836 let p_query_roles_by_name = roles_by_name;
3837 let p_query_roles_by_pk = roles_by_pk;
3838 let p_query_search = search;
3839 let p_query_type = r#type;
3840 let p_query_username = username;
3841 let p_query_uuid = uuid;
3842
3843 let uri_str = format!("{}/core/users/export/", configuration.base_path);
3844 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3845
3846 if let Some(ref param_value) = p_query_attributes {
3847 req_builder = req_builder.query(&[("attributes", ¶m_value.to_string())]);
3848 }
3849 if let Some(ref param_value) = p_query_date_joined {
3850 req_builder = req_builder.query(&[("date_joined", ¶m_value.to_string())]);
3851 }
3852 if let Some(ref param_value) = p_query_date_joined__gt {
3853 req_builder = req_builder.query(&[("date_joined__gt", ¶m_value.to_string())]);
3854 }
3855 if let Some(ref param_value) = p_query_date_joined__lt {
3856 req_builder = req_builder.query(&[("date_joined__lt", ¶m_value.to_string())]);
3857 }
3858 if let Some(ref param_value) = p_query_email {
3859 req_builder = req_builder.query(&[("email", ¶m_value.to_string())]);
3860 }
3861 if let Some(ref param_value) = p_query_groups_by_name {
3862 req_builder = match "multi" {
3863 "multi" => req_builder.query(
3864 ¶m_value
3865 .into_iter()
3866 .map(|p| ("groups_by_name".to_owned(), p.to_string()))
3867 .collect::<Vec<(std::string::String, std::string::String)>>(),
3868 ),
3869 _ => req_builder.query(&[(
3870 "groups_by_name",
3871 ¶m_value
3872 .into_iter()
3873 .map(|p| p.to_string())
3874 .collect::<Vec<String>>()
3875 .join(",")
3876 .to_string(),
3877 )]),
3878 };
3879 }
3880 if let Some(ref param_value) = p_query_groups_by_pk {
3881 req_builder = match "multi" {
3882 "multi" => req_builder.query(
3883 ¶m_value
3884 .into_iter()
3885 .map(|p| ("groups_by_pk".to_owned(), p.to_string()))
3886 .collect::<Vec<(std::string::String, std::string::String)>>(),
3887 ),
3888 _ => req_builder.query(&[(
3889 "groups_by_pk",
3890 ¶m_value
3891 .into_iter()
3892 .map(|p| p.to_string())
3893 .collect::<Vec<String>>()
3894 .join(",")
3895 .to_string(),
3896 )]),
3897 };
3898 }
3899 if let Some(ref param_value) = p_query_is_active {
3900 req_builder = req_builder.query(&[("is_active", ¶m_value.to_string())]);
3901 }
3902 if let Some(ref param_value) = p_query_is_superuser {
3903 req_builder = req_builder.query(&[("is_superuser", ¶m_value.to_string())]);
3904 }
3905 if let Some(ref param_value) = p_query_last_login {
3906 req_builder = req_builder.query(&[("last_login", ¶m_value.to_string())]);
3907 }
3908 if let Some(ref param_value) = p_query_last_login__gt {
3909 req_builder = req_builder.query(&[("last_login__gt", ¶m_value.to_string())]);
3910 }
3911 if let Some(ref param_value) = p_query_last_login__isnull {
3912 req_builder = req_builder.query(&[("last_login__isnull", ¶m_value.to_string())]);
3913 }
3914 if let Some(ref param_value) = p_query_last_login__lt {
3915 req_builder = req_builder.query(&[("last_login__lt", ¶m_value.to_string())]);
3916 }
3917 if let Some(ref param_value) = p_query_last_updated {
3918 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
3919 }
3920 if let Some(ref param_value) = p_query_last_updated__gt {
3921 req_builder = req_builder.query(&[("last_updated__gt", ¶m_value.to_string())]);
3922 }
3923 if let Some(ref param_value) = p_query_last_updated__lt {
3924 req_builder = req_builder.query(&[("last_updated__lt", ¶m_value.to_string())]);
3925 }
3926 if let Some(ref param_value) = p_query_name {
3927 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
3928 }
3929 if let Some(ref param_value) = p_query_ordering {
3930 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
3931 }
3932 if let Some(ref param_value) = p_query_path {
3933 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
3934 }
3935 if let Some(ref param_value) = p_query_path_startswith {
3936 req_builder = req_builder.query(&[("path_startswith", ¶m_value.to_string())]);
3937 }
3938 if let Some(ref param_value) = p_query_roles_by_name {
3939 req_builder = match "multi" {
3940 "multi" => req_builder.query(
3941 ¶m_value
3942 .into_iter()
3943 .map(|p| ("roles_by_name".to_owned(), p.to_string()))
3944 .collect::<Vec<(std::string::String, std::string::String)>>(),
3945 ),
3946 _ => req_builder.query(&[(
3947 "roles_by_name",
3948 ¶m_value
3949 .into_iter()
3950 .map(|p| p.to_string())
3951 .collect::<Vec<String>>()
3952 .join(",")
3953 .to_string(),
3954 )]),
3955 };
3956 }
3957 if let Some(ref param_value) = p_query_roles_by_pk {
3958 req_builder = match "multi" {
3959 "multi" => req_builder.query(
3960 ¶m_value
3961 .into_iter()
3962 .map(|p| ("roles_by_pk".to_owned(), p.to_string()))
3963 .collect::<Vec<(std::string::String, std::string::String)>>(),
3964 ),
3965 _ => req_builder.query(&[(
3966 "roles_by_pk",
3967 ¶m_value
3968 .into_iter()
3969 .map(|p| p.to_string())
3970 .collect::<Vec<String>>()
3971 .join(",")
3972 .to_string(),
3973 )]),
3974 };
3975 }
3976 if let Some(ref param_value) = p_query_search {
3977 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
3978 }
3979 if let Some(ref param_value) = p_query_type {
3980 req_builder = match "multi" {
3981 "multi" => req_builder.query(
3982 ¶m_value
3983 .into_iter()
3984 .map(|p| ("type".to_owned(), p.to_string()))
3985 .collect::<Vec<(std::string::String, std::string::String)>>(),
3986 ),
3987 _ => req_builder.query(&[(
3988 "type",
3989 ¶m_value
3990 .into_iter()
3991 .map(|p| p.to_string())
3992 .collect::<Vec<String>>()
3993 .join(",")
3994 .to_string(),
3995 )]),
3996 };
3997 }
3998 if let Some(ref param_value) = p_query_username {
3999 req_builder = req_builder.query(&[("username", ¶m_value.to_string())]);
4000 }
4001 if let Some(ref param_value) = p_query_uuid {
4002 req_builder = req_builder.query(&[("uuid", ¶m_value.to_string())]);
4003 }
4004 if let Some(ref user_agent) = configuration.user_agent {
4005 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4006 }
4007 if let Some(ref token) = configuration.bearer_access_token {
4008 req_builder = req_builder.bearer_auth(token.to_owned());
4009 };
4010
4011 let req = req_builder.build()?;
4012 let resp = configuration.client.execute(req).await?;
4013
4014 let status = resp.status();
4015 let content_type = resp
4016 .headers()
4017 .get("content-type")
4018 .and_then(|v| v.to_str().ok())
4019 .unwrap_or("application/octet-stream");
4020 let content_type = super::ContentType::from(content_type);
4021
4022 if !status.is_client_error() && !status.is_server_error() {
4023 let content = resp.text().await?;
4024 match content_type {
4025 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4026 ContentType::Text => {
4027 return Err(Error::from(serde_json::Error::custom(
4028 "Received `text/plain` content type response that cannot be converted to `models::DataExport`",
4029 )))
4030 }
4031 ContentType::Unsupported(unknown_type) => {
4032 return Err(Error::from(serde_json::Error::custom(format!(
4033 "Received `{unknown_type}` content type response that cannot be converted to `models::DataExport`"
4034 ))))
4035 }
4036 }
4037 } else {
4038 let content = resp.text().await?;
4039 let entity: Option<CoreUsersExportCreateError> = serde_json::from_str(&content).ok();
4040 Err(Error::ResponseError(ResponseContent {
4041 status,
4042 content,
4043 entity,
4044 }))
4045 }
4046}
4047
4048pub async fn core_users_impersonate_create(
4050 configuration: &configuration::Configuration,
4051 id: i32,
4052 impersonation_request: models::ImpersonationRequest,
4053) -> Result<(), Error<CoreUsersImpersonateCreateError>> {
4054 let p_path_id = id;
4056 let p_body_impersonation_request = impersonation_request;
4057
4058 let uri_str = format!(
4059 "{}/core/users/{id}/impersonate/",
4060 configuration.base_path,
4061 id = p_path_id
4062 );
4063 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4064
4065 if let Some(ref user_agent) = configuration.user_agent {
4066 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4067 }
4068 if let Some(ref token) = configuration.bearer_access_token {
4069 req_builder = req_builder.bearer_auth(token.to_owned());
4070 };
4071 req_builder = req_builder.json(&p_body_impersonation_request);
4072
4073 let req = req_builder.build()?;
4074 let resp = configuration.client.execute(req).await?;
4075
4076 let status = resp.status();
4077
4078 if !status.is_client_error() && !status.is_server_error() {
4079 Ok(())
4080 } else {
4081 let content = resp.text().await?;
4082 let entity: Option<CoreUsersImpersonateCreateError> = serde_json::from_str(&content).ok();
4083 Err(Error::ResponseError(ResponseContent {
4084 status,
4085 content,
4086 entity,
4087 }))
4088 }
4089}
4090
4091pub async fn core_users_impersonate_end_retrieve(
4093 configuration: &configuration::Configuration,
4094) -> Result<(), Error<CoreUsersImpersonateEndRetrieveError>> {
4095 let uri_str = format!("{}/core/users/impersonate_end/", configuration.base_path);
4096 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4097
4098 if let Some(ref user_agent) = configuration.user_agent {
4099 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4100 }
4101 if let Some(ref token) = configuration.bearer_access_token {
4102 req_builder = req_builder.bearer_auth(token.to_owned());
4103 };
4104
4105 let req = req_builder.build()?;
4106 let resp = configuration.client.execute(req).await?;
4107
4108 let status = resp.status();
4109
4110 if !status.is_client_error() && !status.is_server_error() {
4111 Ok(())
4112 } else {
4113 let content = resp.text().await?;
4114 let entity: Option<CoreUsersImpersonateEndRetrieveError> = serde_json::from_str(&content).ok();
4115 Err(Error::ResponseError(ResponseContent {
4116 status,
4117 content,
4118 entity,
4119 }))
4120 }
4121}
4122
4123pub async fn core_users_list(
4125 configuration: &configuration::Configuration,
4126 attributes: Option<&str>,
4127 date_joined: Option<String>,
4128 date_joined__gt: Option<String>,
4129 date_joined__lt: Option<String>,
4130 email: Option<&str>,
4131 groups_by_name: Option<Vec<String>>,
4132 groups_by_pk: Option<Vec<uuid::Uuid>>,
4133 include_groups: Option<bool>,
4134 include_roles: Option<bool>,
4135 is_active: Option<bool>,
4136 is_superuser: Option<bool>,
4137 last_login: Option<String>,
4138 last_login__gt: Option<String>,
4139 last_login__isnull: Option<bool>,
4140 last_login__lt: Option<String>,
4141 last_updated: Option<String>,
4142 last_updated__gt: Option<String>,
4143 last_updated__lt: Option<String>,
4144 name: Option<&str>,
4145 ordering: Option<&str>,
4146 page: Option<i32>,
4147 page_size: Option<i32>,
4148 path: Option<&str>,
4149 path_startswith: Option<&str>,
4150 roles_by_name: Option<Vec<String>>,
4151 roles_by_pk: Option<Vec<uuid::Uuid>>,
4152 search: Option<&str>,
4153 r#type: Option<Vec<String>>,
4154 username: Option<&str>,
4155 uuid: Option<&str>,
4156) -> Result<models::PaginatedUserList, Error<CoreUsersListError>> {
4157 let p_query_attributes = attributes;
4159 let p_query_date_joined = date_joined;
4160 let p_query_date_joined__gt = date_joined__gt;
4161 let p_query_date_joined__lt = date_joined__lt;
4162 let p_query_email = email;
4163 let p_query_groups_by_name = groups_by_name;
4164 let p_query_groups_by_pk = groups_by_pk;
4165 let p_query_include_groups = include_groups;
4166 let p_query_include_roles = include_roles;
4167 let p_query_is_active = is_active;
4168 let p_query_is_superuser = is_superuser;
4169 let p_query_last_login = last_login;
4170 let p_query_last_login__gt = last_login__gt;
4171 let p_query_last_login__isnull = last_login__isnull;
4172 let p_query_last_login__lt = last_login__lt;
4173 let p_query_last_updated = last_updated;
4174 let p_query_last_updated__gt = last_updated__gt;
4175 let p_query_last_updated__lt = last_updated__lt;
4176 let p_query_name = name;
4177 let p_query_ordering = ordering;
4178 let p_query_page = page;
4179 let p_query_page_size = page_size;
4180 let p_query_path = path;
4181 let p_query_path_startswith = path_startswith;
4182 let p_query_roles_by_name = roles_by_name;
4183 let p_query_roles_by_pk = roles_by_pk;
4184 let p_query_search = search;
4185 let p_query_type = r#type;
4186 let p_query_username = username;
4187 let p_query_uuid = uuid;
4188
4189 let uri_str = format!("{}/core/users/", configuration.base_path);
4190 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4191
4192 if let Some(ref param_value) = p_query_attributes {
4193 req_builder = req_builder.query(&[("attributes", ¶m_value.to_string())]);
4194 }
4195 if let Some(ref param_value) = p_query_date_joined {
4196 req_builder = req_builder.query(&[("date_joined", ¶m_value.to_string())]);
4197 }
4198 if let Some(ref param_value) = p_query_date_joined__gt {
4199 req_builder = req_builder.query(&[("date_joined__gt", ¶m_value.to_string())]);
4200 }
4201 if let Some(ref param_value) = p_query_date_joined__lt {
4202 req_builder = req_builder.query(&[("date_joined__lt", ¶m_value.to_string())]);
4203 }
4204 if let Some(ref param_value) = p_query_email {
4205 req_builder = req_builder.query(&[("email", ¶m_value.to_string())]);
4206 }
4207 if let Some(ref param_value) = p_query_groups_by_name {
4208 req_builder = match "multi" {
4209 "multi" => req_builder.query(
4210 ¶m_value
4211 .into_iter()
4212 .map(|p| ("groups_by_name".to_owned(), p.to_string()))
4213 .collect::<Vec<(std::string::String, std::string::String)>>(),
4214 ),
4215 _ => req_builder.query(&[(
4216 "groups_by_name",
4217 ¶m_value
4218 .into_iter()
4219 .map(|p| p.to_string())
4220 .collect::<Vec<String>>()
4221 .join(",")
4222 .to_string(),
4223 )]),
4224 };
4225 }
4226 if let Some(ref param_value) = p_query_groups_by_pk {
4227 req_builder = match "multi" {
4228 "multi" => req_builder.query(
4229 ¶m_value
4230 .into_iter()
4231 .map(|p| ("groups_by_pk".to_owned(), p.to_string()))
4232 .collect::<Vec<(std::string::String, std::string::String)>>(),
4233 ),
4234 _ => req_builder.query(&[(
4235 "groups_by_pk",
4236 ¶m_value
4237 .into_iter()
4238 .map(|p| p.to_string())
4239 .collect::<Vec<String>>()
4240 .join(",")
4241 .to_string(),
4242 )]),
4243 };
4244 }
4245 if let Some(ref param_value) = p_query_include_groups {
4246 req_builder = req_builder.query(&[("include_groups", ¶m_value.to_string())]);
4247 }
4248 if let Some(ref param_value) = p_query_include_roles {
4249 req_builder = req_builder.query(&[("include_roles", ¶m_value.to_string())]);
4250 }
4251 if let Some(ref param_value) = p_query_is_active {
4252 req_builder = req_builder.query(&[("is_active", ¶m_value.to_string())]);
4253 }
4254 if let Some(ref param_value) = p_query_is_superuser {
4255 req_builder = req_builder.query(&[("is_superuser", ¶m_value.to_string())]);
4256 }
4257 if let Some(ref param_value) = p_query_last_login {
4258 req_builder = req_builder.query(&[("last_login", ¶m_value.to_string())]);
4259 }
4260 if let Some(ref param_value) = p_query_last_login__gt {
4261 req_builder = req_builder.query(&[("last_login__gt", ¶m_value.to_string())]);
4262 }
4263 if let Some(ref param_value) = p_query_last_login__isnull {
4264 req_builder = req_builder.query(&[("last_login__isnull", ¶m_value.to_string())]);
4265 }
4266 if let Some(ref param_value) = p_query_last_login__lt {
4267 req_builder = req_builder.query(&[("last_login__lt", ¶m_value.to_string())]);
4268 }
4269 if let Some(ref param_value) = p_query_last_updated {
4270 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
4271 }
4272 if let Some(ref param_value) = p_query_last_updated__gt {
4273 req_builder = req_builder.query(&[("last_updated__gt", ¶m_value.to_string())]);
4274 }
4275 if let Some(ref param_value) = p_query_last_updated__lt {
4276 req_builder = req_builder.query(&[("last_updated__lt", ¶m_value.to_string())]);
4277 }
4278 if let Some(ref param_value) = p_query_name {
4279 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
4280 }
4281 if let Some(ref param_value) = p_query_ordering {
4282 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
4283 }
4284 if let Some(ref param_value) = p_query_page {
4285 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4286 }
4287 if let Some(ref param_value) = p_query_page_size {
4288 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
4289 }
4290 if let Some(ref param_value) = p_query_path {
4291 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
4292 }
4293 if let Some(ref param_value) = p_query_path_startswith {
4294 req_builder = req_builder.query(&[("path_startswith", ¶m_value.to_string())]);
4295 }
4296 if let Some(ref param_value) = p_query_roles_by_name {
4297 req_builder = match "multi" {
4298 "multi" => req_builder.query(
4299 ¶m_value
4300 .into_iter()
4301 .map(|p| ("roles_by_name".to_owned(), p.to_string()))
4302 .collect::<Vec<(std::string::String, std::string::String)>>(),
4303 ),
4304 _ => req_builder.query(&[(
4305 "roles_by_name",
4306 ¶m_value
4307 .into_iter()
4308 .map(|p| p.to_string())
4309 .collect::<Vec<String>>()
4310 .join(",")
4311 .to_string(),
4312 )]),
4313 };
4314 }
4315 if let Some(ref param_value) = p_query_roles_by_pk {
4316 req_builder = match "multi" {
4317 "multi" => req_builder.query(
4318 ¶m_value
4319 .into_iter()
4320 .map(|p| ("roles_by_pk".to_owned(), p.to_string()))
4321 .collect::<Vec<(std::string::String, std::string::String)>>(),
4322 ),
4323 _ => req_builder.query(&[(
4324 "roles_by_pk",
4325 ¶m_value
4326 .into_iter()
4327 .map(|p| p.to_string())
4328 .collect::<Vec<String>>()
4329 .join(",")
4330 .to_string(),
4331 )]),
4332 };
4333 }
4334 if let Some(ref param_value) = p_query_search {
4335 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
4336 }
4337 if let Some(ref param_value) = p_query_type {
4338 req_builder = match "multi" {
4339 "multi" => req_builder.query(
4340 ¶m_value
4341 .into_iter()
4342 .map(|p| ("type".to_owned(), p.to_string()))
4343 .collect::<Vec<(std::string::String, std::string::String)>>(),
4344 ),
4345 _ => req_builder.query(&[(
4346 "type",
4347 ¶m_value
4348 .into_iter()
4349 .map(|p| p.to_string())
4350 .collect::<Vec<String>>()
4351 .join(",")
4352 .to_string(),
4353 )]),
4354 };
4355 }
4356 if let Some(ref param_value) = p_query_username {
4357 req_builder = req_builder.query(&[("username", ¶m_value.to_string())]);
4358 }
4359 if let Some(ref param_value) = p_query_uuid {
4360 req_builder = req_builder.query(&[("uuid", ¶m_value.to_string())]);
4361 }
4362 if let Some(ref user_agent) = configuration.user_agent {
4363 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4364 }
4365 if let Some(ref token) = configuration.bearer_access_token {
4366 req_builder = req_builder.bearer_auth(token.to_owned());
4367 };
4368
4369 let req = req_builder.build()?;
4370 let resp = configuration.client.execute(req).await?;
4371
4372 let status = resp.status();
4373 let content_type = resp
4374 .headers()
4375 .get("content-type")
4376 .and_then(|v| v.to_str().ok())
4377 .unwrap_or("application/octet-stream");
4378 let content_type = super::ContentType::from(content_type);
4379
4380 if !status.is_client_error() && !status.is_server_error() {
4381 let content = resp.text().await?;
4382 match content_type {
4383 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4384 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedUserList`"))),
4385 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::PaginatedUserList`")))),
4386 }
4387 } else {
4388 let content = resp.text().await?;
4389 let entity: Option<CoreUsersListError> = serde_json::from_str(&content).ok();
4390 Err(Error::ResponseError(ResponseContent {
4391 status,
4392 content,
4393 entity,
4394 }))
4395 }
4396}
4397
4398pub async fn core_users_me_retrieve(
4400 configuration: &configuration::Configuration,
4401) -> Result<models::SessionUser, Error<CoreUsersMeRetrieveError>> {
4402 let uri_str = format!("{}/core/users/me/", configuration.base_path);
4403 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4404
4405 if let Some(ref user_agent) = configuration.user_agent {
4406 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4407 }
4408 if let Some(ref token) = configuration.bearer_access_token {
4409 req_builder = req_builder.bearer_auth(token.to_owned());
4410 };
4411
4412 let req = req_builder.build()?;
4413 let resp = configuration.client.execute(req).await?;
4414
4415 let status = resp.status();
4416 let content_type = resp
4417 .headers()
4418 .get("content-type")
4419 .and_then(|v| v.to_str().ok())
4420 .unwrap_or("application/octet-stream");
4421 let content_type = super::ContentType::from(content_type);
4422
4423 if !status.is_client_error() && !status.is_server_error() {
4424 let content = resp.text().await?;
4425 match content_type {
4426 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4427 ContentType::Text => {
4428 return Err(Error::from(serde_json::Error::custom(
4429 "Received `text/plain` content type response that cannot be converted to `models::SessionUser`",
4430 )))
4431 }
4432 ContentType::Unsupported(unknown_type) => {
4433 return Err(Error::from(serde_json::Error::custom(format!(
4434 "Received `{unknown_type}` content type response that cannot be converted to `models::SessionUser`"
4435 ))))
4436 }
4437 }
4438 } else {
4439 let content = resp.text().await?;
4440 let entity: Option<CoreUsersMeRetrieveError> = serde_json::from_str(&content).ok();
4441 Err(Error::ResponseError(ResponseContent {
4442 status,
4443 content,
4444 entity,
4445 }))
4446 }
4447}
4448
4449pub async fn core_users_partial_update(
4451 configuration: &configuration::Configuration,
4452 id: i32,
4453 patched_user_request: Option<models::PatchedUserRequest>,
4454) -> Result<models::User, Error<CoreUsersPartialUpdateError>> {
4455 let p_path_id = id;
4457 let p_body_patched_user_request = patched_user_request;
4458
4459 let uri_str = format!("{}/core/users/{id}/", configuration.base_path, id = p_path_id);
4460 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4461
4462 if let Some(ref user_agent) = configuration.user_agent {
4463 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4464 }
4465 if let Some(ref token) = configuration.bearer_access_token {
4466 req_builder = req_builder.bearer_auth(token.to_owned());
4467 };
4468 req_builder = req_builder.json(&p_body_patched_user_request);
4469
4470 let req = req_builder.build()?;
4471 let resp = configuration.client.execute(req).await?;
4472
4473 let status = resp.status();
4474 let content_type = resp
4475 .headers()
4476 .get("content-type")
4477 .and_then(|v| v.to_str().ok())
4478 .unwrap_or("application/octet-stream");
4479 let content_type = super::ContentType::from(content_type);
4480
4481 if !status.is_client_error() && !status.is_server_error() {
4482 let content = resp.text().await?;
4483 match content_type {
4484 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4485 ContentType::Text => {
4486 return Err(Error::from(serde_json::Error::custom(
4487 "Received `text/plain` content type response that cannot be converted to `models::User`",
4488 )))
4489 }
4490 ContentType::Unsupported(unknown_type) => {
4491 return Err(Error::from(serde_json::Error::custom(format!(
4492 "Received `{unknown_type}` content type response that cannot be converted to `models::User`"
4493 ))))
4494 }
4495 }
4496 } else {
4497 let content = resp.text().await?;
4498 let entity: Option<CoreUsersPartialUpdateError> = serde_json::from_str(&content).ok();
4499 Err(Error::ResponseError(ResponseContent {
4500 status,
4501 content,
4502 entity,
4503 }))
4504 }
4505}
4506
4507pub async fn core_users_paths_retrieve(
4509 configuration: &configuration::Configuration,
4510 search: Option<&str>,
4511) -> Result<models::UserPath, Error<CoreUsersPathsRetrieveError>> {
4512 let p_query_search = search;
4514
4515 let uri_str = format!("{}/core/users/paths/", configuration.base_path);
4516 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4517
4518 if let Some(ref param_value) = p_query_search {
4519 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
4520 }
4521 if let Some(ref user_agent) = configuration.user_agent {
4522 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4523 }
4524 if let Some(ref token) = configuration.bearer_access_token {
4525 req_builder = req_builder.bearer_auth(token.to_owned());
4526 };
4527
4528 let req = req_builder.build()?;
4529 let resp = configuration.client.execute(req).await?;
4530
4531 let status = resp.status();
4532 let content_type = resp
4533 .headers()
4534 .get("content-type")
4535 .and_then(|v| v.to_str().ok())
4536 .unwrap_or("application/octet-stream");
4537 let content_type = super::ContentType::from(content_type);
4538
4539 if !status.is_client_error() && !status.is_server_error() {
4540 let content = resp.text().await?;
4541 match content_type {
4542 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4543 ContentType::Text => {
4544 return Err(Error::from(serde_json::Error::custom(
4545 "Received `text/plain` content type response that cannot be converted to `models::UserPath`",
4546 )))
4547 }
4548 ContentType::Unsupported(unknown_type) => {
4549 return Err(Error::from(serde_json::Error::custom(format!(
4550 "Received `{unknown_type}` content type response that cannot be converted to `models::UserPath`"
4551 ))))
4552 }
4553 }
4554 } else {
4555 let content = resp.text().await?;
4556 let entity: Option<CoreUsersPathsRetrieveError> = serde_json::from_str(&content).ok();
4557 Err(Error::ResponseError(ResponseContent {
4558 status,
4559 content,
4560 entity,
4561 }))
4562 }
4563}
4564
4565pub async fn core_users_recovery_create(
4567 configuration: &configuration::Configuration,
4568 id: i32,
4569 user_recovery_link_request: Option<models::UserRecoveryLinkRequest>,
4570) -> Result<models::Link, Error<CoreUsersRecoveryCreateError>> {
4571 let p_path_id = id;
4573 let p_body_user_recovery_link_request = user_recovery_link_request;
4574
4575 let uri_str = format!("{}/core/users/{id}/recovery/", configuration.base_path, id = p_path_id);
4576 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4577
4578 if let Some(ref user_agent) = configuration.user_agent {
4579 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4580 }
4581 if let Some(ref token) = configuration.bearer_access_token {
4582 req_builder = req_builder.bearer_auth(token.to_owned());
4583 };
4584 req_builder = req_builder.json(&p_body_user_recovery_link_request);
4585
4586 let req = req_builder.build()?;
4587 let resp = configuration.client.execute(req).await?;
4588
4589 let status = resp.status();
4590 let content_type = resp
4591 .headers()
4592 .get("content-type")
4593 .and_then(|v| v.to_str().ok())
4594 .unwrap_or("application/octet-stream");
4595 let content_type = super::ContentType::from(content_type);
4596
4597 if !status.is_client_error() && !status.is_server_error() {
4598 let content = resp.text().await?;
4599 match content_type {
4600 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4601 ContentType::Text => {
4602 return Err(Error::from(serde_json::Error::custom(
4603 "Received `text/plain` content type response that cannot be converted to `models::Link`",
4604 )))
4605 }
4606 ContentType::Unsupported(unknown_type) => {
4607 return Err(Error::from(serde_json::Error::custom(format!(
4608 "Received `{unknown_type}` content type response that cannot be converted to `models::Link`"
4609 ))))
4610 }
4611 }
4612 } else {
4613 let content = resp.text().await?;
4614 let entity: Option<CoreUsersRecoveryCreateError> = serde_json::from_str(&content).ok();
4615 Err(Error::ResponseError(ResponseContent {
4616 status,
4617 content,
4618 entity,
4619 }))
4620 }
4621}
4622
4623pub async fn core_users_recovery_email_create(
4625 configuration: &configuration::Configuration,
4626 id: i32,
4627 user_recovery_email_request: models::UserRecoveryEmailRequest,
4628) -> Result<(), Error<CoreUsersRecoveryEmailCreateError>> {
4629 let p_path_id = id;
4631 let p_body_user_recovery_email_request = user_recovery_email_request;
4632
4633 let uri_str = format!(
4634 "{}/core/users/{id}/recovery_email/",
4635 configuration.base_path,
4636 id = p_path_id
4637 );
4638 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4639
4640 if let Some(ref user_agent) = configuration.user_agent {
4641 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4642 }
4643 if let Some(ref token) = configuration.bearer_access_token {
4644 req_builder = req_builder.bearer_auth(token.to_owned());
4645 };
4646 req_builder = req_builder.json(&p_body_user_recovery_email_request);
4647
4648 let req = req_builder.build()?;
4649 let resp = configuration.client.execute(req).await?;
4650
4651 let status = resp.status();
4652
4653 if !status.is_client_error() && !status.is_server_error() {
4654 Ok(())
4655 } else {
4656 let content = resp.text().await?;
4657 let entity: Option<CoreUsersRecoveryEmailCreateError> = serde_json::from_str(&content).ok();
4658 Err(Error::ResponseError(ResponseContent {
4659 status,
4660 content,
4661 entity,
4662 }))
4663 }
4664}
4665
4666pub async fn core_users_retrieve(
4668 configuration: &configuration::Configuration,
4669 id: i32,
4670) -> Result<models::User, Error<CoreUsersRetrieveError>> {
4671 let p_path_id = id;
4673
4674 let uri_str = format!("{}/core/users/{id}/", configuration.base_path, id = p_path_id);
4675 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4676
4677 if let Some(ref user_agent) = configuration.user_agent {
4678 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4679 }
4680 if let Some(ref token) = configuration.bearer_access_token {
4681 req_builder = req_builder.bearer_auth(token.to_owned());
4682 };
4683
4684 let req = req_builder.build()?;
4685 let resp = configuration.client.execute(req).await?;
4686
4687 let status = resp.status();
4688 let content_type = resp
4689 .headers()
4690 .get("content-type")
4691 .and_then(|v| v.to_str().ok())
4692 .unwrap_or("application/octet-stream");
4693 let content_type = super::ContentType::from(content_type);
4694
4695 if !status.is_client_error() && !status.is_server_error() {
4696 let content = resp.text().await?;
4697 match content_type {
4698 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4699 ContentType::Text => {
4700 return Err(Error::from(serde_json::Error::custom(
4701 "Received `text/plain` content type response that cannot be converted to `models::User`",
4702 )))
4703 }
4704 ContentType::Unsupported(unknown_type) => {
4705 return Err(Error::from(serde_json::Error::custom(format!(
4706 "Received `{unknown_type}` content type response that cannot be converted to `models::User`"
4707 ))))
4708 }
4709 }
4710 } else {
4711 let content = resp.text().await?;
4712 let entity: Option<CoreUsersRetrieveError> = serde_json::from_str(&content).ok();
4713 Err(Error::ResponseError(ResponseContent {
4714 status,
4715 content,
4716 entity,
4717 }))
4718 }
4719}
4720
4721pub async fn core_users_service_account_create(
4723 configuration: &configuration::Configuration,
4724 user_service_account_request: models::UserServiceAccountRequest,
4725) -> Result<models::UserServiceAccountResponse, Error<CoreUsersServiceAccountCreateError>> {
4726 let p_body_user_service_account_request = user_service_account_request;
4728
4729 let uri_str = format!("{}/core/users/service_account/", configuration.base_path);
4730 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4731
4732 if let Some(ref user_agent) = configuration.user_agent {
4733 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4734 }
4735 if let Some(ref token) = configuration.bearer_access_token {
4736 req_builder = req_builder.bearer_auth(token.to_owned());
4737 };
4738 req_builder = req_builder.json(&p_body_user_service_account_request);
4739
4740 let req = req_builder.build()?;
4741 let resp = configuration.client.execute(req).await?;
4742
4743 let status = resp.status();
4744 let content_type = resp
4745 .headers()
4746 .get("content-type")
4747 .and_then(|v| v.to_str().ok())
4748 .unwrap_or("application/octet-stream");
4749 let content_type = super::ContentType::from(content_type);
4750
4751 if !status.is_client_error() && !status.is_server_error() {
4752 let content = resp.text().await?;
4753 match content_type {
4754 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4755 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserServiceAccountResponse`"))),
4756 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::UserServiceAccountResponse`")))),
4757 }
4758 } else {
4759 let content = resp.text().await?;
4760 let entity: Option<CoreUsersServiceAccountCreateError> = serde_json::from_str(&content).ok();
4761 Err(Error::ResponseError(ResponseContent {
4762 status,
4763 content,
4764 entity,
4765 }))
4766 }
4767}
4768
4769pub async fn core_users_set_password_create(
4771 configuration: &configuration::Configuration,
4772 id: i32,
4773 user_password_set_request: models::UserPasswordSetRequest,
4774) -> Result<(), Error<CoreUsersSetPasswordCreateError>> {
4775 let p_path_id = id;
4777 let p_body_user_password_set_request = user_password_set_request;
4778
4779 let uri_str = format!(
4780 "{}/core/users/{id}/set_password/",
4781 configuration.base_path,
4782 id = p_path_id
4783 );
4784 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4785
4786 if let Some(ref user_agent) = configuration.user_agent {
4787 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4788 }
4789 if let Some(ref token) = configuration.bearer_access_token {
4790 req_builder = req_builder.bearer_auth(token.to_owned());
4791 };
4792 req_builder = req_builder.json(&p_body_user_password_set_request);
4793
4794 let req = req_builder.build()?;
4795 let resp = configuration.client.execute(req).await?;
4796
4797 let status = resp.status();
4798
4799 if !status.is_client_error() && !status.is_server_error() {
4800 Ok(())
4801 } else {
4802 let content = resp.text().await?;
4803 let entity: Option<CoreUsersSetPasswordCreateError> = serde_json::from_str(&content).ok();
4804 Err(Error::ResponseError(ResponseContent {
4805 status,
4806 content,
4807 entity,
4808 }))
4809 }
4810}
4811
4812pub async fn core_users_update(
4814 configuration: &configuration::Configuration,
4815 id: i32,
4816 user_request: models::UserRequest,
4817) -> Result<models::User, Error<CoreUsersUpdateError>> {
4818 let p_path_id = id;
4820 let p_body_user_request = user_request;
4821
4822 let uri_str = format!("{}/core/users/{id}/", configuration.base_path, id = p_path_id);
4823 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4824
4825 if let Some(ref user_agent) = configuration.user_agent {
4826 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4827 }
4828 if let Some(ref token) = configuration.bearer_access_token {
4829 req_builder = req_builder.bearer_auth(token.to_owned());
4830 };
4831 req_builder = req_builder.json(&p_body_user_request);
4832
4833 let req = req_builder.build()?;
4834 let resp = configuration.client.execute(req).await?;
4835
4836 let status = resp.status();
4837 let content_type = resp
4838 .headers()
4839 .get("content-type")
4840 .and_then(|v| v.to_str().ok())
4841 .unwrap_or("application/octet-stream");
4842 let content_type = super::ContentType::from(content_type);
4843
4844 if !status.is_client_error() && !status.is_server_error() {
4845 let content = resp.text().await?;
4846 match content_type {
4847 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4848 ContentType::Text => {
4849 return Err(Error::from(serde_json::Error::custom(
4850 "Received `text/plain` content type response that cannot be converted to `models::User`",
4851 )))
4852 }
4853 ContentType::Unsupported(unknown_type) => {
4854 return Err(Error::from(serde_json::Error::custom(format!(
4855 "Received `{unknown_type}` content type response that cannot be converted to `models::User`"
4856 ))))
4857 }
4858 }
4859 } else {
4860 let content = resp.text().await?;
4861 let entity: Option<CoreUsersUpdateError> = serde_json::from_str(&content).ok();
4862 Err(Error::ResponseError(ResponseContent {
4863 status,
4864 content,
4865 entity,
4866 }))
4867 }
4868}
4869
4870pub async fn core_users_used_by_list(
4872 configuration: &configuration::Configuration,
4873 id: i32,
4874) -> Result<Vec<models::UsedBy>, Error<CoreUsersUsedByListError>> {
4875 let p_path_id = id;
4877
4878 let uri_str = format!("{}/core/users/{id}/used_by/", configuration.base_path, id = p_path_id);
4879 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4880
4881 if let Some(ref user_agent) = configuration.user_agent {
4882 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4883 }
4884 if let Some(ref token) = configuration.bearer_access_token {
4885 req_builder = req_builder.bearer_auth(token.to_owned());
4886 };
4887
4888 let req = req_builder.build()?;
4889 let resp = configuration.client.execute(req).await?;
4890
4891 let status = resp.status();
4892 let content_type = resp
4893 .headers()
4894 .get("content-type")
4895 .and_then(|v| v.to_str().ok())
4896 .unwrap_or("application/octet-stream");
4897 let content_type = super::ContentType::from(content_type);
4898
4899 if !status.is_client_error() && !status.is_server_error() {
4900 let content = resp.text().await?;
4901 match content_type {
4902 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4903 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
4904 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::UsedBy>`")))),
4905 }
4906 } else {
4907 let content = resp.text().await?;
4908 let entity: Option<CoreUsersUsedByListError> = serde_json::from_str(&content).ok();
4909 Err(Error::ResponseError(ResponseContent {
4910 status,
4911 content,
4912 entity,
4913 }))
4914 }
4915}