authentik_rust/apis/
core_api.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2024.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`core_applications_check_access_retrieve`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CoreApplicationsCheckAccessRetrieveError {
22    Status400(models::ValidationError),
23    Status403(models::GenericError),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`core_applications_create`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum CoreApplicationsCreateError {
31    Status400(models::ValidationError),
32    Status403(models::GenericError),
33    UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`core_applications_destroy`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum CoreApplicationsDestroyError {
40    Status400(models::ValidationError),
41    Status403(models::GenericError),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`core_applications_list`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum CoreApplicationsListError {
49    Status400(models::ValidationError),
50    Status403(models::GenericError),
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`core_applications_metrics_list`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum CoreApplicationsMetricsListError {
58    Status400(models::ValidationError),
59    Status403(models::GenericError),
60    UnknownValue(serde_json::Value),
61}
62
63/// struct for typed errors of method [`core_applications_partial_update`]
64#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum CoreApplicationsPartialUpdateError {
67    Status400(models::ValidationError),
68    Status403(models::GenericError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`core_applications_retrieve`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum CoreApplicationsRetrieveError {
76    Status400(models::ValidationError),
77    Status403(models::GenericError),
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`core_applications_set_icon_create`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum CoreApplicationsSetIconCreateError {
85    Status400(),
86    Status403(models::GenericError),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`core_applications_set_icon_url_create`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum CoreApplicationsSetIconUrlCreateError {
94    Status400(),
95    Status403(models::GenericError),
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`core_applications_update`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum CoreApplicationsUpdateError {
103    Status400(models::ValidationError),
104    Status403(models::GenericError),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`core_applications_used_by_list`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum CoreApplicationsUsedByListError {
112    Status400(models::ValidationError),
113    Status403(models::GenericError),
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`core_authenticated_sessions_destroy`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum CoreAuthenticatedSessionsDestroyError {
121    Status400(models::ValidationError),
122    Status403(models::GenericError),
123    UnknownValue(serde_json::Value),
124}
125
126/// struct for typed errors of method [`core_authenticated_sessions_list`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum CoreAuthenticatedSessionsListError {
130    Status400(models::ValidationError),
131    Status403(models::GenericError),
132    UnknownValue(serde_json::Value),
133}
134
135/// struct for typed errors of method [`core_authenticated_sessions_retrieve`]
136#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum CoreAuthenticatedSessionsRetrieveError {
139    Status400(models::ValidationError),
140    Status403(models::GenericError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`core_authenticated_sessions_used_by_list`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum CoreAuthenticatedSessionsUsedByListError {
148    Status400(models::ValidationError),
149    Status403(models::GenericError),
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`core_brands_create`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum CoreBrandsCreateError {
157    Status400(models::ValidationError),
158    Status403(models::GenericError),
159    UnknownValue(serde_json::Value),
160}
161
162/// struct for typed errors of method [`core_brands_current_retrieve`]
163#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum CoreBrandsCurrentRetrieveError {
166    Status400(models::ValidationError),
167    Status403(models::GenericError),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`core_brands_destroy`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum CoreBrandsDestroyError {
175    Status400(models::ValidationError),
176    Status403(models::GenericError),
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`core_brands_list`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum CoreBrandsListError {
184    Status400(models::ValidationError),
185    Status403(models::GenericError),
186    UnknownValue(serde_json::Value),
187}
188
189/// struct for typed errors of method [`core_brands_partial_update`]
190#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum CoreBrandsPartialUpdateError {
193    Status400(models::ValidationError),
194    Status403(models::GenericError),
195    UnknownValue(serde_json::Value),
196}
197
198/// struct for typed errors of method [`core_brands_retrieve`]
199#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum CoreBrandsRetrieveError {
202    Status400(models::ValidationError),
203    Status403(models::GenericError),
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`core_brands_update`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum CoreBrandsUpdateError {
211    Status400(models::ValidationError),
212    Status403(models::GenericError),
213    UnknownValue(serde_json::Value),
214}
215
216/// struct for typed errors of method [`core_brands_used_by_list`]
217#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum CoreBrandsUsedByListError {
220    Status400(models::ValidationError),
221    Status403(models::GenericError),
222    UnknownValue(serde_json::Value),
223}
224
225/// struct for typed errors of method [`core_groups_add_user_create`]
226#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum CoreGroupsAddUserCreateError {
229    Status404(),
230    Status400(models::ValidationError),
231    Status403(models::GenericError),
232    UnknownValue(serde_json::Value),
233}
234
235/// struct for typed errors of method [`core_groups_create`]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum CoreGroupsCreateError {
239    Status400(models::ValidationError),
240    Status403(models::GenericError),
241    UnknownValue(serde_json::Value),
242}
243
244/// struct for typed errors of method [`core_groups_destroy`]
245#[derive(Debug, Clone, Serialize, Deserialize)]
246#[serde(untagged)]
247pub enum CoreGroupsDestroyError {
248    Status400(models::ValidationError),
249    Status403(models::GenericError),
250    UnknownValue(serde_json::Value),
251}
252
253/// struct for typed errors of method [`core_groups_list`]
254#[derive(Debug, Clone, Serialize, Deserialize)]
255#[serde(untagged)]
256pub enum CoreGroupsListError {
257    Status400(models::ValidationError),
258    Status403(models::GenericError),
259    UnknownValue(serde_json::Value),
260}
261
262/// struct for typed errors of method [`core_groups_partial_update`]
263#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum CoreGroupsPartialUpdateError {
266    Status400(models::ValidationError),
267    Status403(models::GenericError),
268    UnknownValue(serde_json::Value),
269}
270
271/// struct for typed errors of method [`core_groups_remove_user_create`]
272#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum CoreGroupsRemoveUserCreateError {
275    Status404(),
276    Status400(models::ValidationError),
277    Status403(models::GenericError),
278    UnknownValue(serde_json::Value),
279}
280
281/// struct for typed errors of method [`core_groups_retrieve`]
282#[derive(Debug, Clone, Serialize, Deserialize)]
283#[serde(untagged)]
284pub enum CoreGroupsRetrieveError {
285    Status400(models::ValidationError),
286    Status403(models::GenericError),
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`core_groups_update`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum CoreGroupsUpdateError {
294    Status400(models::ValidationError),
295    Status403(models::GenericError),
296    UnknownValue(serde_json::Value),
297}
298
299/// struct for typed errors of method [`core_groups_used_by_list`]
300#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum CoreGroupsUsedByListError {
303    Status400(models::ValidationError),
304    Status403(models::GenericError),
305    UnknownValue(serde_json::Value),
306}
307
308/// struct for typed errors of method [`core_tokens_create`]
309#[derive(Debug, Clone, Serialize, Deserialize)]
310#[serde(untagged)]
311pub enum CoreTokensCreateError {
312    Status400(models::ValidationError),
313    Status403(models::GenericError),
314    UnknownValue(serde_json::Value),
315}
316
317/// struct for typed errors of method [`core_tokens_destroy`]
318#[derive(Debug, Clone, Serialize, Deserialize)]
319#[serde(untagged)]
320pub enum CoreTokensDestroyError {
321    Status400(models::ValidationError),
322    Status403(models::GenericError),
323    UnknownValue(serde_json::Value),
324}
325
326/// struct for typed errors of method [`core_tokens_list`]
327#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum CoreTokensListError {
330    Status400(models::ValidationError),
331    Status403(models::GenericError),
332    UnknownValue(serde_json::Value),
333}
334
335/// struct for typed errors of method [`core_tokens_partial_update`]
336#[derive(Debug, Clone, Serialize, Deserialize)]
337#[serde(untagged)]
338pub enum CoreTokensPartialUpdateError {
339    Status400(models::ValidationError),
340    Status403(models::GenericError),
341    UnknownValue(serde_json::Value),
342}
343
344/// struct for typed errors of method [`core_tokens_retrieve`]
345#[derive(Debug, Clone, Serialize, Deserialize)]
346#[serde(untagged)]
347pub enum CoreTokensRetrieveError {
348    Status400(models::ValidationError),
349    Status403(models::GenericError),
350    UnknownValue(serde_json::Value),
351}
352
353/// struct for typed errors of method [`core_tokens_set_key_create`]
354#[derive(Debug, Clone, Serialize, Deserialize)]
355#[serde(untagged)]
356pub enum CoreTokensSetKeyCreateError {
357    Status400(),
358    Status404(),
359    Status403(models::GenericError),
360    UnknownValue(serde_json::Value),
361}
362
363/// struct for typed errors of method [`core_tokens_update`]
364#[derive(Debug, Clone, Serialize, Deserialize)]
365#[serde(untagged)]
366pub enum CoreTokensUpdateError {
367    Status400(models::ValidationError),
368    Status403(models::GenericError),
369    UnknownValue(serde_json::Value),
370}
371
372/// struct for typed errors of method [`core_tokens_used_by_list`]
373#[derive(Debug, Clone, Serialize, Deserialize)]
374#[serde(untagged)]
375pub enum CoreTokensUsedByListError {
376    Status400(models::ValidationError),
377    Status403(models::GenericError),
378    UnknownValue(serde_json::Value),
379}
380
381/// struct for typed errors of method [`core_tokens_view_key_retrieve`]
382#[derive(Debug, Clone, Serialize, Deserialize)]
383#[serde(untagged)]
384pub enum CoreTokensViewKeyRetrieveError {
385    Status404(),
386    Status400(models::ValidationError),
387    Status403(models::GenericError),
388    UnknownValue(serde_json::Value),
389}
390
391/// struct for typed errors of method [`core_transactional_applications_update`]
392#[derive(Debug, Clone, Serialize, Deserialize)]
393#[serde(untagged)]
394pub enum CoreTransactionalApplicationsUpdateError {
395    Status400(models::ValidationError),
396    Status403(models::GenericError),
397    UnknownValue(serde_json::Value),
398}
399
400/// struct for typed errors of method [`core_user_consent_destroy`]
401#[derive(Debug, Clone, Serialize, Deserialize)]
402#[serde(untagged)]
403pub enum CoreUserConsentDestroyError {
404    Status400(models::ValidationError),
405    Status403(models::GenericError),
406    UnknownValue(serde_json::Value),
407}
408
409/// struct for typed errors of method [`core_user_consent_list`]
410#[derive(Debug, Clone, Serialize, Deserialize)]
411#[serde(untagged)]
412pub enum CoreUserConsentListError {
413    Status400(models::ValidationError),
414    Status403(models::GenericError),
415    UnknownValue(serde_json::Value),
416}
417
418/// struct for typed errors of method [`core_user_consent_retrieve`]
419#[derive(Debug, Clone, Serialize, Deserialize)]
420#[serde(untagged)]
421pub enum CoreUserConsentRetrieveError {
422    Status400(models::ValidationError),
423    Status403(models::GenericError),
424    UnknownValue(serde_json::Value),
425}
426
427/// struct for typed errors of method [`core_user_consent_used_by_list`]
428#[derive(Debug, Clone, Serialize, Deserialize)]
429#[serde(untagged)]
430pub enum CoreUserConsentUsedByListError {
431    Status400(models::ValidationError),
432    Status403(models::GenericError),
433    UnknownValue(serde_json::Value),
434}
435
436/// struct for typed errors of method [`core_users_create`]
437#[derive(Debug, Clone, Serialize, Deserialize)]
438#[serde(untagged)]
439pub enum CoreUsersCreateError {
440    Status400(models::ValidationError),
441    Status403(models::GenericError),
442    UnknownValue(serde_json::Value),
443}
444
445/// struct for typed errors of method [`core_users_destroy`]
446#[derive(Debug, Clone, Serialize, Deserialize)]
447#[serde(untagged)]
448pub enum CoreUsersDestroyError {
449    Status400(models::ValidationError),
450    Status403(models::GenericError),
451    UnknownValue(serde_json::Value),
452}
453
454/// struct for typed errors of method [`core_users_impersonate_create`]
455#[derive(Debug, Clone, Serialize, Deserialize)]
456#[serde(untagged)]
457pub enum CoreUsersImpersonateCreateError {
458    Status401(),
459    Status400(models::ValidationError),
460    Status403(models::GenericError),
461    UnknownValue(serde_json::Value),
462}
463
464/// struct for typed errors of method [`core_users_impersonate_end_retrieve`]
465#[derive(Debug, Clone, Serialize, Deserialize)]
466#[serde(untagged)]
467pub enum CoreUsersImpersonateEndRetrieveError {
468    Status400(models::ValidationError),
469    Status403(models::GenericError),
470    UnknownValue(serde_json::Value),
471}
472
473/// struct for typed errors of method [`core_users_list`]
474#[derive(Debug, Clone, Serialize, Deserialize)]
475#[serde(untagged)]
476pub enum CoreUsersListError {
477    Status400(models::ValidationError),
478    Status403(models::GenericError),
479    UnknownValue(serde_json::Value),
480}
481
482/// struct for typed errors of method [`core_users_me_retrieve`]
483#[derive(Debug, Clone, Serialize, Deserialize)]
484#[serde(untagged)]
485pub enum CoreUsersMeRetrieveError {
486    Status400(models::ValidationError),
487    Status403(models::GenericError),
488    UnknownValue(serde_json::Value),
489}
490
491/// struct for typed errors of method [`core_users_metrics_retrieve`]
492#[derive(Debug, Clone, Serialize, Deserialize)]
493#[serde(untagged)]
494pub enum CoreUsersMetricsRetrieveError {
495    Status400(models::ValidationError),
496    Status403(models::GenericError),
497    UnknownValue(serde_json::Value),
498}
499
500/// struct for typed errors of method [`core_users_partial_update`]
501#[derive(Debug, Clone, Serialize, Deserialize)]
502#[serde(untagged)]
503pub enum CoreUsersPartialUpdateError {
504    Status400(models::ValidationError),
505    Status403(models::GenericError),
506    UnknownValue(serde_json::Value),
507}
508
509/// struct for typed errors of method [`core_users_paths_retrieve`]
510#[derive(Debug, Clone, Serialize, Deserialize)]
511#[serde(untagged)]
512pub enum CoreUsersPathsRetrieveError {
513    Status400(models::ValidationError),
514    Status403(models::GenericError),
515    UnknownValue(serde_json::Value),
516}
517
518/// struct for typed errors of method [`core_users_recovery_create`]
519#[derive(Debug, Clone, Serialize, Deserialize)]
520#[serde(untagged)]
521pub enum CoreUsersRecoveryCreateError {
522    Status400(models::ValidationError),
523    Status403(models::GenericError),
524    UnknownValue(serde_json::Value),
525}
526
527/// struct for typed errors of method [`core_users_recovery_email_create`]
528#[derive(Debug, Clone, Serialize, Deserialize)]
529#[serde(untagged)]
530pub enum CoreUsersRecoveryEmailCreateError {
531    Status400(models::ValidationError),
532    Status403(models::GenericError),
533    UnknownValue(serde_json::Value),
534}
535
536/// struct for typed errors of method [`core_users_retrieve`]
537#[derive(Debug, Clone, Serialize, Deserialize)]
538#[serde(untagged)]
539pub enum CoreUsersRetrieveError {
540    Status400(models::ValidationError),
541    Status403(models::GenericError),
542    UnknownValue(serde_json::Value),
543}
544
545/// struct for typed errors of method [`core_users_service_account_create`]
546#[derive(Debug, Clone, Serialize, Deserialize)]
547#[serde(untagged)]
548pub enum CoreUsersServiceAccountCreateError {
549    Status400(models::ValidationError),
550    Status403(models::GenericError),
551    UnknownValue(serde_json::Value),
552}
553
554/// struct for typed errors of method [`core_users_set_password_create`]
555#[derive(Debug, Clone, Serialize, Deserialize)]
556#[serde(untagged)]
557pub enum CoreUsersSetPasswordCreateError {
558    Status400(),
559    Status403(models::GenericError),
560    UnknownValue(serde_json::Value),
561}
562
563/// struct for typed errors of method [`core_users_update`]
564#[derive(Debug, Clone, Serialize, Deserialize)]
565#[serde(untagged)]
566pub enum CoreUsersUpdateError {
567    Status400(models::ValidationError),
568    Status403(models::GenericError),
569    UnknownValue(serde_json::Value),
570}
571
572/// struct for typed errors of method [`core_users_used_by_list`]
573#[derive(Debug, Clone, Serialize, Deserialize)]
574#[serde(untagged)]
575pub enum CoreUsersUsedByListError {
576    Status400(models::ValidationError),
577    Status403(models::GenericError),
578    UnknownValue(serde_json::Value),
579}
580
581
582/// Check access to a single application by slug
583pub async fn core_applications_check_access_retrieve(configuration: &configuration::Configuration, slug: &str, for_user: Option<i32>) -> Result<models::PolicyTestResult, Error<CoreApplicationsCheckAccessRetrieveError>> {
584    let local_var_configuration = configuration;
585
586    let local_var_client = &local_var_configuration.client;
587
588    let local_var_uri_str = format!("{}/core/applications/{slug}/check_access/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
589    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
590
591    if let Some(ref local_var_str) = for_user {
592        local_var_req_builder = local_var_req_builder.query(&[("for_user", &local_var_str.to_string())]);
593    }
594    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
595        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
596    }
597    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
598        let local_var_key = local_var_apikey.key.clone();
599        let local_var_value = match local_var_apikey.prefix {
600            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
601            None => local_var_key,
602        };
603        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
604    };
605
606    let local_var_req = local_var_req_builder.build()?;
607    let local_var_resp = local_var_client.execute(local_var_req).await?;
608
609    let local_var_status = local_var_resp.status();
610    let local_var_content = local_var_resp.text().await?;
611
612    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
613        serde_json::from_str(&local_var_content).map_err(Error::from)
614    } else {
615        let local_var_entity: Option<CoreApplicationsCheckAccessRetrieveError> = serde_json::from_str(&local_var_content).ok();
616        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
617        Err(Error::ResponseError(local_var_error))
618    }
619}
620
621/// Application Viewset
622pub async fn core_applications_create(configuration: &configuration::Configuration, application_request: models::ApplicationRequest) -> Result<models::Application, Error<CoreApplicationsCreateError>> {
623    let local_var_configuration = configuration;
624
625    let local_var_client = &local_var_configuration.client;
626
627    let local_var_uri_str = format!("{}/core/applications/", local_var_configuration.base_path);
628    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
629
630    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
631        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
632    }
633    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
634        let local_var_key = local_var_apikey.key.clone();
635        let local_var_value = match local_var_apikey.prefix {
636            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
637            None => local_var_key,
638        };
639        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
640    };
641    local_var_req_builder = local_var_req_builder.json(&application_request);
642
643    let local_var_req = local_var_req_builder.build()?;
644    let local_var_resp = local_var_client.execute(local_var_req).await?;
645
646    let local_var_status = local_var_resp.status();
647    let local_var_content = local_var_resp.text().await?;
648
649    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
650        serde_json::from_str(&local_var_content).map_err(Error::from)
651    } else {
652        let local_var_entity: Option<CoreApplicationsCreateError> = serde_json::from_str(&local_var_content).ok();
653        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
654        Err(Error::ResponseError(local_var_error))
655    }
656}
657
658/// Application Viewset
659pub async fn core_applications_destroy(configuration: &configuration::Configuration, slug: &str) -> Result<(), Error<CoreApplicationsDestroyError>> {
660    let local_var_configuration = configuration;
661
662    let local_var_client = &local_var_configuration.client;
663
664    let local_var_uri_str = format!("{}/core/applications/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
665    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
666
667    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
668        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
669    }
670    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
671        let local_var_key = local_var_apikey.key.clone();
672        let local_var_value = match local_var_apikey.prefix {
673            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
674            None => local_var_key,
675        };
676        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
677    };
678
679    let local_var_req = local_var_req_builder.build()?;
680    let local_var_resp = local_var_client.execute(local_var_req).await?;
681
682    let local_var_status = local_var_resp.status();
683    let local_var_content = local_var_resp.text().await?;
684
685    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
686        Ok(())
687    } else {
688        let local_var_entity: Option<CoreApplicationsDestroyError> = serde_json::from_str(&local_var_content).ok();
689        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
690        Err(Error::ResponseError(local_var_error))
691    }
692}
693
694/// Custom list method that checks Policy based access instead of guardian
695pub async fn core_applications_list(configuration: &configuration::Configuration, for_user: Option<i32>, group: Option<&str>, meta_description: Option<&str>, meta_launch_url: Option<&str>, meta_publisher: Option<&str>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, slug: Option<&str>, superuser_full_list: Option<bool>) -> Result<models::PaginatedApplicationList, Error<CoreApplicationsListError>> {
696    let local_var_configuration = configuration;
697
698    let local_var_client = &local_var_configuration.client;
699
700    let local_var_uri_str = format!("{}/core/applications/", local_var_configuration.base_path);
701    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
702
703    if let Some(ref local_var_str) = for_user {
704        local_var_req_builder = local_var_req_builder.query(&[("for_user", &local_var_str.to_string())]);
705    }
706    if let Some(ref local_var_str) = group {
707        local_var_req_builder = local_var_req_builder.query(&[("group", &local_var_str.to_string())]);
708    }
709    if let Some(ref local_var_str) = meta_description {
710        local_var_req_builder = local_var_req_builder.query(&[("meta_description", &local_var_str.to_string())]);
711    }
712    if let Some(ref local_var_str) = meta_launch_url {
713        local_var_req_builder = local_var_req_builder.query(&[("meta_launch_url", &local_var_str.to_string())]);
714    }
715    if let Some(ref local_var_str) = meta_publisher {
716        local_var_req_builder = local_var_req_builder.query(&[("meta_publisher", &local_var_str.to_string())]);
717    }
718    if let Some(ref local_var_str) = name {
719        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
720    }
721    if let Some(ref local_var_str) = ordering {
722        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
723    }
724    if let Some(ref local_var_str) = page {
725        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
726    }
727    if let Some(ref local_var_str) = page_size {
728        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
729    }
730    if let Some(ref local_var_str) = search {
731        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
732    }
733    if let Some(ref local_var_str) = slug {
734        local_var_req_builder = local_var_req_builder.query(&[("slug", &local_var_str.to_string())]);
735    }
736    if let Some(ref local_var_str) = superuser_full_list {
737        local_var_req_builder = local_var_req_builder.query(&[("superuser_full_list", &local_var_str.to_string())]);
738    }
739    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
740        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
741    }
742    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
743        let local_var_key = local_var_apikey.key.clone();
744        let local_var_value = match local_var_apikey.prefix {
745            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
746            None => local_var_key,
747        };
748        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
749    };
750
751    let local_var_req = local_var_req_builder.build()?;
752    let local_var_resp = local_var_client.execute(local_var_req).await?;
753
754    let local_var_status = local_var_resp.status();
755    let local_var_content = local_var_resp.text().await?;
756
757    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
758        serde_json::from_str(&local_var_content).map_err(Error::from)
759    } else {
760        let local_var_entity: Option<CoreApplicationsListError> = serde_json::from_str(&local_var_content).ok();
761        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
762        Err(Error::ResponseError(local_var_error))
763    }
764}
765
766/// Metrics for application logins
767pub async fn core_applications_metrics_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::Coordinate>, Error<CoreApplicationsMetricsListError>> {
768    let local_var_configuration = configuration;
769
770    let local_var_client = &local_var_configuration.client;
771
772    let local_var_uri_str = format!("{}/core/applications/{slug}/metrics/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
773    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
774
775    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
776        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
777    }
778    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
779        let local_var_key = local_var_apikey.key.clone();
780        let local_var_value = match local_var_apikey.prefix {
781            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
782            None => local_var_key,
783        };
784        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
785    };
786
787    let local_var_req = local_var_req_builder.build()?;
788    let local_var_resp = local_var_client.execute(local_var_req).await?;
789
790    let local_var_status = local_var_resp.status();
791    let local_var_content = local_var_resp.text().await?;
792
793    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
794        serde_json::from_str(&local_var_content).map_err(Error::from)
795    } else {
796        let local_var_entity: Option<CoreApplicationsMetricsListError> = serde_json::from_str(&local_var_content).ok();
797        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
798        Err(Error::ResponseError(local_var_error))
799    }
800}
801
802/// Application Viewset
803pub async fn core_applications_partial_update(configuration: &configuration::Configuration, slug: &str, patched_application_request: Option<models::PatchedApplicationRequest>) -> Result<models::Application, Error<CoreApplicationsPartialUpdateError>> {
804    let local_var_configuration = configuration;
805
806    let local_var_client = &local_var_configuration.client;
807
808    let local_var_uri_str = format!("{}/core/applications/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
809    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
810
811    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
812        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
813    }
814    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
815        let local_var_key = local_var_apikey.key.clone();
816        let local_var_value = match local_var_apikey.prefix {
817            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
818            None => local_var_key,
819        };
820        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
821    };
822    local_var_req_builder = local_var_req_builder.json(&patched_application_request);
823
824    let local_var_req = local_var_req_builder.build()?;
825    let local_var_resp = local_var_client.execute(local_var_req).await?;
826
827    let local_var_status = local_var_resp.status();
828    let local_var_content = local_var_resp.text().await?;
829
830    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
831        serde_json::from_str(&local_var_content).map_err(Error::from)
832    } else {
833        let local_var_entity: Option<CoreApplicationsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
834        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
835        Err(Error::ResponseError(local_var_error))
836    }
837}
838
839/// Application Viewset
840pub async fn core_applications_retrieve(configuration: &configuration::Configuration, slug: &str) -> Result<models::Application, Error<CoreApplicationsRetrieveError>> {
841    let local_var_configuration = configuration;
842
843    let local_var_client = &local_var_configuration.client;
844
845    let local_var_uri_str = format!("{}/core/applications/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
846    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
847
848    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
849        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
850    }
851    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
852        let local_var_key = local_var_apikey.key.clone();
853        let local_var_value = match local_var_apikey.prefix {
854            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
855            None => local_var_key,
856        };
857        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
858    };
859
860    let local_var_req = local_var_req_builder.build()?;
861    let local_var_resp = local_var_client.execute(local_var_req).await?;
862
863    let local_var_status = local_var_resp.status();
864    let local_var_content = local_var_resp.text().await?;
865
866    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
867        serde_json::from_str(&local_var_content).map_err(Error::from)
868    } else {
869        let local_var_entity: Option<CoreApplicationsRetrieveError> = serde_json::from_str(&local_var_content).ok();
870        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
871        Err(Error::ResponseError(local_var_error))
872    }
873}
874
875/// Set application icon
876pub async fn core_applications_set_icon_create(configuration: &configuration::Configuration, slug: &str, file: Option<std::path::PathBuf>, clear: Option<bool>) -> Result<(), Error<CoreApplicationsSetIconCreateError>> {
877    let local_var_configuration = configuration;
878
879    let local_var_client = &local_var_configuration.client;
880
881    let local_var_uri_str = format!("{}/core/applications/{slug}/set_icon/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
882    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
883
884    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
885        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
886    }
887    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
888        let local_var_key = local_var_apikey.key.clone();
889        let local_var_value = match local_var_apikey.prefix {
890            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
891            None => local_var_key,
892        };
893        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
894    };
895    let mut local_var_form = reqwest::multipart::Form::new();
896    // TODO: support file upload for 'file' parameter
897    if let Some(local_var_param_value) = clear {
898        local_var_form = local_var_form.text("clear", local_var_param_value.to_string());
899    }
900    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
901
902    let local_var_req = local_var_req_builder.build()?;
903    let local_var_resp = local_var_client.execute(local_var_req).await?;
904
905    let local_var_status = local_var_resp.status();
906    let local_var_content = local_var_resp.text().await?;
907
908    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
909        Ok(())
910    } else {
911        let local_var_entity: Option<CoreApplicationsSetIconCreateError> = serde_json::from_str(&local_var_content).ok();
912        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
913        Err(Error::ResponseError(local_var_error))
914    }
915}
916
917/// Set application icon (as URL)
918pub async fn core_applications_set_icon_url_create(configuration: &configuration::Configuration, slug: &str, file_path_request: models::FilePathRequest) -> Result<(), Error<CoreApplicationsSetIconUrlCreateError>> {
919    let local_var_configuration = configuration;
920
921    let local_var_client = &local_var_configuration.client;
922
923    let local_var_uri_str = format!("{}/core/applications/{slug}/set_icon_url/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
924    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
925
926    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
927        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
928    }
929    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
930        let local_var_key = local_var_apikey.key.clone();
931        let local_var_value = match local_var_apikey.prefix {
932            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
933            None => local_var_key,
934        };
935        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
936    };
937    local_var_req_builder = local_var_req_builder.json(&file_path_request);
938
939    let local_var_req = local_var_req_builder.build()?;
940    let local_var_resp = local_var_client.execute(local_var_req).await?;
941
942    let local_var_status = local_var_resp.status();
943    let local_var_content = local_var_resp.text().await?;
944
945    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
946        Ok(())
947    } else {
948        let local_var_entity: Option<CoreApplicationsSetIconUrlCreateError> = serde_json::from_str(&local_var_content).ok();
949        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
950        Err(Error::ResponseError(local_var_error))
951    }
952}
953
954/// Application Viewset
955pub async fn core_applications_update(configuration: &configuration::Configuration, slug: &str, application_request: models::ApplicationRequest) -> Result<models::Application, Error<CoreApplicationsUpdateError>> {
956    let local_var_configuration = configuration;
957
958    let local_var_client = &local_var_configuration.client;
959
960    let local_var_uri_str = format!("{}/core/applications/{slug}/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
961    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
962
963    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
964        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
965    }
966    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
967        let local_var_key = local_var_apikey.key.clone();
968        let local_var_value = match local_var_apikey.prefix {
969            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
970            None => local_var_key,
971        };
972        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
973    };
974    local_var_req_builder = local_var_req_builder.json(&application_request);
975
976    let local_var_req = local_var_req_builder.build()?;
977    let local_var_resp = local_var_client.execute(local_var_req).await?;
978
979    let local_var_status = local_var_resp.status();
980    let local_var_content = local_var_resp.text().await?;
981
982    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
983        serde_json::from_str(&local_var_content).map_err(Error::from)
984    } else {
985        let local_var_entity: Option<CoreApplicationsUpdateError> = serde_json::from_str(&local_var_content).ok();
986        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
987        Err(Error::ResponseError(local_var_error))
988    }
989}
990
991/// Get a list of all objects that use this object
992pub async fn core_applications_used_by_list(configuration: &configuration::Configuration, slug: &str) -> Result<Vec<models::UsedBy>, Error<CoreApplicationsUsedByListError>> {
993    let local_var_configuration = configuration;
994
995    let local_var_client = &local_var_configuration.client;
996
997    let local_var_uri_str = format!("{}/core/applications/{slug}/used_by/", local_var_configuration.base_path, slug=crate::apis::urlencode(slug));
998    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
999
1000    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1001        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1002    }
1003    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1004        let local_var_key = local_var_apikey.key.clone();
1005        let local_var_value = match local_var_apikey.prefix {
1006            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1007            None => local_var_key,
1008        };
1009        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1010    };
1011
1012    let local_var_req = local_var_req_builder.build()?;
1013    let local_var_resp = local_var_client.execute(local_var_req).await?;
1014
1015    let local_var_status = local_var_resp.status();
1016    let local_var_content = local_var_resp.text().await?;
1017
1018    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1019        serde_json::from_str(&local_var_content).map_err(Error::from)
1020    } else {
1021        let local_var_entity: Option<CoreApplicationsUsedByListError> = serde_json::from_str(&local_var_content).ok();
1022        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1023        Err(Error::ResponseError(local_var_error))
1024    }
1025}
1026
1027/// AuthenticatedSession Viewset
1028pub async fn core_authenticated_sessions_destroy(configuration: &configuration::Configuration, uuid: &str) -> Result<(), Error<CoreAuthenticatedSessionsDestroyError>> {
1029    let local_var_configuration = configuration;
1030
1031    let local_var_client = &local_var_configuration.client;
1032
1033    let local_var_uri_str = format!("{}/core/authenticated_sessions/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1034    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1035
1036    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1037        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1038    }
1039    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1040        let local_var_key = local_var_apikey.key.clone();
1041        let local_var_value = match local_var_apikey.prefix {
1042            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1043            None => local_var_key,
1044        };
1045        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1046    };
1047
1048    let local_var_req = local_var_req_builder.build()?;
1049    let local_var_resp = local_var_client.execute(local_var_req).await?;
1050
1051    let local_var_status = local_var_resp.status();
1052    let local_var_content = local_var_resp.text().await?;
1053
1054    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1055        Ok(())
1056    } else {
1057        let local_var_entity: Option<CoreAuthenticatedSessionsDestroyError> = serde_json::from_str(&local_var_content).ok();
1058        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1059        Err(Error::ResponseError(local_var_error))
1060    }
1061}
1062
1063/// AuthenticatedSession Viewset
1064pub async fn core_authenticated_sessions_list(configuration: &configuration::Configuration, last_ip: Option<&str>, last_user_agent: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, user__username: Option<&str>) -> Result<models::PaginatedAuthenticatedSessionList, Error<CoreAuthenticatedSessionsListError>> {
1065    let local_var_configuration = configuration;
1066
1067    let local_var_client = &local_var_configuration.client;
1068
1069    let local_var_uri_str = format!("{}/core/authenticated_sessions/", local_var_configuration.base_path);
1070    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1071
1072    if let Some(ref local_var_str) = last_ip {
1073        local_var_req_builder = local_var_req_builder.query(&[("last_ip", &local_var_str.to_string())]);
1074    }
1075    if let Some(ref local_var_str) = last_user_agent {
1076        local_var_req_builder = local_var_req_builder.query(&[("last_user_agent", &local_var_str.to_string())]);
1077    }
1078    if let Some(ref local_var_str) = ordering {
1079        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1080    }
1081    if let Some(ref local_var_str) = page {
1082        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1083    }
1084    if let Some(ref local_var_str) = page_size {
1085        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1086    }
1087    if let Some(ref local_var_str) = search {
1088        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1089    }
1090    if let Some(ref local_var_str) = user__username {
1091        local_var_req_builder = local_var_req_builder.query(&[("user__username", &local_var_str.to_string())]);
1092    }
1093    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1094        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1095    }
1096    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1097        let local_var_key = local_var_apikey.key.clone();
1098        let local_var_value = match local_var_apikey.prefix {
1099            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1100            None => local_var_key,
1101        };
1102        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1103    };
1104
1105    let local_var_req = local_var_req_builder.build()?;
1106    let local_var_resp = local_var_client.execute(local_var_req).await?;
1107
1108    let local_var_status = local_var_resp.status();
1109    let local_var_content = local_var_resp.text().await?;
1110
1111    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1112        serde_json::from_str(&local_var_content).map_err(Error::from)
1113    } else {
1114        let local_var_entity: Option<CoreAuthenticatedSessionsListError> = serde_json::from_str(&local_var_content).ok();
1115        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1116        Err(Error::ResponseError(local_var_error))
1117    }
1118}
1119
1120/// AuthenticatedSession Viewset
1121pub async fn core_authenticated_sessions_retrieve(configuration: &configuration::Configuration, uuid: &str) -> Result<models::AuthenticatedSession, Error<CoreAuthenticatedSessionsRetrieveError>> {
1122    let local_var_configuration = configuration;
1123
1124    let local_var_client = &local_var_configuration.client;
1125
1126    let local_var_uri_str = format!("{}/core/authenticated_sessions/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1127    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1128
1129    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1130        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1131    }
1132    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1133        let local_var_key = local_var_apikey.key.clone();
1134        let local_var_value = match local_var_apikey.prefix {
1135            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1136            None => local_var_key,
1137        };
1138        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1139    };
1140
1141    let local_var_req = local_var_req_builder.build()?;
1142    let local_var_resp = local_var_client.execute(local_var_req).await?;
1143
1144    let local_var_status = local_var_resp.status();
1145    let local_var_content = local_var_resp.text().await?;
1146
1147    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1148        serde_json::from_str(&local_var_content).map_err(Error::from)
1149    } else {
1150        let local_var_entity: Option<CoreAuthenticatedSessionsRetrieveError> = serde_json::from_str(&local_var_content).ok();
1151        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1152        Err(Error::ResponseError(local_var_error))
1153    }
1154}
1155
1156/// Get a list of all objects that use this object
1157pub async fn core_authenticated_sessions_used_by_list(configuration: &configuration::Configuration, uuid: &str) -> Result<Vec<models::UsedBy>, Error<CoreAuthenticatedSessionsUsedByListError>> {
1158    let local_var_configuration = configuration;
1159
1160    let local_var_client = &local_var_configuration.client;
1161
1162    let local_var_uri_str = format!("{}/core/authenticated_sessions/{uuid}/used_by/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1163    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1164
1165    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1166        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1167    }
1168    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1169        let local_var_key = local_var_apikey.key.clone();
1170        let local_var_value = match local_var_apikey.prefix {
1171            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1172            None => local_var_key,
1173        };
1174        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1175    };
1176
1177    let local_var_req = local_var_req_builder.build()?;
1178    let local_var_resp = local_var_client.execute(local_var_req).await?;
1179
1180    let local_var_status = local_var_resp.status();
1181    let local_var_content = local_var_resp.text().await?;
1182
1183    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1184        serde_json::from_str(&local_var_content).map_err(Error::from)
1185    } else {
1186        let local_var_entity: Option<CoreAuthenticatedSessionsUsedByListError> = serde_json::from_str(&local_var_content).ok();
1187        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1188        Err(Error::ResponseError(local_var_error))
1189    }
1190}
1191
1192/// Brand Viewset
1193pub async fn core_brands_create(configuration: &configuration::Configuration, brand_request: models::BrandRequest) -> Result<models::Brand, Error<CoreBrandsCreateError>> {
1194    let local_var_configuration = configuration;
1195
1196    let local_var_client = &local_var_configuration.client;
1197
1198    let local_var_uri_str = format!("{}/core/brands/", local_var_configuration.base_path);
1199    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1200
1201    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1202        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1203    }
1204    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1205        let local_var_key = local_var_apikey.key.clone();
1206        let local_var_value = match local_var_apikey.prefix {
1207            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1208            None => local_var_key,
1209        };
1210        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1211    };
1212    local_var_req_builder = local_var_req_builder.json(&brand_request);
1213
1214    let local_var_req = local_var_req_builder.build()?;
1215    let local_var_resp = local_var_client.execute(local_var_req).await?;
1216
1217    let local_var_status = local_var_resp.status();
1218    let local_var_content = local_var_resp.text().await?;
1219
1220    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1221        serde_json::from_str(&local_var_content).map_err(Error::from)
1222    } else {
1223        let local_var_entity: Option<CoreBrandsCreateError> = serde_json::from_str(&local_var_content).ok();
1224        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1225        Err(Error::ResponseError(local_var_error))
1226    }
1227}
1228
1229/// Get current brand
1230pub async fn core_brands_current_retrieve(configuration: &configuration::Configuration, ) -> Result<models::CurrentBrand, Error<CoreBrandsCurrentRetrieveError>> {
1231    let local_var_configuration = configuration;
1232
1233    let local_var_client = &local_var_configuration.client;
1234
1235    let local_var_uri_str = format!("{}/core/brands/current/", local_var_configuration.base_path);
1236    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1237
1238    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1239        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1240    }
1241    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1242        let local_var_key = local_var_apikey.key.clone();
1243        let local_var_value = match local_var_apikey.prefix {
1244            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1245            None => local_var_key,
1246        };
1247        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1248    };
1249
1250    let local_var_req = local_var_req_builder.build()?;
1251    let local_var_resp = local_var_client.execute(local_var_req).await?;
1252
1253    let local_var_status = local_var_resp.status();
1254    let local_var_content = local_var_resp.text().await?;
1255
1256    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1257        serde_json::from_str(&local_var_content).map_err(Error::from)
1258    } else {
1259        let local_var_entity: Option<CoreBrandsCurrentRetrieveError> = serde_json::from_str(&local_var_content).ok();
1260        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1261        Err(Error::ResponseError(local_var_error))
1262    }
1263}
1264
1265/// Brand Viewset
1266pub async fn core_brands_destroy(configuration: &configuration::Configuration, brand_uuid: &str) -> Result<(), Error<CoreBrandsDestroyError>> {
1267    let local_var_configuration = configuration;
1268
1269    let local_var_client = &local_var_configuration.client;
1270
1271    let local_var_uri_str = format!("{}/core/brands/{brand_uuid}/", local_var_configuration.base_path, brand_uuid=crate::apis::urlencode(brand_uuid));
1272    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1273
1274    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1275        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1276    }
1277    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1278        let local_var_key = local_var_apikey.key.clone();
1279        let local_var_value = match local_var_apikey.prefix {
1280            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1281            None => local_var_key,
1282        };
1283        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1284    };
1285
1286    let local_var_req = local_var_req_builder.build()?;
1287    let local_var_resp = local_var_client.execute(local_var_req).await?;
1288
1289    let local_var_status = local_var_resp.status();
1290    let local_var_content = local_var_resp.text().await?;
1291
1292    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1293        Ok(())
1294    } else {
1295        let local_var_entity: Option<CoreBrandsDestroyError> = serde_json::from_str(&local_var_content).ok();
1296        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1297        Err(Error::ResponseError(local_var_error))
1298    }
1299}
1300
1301/// Brand Viewset
1302pub async fn core_brands_list(configuration: &configuration::Configuration, brand_uuid: Option<&str>, branding_favicon: Option<&str>, branding_logo: Option<&str>, branding_title: Option<&str>, default: Option<bool>, domain: Option<&str>, flow_authentication: Option<&str>, flow_device_code: Option<&str>, flow_invalidation: Option<&str>, flow_recovery: Option<&str>, flow_unenrollment: Option<&str>, flow_user_settings: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, web_certificate: Option<&str>) -> Result<models::PaginatedBrandList, Error<CoreBrandsListError>> {
1303    let local_var_configuration = configuration;
1304
1305    let local_var_client = &local_var_configuration.client;
1306
1307    let local_var_uri_str = format!("{}/core/brands/", local_var_configuration.base_path);
1308    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1309
1310    if let Some(ref local_var_str) = brand_uuid {
1311        local_var_req_builder = local_var_req_builder.query(&[("brand_uuid", &local_var_str.to_string())]);
1312    }
1313    if let Some(ref local_var_str) = branding_favicon {
1314        local_var_req_builder = local_var_req_builder.query(&[("branding_favicon", &local_var_str.to_string())]);
1315    }
1316    if let Some(ref local_var_str) = branding_logo {
1317        local_var_req_builder = local_var_req_builder.query(&[("branding_logo", &local_var_str.to_string())]);
1318    }
1319    if let Some(ref local_var_str) = branding_title {
1320        local_var_req_builder = local_var_req_builder.query(&[("branding_title", &local_var_str.to_string())]);
1321    }
1322    if let Some(ref local_var_str) = default {
1323        local_var_req_builder = local_var_req_builder.query(&[("default", &local_var_str.to_string())]);
1324    }
1325    if let Some(ref local_var_str) = domain {
1326        local_var_req_builder = local_var_req_builder.query(&[("domain", &local_var_str.to_string())]);
1327    }
1328    if let Some(ref local_var_str) = flow_authentication {
1329        local_var_req_builder = local_var_req_builder.query(&[("flow_authentication", &local_var_str.to_string())]);
1330    }
1331    if let Some(ref local_var_str) = flow_device_code {
1332        local_var_req_builder = local_var_req_builder.query(&[("flow_device_code", &local_var_str.to_string())]);
1333    }
1334    if let Some(ref local_var_str) = flow_invalidation {
1335        local_var_req_builder = local_var_req_builder.query(&[("flow_invalidation", &local_var_str.to_string())]);
1336    }
1337    if let Some(ref local_var_str) = flow_recovery {
1338        local_var_req_builder = local_var_req_builder.query(&[("flow_recovery", &local_var_str.to_string())]);
1339    }
1340    if let Some(ref local_var_str) = flow_unenrollment {
1341        local_var_req_builder = local_var_req_builder.query(&[("flow_unenrollment", &local_var_str.to_string())]);
1342    }
1343    if let Some(ref local_var_str) = flow_user_settings {
1344        local_var_req_builder = local_var_req_builder.query(&[("flow_user_settings", &local_var_str.to_string())]);
1345    }
1346    if let Some(ref local_var_str) = ordering {
1347        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1348    }
1349    if let Some(ref local_var_str) = page {
1350        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1351    }
1352    if let Some(ref local_var_str) = page_size {
1353        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1354    }
1355    if let Some(ref local_var_str) = search {
1356        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1357    }
1358    if let Some(ref local_var_str) = web_certificate {
1359        local_var_req_builder = local_var_req_builder.query(&[("web_certificate", &local_var_str.to_string())]);
1360    }
1361    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1362        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1363    }
1364    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1365        let local_var_key = local_var_apikey.key.clone();
1366        let local_var_value = match local_var_apikey.prefix {
1367            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1368            None => local_var_key,
1369        };
1370        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1371    };
1372
1373    let local_var_req = local_var_req_builder.build()?;
1374    let local_var_resp = local_var_client.execute(local_var_req).await?;
1375
1376    let local_var_status = local_var_resp.status();
1377    let local_var_content = local_var_resp.text().await?;
1378
1379    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1380        serde_json::from_str(&local_var_content).map_err(Error::from)
1381    } else {
1382        let local_var_entity: Option<CoreBrandsListError> = serde_json::from_str(&local_var_content).ok();
1383        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1384        Err(Error::ResponseError(local_var_error))
1385    }
1386}
1387
1388/// Brand Viewset
1389pub async fn core_brands_partial_update(configuration: &configuration::Configuration, brand_uuid: &str, patched_brand_request: Option<models::PatchedBrandRequest>) -> Result<models::Brand, Error<CoreBrandsPartialUpdateError>> {
1390    let local_var_configuration = configuration;
1391
1392    let local_var_client = &local_var_configuration.client;
1393
1394    let local_var_uri_str = format!("{}/core/brands/{brand_uuid}/", local_var_configuration.base_path, brand_uuid=crate::apis::urlencode(brand_uuid));
1395    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1396
1397    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1398        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1399    }
1400    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1401        let local_var_key = local_var_apikey.key.clone();
1402        let local_var_value = match local_var_apikey.prefix {
1403            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1404            None => local_var_key,
1405        };
1406        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1407    };
1408    local_var_req_builder = local_var_req_builder.json(&patched_brand_request);
1409
1410    let local_var_req = local_var_req_builder.build()?;
1411    let local_var_resp = local_var_client.execute(local_var_req).await?;
1412
1413    let local_var_status = local_var_resp.status();
1414    let local_var_content = local_var_resp.text().await?;
1415
1416    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1417        serde_json::from_str(&local_var_content).map_err(Error::from)
1418    } else {
1419        let local_var_entity: Option<CoreBrandsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1420        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1421        Err(Error::ResponseError(local_var_error))
1422    }
1423}
1424
1425/// Brand Viewset
1426pub async fn core_brands_retrieve(configuration: &configuration::Configuration, brand_uuid: &str) -> Result<models::Brand, Error<CoreBrandsRetrieveError>> {
1427    let local_var_configuration = configuration;
1428
1429    let local_var_client = &local_var_configuration.client;
1430
1431    let local_var_uri_str = format!("{}/core/brands/{brand_uuid}/", local_var_configuration.base_path, brand_uuid=crate::apis::urlencode(brand_uuid));
1432    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1433
1434    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1435        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1436    }
1437    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1438        let local_var_key = local_var_apikey.key.clone();
1439        let local_var_value = match local_var_apikey.prefix {
1440            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1441            None => local_var_key,
1442        };
1443        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1444    };
1445
1446    let local_var_req = local_var_req_builder.build()?;
1447    let local_var_resp = local_var_client.execute(local_var_req).await?;
1448
1449    let local_var_status = local_var_resp.status();
1450    let local_var_content = local_var_resp.text().await?;
1451
1452    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1453        serde_json::from_str(&local_var_content).map_err(Error::from)
1454    } else {
1455        let local_var_entity: Option<CoreBrandsRetrieveError> = serde_json::from_str(&local_var_content).ok();
1456        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1457        Err(Error::ResponseError(local_var_error))
1458    }
1459}
1460
1461/// Brand Viewset
1462pub async fn core_brands_update(configuration: &configuration::Configuration, brand_uuid: &str, brand_request: models::BrandRequest) -> Result<models::Brand, Error<CoreBrandsUpdateError>> {
1463    let local_var_configuration = configuration;
1464
1465    let local_var_client = &local_var_configuration.client;
1466
1467    let local_var_uri_str = format!("{}/core/brands/{brand_uuid}/", local_var_configuration.base_path, brand_uuid=crate::apis::urlencode(brand_uuid));
1468    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1469
1470    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1471        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1472    }
1473    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1474        let local_var_key = local_var_apikey.key.clone();
1475        let local_var_value = match local_var_apikey.prefix {
1476            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1477            None => local_var_key,
1478        };
1479        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1480    };
1481    local_var_req_builder = local_var_req_builder.json(&brand_request);
1482
1483    let local_var_req = local_var_req_builder.build()?;
1484    let local_var_resp = local_var_client.execute(local_var_req).await?;
1485
1486    let local_var_status = local_var_resp.status();
1487    let local_var_content = local_var_resp.text().await?;
1488
1489    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1490        serde_json::from_str(&local_var_content).map_err(Error::from)
1491    } else {
1492        let local_var_entity: Option<CoreBrandsUpdateError> = serde_json::from_str(&local_var_content).ok();
1493        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1494        Err(Error::ResponseError(local_var_error))
1495    }
1496}
1497
1498/// Get a list of all objects that use this object
1499pub async fn core_brands_used_by_list(configuration: &configuration::Configuration, brand_uuid: &str) -> Result<Vec<models::UsedBy>, Error<CoreBrandsUsedByListError>> {
1500    let local_var_configuration = configuration;
1501
1502    let local_var_client = &local_var_configuration.client;
1503
1504    let local_var_uri_str = format!("{}/core/brands/{brand_uuid}/used_by/", local_var_configuration.base_path, brand_uuid=crate::apis::urlencode(brand_uuid));
1505    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1506
1507    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1508        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1509    }
1510    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1511        let local_var_key = local_var_apikey.key.clone();
1512        let local_var_value = match local_var_apikey.prefix {
1513            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1514            None => local_var_key,
1515        };
1516        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1517    };
1518
1519    let local_var_req = local_var_req_builder.build()?;
1520    let local_var_resp = local_var_client.execute(local_var_req).await?;
1521
1522    let local_var_status = local_var_resp.status();
1523    let local_var_content = local_var_resp.text().await?;
1524
1525    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1526        serde_json::from_str(&local_var_content).map_err(Error::from)
1527    } else {
1528        let local_var_entity: Option<CoreBrandsUsedByListError> = serde_json::from_str(&local_var_content).ok();
1529        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1530        Err(Error::ResponseError(local_var_error))
1531    }
1532}
1533
1534/// Add user to group
1535pub async fn core_groups_add_user_create(configuration: &configuration::Configuration, group_uuid: &str, user_account_request: models::UserAccountRequest) -> Result<(), Error<CoreGroupsAddUserCreateError>> {
1536    let local_var_configuration = configuration;
1537
1538    let local_var_client = &local_var_configuration.client;
1539
1540    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/add_user/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1541    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1542
1543    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1544        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1545    }
1546    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1547        let local_var_key = local_var_apikey.key.clone();
1548        let local_var_value = match local_var_apikey.prefix {
1549            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1550            None => local_var_key,
1551        };
1552        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1553    };
1554    local_var_req_builder = local_var_req_builder.json(&user_account_request);
1555
1556    let local_var_req = local_var_req_builder.build()?;
1557    let local_var_resp = local_var_client.execute(local_var_req).await?;
1558
1559    let local_var_status = local_var_resp.status();
1560    let local_var_content = local_var_resp.text().await?;
1561
1562    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1563        Ok(())
1564    } else {
1565        let local_var_entity: Option<CoreGroupsAddUserCreateError> = serde_json::from_str(&local_var_content).ok();
1566        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1567        Err(Error::ResponseError(local_var_error))
1568    }
1569}
1570
1571/// Group Viewset
1572pub async fn core_groups_create(configuration: &configuration::Configuration, group_request: models::GroupRequest) -> Result<models::Group, Error<CoreGroupsCreateError>> {
1573    let local_var_configuration = configuration;
1574
1575    let local_var_client = &local_var_configuration.client;
1576
1577    let local_var_uri_str = format!("{}/core/groups/", local_var_configuration.base_path);
1578    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1579
1580    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1581        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1582    }
1583    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1584        let local_var_key = local_var_apikey.key.clone();
1585        let local_var_value = match local_var_apikey.prefix {
1586            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1587            None => local_var_key,
1588        };
1589        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1590    };
1591    local_var_req_builder = local_var_req_builder.json(&group_request);
1592
1593    let local_var_req = local_var_req_builder.build()?;
1594    let local_var_resp = local_var_client.execute(local_var_req).await?;
1595
1596    let local_var_status = local_var_resp.status();
1597    let local_var_content = local_var_resp.text().await?;
1598
1599    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1600        serde_json::from_str(&local_var_content).map_err(Error::from)
1601    } else {
1602        let local_var_entity: Option<CoreGroupsCreateError> = serde_json::from_str(&local_var_content).ok();
1603        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1604        Err(Error::ResponseError(local_var_error))
1605    }
1606}
1607
1608/// Group Viewset
1609pub async fn core_groups_destroy(configuration: &configuration::Configuration, group_uuid: &str) -> Result<(), Error<CoreGroupsDestroyError>> {
1610    let local_var_configuration = configuration;
1611
1612    let local_var_client = &local_var_configuration.client;
1613
1614    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1615    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1616
1617    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1618        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1619    }
1620    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1621        let local_var_key = local_var_apikey.key.clone();
1622        let local_var_value = match local_var_apikey.prefix {
1623            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1624            None => local_var_key,
1625        };
1626        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1627    };
1628
1629    let local_var_req = local_var_req_builder.build()?;
1630    let local_var_resp = local_var_client.execute(local_var_req).await?;
1631
1632    let local_var_status = local_var_resp.status();
1633    let local_var_content = local_var_resp.text().await?;
1634
1635    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1636        Ok(())
1637    } else {
1638        let local_var_entity: Option<CoreGroupsDestroyError> = serde_json::from_str(&local_var_content).ok();
1639        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1640        Err(Error::ResponseError(local_var_error))
1641    }
1642}
1643
1644/// Group Viewset
1645pub async fn core_groups_list(configuration: &configuration::Configuration, attributes: Option<&str>, is_superuser: Option<bool>, members_by_pk: Option<Vec<i32>>, members_by_username: Option<Vec<String>>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>) -> Result<models::PaginatedGroupList, Error<CoreGroupsListError>> {
1646    let local_var_configuration = configuration;
1647
1648    let local_var_client = &local_var_configuration.client;
1649
1650    let local_var_uri_str = format!("{}/core/groups/", local_var_configuration.base_path);
1651    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1652
1653    if let Some(ref local_var_str) = attributes {
1654        local_var_req_builder = local_var_req_builder.query(&[("attributes", &local_var_str.to_string())]);
1655    }
1656    if let Some(ref local_var_str) = is_superuser {
1657        local_var_req_builder = local_var_req_builder.query(&[("is_superuser", &local_var_str.to_string())]);
1658    }
1659    if let Some(ref local_var_str) = members_by_pk {
1660        local_var_req_builder = match "multi" {
1661            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("members_by_pk".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1662            _ => local_var_req_builder.query(&[("members_by_pk", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1663        };
1664    }
1665    if let Some(ref local_var_str) = members_by_username {
1666        local_var_req_builder = match "multi" {
1667            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("members_by_username".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1668            _ => local_var_req_builder.query(&[("members_by_username", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1669        };
1670    }
1671    if let Some(ref local_var_str) = name {
1672        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1673    }
1674    if let Some(ref local_var_str) = ordering {
1675        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1676    }
1677    if let Some(ref local_var_str) = page {
1678        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1679    }
1680    if let Some(ref local_var_str) = page_size {
1681        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1682    }
1683    if let Some(ref local_var_str) = search {
1684        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1685    }
1686    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1687        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1688    }
1689    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1690        let local_var_key = local_var_apikey.key.clone();
1691        let local_var_value = match local_var_apikey.prefix {
1692            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1693            None => local_var_key,
1694        };
1695        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1696    };
1697
1698    let local_var_req = local_var_req_builder.build()?;
1699    let local_var_resp = local_var_client.execute(local_var_req).await?;
1700
1701    let local_var_status = local_var_resp.status();
1702    let local_var_content = local_var_resp.text().await?;
1703
1704    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1705        serde_json::from_str(&local_var_content).map_err(Error::from)
1706    } else {
1707        let local_var_entity: Option<CoreGroupsListError> = serde_json::from_str(&local_var_content).ok();
1708        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1709        Err(Error::ResponseError(local_var_error))
1710    }
1711}
1712
1713/// Group Viewset
1714pub async fn core_groups_partial_update(configuration: &configuration::Configuration, group_uuid: &str, patched_group_request: Option<models::PatchedGroupRequest>) -> Result<models::Group, Error<CoreGroupsPartialUpdateError>> {
1715    let local_var_configuration = configuration;
1716
1717    let local_var_client = &local_var_configuration.client;
1718
1719    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1720    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1721
1722    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1723        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1724    }
1725    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1726        let local_var_key = local_var_apikey.key.clone();
1727        let local_var_value = match local_var_apikey.prefix {
1728            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1729            None => local_var_key,
1730        };
1731        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1732    };
1733    local_var_req_builder = local_var_req_builder.json(&patched_group_request);
1734
1735    let local_var_req = local_var_req_builder.build()?;
1736    let local_var_resp = local_var_client.execute(local_var_req).await?;
1737
1738    let local_var_status = local_var_resp.status();
1739    let local_var_content = local_var_resp.text().await?;
1740
1741    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1742        serde_json::from_str(&local_var_content).map_err(Error::from)
1743    } else {
1744        let local_var_entity: Option<CoreGroupsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1745        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1746        Err(Error::ResponseError(local_var_error))
1747    }
1748}
1749
1750/// Add user to group
1751pub async fn core_groups_remove_user_create(configuration: &configuration::Configuration, group_uuid: &str, user_account_request: models::UserAccountRequest) -> Result<(), Error<CoreGroupsRemoveUserCreateError>> {
1752    let local_var_configuration = configuration;
1753
1754    let local_var_client = &local_var_configuration.client;
1755
1756    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/remove_user/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1757    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1758
1759    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1760        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1761    }
1762    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1763        let local_var_key = local_var_apikey.key.clone();
1764        let local_var_value = match local_var_apikey.prefix {
1765            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1766            None => local_var_key,
1767        };
1768        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1769    };
1770    local_var_req_builder = local_var_req_builder.json(&user_account_request);
1771
1772    let local_var_req = local_var_req_builder.build()?;
1773    let local_var_resp = local_var_client.execute(local_var_req).await?;
1774
1775    let local_var_status = local_var_resp.status();
1776    let local_var_content = local_var_resp.text().await?;
1777
1778    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1779        Ok(())
1780    } else {
1781        let local_var_entity: Option<CoreGroupsRemoveUserCreateError> = serde_json::from_str(&local_var_content).ok();
1782        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1783        Err(Error::ResponseError(local_var_error))
1784    }
1785}
1786
1787/// Group Viewset
1788pub async fn core_groups_retrieve(configuration: &configuration::Configuration, group_uuid: &str) -> Result<models::Group, Error<CoreGroupsRetrieveError>> {
1789    let local_var_configuration = configuration;
1790
1791    let local_var_client = &local_var_configuration.client;
1792
1793    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1794    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1795
1796    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1797        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1798    }
1799    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1800        let local_var_key = local_var_apikey.key.clone();
1801        let local_var_value = match local_var_apikey.prefix {
1802            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1803            None => local_var_key,
1804        };
1805        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1806    };
1807
1808    let local_var_req = local_var_req_builder.build()?;
1809    let local_var_resp = local_var_client.execute(local_var_req).await?;
1810
1811    let local_var_status = local_var_resp.status();
1812    let local_var_content = local_var_resp.text().await?;
1813
1814    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1815        serde_json::from_str(&local_var_content).map_err(Error::from)
1816    } else {
1817        let local_var_entity: Option<CoreGroupsRetrieveError> = serde_json::from_str(&local_var_content).ok();
1818        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1819        Err(Error::ResponseError(local_var_error))
1820    }
1821}
1822
1823/// Group Viewset
1824pub async fn core_groups_update(configuration: &configuration::Configuration, group_uuid: &str, group_request: models::GroupRequest) -> Result<models::Group, Error<CoreGroupsUpdateError>> {
1825    let local_var_configuration = configuration;
1826
1827    let local_var_client = &local_var_configuration.client;
1828
1829    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1830    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1831
1832    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1833        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1834    }
1835    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1836        let local_var_key = local_var_apikey.key.clone();
1837        let local_var_value = match local_var_apikey.prefix {
1838            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1839            None => local_var_key,
1840        };
1841        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1842    };
1843    local_var_req_builder = local_var_req_builder.json(&group_request);
1844
1845    let local_var_req = local_var_req_builder.build()?;
1846    let local_var_resp = local_var_client.execute(local_var_req).await?;
1847
1848    let local_var_status = local_var_resp.status();
1849    let local_var_content = local_var_resp.text().await?;
1850
1851    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1852        serde_json::from_str(&local_var_content).map_err(Error::from)
1853    } else {
1854        let local_var_entity: Option<CoreGroupsUpdateError> = serde_json::from_str(&local_var_content).ok();
1855        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1856        Err(Error::ResponseError(local_var_error))
1857    }
1858}
1859
1860/// Get a list of all objects that use this object
1861pub async fn core_groups_used_by_list(configuration: &configuration::Configuration, group_uuid: &str) -> Result<Vec<models::UsedBy>, Error<CoreGroupsUsedByListError>> {
1862    let local_var_configuration = configuration;
1863
1864    let local_var_client = &local_var_configuration.client;
1865
1866    let local_var_uri_str = format!("{}/core/groups/{group_uuid}/used_by/", local_var_configuration.base_path, group_uuid=crate::apis::urlencode(group_uuid));
1867    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1868
1869    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1870        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1871    }
1872    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1873        let local_var_key = local_var_apikey.key.clone();
1874        let local_var_value = match local_var_apikey.prefix {
1875            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1876            None => local_var_key,
1877        };
1878        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1879    };
1880
1881    let local_var_req = local_var_req_builder.build()?;
1882    let local_var_resp = local_var_client.execute(local_var_req).await?;
1883
1884    let local_var_status = local_var_resp.status();
1885    let local_var_content = local_var_resp.text().await?;
1886
1887    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1888        serde_json::from_str(&local_var_content).map_err(Error::from)
1889    } else {
1890        let local_var_entity: Option<CoreGroupsUsedByListError> = serde_json::from_str(&local_var_content).ok();
1891        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1892        Err(Error::ResponseError(local_var_error))
1893    }
1894}
1895
1896/// Token Viewset
1897pub async fn core_tokens_create(configuration: &configuration::Configuration, token_request: models::TokenRequest) -> Result<models::Token, Error<CoreTokensCreateError>> {
1898    let local_var_configuration = configuration;
1899
1900    let local_var_client = &local_var_configuration.client;
1901
1902    let local_var_uri_str = format!("{}/core/tokens/", local_var_configuration.base_path);
1903    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1904
1905    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1906        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1907    }
1908    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1909        let local_var_key = local_var_apikey.key.clone();
1910        let local_var_value = match local_var_apikey.prefix {
1911            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1912            None => local_var_key,
1913        };
1914        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1915    };
1916    local_var_req_builder = local_var_req_builder.json(&token_request);
1917
1918    let local_var_req = local_var_req_builder.build()?;
1919    let local_var_resp = local_var_client.execute(local_var_req).await?;
1920
1921    let local_var_status = local_var_resp.status();
1922    let local_var_content = local_var_resp.text().await?;
1923
1924    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1925        serde_json::from_str(&local_var_content).map_err(Error::from)
1926    } else {
1927        let local_var_entity: Option<CoreTokensCreateError> = serde_json::from_str(&local_var_content).ok();
1928        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1929        Err(Error::ResponseError(local_var_error))
1930    }
1931}
1932
1933/// Token Viewset
1934pub async fn core_tokens_destroy(configuration: &configuration::Configuration, identifier: &str) -> Result<(), Error<CoreTokensDestroyError>> {
1935    let local_var_configuration = configuration;
1936
1937    let local_var_client = &local_var_configuration.client;
1938
1939    let local_var_uri_str = format!("{}/core/tokens/{identifier}/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
1940    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1941
1942    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1943        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1944    }
1945    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1946        let local_var_key = local_var_apikey.key.clone();
1947        let local_var_value = match local_var_apikey.prefix {
1948            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1949            None => local_var_key,
1950        };
1951        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1952    };
1953
1954    let local_var_req = local_var_req_builder.build()?;
1955    let local_var_resp = local_var_client.execute(local_var_req).await?;
1956
1957    let local_var_status = local_var_resp.status();
1958    let local_var_content = local_var_resp.text().await?;
1959
1960    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1961        Ok(())
1962    } else {
1963        let local_var_entity: Option<CoreTokensDestroyError> = serde_json::from_str(&local_var_content).ok();
1964        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1965        Err(Error::ResponseError(local_var_error))
1966    }
1967}
1968
1969/// Token Viewset
1970pub async fn core_tokens_list(configuration: &configuration::Configuration, description: Option<&str>, expires: Option<String>, expiring: Option<bool>, identifier: Option<&str>, intent: Option<&str>, managed: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, user__username: Option<&str>) -> Result<models::PaginatedTokenList, Error<CoreTokensListError>> {
1971    let local_var_configuration = configuration;
1972
1973    let local_var_client = &local_var_configuration.client;
1974
1975    let local_var_uri_str = format!("{}/core/tokens/", local_var_configuration.base_path);
1976    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1977
1978    if let Some(ref local_var_str) = description {
1979        local_var_req_builder = local_var_req_builder.query(&[("description", &local_var_str.to_string())]);
1980    }
1981    if let Some(ref local_var_str) = expires {
1982        local_var_req_builder = local_var_req_builder.query(&[("expires", &local_var_str.to_string())]);
1983    }
1984    if let Some(ref local_var_str) = expiring {
1985        local_var_req_builder = local_var_req_builder.query(&[("expiring", &local_var_str.to_string())]);
1986    }
1987    if let Some(ref local_var_str) = identifier {
1988        local_var_req_builder = local_var_req_builder.query(&[("identifier", &local_var_str.to_string())]);
1989    }
1990    if let Some(ref local_var_str) = intent {
1991        local_var_req_builder = local_var_req_builder.query(&[("intent", &local_var_str.to_string())]);
1992    }
1993    if let Some(ref local_var_str) = managed {
1994        local_var_req_builder = local_var_req_builder.query(&[("managed", &local_var_str.to_string())]);
1995    }
1996    if let Some(ref local_var_str) = ordering {
1997        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1998    }
1999    if let Some(ref local_var_str) = page {
2000        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2001    }
2002    if let Some(ref local_var_str) = page_size {
2003        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
2004    }
2005    if let Some(ref local_var_str) = search {
2006        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2007    }
2008    if let Some(ref local_var_str) = user__username {
2009        local_var_req_builder = local_var_req_builder.query(&[("user__username", &local_var_str.to_string())]);
2010    }
2011    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2012        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2013    }
2014    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2015        let local_var_key = local_var_apikey.key.clone();
2016        let local_var_value = match local_var_apikey.prefix {
2017            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2018            None => local_var_key,
2019        };
2020        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2021    };
2022
2023    let local_var_req = local_var_req_builder.build()?;
2024    let local_var_resp = local_var_client.execute(local_var_req).await?;
2025
2026    let local_var_status = local_var_resp.status();
2027    let local_var_content = local_var_resp.text().await?;
2028
2029    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2030        serde_json::from_str(&local_var_content).map_err(Error::from)
2031    } else {
2032        let local_var_entity: Option<CoreTokensListError> = serde_json::from_str(&local_var_content).ok();
2033        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2034        Err(Error::ResponseError(local_var_error))
2035    }
2036}
2037
2038/// Token Viewset
2039pub async fn core_tokens_partial_update(configuration: &configuration::Configuration, identifier: &str, patched_token_request: Option<models::PatchedTokenRequest>) -> Result<models::Token, Error<CoreTokensPartialUpdateError>> {
2040    let local_var_configuration = configuration;
2041
2042    let local_var_client = &local_var_configuration.client;
2043
2044    let local_var_uri_str = format!("{}/core/tokens/{identifier}/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
2045    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2046
2047    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2048        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2049    }
2050    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2051        let local_var_key = local_var_apikey.key.clone();
2052        let local_var_value = match local_var_apikey.prefix {
2053            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2054            None => local_var_key,
2055        };
2056        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2057    };
2058    local_var_req_builder = local_var_req_builder.json(&patched_token_request);
2059
2060    let local_var_req = local_var_req_builder.build()?;
2061    let local_var_resp = local_var_client.execute(local_var_req).await?;
2062
2063    let local_var_status = local_var_resp.status();
2064    let local_var_content = local_var_resp.text().await?;
2065
2066    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2067        serde_json::from_str(&local_var_content).map_err(Error::from)
2068    } else {
2069        let local_var_entity: Option<CoreTokensPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
2070        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2071        Err(Error::ResponseError(local_var_error))
2072    }
2073}
2074
2075/// Token Viewset
2076pub async fn core_tokens_retrieve(configuration: &configuration::Configuration, identifier: &str) -> Result<models::Token, Error<CoreTokensRetrieveError>> {
2077    let local_var_configuration = configuration;
2078
2079    let local_var_client = &local_var_configuration.client;
2080
2081    let local_var_uri_str = format!("{}/core/tokens/{identifier}/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
2082    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2083
2084    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2085        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2086    }
2087    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2088        let local_var_key = local_var_apikey.key.clone();
2089        let local_var_value = match local_var_apikey.prefix {
2090            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2091            None => local_var_key,
2092        };
2093        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2094    };
2095
2096    let local_var_req = local_var_req_builder.build()?;
2097    let local_var_resp = local_var_client.execute(local_var_req).await?;
2098
2099    let local_var_status = local_var_resp.status();
2100    let local_var_content = local_var_resp.text().await?;
2101
2102    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2103        serde_json::from_str(&local_var_content).map_err(Error::from)
2104    } else {
2105        let local_var_entity: Option<CoreTokensRetrieveError> = serde_json::from_str(&local_var_content).ok();
2106        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2107        Err(Error::ResponseError(local_var_error))
2108    }
2109}
2110
2111/// Set token key. Action is logged as event. `authentik_core.set_token_key` permission is required.
2112pub async fn core_tokens_set_key_create(configuration: &configuration::Configuration, identifier: &str, token_set_key_request: models::TokenSetKeyRequest) -> Result<(), Error<CoreTokensSetKeyCreateError>> {
2113    let local_var_configuration = configuration;
2114
2115    let local_var_client = &local_var_configuration.client;
2116
2117    let local_var_uri_str = format!("{}/core/tokens/{identifier}/set_key/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
2118    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2119
2120    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2121        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2122    }
2123    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2124        let local_var_key = local_var_apikey.key.clone();
2125        let local_var_value = match local_var_apikey.prefix {
2126            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2127            None => local_var_key,
2128        };
2129        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2130    };
2131    local_var_req_builder = local_var_req_builder.json(&token_set_key_request);
2132
2133    let local_var_req = local_var_req_builder.build()?;
2134    let local_var_resp = local_var_client.execute(local_var_req).await?;
2135
2136    let local_var_status = local_var_resp.status();
2137    let local_var_content = local_var_resp.text().await?;
2138
2139    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2140        Ok(())
2141    } else {
2142        let local_var_entity: Option<CoreTokensSetKeyCreateError> = serde_json::from_str(&local_var_content).ok();
2143        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2144        Err(Error::ResponseError(local_var_error))
2145    }
2146}
2147
2148/// Token Viewset
2149pub async fn core_tokens_update(configuration: &configuration::Configuration, identifier: &str, token_request: models::TokenRequest) -> Result<models::Token, Error<CoreTokensUpdateError>> {
2150    let local_var_configuration = configuration;
2151
2152    let local_var_client = &local_var_configuration.client;
2153
2154    let local_var_uri_str = format!("{}/core/tokens/{identifier}/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
2155    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2156
2157    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2158        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2159    }
2160    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2161        let local_var_key = local_var_apikey.key.clone();
2162        let local_var_value = match local_var_apikey.prefix {
2163            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2164            None => local_var_key,
2165        };
2166        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2167    };
2168    local_var_req_builder = local_var_req_builder.json(&token_request);
2169
2170    let local_var_req = local_var_req_builder.build()?;
2171    let local_var_resp = local_var_client.execute(local_var_req).await?;
2172
2173    let local_var_status = local_var_resp.status();
2174    let local_var_content = local_var_resp.text().await?;
2175
2176    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2177        serde_json::from_str(&local_var_content).map_err(Error::from)
2178    } else {
2179        let local_var_entity: Option<CoreTokensUpdateError> = serde_json::from_str(&local_var_content).ok();
2180        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2181        Err(Error::ResponseError(local_var_error))
2182    }
2183}
2184
2185/// Get a list of all objects that use this object
2186pub async fn core_tokens_used_by_list(configuration: &configuration::Configuration, identifier: &str) -> Result<Vec<models::UsedBy>, Error<CoreTokensUsedByListError>> {
2187    let local_var_configuration = configuration;
2188
2189    let local_var_client = &local_var_configuration.client;
2190
2191    let local_var_uri_str = format!("{}/core/tokens/{identifier}/used_by/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
2192    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2193
2194    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2195        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2196    }
2197    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2198        let local_var_key = local_var_apikey.key.clone();
2199        let local_var_value = match local_var_apikey.prefix {
2200            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2201            None => local_var_key,
2202        };
2203        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2204    };
2205
2206    let local_var_req = local_var_req_builder.build()?;
2207    let local_var_resp = local_var_client.execute(local_var_req).await?;
2208
2209    let local_var_status = local_var_resp.status();
2210    let local_var_content = local_var_resp.text().await?;
2211
2212    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2213        serde_json::from_str(&local_var_content).map_err(Error::from)
2214    } else {
2215        let local_var_entity: Option<CoreTokensUsedByListError> = serde_json::from_str(&local_var_content).ok();
2216        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2217        Err(Error::ResponseError(local_var_error))
2218    }
2219}
2220
2221/// Return token key and log access
2222pub async fn core_tokens_view_key_retrieve(configuration: &configuration::Configuration, identifier: &str) -> Result<models::TokenView, Error<CoreTokensViewKeyRetrieveError>> {
2223    let local_var_configuration = configuration;
2224
2225    let local_var_client = &local_var_configuration.client;
2226
2227    let local_var_uri_str = format!("{}/core/tokens/{identifier}/view_key/", local_var_configuration.base_path, identifier=crate::apis::urlencode(identifier));
2228    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2229
2230    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2231        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2232    }
2233    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2234        let local_var_key = local_var_apikey.key.clone();
2235        let local_var_value = match local_var_apikey.prefix {
2236            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2237            None => local_var_key,
2238        };
2239        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2240    };
2241
2242    let local_var_req = local_var_req_builder.build()?;
2243    let local_var_resp = local_var_client.execute(local_var_req).await?;
2244
2245    let local_var_status = local_var_resp.status();
2246    let local_var_content = local_var_resp.text().await?;
2247
2248    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2249        serde_json::from_str(&local_var_content).map_err(Error::from)
2250    } else {
2251        let local_var_entity: Option<CoreTokensViewKeyRetrieveError> = serde_json::from_str(&local_var_content).ok();
2252        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2253        Err(Error::ResponseError(local_var_error))
2254    }
2255}
2256
2257/// Convert data into a blueprint, validate it and apply it
2258pub async fn core_transactional_applications_update(configuration: &configuration::Configuration, transaction_application_request: models::TransactionApplicationRequest) -> Result<models::TransactionApplicationResponse, Error<CoreTransactionalApplicationsUpdateError>> {
2259    let local_var_configuration = configuration;
2260
2261    let local_var_client = &local_var_configuration.client;
2262
2263    let local_var_uri_str = format!("{}/core/transactional/applications/", local_var_configuration.base_path);
2264    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2265
2266    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2267        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2268    }
2269    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2270        let local_var_key = local_var_apikey.key.clone();
2271        let local_var_value = match local_var_apikey.prefix {
2272            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2273            None => local_var_key,
2274        };
2275        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2276    };
2277    local_var_req_builder = local_var_req_builder.json(&transaction_application_request);
2278
2279    let local_var_req = local_var_req_builder.build()?;
2280    let local_var_resp = local_var_client.execute(local_var_req).await?;
2281
2282    let local_var_status = local_var_resp.status();
2283    let local_var_content = local_var_resp.text().await?;
2284
2285    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2286        serde_json::from_str(&local_var_content).map_err(Error::from)
2287    } else {
2288        let local_var_entity: Option<CoreTransactionalApplicationsUpdateError> = serde_json::from_str(&local_var_content).ok();
2289        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2290        Err(Error::ResponseError(local_var_error))
2291    }
2292}
2293
2294/// UserConsent Viewset
2295pub async fn core_user_consent_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<CoreUserConsentDestroyError>> {
2296    let local_var_configuration = configuration;
2297
2298    let local_var_client = &local_var_configuration.client;
2299
2300    let local_var_uri_str = format!("{}/core/user_consent/{id}/", local_var_configuration.base_path, id=id);
2301    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2302
2303    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2304        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2305    }
2306    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2307        let local_var_key = local_var_apikey.key.clone();
2308        let local_var_value = match local_var_apikey.prefix {
2309            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2310            None => local_var_key,
2311        };
2312        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2313    };
2314
2315    let local_var_req = local_var_req_builder.build()?;
2316    let local_var_resp = local_var_client.execute(local_var_req).await?;
2317
2318    let local_var_status = local_var_resp.status();
2319    let local_var_content = local_var_resp.text().await?;
2320
2321    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2322        Ok(())
2323    } else {
2324        let local_var_entity: Option<CoreUserConsentDestroyError> = serde_json::from_str(&local_var_content).ok();
2325        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2326        Err(Error::ResponseError(local_var_error))
2327    }
2328}
2329
2330/// UserConsent Viewset
2331pub async fn core_user_consent_list(configuration: &configuration::Configuration, application: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, user: Option<i32>) -> Result<models::PaginatedUserConsentList, Error<CoreUserConsentListError>> {
2332    let local_var_configuration = configuration;
2333
2334    let local_var_client = &local_var_configuration.client;
2335
2336    let local_var_uri_str = format!("{}/core/user_consent/", local_var_configuration.base_path);
2337    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2338
2339    if let Some(ref local_var_str) = application {
2340        local_var_req_builder = local_var_req_builder.query(&[("application", &local_var_str.to_string())]);
2341    }
2342    if let Some(ref local_var_str) = ordering {
2343        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
2344    }
2345    if let Some(ref local_var_str) = page {
2346        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2347    }
2348    if let Some(ref local_var_str) = page_size {
2349        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
2350    }
2351    if let Some(ref local_var_str) = search {
2352        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2353    }
2354    if let Some(ref local_var_str) = user {
2355        local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
2356    }
2357    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2358        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2359    }
2360    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2361        let local_var_key = local_var_apikey.key.clone();
2362        let local_var_value = match local_var_apikey.prefix {
2363            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2364            None => local_var_key,
2365        };
2366        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2367    };
2368
2369    let local_var_req = local_var_req_builder.build()?;
2370    let local_var_resp = local_var_client.execute(local_var_req).await?;
2371
2372    let local_var_status = local_var_resp.status();
2373    let local_var_content = local_var_resp.text().await?;
2374
2375    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2376        serde_json::from_str(&local_var_content).map_err(Error::from)
2377    } else {
2378        let local_var_entity: Option<CoreUserConsentListError> = serde_json::from_str(&local_var_content).ok();
2379        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2380        Err(Error::ResponseError(local_var_error))
2381    }
2382}
2383
2384/// UserConsent Viewset
2385pub async fn core_user_consent_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::UserConsent, Error<CoreUserConsentRetrieveError>> {
2386    let local_var_configuration = configuration;
2387
2388    let local_var_client = &local_var_configuration.client;
2389
2390    let local_var_uri_str = format!("{}/core/user_consent/{id}/", local_var_configuration.base_path, id=id);
2391    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2392
2393    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2394        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2395    }
2396    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2397        let local_var_key = local_var_apikey.key.clone();
2398        let local_var_value = match local_var_apikey.prefix {
2399            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2400            None => local_var_key,
2401        };
2402        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2403    };
2404
2405    let local_var_req = local_var_req_builder.build()?;
2406    let local_var_resp = local_var_client.execute(local_var_req).await?;
2407
2408    let local_var_status = local_var_resp.status();
2409    let local_var_content = local_var_resp.text().await?;
2410
2411    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2412        serde_json::from_str(&local_var_content).map_err(Error::from)
2413    } else {
2414        let local_var_entity: Option<CoreUserConsentRetrieveError> = serde_json::from_str(&local_var_content).ok();
2415        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2416        Err(Error::ResponseError(local_var_error))
2417    }
2418}
2419
2420/// Get a list of all objects that use this object
2421pub async fn core_user_consent_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<CoreUserConsentUsedByListError>> {
2422    let local_var_configuration = configuration;
2423
2424    let local_var_client = &local_var_configuration.client;
2425
2426    let local_var_uri_str = format!("{}/core/user_consent/{id}/used_by/", local_var_configuration.base_path, id=id);
2427    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2428
2429    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2430        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2431    }
2432    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2433        let local_var_key = local_var_apikey.key.clone();
2434        let local_var_value = match local_var_apikey.prefix {
2435            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2436            None => local_var_key,
2437        };
2438        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2439    };
2440
2441    let local_var_req = local_var_req_builder.build()?;
2442    let local_var_resp = local_var_client.execute(local_var_req).await?;
2443
2444    let local_var_status = local_var_resp.status();
2445    let local_var_content = local_var_resp.text().await?;
2446
2447    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2448        serde_json::from_str(&local_var_content).map_err(Error::from)
2449    } else {
2450        let local_var_entity: Option<CoreUserConsentUsedByListError> = serde_json::from_str(&local_var_content).ok();
2451        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2452        Err(Error::ResponseError(local_var_error))
2453    }
2454}
2455
2456/// User Viewset
2457pub async fn core_users_create(configuration: &configuration::Configuration, user_request: models::UserRequest) -> Result<models::User, Error<CoreUsersCreateError>> {
2458    let local_var_configuration = configuration;
2459
2460    let local_var_client = &local_var_configuration.client;
2461
2462    let local_var_uri_str = format!("{}/core/users/", local_var_configuration.base_path);
2463    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2464
2465    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2466        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2467    }
2468    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2469        let local_var_key = local_var_apikey.key.clone();
2470        let local_var_value = match local_var_apikey.prefix {
2471            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2472            None => local_var_key,
2473        };
2474        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2475    };
2476    local_var_req_builder = local_var_req_builder.json(&user_request);
2477
2478    let local_var_req = local_var_req_builder.build()?;
2479    let local_var_resp = local_var_client.execute(local_var_req).await?;
2480
2481    let local_var_status = local_var_resp.status();
2482    let local_var_content = local_var_resp.text().await?;
2483
2484    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2485        serde_json::from_str(&local_var_content).map_err(Error::from)
2486    } else {
2487        let local_var_entity: Option<CoreUsersCreateError> = serde_json::from_str(&local_var_content).ok();
2488        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2489        Err(Error::ResponseError(local_var_error))
2490    }
2491}
2492
2493/// User Viewset
2494pub async fn core_users_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<CoreUsersDestroyError>> {
2495    let local_var_configuration = configuration;
2496
2497    let local_var_client = &local_var_configuration.client;
2498
2499    let local_var_uri_str = format!("{}/core/users/{id}/", local_var_configuration.base_path, id=id);
2500    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2501
2502    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2503        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2504    }
2505    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2506        let local_var_key = local_var_apikey.key.clone();
2507        let local_var_value = match local_var_apikey.prefix {
2508            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2509            None => local_var_key,
2510        };
2511        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2512    };
2513
2514    let local_var_req = local_var_req_builder.build()?;
2515    let local_var_resp = local_var_client.execute(local_var_req).await?;
2516
2517    let local_var_status = local_var_resp.status();
2518    let local_var_content = local_var_resp.text().await?;
2519
2520    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2521        Ok(())
2522    } else {
2523        let local_var_entity: Option<CoreUsersDestroyError> = serde_json::from_str(&local_var_content).ok();
2524        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2525        Err(Error::ResponseError(local_var_error))
2526    }
2527}
2528
2529/// Impersonate a user
2530pub async fn core_users_impersonate_create(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<CoreUsersImpersonateCreateError>> {
2531    let local_var_configuration = configuration;
2532
2533    let local_var_client = &local_var_configuration.client;
2534
2535    let local_var_uri_str = format!("{}/core/users/{id}/impersonate/", local_var_configuration.base_path, id=id);
2536    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2537
2538    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2539        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2540    }
2541    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2542        let local_var_key = local_var_apikey.key.clone();
2543        let local_var_value = match local_var_apikey.prefix {
2544            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2545            None => local_var_key,
2546        };
2547        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2548    };
2549
2550    let local_var_req = local_var_req_builder.build()?;
2551    let local_var_resp = local_var_client.execute(local_var_req).await?;
2552
2553    let local_var_status = local_var_resp.status();
2554    let local_var_content = local_var_resp.text().await?;
2555
2556    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2557        Ok(())
2558    } else {
2559        let local_var_entity: Option<CoreUsersImpersonateCreateError> = serde_json::from_str(&local_var_content).ok();
2560        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2561        Err(Error::ResponseError(local_var_error))
2562    }
2563}
2564
2565/// End Impersonation a user
2566pub async fn core_users_impersonate_end_retrieve(configuration: &configuration::Configuration, ) -> Result<(), Error<CoreUsersImpersonateEndRetrieveError>> {
2567    let local_var_configuration = configuration;
2568
2569    let local_var_client = &local_var_configuration.client;
2570
2571    let local_var_uri_str = format!("{}/core/users/impersonate_end/", local_var_configuration.base_path);
2572    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2573
2574    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2575        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2576    }
2577    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2578        let local_var_key = local_var_apikey.key.clone();
2579        let local_var_value = match local_var_apikey.prefix {
2580            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2581            None => local_var_key,
2582        };
2583        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2584    };
2585
2586    let local_var_req = local_var_req_builder.build()?;
2587    let local_var_resp = local_var_client.execute(local_var_req).await?;
2588
2589    let local_var_status = local_var_resp.status();
2590    let local_var_content = local_var_resp.text().await?;
2591
2592    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2593        Ok(())
2594    } else {
2595        let local_var_entity: Option<CoreUsersImpersonateEndRetrieveError> = serde_json::from_str(&local_var_content).ok();
2596        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2597        Err(Error::ResponseError(local_var_error))
2598    }
2599}
2600
2601/// User Viewset
2602pub async fn core_users_list(configuration: &configuration::Configuration, attributes: Option<&str>, email: Option<&str>, groups_by_name: Option<Vec<String>>, groups_by_pk: Option<Vec<uuid::Uuid>>, is_active: Option<bool>, is_superuser: Option<bool>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, path: Option<&str>, path_startswith: Option<&str>, search: Option<&str>, r#type: Option<Vec<String>>, username: Option<&str>, uuid: Option<&str>) -> Result<models::PaginatedUserList, Error<CoreUsersListError>> {
2603    let local_var_configuration = configuration;
2604
2605    let local_var_client = &local_var_configuration.client;
2606
2607    let local_var_uri_str = format!("{}/core/users/", local_var_configuration.base_path);
2608    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2609
2610    if let Some(ref local_var_str) = attributes {
2611        local_var_req_builder = local_var_req_builder.query(&[("attributes", &local_var_str.to_string())]);
2612    }
2613    if let Some(ref local_var_str) = email {
2614        local_var_req_builder = local_var_req_builder.query(&[("email", &local_var_str.to_string())]);
2615    }
2616    if let Some(ref local_var_str) = groups_by_name {
2617        local_var_req_builder = match "multi" {
2618            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("groups_by_name".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
2619            _ => local_var_req_builder.query(&[("groups_by_name", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
2620        };
2621    }
2622    if let Some(ref local_var_str) = groups_by_pk {
2623        local_var_req_builder = match "multi" {
2624            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("groups_by_pk".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
2625            _ => local_var_req_builder.query(&[("groups_by_pk", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
2626        };
2627    }
2628    if let Some(ref local_var_str) = is_active {
2629        local_var_req_builder = local_var_req_builder.query(&[("is_active", &local_var_str.to_string())]);
2630    }
2631    if let Some(ref local_var_str) = is_superuser {
2632        local_var_req_builder = local_var_req_builder.query(&[("is_superuser", &local_var_str.to_string())]);
2633    }
2634    if let Some(ref local_var_str) = name {
2635        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
2636    }
2637    if let Some(ref local_var_str) = ordering {
2638        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
2639    }
2640    if let Some(ref local_var_str) = page {
2641        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2642    }
2643    if let Some(ref local_var_str) = page_size {
2644        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
2645    }
2646    if let Some(ref local_var_str) = path {
2647        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
2648    }
2649    if let Some(ref local_var_str) = path_startswith {
2650        local_var_req_builder = local_var_req_builder.query(&[("path_startswith", &local_var_str.to_string())]);
2651    }
2652    if let Some(ref local_var_str) = search {
2653        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2654    }
2655    if let Some(ref local_var_str) = r#type {
2656        local_var_req_builder = match "multi" {
2657            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
2658            _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
2659        };
2660    }
2661    if let Some(ref local_var_str) = username {
2662        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
2663    }
2664    if let Some(ref local_var_str) = uuid {
2665        local_var_req_builder = local_var_req_builder.query(&[("uuid", &local_var_str.to_string())]);
2666    }
2667    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2668        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2669    }
2670    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2671        let local_var_key = local_var_apikey.key.clone();
2672        let local_var_value = match local_var_apikey.prefix {
2673            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2674            None => local_var_key,
2675        };
2676        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2677    };
2678
2679    let local_var_req = local_var_req_builder.build()?;
2680    let local_var_resp = local_var_client.execute(local_var_req).await?;
2681
2682    let local_var_status = local_var_resp.status();
2683    let local_var_content = local_var_resp.text().await?;
2684
2685    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2686        serde_json::from_str(&local_var_content).map_err(Error::from)
2687    } else {
2688        let local_var_entity: Option<CoreUsersListError> = serde_json::from_str(&local_var_content).ok();
2689        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2690        Err(Error::ResponseError(local_var_error))
2691    }
2692}
2693
2694/// Get information about current user
2695pub async fn core_users_me_retrieve(configuration: &configuration::Configuration, ) -> Result<models::SessionUser, Error<CoreUsersMeRetrieveError>> {
2696    let local_var_configuration = configuration;
2697
2698    let local_var_client = &local_var_configuration.client;
2699
2700    let local_var_uri_str = format!("{}/core/users/me/", local_var_configuration.base_path);
2701    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2702
2703    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2704        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2705    }
2706    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2707        let local_var_key = local_var_apikey.key.clone();
2708        let local_var_value = match local_var_apikey.prefix {
2709            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2710            None => local_var_key,
2711        };
2712        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2713    };
2714
2715    let local_var_req = local_var_req_builder.build()?;
2716    let local_var_resp = local_var_client.execute(local_var_req).await?;
2717
2718    let local_var_status = local_var_resp.status();
2719    let local_var_content = local_var_resp.text().await?;
2720
2721    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2722        serde_json::from_str(&local_var_content).map_err(Error::from)
2723    } else {
2724        let local_var_entity: Option<CoreUsersMeRetrieveError> = serde_json::from_str(&local_var_content).ok();
2725        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2726        Err(Error::ResponseError(local_var_error))
2727    }
2728}
2729
2730/// User metrics per 1h
2731pub async fn core_users_metrics_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::UserMetrics, Error<CoreUsersMetricsRetrieveError>> {
2732    let local_var_configuration = configuration;
2733
2734    let local_var_client = &local_var_configuration.client;
2735
2736    let local_var_uri_str = format!("{}/core/users/{id}/metrics/", local_var_configuration.base_path, id=id);
2737    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2738
2739    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2740        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2741    }
2742    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2743        let local_var_key = local_var_apikey.key.clone();
2744        let local_var_value = match local_var_apikey.prefix {
2745            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2746            None => local_var_key,
2747        };
2748        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2749    };
2750
2751    let local_var_req = local_var_req_builder.build()?;
2752    let local_var_resp = local_var_client.execute(local_var_req).await?;
2753
2754    let local_var_status = local_var_resp.status();
2755    let local_var_content = local_var_resp.text().await?;
2756
2757    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2758        serde_json::from_str(&local_var_content).map_err(Error::from)
2759    } else {
2760        let local_var_entity: Option<CoreUsersMetricsRetrieveError> = serde_json::from_str(&local_var_content).ok();
2761        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2762        Err(Error::ResponseError(local_var_error))
2763    }
2764}
2765
2766/// User Viewset
2767pub async fn core_users_partial_update(configuration: &configuration::Configuration, id: i32, patched_user_request: Option<models::PatchedUserRequest>) -> Result<models::User, Error<CoreUsersPartialUpdateError>> {
2768    let local_var_configuration = configuration;
2769
2770    let local_var_client = &local_var_configuration.client;
2771
2772    let local_var_uri_str = format!("{}/core/users/{id}/", local_var_configuration.base_path, id=id);
2773    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
2774
2775    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2776        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2777    }
2778    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2779        let local_var_key = local_var_apikey.key.clone();
2780        let local_var_value = match local_var_apikey.prefix {
2781            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2782            None => local_var_key,
2783        };
2784        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2785    };
2786    local_var_req_builder = local_var_req_builder.json(&patched_user_request);
2787
2788    let local_var_req = local_var_req_builder.build()?;
2789    let local_var_resp = local_var_client.execute(local_var_req).await?;
2790
2791    let local_var_status = local_var_resp.status();
2792    let local_var_content = local_var_resp.text().await?;
2793
2794    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2795        serde_json::from_str(&local_var_content).map_err(Error::from)
2796    } else {
2797        let local_var_entity: Option<CoreUsersPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
2798        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2799        Err(Error::ResponseError(local_var_error))
2800    }
2801}
2802
2803/// Get all user paths
2804pub async fn core_users_paths_retrieve(configuration: &configuration::Configuration, search: Option<&str>) -> Result<models::UserPath, Error<CoreUsersPathsRetrieveError>> {
2805    let local_var_configuration = configuration;
2806
2807    let local_var_client = &local_var_configuration.client;
2808
2809    let local_var_uri_str = format!("{}/core/users/paths/", local_var_configuration.base_path);
2810    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2811
2812    if let Some(ref local_var_str) = search {
2813        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
2814    }
2815    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2816        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2817    }
2818    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2819        let local_var_key = local_var_apikey.key.clone();
2820        let local_var_value = match local_var_apikey.prefix {
2821            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2822            None => local_var_key,
2823        };
2824        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2825    };
2826
2827    let local_var_req = local_var_req_builder.build()?;
2828    let local_var_resp = local_var_client.execute(local_var_req).await?;
2829
2830    let local_var_status = local_var_resp.status();
2831    let local_var_content = local_var_resp.text().await?;
2832
2833    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2834        serde_json::from_str(&local_var_content).map_err(Error::from)
2835    } else {
2836        let local_var_entity: Option<CoreUsersPathsRetrieveError> = serde_json::from_str(&local_var_content).ok();
2837        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2838        Err(Error::ResponseError(local_var_error))
2839    }
2840}
2841
2842/// Create a temporary link that a user can use to recover their accounts
2843pub async fn core_users_recovery_create(configuration: &configuration::Configuration, id: i32) -> Result<models::Link, Error<CoreUsersRecoveryCreateError>> {
2844    let local_var_configuration = configuration;
2845
2846    let local_var_client = &local_var_configuration.client;
2847
2848    let local_var_uri_str = format!("{}/core/users/{id}/recovery/", local_var_configuration.base_path, id=id);
2849    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2850
2851    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2852        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2853    }
2854    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2855        let local_var_key = local_var_apikey.key.clone();
2856        let local_var_value = match local_var_apikey.prefix {
2857            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2858            None => local_var_key,
2859        };
2860        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2861    };
2862
2863    let local_var_req = local_var_req_builder.build()?;
2864    let local_var_resp = local_var_client.execute(local_var_req).await?;
2865
2866    let local_var_status = local_var_resp.status();
2867    let local_var_content = local_var_resp.text().await?;
2868
2869    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2870        serde_json::from_str(&local_var_content).map_err(Error::from)
2871    } else {
2872        let local_var_entity: Option<CoreUsersRecoveryCreateError> = serde_json::from_str(&local_var_content).ok();
2873        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2874        Err(Error::ResponseError(local_var_error))
2875    }
2876}
2877
2878/// Create a temporary link that a user can use to recover their accounts
2879pub async fn core_users_recovery_email_create(configuration: &configuration::Configuration, email_stage: &str, id: i32) -> Result<(), Error<CoreUsersRecoveryEmailCreateError>> {
2880    let local_var_configuration = configuration;
2881
2882    let local_var_client = &local_var_configuration.client;
2883
2884    let local_var_uri_str = format!("{}/core/users/{id}/recovery_email/", local_var_configuration.base_path, id=id);
2885    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2886
2887    local_var_req_builder = local_var_req_builder.query(&[("email_stage", &email_stage.to_string())]);
2888    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2889        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2890    }
2891    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2892        let local_var_key = local_var_apikey.key.clone();
2893        let local_var_value = match local_var_apikey.prefix {
2894            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2895            None => local_var_key,
2896        };
2897        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2898    };
2899
2900    let local_var_req = local_var_req_builder.build()?;
2901    let local_var_resp = local_var_client.execute(local_var_req).await?;
2902
2903    let local_var_status = local_var_resp.status();
2904    let local_var_content = local_var_resp.text().await?;
2905
2906    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2907        Ok(())
2908    } else {
2909        let local_var_entity: Option<CoreUsersRecoveryEmailCreateError> = serde_json::from_str(&local_var_content).ok();
2910        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2911        Err(Error::ResponseError(local_var_error))
2912    }
2913}
2914
2915/// User Viewset
2916pub async fn core_users_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::User, Error<CoreUsersRetrieveError>> {
2917    let local_var_configuration = configuration;
2918
2919    let local_var_client = &local_var_configuration.client;
2920
2921    let local_var_uri_str = format!("{}/core/users/{id}/", local_var_configuration.base_path, id=id);
2922    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2923
2924    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2925        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2926    }
2927    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2928        let local_var_key = local_var_apikey.key.clone();
2929        let local_var_value = match local_var_apikey.prefix {
2930            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2931            None => local_var_key,
2932        };
2933        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2934    };
2935
2936    let local_var_req = local_var_req_builder.build()?;
2937    let local_var_resp = local_var_client.execute(local_var_req).await?;
2938
2939    let local_var_status = local_var_resp.status();
2940    let local_var_content = local_var_resp.text().await?;
2941
2942    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2943        serde_json::from_str(&local_var_content).map_err(Error::from)
2944    } else {
2945        let local_var_entity: Option<CoreUsersRetrieveError> = serde_json::from_str(&local_var_content).ok();
2946        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2947        Err(Error::ResponseError(local_var_error))
2948    }
2949}
2950
2951/// Create a new user account that is marked as a service account
2952pub async fn core_users_service_account_create(configuration: &configuration::Configuration, user_service_account_request: models::UserServiceAccountRequest) -> Result<models::UserServiceAccountResponse, Error<CoreUsersServiceAccountCreateError>> {
2953    let local_var_configuration = configuration;
2954
2955    let local_var_client = &local_var_configuration.client;
2956
2957    let local_var_uri_str = format!("{}/core/users/service_account/", local_var_configuration.base_path);
2958    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2959
2960    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2961        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2962    }
2963    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
2964        let local_var_key = local_var_apikey.key.clone();
2965        let local_var_value = match local_var_apikey.prefix {
2966            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
2967            None => local_var_key,
2968        };
2969        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
2970    };
2971    local_var_req_builder = local_var_req_builder.json(&user_service_account_request);
2972
2973    let local_var_req = local_var_req_builder.build()?;
2974    let local_var_resp = local_var_client.execute(local_var_req).await?;
2975
2976    let local_var_status = local_var_resp.status();
2977    let local_var_content = local_var_resp.text().await?;
2978
2979    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2980        serde_json::from_str(&local_var_content).map_err(Error::from)
2981    } else {
2982        let local_var_entity: Option<CoreUsersServiceAccountCreateError> = serde_json::from_str(&local_var_content).ok();
2983        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2984        Err(Error::ResponseError(local_var_error))
2985    }
2986}
2987
2988/// Set password for user
2989pub async fn core_users_set_password_create(configuration: &configuration::Configuration, id: i32, user_password_set_request: models::UserPasswordSetRequest) -> Result<(), Error<CoreUsersSetPasswordCreateError>> {
2990    let local_var_configuration = configuration;
2991
2992    let local_var_client = &local_var_configuration.client;
2993
2994    let local_var_uri_str = format!("{}/core/users/{id}/set_password/", local_var_configuration.base_path, id=id);
2995    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2996
2997    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2998        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2999    }
3000    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3001        let local_var_key = local_var_apikey.key.clone();
3002        let local_var_value = match local_var_apikey.prefix {
3003            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3004            None => local_var_key,
3005        };
3006        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3007    };
3008    local_var_req_builder = local_var_req_builder.json(&user_password_set_request);
3009
3010    let local_var_req = local_var_req_builder.build()?;
3011    let local_var_resp = local_var_client.execute(local_var_req).await?;
3012
3013    let local_var_status = local_var_resp.status();
3014    let local_var_content = local_var_resp.text().await?;
3015
3016    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3017        Ok(())
3018    } else {
3019        let local_var_entity: Option<CoreUsersSetPasswordCreateError> = serde_json::from_str(&local_var_content).ok();
3020        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3021        Err(Error::ResponseError(local_var_error))
3022    }
3023}
3024
3025/// User Viewset
3026pub async fn core_users_update(configuration: &configuration::Configuration, id: i32, user_request: models::UserRequest) -> Result<models::User, Error<CoreUsersUpdateError>> {
3027    let local_var_configuration = configuration;
3028
3029    let local_var_client = &local_var_configuration.client;
3030
3031    let local_var_uri_str = format!("{}/core/users/{id}/", local_var_configuration.base_path, id=id);
3032    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3033
3034    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3035        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3036    }
3037    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3038        let local_var_key = local_var_apikey.key.clone();
3039        let local_var_value = match local_var_apikey.prefix {
3040            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3041            None => local_var_key,
3042        };
3043        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3044    };
3045    local_var_req_builder = local_var_req_builder.json(&user_request);
3046
3047    let local_var_req = local_var_req_builder.build()?;
3048    let local_var_resp = local_var_client.execute(local_var_req).await?;
3049
3050    let local_var_status = local_var_resp.status();
3051    let local_var_content = local_var_resp.text().await?;
3052
3053    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3054        serde_json::from_str(&local_var_content).map_err(Error::from)
3055    } else {
3056        let local_var_entity: Option<CoreUsersUpdateError> = serde_json::from_str(&local_var_content).ok();
3057        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3058        Err(Error::ResponseError(local_var_error))
3059    }
3060}
3061
3062/// Get a list of all objects that use this object
3063pub async fn core_users_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<CoreUsersUsedByListError>> {
3064    let local_var_configuration = configuration;
3065
3066    let local_var_client = &local_var_configuration.client;
3067
3068    let local_var_uri_str = format!("{}/core/users/{id}/used_by/", local_var_configuration.base_path, id=id);
3069    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3070
3071    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3072        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3073    }
3074    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3075        let local_var_key = local_var_apikey.key.clone();
3076        let local_var_value = match local_var_apikey.prefix {
3077            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
3078            None => local_var_key,
3079        };
3080        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
3081    };
3082
3083    let local_var_req = local_var_req_builder.build()?;
3084    let local_var_resp = local_var_client.execute(local_var_req).await?;
3085
3086    let local_var_status = local_var_resp.status();
3087    let local_var_content = local_var_resp.text().await?;
3088
3089    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3090        serde_json::from_str(&local_var_content).map_err(Error::from)
3091    } else {
3092        let local_var_entity: Option<CoreUsersUsedByListError> = serde_json::from_str(&local_var_content).ok();
3093        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3094        Err(Error::ResponseError(local_var_error))
3095    }
3096}
3097