Skip to main content

authentik_client/apis/
core_api.rs

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