authentik_client/apis/
core_api.rs

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