authentik_client/apis/
core_api.rs

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