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