Skip to main content

authentik_client/apis/
authenticators_api.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.12.4
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for typed errors of method [`authenticators_admin_all_list`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum AuthenticatorsAdminAllListError {
20    Status400(models::ValidationError),
21    Status403(models::GenericError),
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`authenticators_admin_duo_create`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum AuthenticatorsAdminDuoCreateError {
29    Status400(models::ValidationError),
30    Status403(models::GenericError),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`authenticators_admin_duo_destroy`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum AuthenticatorsAdminDuoDestroyError {
38    Status400(models::ValidationError),
39    Status403(models::GenericError),
40    UnknownValue(serde_json::Value),
41}
42
43/// struct for typed errors of method [`authenticators_admin_duo_list`]
44#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum AuthenticatorsAdminDuoListError {
47    Status400(models::ValidationError),
48    Status403(models::GenericError),
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`authenticators_admin_duo_partial_update`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum AuthenticatorsAdminDuoPartialUpdateError {
56    Status400(models::ValidationError),
57    Status403(models::GenericError),
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`authenticators_admin_duo_retrieve`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum AuthenticatorsAdminDuoRetrieveError {
65    Status400(models::ValidationError),
66    Status403(models::GenericError),
67    UnknownValue(serde_json::Value),
68}
69
70/// struct for typed errors of method [`authenticators_admin_duo_update`]
71#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum AuthenticatorsAdminDuoUpdateError {
74    Status400(models::ValidationError),
75    Status403(models::GenericError),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`authenticators_admin_email_create`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum AuthenticatorsAdminEmailCreateError {
83    Status400(models::ValidationError),
84    Status403(models::GenericError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`authenticators_admin_email_destroy`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum AuthenticatorsAdminEmailDestroyError {
92    Status400(models::ValidationError),
93    Status403(models::GenericError),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`authenticators_admin_email_list`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum AuthenticatorsAdminEmailListError {
101    Status400(models::ValidationError),
102    Status403(models::GenericError),
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`authenticators_admin_email_partial_update`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum AuthenticatorsAdminEmailPartialUpdateError {
110    Status400(models::ValidationError),
111    Status403(models::GenericError),
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`authenticators_admin_email_retrieve`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum AuthenticatorsAdminEmailRetrieveError {
119    Status400(models::ValidationError),
120    Status403(models::GenericError),
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`authenticators_admin_email_update`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum AuthenticatorsAdminEmailUpdateError {
128    Status400(models::ValidationError),
129    Status403(models::GenericError),
130    UnknownValue(serde_json::Value),
131}
132
133/// struct for typed errors of method [`authenticators_admin_endpoint_create`]
134#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum AuthenticatorsAdminEndpointCreateError {
137    Status400(models::ValidationError),
138    Status403(models::GenericError),
139    UnknownValue(serde_json::Value),
140}
141
142/// struct for typed errors of method [`authenticators_admin_endpoint_destroy`]
143#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum AuthenticatorsAdminEndpointDestroyError {
146    Status400(models::ValidationError),
147    Status403(models::GenericError),
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`authenticators_admin_endpoint_list`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum AuthenticatorsAdminEndpointListError {
155    Status400(models::ValidationError),
156    Status403(models::GenericError),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`authenticators_admin_endpoint_partial_update`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum AuthenticatorsAdminEndpointPartialUpdateError {
164    Status400(models::ValidationError),
165    Status403(models::GenericError),
166    UnknownValue(serde_json::Value),
167}
168
169/// struct for typed errors of method [`authenticators_admin_endpoint_retrieve`]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum AuthenticatorsAdminEndpointRetrieveError {
173    Status400(models::ValidationError),
174    Status403(models::GenericError),
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`authenticators_admin_endpoint_update`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum AuthenticatorsAdminEndpointUpdateError {
182    Status400(models::ValidationError),
183    Status403(models::GenericError),
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`authenticators_admin_sms_create`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum AuthenticatorsAdminSmsCreateError {
191    Status400(models::ValidationError),
192    Status403(models::GenericError),
193    UnknownValue(serde_json::Value),
194}
195
196/// struct for typed errors of method [`authenticators_admin_sms_destroy`]
197#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum AuthenticatorsAdminSmsDestroyError {
200    Status400(models::ValidationError),
201    Status403(models::GenericError),
202    UnknownValue(serde_json::Value),
203}
204
205/// struct for typed errors of method [`authenticators_admin_sms_list`]
206#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum AuthenticatorsAdminSmsListError {
209    Status400(models::ValidationError),
210    Status403(models::GenericError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`authenticators_admin_sms_partial_update`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum AuthenticatorsAdminSmsPartialUpdateError {
218    Status400(models::ValidationError),
219    Status403(models::GenericError),
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`authenticators_admin_sms_retrieve`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum AuthenticatorsAdminSmsRetrieveError {
227    Status400(models::ValidationError),
228    Status403(models::GenericError),
229    UnknownValue(serde_json::Value),
230}
231
232/// struct for typed errors of method [`authenticators_admin_sms_update`]
233#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum AuthenticatorsAdminSmsUpdateError {
236    Status400(models::ValidationError),
237    Status403(models::GenericError),
238    UnknownValue(serde_json::Value),
239}
240
241/// struct for typed errors of method [`authenticators_admin_static_create`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum AuthenticatorsAdminStaticCreateError {
245    Status400(models::ValidationError),
246    Status403(models::GenericError),
247    UnknownValue(serde_json::Value),
248}
249
250/// struct for typed errors of method [`authenticators_admin_static_destroy`]
251#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum AuthenticatorsAdminStaticDestroyError {
254    Status400(models::ValidationError),
255    Status403(models::GenericError),
256    UnknownValue(serde_json::Value),
257}
258
259/// struct for typed errors of method [`authenticators_admin_static_list`]
260#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum AuthenticatorsAdminStaticListError {
263    Status400(models::ValidationError),
264    Status403(models::GenericError),
265    UnknownValue(serde_json::Value),
266}
267
268/// struct for typed errors of method [`authenticators_admin_static_partial_update`]
269#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum AuthenticatorsAdminStaticPartialUpdateError {
272    Status400(models::ValidationError),
273    Status403(models::GenericError),
274    UnknownValue(serde_json::Value),
275}
276
277/// struct for typed errors of method [`authenticators_admin_static_retrieve`]
278#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum AuthenticatorsAdminStaticRetrieveError {
281    Status400(models::ValidationError),
282    Status403(models::GenericError),
283    UnknownValue(serde_json::Value),
284}
285
286/// struct for typed errors of method [`authenticators_admin_static_update`]
287#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum AuthenticatorsAdminStaticUpdateError {
290    Status400(models::ValidationError),
291    Status403(models::GenericError),
292    UnknownValue(serde_json::Value),
293}
294
295/// struct for typed errors of method [`authenticators_admin_totp_create`]
296#[derive(Debug, Clone, Serialize, Deserialize)]
297#[serde(untagged)]
298pub enum AuthenticatorsAdminTotpCreateError {
299    Status400(models::ValidationError),
300    Status403(models::GenericError),
301    UnknownValue(serde_json::Value),
302}
303
304/// struct for typed errors of method [`authenticators_admin_totp_destroy`]
305#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum AuthenticatorsAdminTotpDestroyError {
308    Status400(models::ValidationError),
309    Status403(models::GenericError),
310    UnknownValue(serde_json::Value),
311}
312
313/// struct for typed errors of method [`authenticators_admin_totp_list`]
314#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum AuthenticatorsAdminTotpListError {
317    Status400(models::ValidationError),
318    Status403(models::GenericError),
319    UnknownValue(serde_json::Value),
320}
321
322/// struct for typed errors of method [`authenticators_admin_totp_partial_update`]
323#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum AuthenticatorsAdminTotpPartialUpdateError {
326    Status400(models::ValidationError),
327    Status403(models::GenericError),
328    UnknownValue(serde_json::Value),
329}
330
331/// struct for typed errors of method [`authenticators_admin_totp_retrieve`]
332#[derive(Debug, Clone, Serialize, Deserialize)]
333#[serde(untagged)]
334pub enum AuthenticatorsAdminTotpRetrieveError {
335    Status400(models::ValidationError),
336    Status403(models::GenericError),
337    UnknownValue(serde_json::Value),
338}
339
340/// struct for typed errors of method [`authenticators_admin_totp_update`]
341#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum AuthenticatorsAdminTotpUpdateError {
344    Status400(models::ValidationError),
345    Status403(models::GenericError),
346    UnknownValue(serde_json::Value),
347}
348
349/// struct for typed errors of method [`authenticators_admin_webauthn_create`]
350#[derive(Debug, Clone, Serialize, Deserialize)]
351#[serde(untagged)]
352pub enum AuthenticatorsAdminWebauthnCreateError {
353    Status400(models::ValidationError),
354    Status403(models::GenericError),
355    UnknownValue(serde_json::Value),
356}
357
358/// struct for typed errors of method [`authenticators_admin_webauthn_destroy`]
359#[derive(Debug, Clone, Serialize, Deserialize)]
360#[serde(untagged)]
361pub enum AuthenticatorsAdminWebauthnDestroyError {
362    Status400(models::ValidationError),
363    Status403(models::GenericError),
364    UnknownValue(serde_json::Value),
365}
366
367/// struct for typed errors of method [`authenticators_admin_webauthn_list`]
368#[derive(Debug, Clone, Serialize, Deserialize)]
369#[serde(untagged)]
370pub enum AuthenticatorsAdminWebauthnListError {
371    Status400(models::ValidationError),
372    Status403(models::GenericError),
373    UnknownValue(serde_json::Value),
374}
375
376/// struct for typed errors of method [`authenticators_admin_webauthn_partial_update`]
377#[derive(Debug, Clone, Serialize, Deserialize)]
378#[serde(untagged)]
379pub enum AuthenticatorsAdminWebauthnPartialUpdateError {
380    Status400(models::ValidationError),
381    Status403(models::GenericError),
382    UnknownValue(serde_json::Value),
383}
384
385/// struct for typed errors of method [`authenticators_admin_webauthn_retrieve`]
386#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum AuthenticatorsAdminWebauthnRetrieveError {
389    Status400(models::ValidationError),
390    Status403(models::GenericError),
391    UnknownValue(serde_json::Value),
392}
393
394/// struct for typed errors of method [`authenticators_admin_webauthn_update`]
395#[derive(Debug, Clone, Serialize, Deserialize)]
396#[serde(untagged)]
397pub enum AuthenticatorsAdminWebauthnUpdateError {
398    Status400(models::ValidationError),
399    Status403(models::GenericError),
400    UnknownValue(serde_json::Value),
401}
402
403/// struct for typed errors of method [`authenticators_all_list`]
404#[derive(Debug, Clone, Serialize, Deserialize)]
405#[serde(untagged)]
406pub enum AuthenticatorsAllListError {
407    Status400(models::ValidationError),
408    Status403(models::GenericError),
409    UnknownValue(serde_json::Value),
410}
411
412/// struct for typed errors of method [`authenticators_duo_destroy`]
413#[derive(Debug, Clone, Serialize, Deserialize)]
414#[serde(untagged)]
415pub enum AuthenticatorsDuoDestroyError {
416    Status400(models::ValidationError),
417    Status403(models::GenericError),
418    UnknownValue(serde_json::Value),
419}
420
421/// struct for typed errors of method [`authenticators_duo_list`]
422#[derive(Debug, Clone, Serialize, Deserialize)]
423#[serde(untagged)]
424pub enum AuthenticatorsDuoListError {
425    Status400(models::ValidationError),
426    Status403(models::GenericError),
427    UnknownValue(serde_json::Value),
428}
429
430/// struct for typed errors of method [`authenticators_duo_partial_update`]
431#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum AuthenticatorsDuoPartialUpdateError {
434    Status400(models::ValidationError),
435    Status403(models::GenericError),
436    UnknownValue(serde_json::Value),
437}
438
439/// struct for typed errors of method [`authenticators_duo_retrieve`]
440#[derive(Debug, Clone, Serialize, Deserialize)]
441#[serde(untagged)]
442pub enum AuthenticatorsDuoRetrieveError {
443    Status400(models::ValidationError),
444    Status403(models::GenericError),
445    UnknownValue(serde_json::Value),
446}
447
448/// struct for typed errors of method [`authenticators_duo_update`]
449#[derive(Debug, Clone, Serialize, Deserialize)]
450#[serde(untagged)]
451pub enum AuthenticatorsDuoUpdateError {
452    Status400(models::ValidationError),
453    Status403(models::GenericError),
454    UnknownValue(serde_json::Value),
455}
456
457/// struct for typed errors of method [`authenticators_duo_used_by_list`]
458#[derive(Debug, Clone, Serialize, Deserialize)]
459#[serde(untagged)]
460pub enum AuthenticatorsDuoUsedByListError {
461    Status400(models::ValidationError),
462    Status403(models::GenericError),
463    UnknownValue(serde_json::Value),
464}
465
466/// struct for typed errors of method [`authenticators_email_destroy`]
467#[derive(Debug, Clone, Serialize, Deserialize)]
468#[serde(untagged)]
469pub enum AuthenticatorsEmailDestroyError {
470    Status400(models::ValidationError),
471    Status403(models::GenericError),
472    UnknownValue(serde_json::Value),
473}
474
475/// struct for typed errors of method [`authenticators_email_list`]
476#[derive(Debug, Clone, Serialize, Deserialize)]
477#[serde(untagged)]
478pub enum AuthenticatorsEmailListError {
479    Status400(models::ValidationError),
480    Status403(models::GenericError),
481    UnknownValue(serde_json::Value),
482}
483
484/// struct for typed errors of method [`authenticators_email_partial_update`]
485#[derive(Debug, Clone, Serialize, Deserialize)]
486#[serde(untagged)]
487pub enum AuthenticatorsEmailPartialUpdateError {
488    Status400(models::ValidationError),
489    Status403(models::GenericError),
490    UnknownValue(serde_json::Value),
491}
492
493/// struct for typed errors of method [`authenticators_email_retrieve`]
494#[derive(Debug, Clone, Serialize, Deserialize)]
495#[serde(untagged)]
496pub enum AuthenticatorsEmailRetrieveError {
497    Status400(models::ValidationError),
498    Status403(models::GenericError),
499    UnknownValue(serde_json::Value),
500}
501
502/// struct for typed errors of method [`authenticators_email_update`]
503#[derive(Debug, Clone, Serialize, Deserialize)]
504#[serde(untagged)]
505pub enum AuthenticatorsEmailUpdateError {
506    Status400(models::ValidationError),
507    Status403(models::GenericError),
508    UnknownValue(serde_json::Value),
509}
510
511/// struct for typed errors of method [`authenticators_email_used_by_list`]
512#[derive(Debug, Clone, Serialize, Deserialize)]
513#[serde(untagged)]
514pub enum AuthenticatorsEmailUsedByListError {
515    Status400(models::ValidationError),
516    Status403(models::GenericError),
517    UnknownValue(serde_json::Value),
518}
519
520/// struct for typed errors of method [`authenticators_endpoint_list`]
521#[derive(Debug, Clone, Serialize, Deserialize)]
522#[serde(untagged)]
523pub enum AuthenticatorsEndpointListError {
524    Status400(models::ValidationError),
525    Status403(models::GenericError),
526    UnknownValue(serde_json::Value),
527}
528
529/// struct for typed errors of method [`authenticators_endpoint_retrieve`]
530#[derive(Debug, Clone, Serialize, Deserialize)]
531#[serde(untagged)]
532pub enum AuthenticatorsEndpointRetrieveError {
533    Status400(models::ValidationError),
534    Status403(models::GenericError),
535    UnknownValue(serde_json::Value),
536}
537
538/// struct for typed errors of method [`authenticators_endpoint_used_by_list`]
539#[derive(Debug, Clone, Serialize, Deserialize)]
540#[serde(untagged)]
541pub enum AuthenticatorsEndpointUsedByListError {
542    Status400(models::ValidationError),
543    Status403(models::GenericError),
544    UnknownValue(serde_json::Value),
545}
546
547/// struct for typed errors of method [`authenticators_sms_destroy`]
548#[derive(Debug, Clone, Serialize, Deserialize)]
549#[serde(untagged)]
550pub enum AuthenticatorsSmsDestroyError {
551    Status400(models::ValidationError),
552    Status403(models::GenericError),
553    UnknownValue(serde_json::Value),
554}
555
556/// struct for typed errors of method [`authenticators_sms_list`]
557#[derive(Debug, Clone, Serialize, Deserialize)]
558#[serde(untagged)]
559pub enum AuthenticatorsSmsListError {
560    Status400(models::ValidationError),
561    Status403(models::GenericError),
562    UnknownValue(serde_json::Value),
563}
564
565/// struct for typed errors of method [`authenticators_sms_partial_update`]
566#[derive(Debug, Clone, Serialize, Deserialize)]
567#[serde(untagged)]
568pub enum AuthenticatorsSmsPartialUpdateError {
569    Status400(models::ValidationError),
570    Status403(models::GenericError),
571    UnknownValue(serde_json::Value),
572}
573
574/// struct for typed errors of method [`authenticators_sms_retrieve`]
575#[derive(Debug, Clone, Serialize, Deserialize)]
576#[serde(untagged)]
577pub enum AuthenticatorsSmsRetrieveError {
578    Status400(models::ValidationError),
579    Status403(models::GenericError),
580    UnknownValue(serde_json::Value),
581}
582
583/// struct for typed errors of method [`authenticators_sms_update`]
584#[derive(Debug, Clone, Serialize, Deserialize)]
585#[serde(untagged)]
586pub enum AuthenticatorsSmsUpdateError {
587    Status400(models::ValidationError),
588    Status403(models::GenericError),
589    UnknownValue(serde_json::Value),
590}
591
592/// struct for typed errors of method [`authenticators_sms_used_by_list`]
593#[derive(Debug, Clone, Serialize, Deserialize)]
594#[serde(untagged)]
595pub enum AuthenticatorsSmsUsedByListError {
596    Status400(models::ValidationError),
597    Status403(models::GenericError),
598    UnknownValue(serde_json::Value),
599}
600
601/// struct for typed errors of method [`authenticators_static_destroy`]
602#[derive(Debug, Clone, Serialize, Deserialize)]
603#[serde(untagged)]
604pub enum AuthenticatorsStaticDestroyError {
605    Status400(models::ValidationError),
606    Status403(models::GenericError),
607    UnknownValue(serde_json::Value),
608}
609
610/// struct for typed errors of method [`authenticators_static_list`]
611#[derive(Debug, Clone, Serialize, Deserialize)]
612#[serde(untagged)]
613pub enum AuthenticatorsStaticListError {
614    Status400(models::ValidationError),
615    Status403(models::GenericError),
616    UnknownValue(serde_json::Value),
617}
618
619/// struct for typed errors of method [`authenticators_static_partial_update`]
620#[derive(Debug, Clone, Serialize, Deserialize)]
621#[serde(untagged)]
622pub enum AuthenticatorsStaticPartialUpdateError {
623    Status400(models::ValidationError),
624    Status403(models::GenericError),
625    UnknownValue(serde_json::Value),
626}
627
628/// struct for typed errors of method [`authenticators_static_retrieve`]
629#[derive(Debug, Clone, Serialize, Deserialize)]
630#[serde(untagged)]
631pub enum AuthenticatorsStaticRetrieveError {
632    Status400(models::ValidationError),
633    Status403(models::GenericError),
634    UnknownValue(serde_json::Value),
635}
636
637/// struct for typed errors of method [`authenticators_static_update`]
638#[derive(Debug, Clone, Serialize, Deserialize)]
639#[serde(untagged)]
640pub enum AuthenticatorsStaticUpdateError {
641    Status400(models::ValidationError),
642    Status403(models::GenericError),
643    UnknownValue(serde_json::Value),
644}
645
646/// struct for typed errors of method [`authenticators_static_used_by_list`]
647#[derive(Debug, Clone, Serialize, Deserialize)]
648#[serde(untagged)]
649pub enum AuthenticatorsStaticUsedByListError {
650    Status400(models::ValidationError),
651    Status403(models::GenericError),
652    UnknownValue(serde_json::Value),
653}
654
655/// struct for typed errors of method [`authenticators_totp_destroy`]
656#[derive(Debug, Clone, Serialize, Deserialize)]
657#[serde(untagged)]
658pub enum AuthenticatorsTotpDestroyError {
659    Status400(models::ValidationError),
660    Status403(models::GenericError),
661    UnknownValue(serde_json::Value),
662}
663
664/// struct for typed errors of method [`authenticators_totp_list`]
665#[derive(Debug, Clone, Serialize, Deserialize)]
666#[serde(untagged)]
667pub enum AuthenticatorsTotpListError {
668    Status400(models::ValidationError),
669    Status403(models::GenericError),
670    UnknownValue(serde_json::Value),
671}
672
673/// struct for typed errors of method [`authenticators_totp_partial_update`]
674#[derive(Debug, Clone, Serialize, Deserialize)]
675#[serde(untagged)]
676pub enum AuthenticatorsTotpPartialUpdateError {
677    Status400(models::ValidationError),
678    Status403(models::GenericError),
679    UnknownValue(serde_json::Value),
680}
681
682/// struct for typed errors of method [`authenticators_totp_retrieve`]
683#[derive(Debug, Clone, Serialize, Deserialize)]
684#[serde(untagged)]
685pub enum AuthenticatorsTotpRetrieveError {
686    Status400(models::ValidationError),
687    Status403(models::GenericError),
688    UnknownValue(serde_json::Value),
689}
690
691/// struct for typed errors of method [`authenticators_totp_update`]
692#[derive(Debug, Clone, Serialize, Deserialize)]
693#[serde(untagged)]
694pub enum AuthenticatorsTotpUpdateError {
695    Status400(models::ValidationError),
696    Status403(models::GenericError),
697    UnknownValue(serde_json::Value),
698}
699
700/// struct for typed errors of method [`authenticators_totp_used_by_list`]
701#[derive(Debug, Clone, Serialize, Deserialize)]
702#[serde(untagged)]
703pub enum AuthenticatorsTotpUsedByListError {
704    Status400(models::ValidationError),
705    Status403(models::GenericError),
706    UnknownValue(serde_json::Value),
707}
708
709/// struct for typed errors of method [`authenticators_webauthn_destroy`]
710#[derive(Debug, Clone, Serialize, Deserialize)]
711#[serde(untagged)]
712pub enum AuthenticatorsWebauthnDestroyError {
713    Status400(models::ValidationError),
714    Status403(models::GenericError),
715    UnknownValue(serde_json::Value),
716}
717
718/// struct for typed errors of method [`authenticators_webauthn_list`]
719#[derive(Debug, Clone, Serialize, Deserialize)]
720#[serde(untagged)]
721pub enum AuthenticatorsWebauthnListError {
722    Status400(models::ValidationError),
723    Status403(models::GenericError),
724    UnknownValue(serde_json::Value),
725}
726
727/// struct for typed errors of method [`authenticators_webauthn_partial_update`]
728#[derive(Debug, Clone, Serialize, Deserialize)]
729#[serde(untagged)]
730pub enum AuthenticatorsWebauthnPartialUpdateError {
731    Status400(models::ValidationError),
732    Status403(models::GenericError),
733    UnknownValue(serde_json::Value),
734}
735
736/// struct for typed errors of method [`authenticators_webauthn_retrieve`]
737#[derive(Debug, Clone, Serialize, Deserialize)]
738#[serde(untagged)]
739pub enum AuthenticatorsWebauthnRetrieveError {
740    Status400(models::ValidationError),
741    Status403(models::GenericError),
742    UnknownValue(serde_json::Value),
743}
744
745/// struct for typed errors of method [`authenticators_webauthn_update`]
746#[derive(Debug, Clone, Serialize, Deserialize)]
747#[serde(untagged)]
748pub enum AuthenticatorsWebauthnUpdateError {
749    Status400(models::ValidationError),
750    Status403(models::GenericError),
751    UnknownValue(serde_json::Value),
752}
753
754/// struct for typed errors of method [`authenticators_webauthn_used_by_list`]
755#[derive(Debug, Clone, Serialize, Deserialize)]
756#[serde(untagged)]
757pub enum AuthenticatorsWebauthnUsedByListError {
758    Status400(models::ValidationError),
759    Status403(models::GenericError),
760    UnknownValue(serde_json::Value),
761}
762
763/// Get all devices for current user
764pub async fn authenticators_admin_all_list(
765    configuration: &configuration::Configuration,
766    user: Option<i32>,
767) -> Result<Vec<models::Device>, Error<AuthenticatorsAdminAllListError>> {
768    // add a prefix to parameters to efficiently prevent name collisions
769    let p_query_user = user;
770
771    let uri_str = format!("{}/authenticators/admin/all/", configuration.base_path);
772    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
773
774    if let Some(ref param_value) = p_query_user {
775        req_builder = req_builder.query(&[("user", &param_value.to_string())]);
776    }
777    if let Some(ref user_agent) = configuration.user_agent {
778        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
779    }
780    if let Some(ref token) = configuration.bearer_access_token {
781        req_builder = req_builder.bearer_auth(token.to_owned());
782    };
783
784    let req = req_builder.build()?;
785    let resp = configuration.client.execute(req).await?;
786
787    let status = resp.status();
788    let content_type = resp
789        .headers()
790        .get("content-type")
791        .and_then(|v| v.to_str().ok())
792        .unwrap_or("application/octet-stream");
793    let content_type = super::ContentType::from(content_type);
794
795    if !status.is_client_error() && !status.is_server_error() {
796        let content = resp.text().await?;
797        match content_type {
798            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
799            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Device&gt;`"))),
800            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Device&gt;`")))),
801        }
802    } else {
803        let content = resp.text().await?;
804        let entity: Option<AuthenticatorsAdminAllListError> = serde_json::from_str(&content).ok();
805        Err(Error::ResponseError(ResponseContent {
806            status,
807            content,
808            entity,
809        }))
810    }
811}
812
813/// Viewset for Duo authenticator devices (for admins)
814pub async fn authenticators_admin_duo_create(
815    configuration: &configuration::Configuration,
816    duo_device_request: models::DuoDeviceRequest,
817) -> Result<models::DuoDevice, Error<AuthenticatorsAdminDuoCreateError>> {
818    // add a prefix to parameters to efficiently prevent name collisions
819    let p_body_duo_device_request = duo_device_request;
820
821    let uri_str = format!("{}/authenticators/admin/duo/", configuration.base_path);
822    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
823
824    if let Some(ref user_agent) = configuration.user_agent {
825        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
826    }
827    if let Some(ref token) = configuration.bearer_access_token {
828        req_builder = req_builder.bearer_auth(token.to_owned());
829    };
830    req_builder = req_builder.json(&p_body_duo_device_request);
831
832    let req = req_builder.build()?;
833    let resp = configuration.client.execute(req).await?;
834
835    let status = resp.status();
836    let content_type = resp
837        .headers()
838        .get("content-type")
839        .and_then(|v| v.to_str().ok())
840        .unwrap_or("application/octet-stream");
841    let content_type = super::ContentType::from(content_type);
842
843    if !status.is_client_error() && !status.is_server_error() {
844        let content = resp.text().await?;
845        match content_type {
846            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
847            ContentType::Text => {
848                return Err(Error::from(serde_json::Error::custom(
849                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
850                )))
851            }
852            ContentType::Unsupported(unknown_type) => {
853                return Err(Error::from(serde_json::Error::custom(format!(
854                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
855                ))))
856            }
857        }
858    } else {
859        let content = resp.text().await?;
860        let entity: Option<AuthenticatorsAdminDuoCreateError> = serde_json::from_str(&content).ok();
861        Err(Error::ResponseError(ResponseContent {
862            status,
863            content,
864            entity,
865        }))
866    }
867}
868
869/// Viewset for Duo authenticator devices (for admins)
870pub async fn authenticators_admin_duo_destroy(
871    configuration: &configuration::Configuration,
872    id: i32,
873) -> Result<(), Error<AuthenticatorsAdminDuoDestroyError>> {
874    // add a prefix to parameters to efficiently prevent name collisions
875    let p_path_id = id;
876
877    let uri_str = format!(
878        "{}/authenticators/admin/duo/{id}/",
879        configuration.base_path,
880        id = p_path_id
881    );
882    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
883
884    if let Some(ref user_agent) = configuration.user_agent {
885        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
886    }
887    if let Some(ref token) = configuration.bearer_access_token {
888        req_builder = req_builder.bearer_auth(token.to_owned());
889    };
890
891    let req = req_builder.build()?;
892    let resp = configuration.client.execute(req).await?;
893
894    let status = resp.status();
895
896    if !status.is_client_error() && !status.is_server_error() {
897        Ok(())
898    } else {
899        let content = resp.text().await?;
900        let entity: Option<AuthenticatorsAdminDuoDestroyError> = serde_json::from_str(&content).ok();
901        Err(Error::ResponseError(ResponseContent {
902            status,
903            content,
904            entity,
905        }))
906    }
907}
908
909/// Viewset for Duo authenticator devices (for admins)
910pub async fn authenticators_admin_duo_list(
911    configuration: &configuration::Configuration,
912    name: Option<&str>,
913    ordering: Option<&str>,
914    page: Option<i32>,
915    page_size: Option<i32>,
916    search: Option<&str>,
917) -> Result<models::PaginatedDuoDeviceList, Error<AuthenticatorsAdminDuoListError>> {
918    // add a prefix to parameters to efficiently prevent name collisions
919    let p_query_name = name;
920    let p_query_ordering = ordering;
921    let p_query_page = page;
922    let p_query_page_size = page_size;
923    let p_query_search = search;
924
925    let uri_str = format!("{}/authenticators/admin/duo/", configuration.base_path);
926    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
927
928    if let Some(ref param_value) = p_query_name {
929        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
930    }
931    if let Some(ref param_value) = p_query_ordering {
932        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
933    }
934    if let Some(ref param_value) = p_query_page {
935        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
936    }
937    if let Some(ref param_value) = p_query_page_size {
938        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
939    }
940    if let Some(ref param_value) = p_query_search {
941        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
942    }
943    if let Some(ref user_agent) = configuration.user_agent {
944        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
945    }
946    if let Some(ref token) = configuration.bearer_access_token {
947        req_builder = req_builder.bearer_auth(token.to_owned());
948    };
949
950    let req = req_builder.build()?;
951    let resp = configuration.client.execute(req).await?;
952
953    let status = resp.status();
954    let content_type = resp
955        .headers()
956        .get("content-type")
957        .and_then(|v| v.to_str().ok())
958        .unwrap_or("application/octet-stream");
959    let content_type = super::ContentType::from(content_type);
960
961    if !status.is_client_error() && !status.is_server_error() {
962        let content = resp.text().await?;
963        match content_type {
964            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
965            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDuoDeviceList`"))),
966            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedDuoDeviceList`")))),
967        }
968    } else {
969        let content = resp.text().await?;
970        let entity: Option<AuthenticatorsAdminDuoListError> = serde_json::from_str(&content).ok();
971        Err(Error::ResponseError(ResponseContent {
972            status,
973            content,
974            entity,
975        }))
976    }
977}
978
979/// Viewset for Duo authenticator devices (for admins)
980pub async fn authenticators_admin_duo_partial_update(
981    configuration: &configuration::Configuration,
982    id: i32,
983    patched_duo_device_request: Option<models::PatchedDuoDeviceRequest>,
984) -> Result<models::DuoDevice, Error<AuthenticatorsAdminDuoPartialUpdateError>> {
985    // add a prefix to parameters to efficiently prevent name collisions
986    let p_path_id = id;
987    let p_body_patched_duo_device_request = patched_duo_device_request;
988
989    let uri_str = format!(
990        "{}/authenticators/admin/duo/{id}/",
991        configuration.base_path,
992        id = p_path_id
993    );
994    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
995
996    if let Some(ref user_agent) = configuration.user_agent {
997        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
998    }
999    if let Some(ref token) = configuration.bearer_access_token {
1000        req_builder = req_builder.bearer_auth(token.to_owned());
1001    };
1002    req_builder = req_builder.json(&p_body_patched_duo_device_request);
1003
1004    let req = req_builder.build()?;
1005    let resp = configuration.client.execute(req).await?;
1006
1007    let status = resp.status();
1008    let content_type = resp
1009        .headers()
1010        .get("content-type")
1011        .and_then(|v| v.to_str().ok())
1012        .unwrap_or("application/octet-stream");
1013    let content_type = super::ContentType::from(content_type);
1014
1015    if !status.is_client_error() && !status.is_server_error() {
1016        let content = resp.text().await?;
1017        match content_type {
1018            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1019            ContentType::Text => {
1020                return Err(Error::from(serde_json::Error::custom(
1021                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
1022                )))
1023            }
1024            ContentType::Unsupported(unknown_type) => {
1025                return Err(Error::from(serde_json::Error::custom(format!(
1026                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
1027                ))))
1028            }
1029        }
1030    } else {
1031        let content = resp.text().await?;
1032        let entity: Option<AuthenticatorsAdminDuoPartialUpdateError> = serde_json::from_str(&content).ok();
1033        Err(Error::ResponseError(ResponseContent {
1034            status,
1035            content,
1036            entity,
1037        }))
1038    }
1039}
1040
1041/// Viewset for Duo authenticator devices (for admins)
1042pub async fn authenticators_admin_duo_retrieve(
1043    configuration: &configuration::Configuration,
1044    id: i32,
1045) -> Result<models::DuoDevice, Error<AuthenticatorsAdminDuoRetrieveError>> {
1046    // add a prefix to parameters to efficiently prevent name collisions
1047    let p_path_id = id;
1048
1049    let uri_str = format!(
1050        "{}/authenticators/admin/duo/{id}/",
1051        configuration.base_path,
1052        id = p_path_id
1053    );
1054    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1055
1056    if let Some(ref user_agent) = configuration.user_agent {
1057        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1058    }
1059    if let Some(ref token) = configuration.bearer_access_token {
1060        req_builder = req_builder.bearer_auth(token.to_owned());
1061    };
1062
1063    let req = req_builder.build()?;
1064    let resp = configuration.client.execute(req).await?;
1065
1066    let status = resp.status();
1067    let content_type = resp
1068        .headers()
1069        .get("content-type")
1070        .and_then(|v| v.to_str().ok())
1071        .unwrap_or("application/octet-stream");
1072    let content_type = super::ContentType::from(content_type);
1073
1074    if !status.is_client_error() && !status.is_server_error() {
1075        let content = resp.text().await?;
1076        match content_type {
1077            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1078            ContentType::Text => {
1079                return Err(Error::from(serde_json::Error::custom(
1080                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
1081                )))
1082            }
1083            ContentType::Unsupported(unknown_type) => {
1084                return Err(Error::from(serde_json::Error::custom(format!(
1085                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
1086                ))))
1087            }
1088        }
1089    } else {
1090        let content = resp.text().await?;
1091        let entity: Option<AuthenticatorsAdminDuoRetrieveError> = serde_json::from_str(&content).ok();
1092        Err(Error::ResponseError(ResponseContent {
1093            status,
1094            content,
1095            entity,
1096        }))
1097    }
1098}
1099
1100/// Viewset for Duo authenticator devices (for admins)
1101pub async fn authenticators_admin_duo_update(
1102    configuration: &configuration::Configuration,
1103    id: i32,
1104    duo_device_request: models::DuoDeviceRequest,
1105) -> Result<models::DuoDevice, Error<AuthenticatorsAdminDuoUpdateError>> {
1106    // add a prefix to parameters to efficiently prevent name collisions
1107    let p_path_id = id;
1108    let p_body_duo_device_request = duo_device_request;
1109
1110    let uri_str = format!(
1111        "{}/authenticators/admin/duo/{id}/",
1112        configuration.base_path,
1113        id = p_path_id
1114    );
1115    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1116
1117    if let Some(ref user_agent) = configuration.user_agent {
1118        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1119    }
1120    if let Some(ref token) = configuration.bearer_access_token {
1121        req_builder = req_builder.bearer_auth(token.to_owned());
1122    };
1123    req_builder = req_builder.json(&p_body_duo_device_request);
1124
1125    let req = req_builder.build()?;
1126    let resp = configuration.client.execute(req).await?;
1127
1128    let status = resp.status();
1129    let content_type = resp
1130        .headers()
1131        .get("content-type")
1132        .and_then(|v| v.to_str().ok())
1133        .unwrap_or("application/octet-stream");
1134    let content_type = super::ContentType::from(content_type);
1135
1136    if !status.is_client_error() && !status.is_server_error() {
1137        let content = resp.text().await?;
1138        match content_type {
1139            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1140            ContentType::Text => {
1141                return Err(Error::from(serde_json::Error::custom(
1142                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
1143                )))
1144            }
1145            ContentType::Unsupported(unknown_type) => {
1146                return Err(Error::from(serde_json::Error::custom(format!(
1147                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
1148                ))))
1149            }
1150        }
1151    } else {
1152        let content = resp.text().await?;
1153        let entity: Option<AuthenticatorsAdminDuoUpdateError> = serde_json::from_str(&content).ok();
1154        Err(Error::ResponseError(ResponseContent {
1155            status,
1156            content,
1157            entity,
1158        }))
1159    }
1160}
1161
1162/// Viewset for email authenticator devices (for admins)
1163pub async fn authenticators_admin_email_create(
1164    configuration: &configuration::Configuration,
1165    email_device_request: models::EmailDeviceRequest,
1166) -> Result<models::EmailDevice, Error<AuthenticatorsAdminEmailCreateError>> {
1167    // add a prefix to parameters to efficiently prevent name collisions
1168    let p_body_email_device_request = email_device_request;
1169
1170    let uri_str = format!("{}/authenticators/admin/email/", configuration.base_path);
1171    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1172
1173    if let Some(ref user_agent) = configuration.user_agent {
1174        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1175    }
1176    if let Some(ref token) = configuration.bearer_access_token {
1177        req_builder = req_builder.bearer_auth(token.to_owned());
1178    };
1179    req_builder = req_builder.json(&p_body_email_device_request);
1180
1181    let req = req_builder.build()?;
1182    let resp = configuration.client.execute(req).await?;
1183
1184    let status = resp.status();
1185    let content_type = resp
1186        .headers()
1187        .get("content-type")
1188        .and_then(|v| v.to_str().ok())
1189        .unwrap_or("application/octet-stream");
1190    let content_type = super::ContentType::from(content_type);
1191
1192    if !status.is_client_error() && !status.is_server_error() {
1193        let content = resp.text().await?;
1194        match content_type {
1195            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1196            ContentType::Text => {
1197                return Err(Error::from(serde_json::Error::custom(
1198                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
1199                )))
1200            }
1201            ContentType::Unsupported(unknown_type) => {
1202                return Err(Error::from(serde_json::Error::custom(format!(
1203                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
1204                ))))
1205            }
1206        }
1207    } else {
1208        let content = resp.text().await?;
1209        let entity: Option<AuthenticatorsAdminEmailCreateError> = serde_json::from_str(&content).ok();
1210        Err(Error::ResponseError(ResponseContent {
1211            status,
1212            content,
1213            entity,
1214        }))
1215    }
1216}
1217
1218/// Viewset for email authenticator devices (for admins)
1219pub async fn authenticators_admin_email_destroy(
1220    configuration: &configuration::Configuration,
1221    id: i32,
1222) -> Result<(), Error<AuthenticatorsAdminEmailDestroyError>> {
1223    // add a prefix to parameters to efficiently prevent name collisions
1224    let p_path_id = id;
1225
1226    let uri_str = format!(
1227        "{}/authenticators/admin/email/{id}/",
1228        configuration.base_path,
1229        id = p_path_id
1230    );
1231    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1232
1233    if let Some(ref user_agent) = configuration.user_agent {
1234        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1235    }
1236    if let Some(ref token) = configuration.bearer_access_token {
1237        req_builder = req_builder.bearer_auth(token.to_owned());
1238    };
1239
1240    let req = req_builder.build()?;
1241    let resp = configuration.client.execute(req).await?;
1242
1243    let status = resp.status();
1244
1245    if !status.is_client_error() && !status.is_server_error() {
1246        Ok(())
1247    } else {
1248        let content = resp.text().await?;
1249        let entity: Option<AuthenticatorsAdminEmailDestroyError> = serde_json::from_str(&content).ok();
1250        Err(Error::ResponseError(ResponseContent {
1251            status,
1252            content,
1253            entity,
1254        }))
1255    }
1256}
1257
1258/// Viewset for email authenticator devices (for admins)
1259pub async fn authenticators_admin_email_list(
1260    configuration: &configuration::Configuration,
1261    name: Option<&str>,
1262    ordering: Option<&str>,
1263    page: Option<i32>,
1264    page_size: Option<i32>,
1265    search: Option<&str>,
1266) -> Result<models::PaginatedEmailDeviceList, Error<AuthenticatorsAdminEmailListError>> {
1267    // add a prefix to parameters to efficiently prevent name collisions
1268    let p_query_name = name;
1269    let p_query_ordering = ordering;
1270    let p_query_page = page;
1271    let p_query_page_size = page_size;
1272    let p_query_search = search;
1273
1274    let uri_str = format!("{}/authenticators/admin/email/", configuration.base_path);
1275    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1276
1277    if let Some(ref param_value) = p_query_name {
1278        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
1279    }
1280    if let Some(ref param_value) = p_query_ordering {
1281        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
1282    }
1283    if let Some(ref param_value) = p_query_page {
1284        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1285    }
1286    if let Some(ref param_value) = p_query_page_size {
1287        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1288    }
1289    if let Some(ref param_value) = p_query_search {
1290        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
1291    }
1292    if let Some(ref user_agent) = configuration.user_agent {
1293        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1294    }
1295    if let Some(ref token) = configuration.bearer_access_token {
1296        req_builder = req_builder.bearer_auth(token.to_owned());
1297    };
1298
1299    let req = req_builder.build()?;
1300    let resp = configuration.client.execute(req).await?;
1301
1302    let status = resp.status();
1303    let content_type = resp
1304        .headers()
1305        .get("content-type")
1306        .and_then(|v| v.to_str().ok())
1307        .unwrap_or("application/octet-stream");
1308    let content_type = super::ContentType::from(content_type);
1309
1310    if !status.is_client_error() && !status.is_server_error() {
1311        let content = resp.text().await?;
1312        match content_type {
1313            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1314            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEmailDeviceList`"))),
1315            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedEmailDeviceList`")))),
1316        }
1317    } else {
1318        let content = resp.text().await?;
1319        let entity: Option<AuthenticatorsAdminEmailListError> = serde_json::from_str(&content).ok();
1320        Err(Error::ResponseError(ResponseContent {
1321            status,
1322            content,
1323            entity,
1324        }))
1325    }
1326}
1327
1328/// Viewset for email authenticator devices (for admins)
1329pub async fn authenticators_admin_email_partial_update(
1330    configuration: &configuration::Configuration,
1331    id: i32,
1332    patched_email_device_request: Option<models::PatchedEmailDeviceRequest>,
1333) -> Result<models::EmailDevice, Error<AuthenticatorsAdminEmailPartialUpdateError>> {
1334    // add a prefix to parameters to efficiently prevent name collisions
1335    let p_path_id = id;
1336    let p_body_patched_email_device_request = patched_email_device_request;
1337
1338    let uri_str = format!(
1339        "{}/authenticators/admin/email/{id}/",
1340        configuration.base_path,
1341        id = p_path_id
1342    );
1343    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1344
1345    if let Some(ref user_agent) = configuration.user_agent {
1346        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1347    }
1348    if let Some(ref token) = configuration.bearer_access_token {
1349        req_builder = req_builder.bearer_auth(token.to_owned());
1350    };
1351    req_builder = req_builder.json(&p_body_patched_email_device_request);
1352
1353    let req = req_builder.build()?;
1354    let resp = configuration.client.execute(req).await?;
1355
1356    let status = resp.status();
1357    let content_type = resp
1358        .headers()
1359        .get("content-type")
1360        .and_then(|v| v.to_str().ok())
1361        .unwrap_or("application/octet-stream");
1362    let content_type = super::ContentType::from(content_type);
1363
1364    if !status.is_client_error() && !status.is_server_error() {
1365        let content = resp.text().await?;
1366        match content_type {
1367            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1368            ContentType::Text => {
1369                return Err(Error::from(serde_json::Error::custom(
1370                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
1371                )))
1372            }
1373            ContentType::Unsupported(unknown_type) => {
1374                return Err(Error::from(serde_json::Error::custom(format!(
1375                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
1376                ))))
1377            }
1378        }
1379    } else {
1380        let content = resp.text().await?;
1381        let entity: Option<AuthenticatorsAdminEmailPartialUpdateError> = serde_json::from_str(&content).ok();
1382        Err(Error::ResponseError(ResponseContent {
1383            status,
1384            content,
1385            entity,
1386        }))
1387    }
1388}
1389
1390/// Viewset for email authenticator devices (for admins)
1391pub async fn authenticators_admin_email_retrieve(
1392    configuration: &configuration::Configuration,
1393    id: i32,
1394) -> Result<models::EmailDevice, Error<AuthenticatorsAdminEmailRetrieveError>> {
1395    // add a prefix to parameters to efficiently prevent name collisions
1396    let p_path_id = id;
1397
1398    let uri_str = format!(
1399        "{}/authenticators/admin/email/{id}/",
1400        configuration.base_path,
1401        id = p_path_id
1402    );
1403    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1404
1405    if let Some(ref user_agent) = configuration.user_agent {
1406        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1407    }
1408    if let Some(ref token) = configuration.bearer_access_token {
1409        req_builder = req_builder.bearer_auth(token.to_owned());
1410    };
1411
1412    let req = req_builder.build()?;
1413    let resp = configuration.client.execute(req).await?;
1414
1415    let status = resp.status();
1416    let content_type = resp
1417        .headers()
1418        .get("content-type")
1419        .and_then(|v| v.to_str().ok())
1420        .unwrap_or("application/octet-stream");
1421    let content_type = super::ContentType::from(content_type);
1422
1423    if !status.is_client_error() && !status.is_server_error() {
1424        let content = resp.text().await?;
1425        match content_type {
1426            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1427            ContentType::Text => {
1428                return Err(Error::from(serde_json::Error::custom(
1429                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
1430                )))
1431            }
1432            ContentType::Unsupported(unknown_type) => {
1433                return Err(Error::from(serde_json::Error::custom(format!(
1434                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
1435                ))))
1436            }
1437        }
1438    } else {
1439        let content = resp.text().await?;
1440        let entity: Option<AuthenticatorsAdminEmailRetrieveError> = serde_json::from_str(&content).ok();
1441        Err(Error::ResponseError(ResponseContent {
1442            status,
1443            content,
1444            entity,
1445        }))
1446    }
1447}
1448
1449/// Viewset for email authenticator devices (for admins)
1450pub async fn authenticators_admin_email_update(
1451    configuration: &configuration::Configuration,
1452    id: i32,
1453    email_device_request: models::EmailDeviceRequest,
1454) -> Result<models::EmailDevice, Error<AuthenticatorsAdminEmailUpdateError>> {
1455    // add a prefix to parameters to efficiently prevent name collisions
1456    let p_path_id = id;
1457    let p_body_email_device_request = email_device_request;
1458
1459    let uri_str = format!(
1460        "{}/authenticators/admin/email/{id}/",
1461        configuration.base_path,
1462        id = p_path_id
1463    );
1464    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1465
1466    if let Some(ref user_agent) = configuration.user_agent {
1467        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1468    }
1469    if let Some(ref token) = configuration.bearer_access_token {
1470        req_builder = req_builder.bearer_auth(token.to_owned());
1471    };
1472    req_builder = req_builder.json(&p_body_email_device_request);
1473
1474    let req = req_builder.build()?;
1475    let resp = configuration.client.execute(req).await?;
1476
1477    let status = resp.status();
1478    let content_type = resp
1479        .headers()
1480        .get("content-type")
1481        .and_then(|v| v.to_str().ok())
1482        .unwrap_or("application/octet-stream");
1483    let content_type = super::ContentType::from(content_type);
1484
1485    if !status.is_client_error() && !status.is_server_error() {
1486        let content = resp.text().await?;
1487        match content_type {
1488            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1489            ContentType::Text => {
1490                return Err(Error::from(serde_json::Error::custom(
1491                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
1492                )))
1493            }
1494            ContentType::Unsupported(unknown_type) => {
1495                return Err(Error::from(serde_json::Error::custom(format!(
1496                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
1497                ))))
1498            }
1499        }
1500    } else {
1501        let content = resp.text().await?;
1502        let entity: Option<AuthenticatorsAdminEmailUpdateError> = serde_json::from_str(&content).ok();
1503        Err(Error::ResponseError(ResponseContent {
1504            status,
1505            content,
1506            entity,
1507        }))
1508    }
1509}
1510
1511/// Viewset for Endpoint authenticator devices (for admins)
1512pub async fn authenticators_admin_endpoint_create(
1513    configuration: &configuration::Configuration,
1514    google_endpoint_device_request: models::GoogleEndpointDeviceRequest,
1515) -> Result<models::GoogleEndpointDevice, Error<AuthenticatorsAdminEndpointCreateError>> {
1516    // add a prefix to parameters to efficiently prevent name collisions
1517    let p_body_google_endpoint_device_request = google_endpoint_device_request;
1518
1519    let uri_str = format!("{}/authenticators/admin/endpoint/", configuration.base_path);
1520    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1521
1522    if let Some(ref user_agent) = configuration.user_agent {
1523        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1524    }
1525    if let Some(ref token) = configuration.bearer_access_token {
1526        req_builder = req_builder.bearer_auth(token.to_owned());
1527    };
1528    req_builder = req_builder.json(&p_body_google_endpoint_device_request);
1529
1530    let req = req_builder.build()?;
1531    let resp = configuration.client.execute(req).await?;
1532
1533    let status = resp.status();
1534    let content_type = resp
1535        .headers()
1536        .get("content-type")
1537        .and_then(|v| v.to_str().ok())
1538        .unwrap_or("application/octet-stream");
1539    let content_type = super::ContentType::from(content_type);
1540
1541    if !status.is_client_error() && !status.is_server_error() {
1542        let content = resp.text().await?;
1543        match content_type {
1544            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1545            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GoogleEndpointDevice`"))),
1546            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GoogleEndpointDevice`")))),
1547        }
1548    } else {
1549        let content = resp.text().await?;
1550        let entity: Option<AuthenticatorsAdminEndpointCreateError> = serde_json::from_str(&content).ok();
1551        Err(Error::ResponseError(ResponseContent {
1552            status,
1553            content,
1554            entity,
1555        }))
1556    }
1557}
1558
1559/// Viewset for Endpoint authenticator devices (for admins)
1560pub async fn authenticators_admin_endpoint_destroy(
1561    configuration: &configuration::Configuration,
1562    uuid: &str,
1563) -> Result<(), Error<AuthenticatorsAdminEndpointDestroyError>> {
1564    // add a prefix to parameters to efficiently prevent name collisions
1565    let p_path_uuid = uuid;
1566
1567    let uri_str = format!(
1568        "{}/authenticators/admin/endpoint/{uuid}/",
1569        configuration.base_path,
1570        uuid = crate::apis::urlencode(p_path_uuid)
1571    );
1572    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1573
1574    if let Some(ref user_agent) = configuration.user_agent {
1575        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1576    }
1577    if let Some(ref token) = configuration.bearer_access_token {
1578        req_builder = req_builder.bearer_auth(token.to_owned());
1579    };
1580
1581    let req = req_builder.build()?;
1582    let resp = configuration.client.execute(req).await?;
1583
1584    let status = resp.status();
1585
1586    if !status.is_client_error() && !status.is_server_error() {
1587        Ok(())
1588    } else {
1589        let content = resp.text().await?;
1590        let entity: Option<AuthenticatorsAdminEndpointDestroyError> = serde_json::from_str(&content).ok();
1591        Err(Error::ResponseError(ResponseContent {
1592            status,
1593            content,
1594            entity,
1595        }))
1596    }
1597}
1598
1599/// Viewset for Endpoint authenticator devices (for admins)
1600pub async fn authenticators_admin_endpoint_list(
1601    configuration: &configuration::Configuration,
1602    name: Option<&str>,
1603    ordering: Option<&str>,
1604    page: Option<i32>,
1605    page_size: Option<i32>,
1606    search: Option<&str>,
1607) -> Result<models::PaginatedGoogleEndpointDeviceList, Error<AuthenticatorsAdminEndpointListError>> {
1608    // add a prefix to parameters to efficiently prevent name collisions
1609    let p_query_name = name;
1610    let p_query_ordering = ordering;
1611    let p_query_page = page;
1612    let p_query_page_size = page_size;
1613    let p_query_search = search;
1614
1615    let uri_str = format!("{}/authenticators/admin/endpoint/", configuration.base_path);
1616    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1617
1618    if let Some(ref param_value) = p_query_name {
1619        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
1620    }
1621    if let Some(ref param_value) = p_query_ordering {
1622        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
1623    }
1624    if let Some(ref param_value) = p_query_page {
1625        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1626    }
1627    if let Some(ref param_value) = p_query_page_size {
1628        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1629    }
1630    if let Some(ref param_value) = p_query_search {
1631        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
1632    }
1633    if let Some(ref user_agent) = configuration.user_agent {
1634        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1635    }
1636    if let Some(ref token) = configuration.bearer_access_token {
1637        req_builder = req_builder.bearer_auth(token.to_owned());
1638    };
1639
1640    let req = req_builder.build()?;
1641    let resp = configuration.client.execute(req).await?;
1642
1643    let status = resp.status();
1644    let content_type = resp
1645        .headers()
1646        .get("content-type")
1647        .and_then(|v| v.to_str().ok())
1648        .unwrap_or("application/octet-stream");
1649    let content_type = super::ContentType::from(content_type);
1650
1651    if !status.is_client_error() && !status.is_server_error() {
1652        let content = resp.text().await?;
1653        match content_type {
1654            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1655            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedGoogleEndpointDeviceList`"))),
1656            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedGoogleEndpointDeviceList`")))),
1657        }
1658    } else {
1659        let content = resp.text().await?;
1660        let entity: Option<AuthenticatorsAdminEndpointListError> = serde_json::from_str(&content).ok();
1661        Err(Error::ResponseError(ResponseContent {
1662            status,
1663            content,
1664            entity,
1665        }))
1666    }
1667}
1668
1669/// Viewset for Endpoint authenticator devices (for admins)
1670pub async fn authenticators_admin_endpoint_partial_update(
1671    configuration: &configuration::Configuration,
1672    uuid: &str,
1673    patched_google_endpoint_device_request: Option<models::PatchedGoogleEndpointDeviceRequest>,
1674) -> Result<models::GoogleEndpointDevice, Error<AuthenticatorsAdminEndpointPartialUpdateError>> {
1675    // add a prefix to parameters to efficiently prevent name collisions
1676    let p_path_uuid = uuid;
1677    let p_body_patched_google_endpoint_device_request = patched_google_endpoint_device_request;
1678
1679    let uri_str = format!(
1680        "{}/authenticators/admin/endpoint/{uuid}/",
1681        configuration.base_path,
1682        uuid = crate::apis::urlencode(p_path_uuid)
1683    );
1684    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1685
1686    if let Some(ref user_agent) = configuration.user_agent {
1687        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1688    }
1689    if let Some(ref token) = configuration.bearer_access_token {
1690        req_builder = req_builder.bearer_auth(token.to_owned());
1691    };
1692    req_builder = req_builder.json(&p_body_patched_google_endpoint_device_request);
1693
1694    let req = req_builder.build()?;
1695    let resp = configuration.client.execute(req).await?;
1696
1697    let status = resp.status();
1698    let content_type = resp
1699        .headers()
1700        .get("content-type")
1701        .and_then(|v| v.to_str().ok())
1702        .unwrap_or("application/octet-stream");
1703    let content_type = super::ContentType::from(content_type);
1704
1705    if !status.is_client_error() && !status.is_server_error() {
1706        let content = resp.text().await?;
1707        match content_type {
1708            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1709            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GoogleEndpointDevice`"))),
1710            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GoogleEndpointDevice`")))),
1711        }
1712    } else {
1713        let content = resp.text().await?;
1714        let entity: Option<AuthenticatorsAdminEndpointPartialUpdateError> = serde_json::from_str(&content).ok();
1715        Err(Error::ResponseError(ResponseContent {
1716            status,
1717            content,
1718            entity,
1719        }))
1720    }
1721}
1722
1723/// Viewset for Endpoint authenticator devices (for admins)
1724pub async fn authenticators_admin_endpoint_retrieve(
1725    configuration: &configuration::Configuration,
1726    uuid: &str,
1727) -> Result<models::GoogleEndpointDevice, Error<AuthenticatorsAdminEndpointRetrieveError>> {
1728    // add a prefix to parameters to efficiently prevent name collisions
1729    let p_path_uuid = uuid;
1730
1731    let uri_str = format!(
1732        "{}/authenticators/admin/endpoint/{uuid}/",
1733        configuration.base_path,
1734        uuid = crate::apis::urlencode(p_path_uuid)
1735    );
1736    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1737
1738    if let Some(ref user_agent) = configuration.user_agent {
1739        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1740    }
1741    if let Some(ref token) = configuration.bearer_access_token {
1742        req_builder = req_builder.bearer_auth(token.to_owned());
1743    };
1744
1745    let req = req_builder.build()?;
1746    let resp = configuration.client.execute(req).await?;
1747
1748    let status = resp.status();
1749    let content_type = resp
1750        .headers()
1751        .get("content-type")
1752        .and_then(|v| v.to_str().ok())
1753        .unwrap_or("application/octet-stream");
1754    let content_type = super::ContentType::from(content_type);
1755
1756    if !status.is_client_error() && !status.is_server_error() {
1757        let content = resp.text().await?;
1758        match content_type {
1759            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1760            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GoogleEndpointDevice`"))),
1761            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GoogleEndpointDevice`")))),
1762        }
1763    } else {
1764        let content = resp.text().await?;
1765        let entity: Option<AuthenticatorsAdminEndpointRetrieveError> = serde_json::from_str(&content).ok();
1766        Err(Error::ResponseError(ResponseContent {
1767            status,
1768            content,
1769            entity,
1770        }))
1771    }
1772}
1773
1774/// Viewset for Endpoint authenticator devices (for admins)
1775pub async fn authenticators_admin_endpoint_update(
1776    configuration: &configuration::Configuration,
1777    uuid: &str,
1778    google_endpoint_device_request: models::GoogleEndpointDeviceRequest,
1779) -> Result<models::GoogleEndpointDevice, Error<AuthenticatorsAdminEndpointUpdateError>> {
1780    // add a prefix to parameters to efficiently prevent name collisions
1781    let p_path_uuid = uuid;
1782    let p_body_google_endpoint_device_request = google_endpoint_device_request;
1783
1784    let uri_str = format!(
1785        "{}/authenticators/admin/endpoint/{uuid}/",
1786        configuration.base_path,
1787        uuid = crate::apis::urlencode(p_path_uuid)
1788    );
1789    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1790
1791    if let Some(ref user_agent) = configuration.user_agent {
1792        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1793    }
1794    if let Some(ref token) = configuration.bearer_access_token {
1795        req_builder = req_builder.bearer_auth(token.to_owned());
1796    };
1797    req_builder = req_builder.json(&p_body_google_endpoint_device_request);
1798
1799    let req = req_builder.build()?;
1800    let resp = configuration.client.execute(req).await?;
1801
1802    let status = resp.status();
1803    let content_type = resp
1804        .headers()
1805        .get("content-type")
1806        .and_then(|v| v.to_str().ok())
1807        .unwrap_or("application/octet-stream");
1808    let content_type = super::ContentType::from(content_type);
1809
1810    if !status.is_client_error() && !status.is_server_error() {
1811        let content = resp.text().await?;
1812        match content_type {
1813            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1814            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GoogleEndpointDevice`"))),
1815            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GoogleEndpointDevice`")))),
1816        }
1817    } else {
1818        let content = resp.text().await?;
1819        let entity: Option<AuthenticatorsAdminEndpointUpdateError> = serde_json::from_str(&content).ok();
1820        Err(Error::ResponseError(ResponseContent {
1821            status,
1822            content,
1823            entity,
1824        }))
1825    }
1826}
1827
1828/// Viewset for sms authenticator devices (for admins)
1829pub async fn authenticators_admin_sms_create(
1830    configuration: &configuration::Configuration,
1831    sms_device_request: models::SmsDeviceRequest,
1832) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsCreateError>> {
1833    // add a prefix to parameters to efficiently prevent name collisions
1834    let p_body_sms_device_request = sms_device_request;
1835
1836    let uri_str = format!("{}/authenticators/admin/sms/", configuration.base_path);
1837    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1838
1839    if let Some(ref user_agent) = configuration.user_agent {
1840        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1841    }
1842    if let Some(ref token) = configuration.bearer_access_token {
1843        req_builder = req_builder.bearer_auth(token.to_owned());
1844    };
1845    req_builder = req_builder.json(&p_body_sms_device_request);
1846
1847    let req = req_builder.build()?;
1848    let resp = configuration.client.execute(req).await?;
1849
1850    let status = resp.status();
1851    let content_type = resp
1852        .headers()
1853        .get("content-type")
1854        .and_then(|v| v.to_str().ok())
1855        .unwrap_or("application/octet-stream");
1856    let content_type = super::ContentType::from(content_type);
1857
1858    if !status.is_client_error() && !status.is_server_error() {
1859        let content = resp.text().await?;
1860        match content_type {
1861            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1862            ContentType::Text => {
1863                return Err(Error::from(serde_json::Error::custom(
1864                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
1865                )))
1866            }
1867            ContentType::Unsupported(unknown_type) => {
1868                return Err(Error::from(serde_json::Error::custom(format!(
1869                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
1870                ))))
1871            }
1872        }
1873    } else {
1874        let content = resp.text().await?;
1875        let entity: Option<AuthenticatorsAdminSmsCreateError> = serde_json::from_str(&content).ok();
1876        Err(Error::ResponseError(ResponseContent {
1877            status,
1878            content,
1879            entity,
1880        }))
1881    }
1882}
1883
1884/// Viewset for sms authenticator devices (for admins)
1885pub async fn authenticators_admin_sms_destroy(
1886    configuration: &configuration::Configuration,
1887    id: i32,
1888) -> Result<(), Error<AuthenticatorsAdminSmsDestroyError>> {
1889    // add a prefix to parameters to efficiently prevent name collisions
1890    let p_path_id = id;
1891
1892    let uri_str = format!(
1893        "{}/authenticators/admin/sms/{id}/",
1894        configuration.base_path,
1895        id = p_path_id
1896    );
1897    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1898
1899    if let Some(ref user_agent) = configuration.user_agent {
1900        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1901    }
1902    if let Some(ref token) = configuration.bearer_access_token {
1903        req_builder = req_builder.bearer_auth(token.to_owned());
1904    };
1905
1906    let req = req_builder.build()?;
1907    let resp = configuration.client.execute(req).await?;
1908
1909    let status = resp.status();
1910
1911    if !status.is_client_error() && !status.is_server_error() {
1912        Ok(())
1913    } else {
1914        let content = resp.text().await?;
1915        let entity: Option<AuthenticatorsAdminSmsDestroyError> = serde_json::from_str(&content).ok();
1916        Err(Error::ResponseError(ResponseContent {
1917            status,
1918            content,
1919            entity,
1920        }))
1921    }
1922}
1923
1924/// Viewset for sms authenticator devices (for admins)
1925pub async fn authenticators_admin_sms_list(
1926    configuration: &configuration::Configuration,
1927    name: Option<&str>,
1928    ordering: Option<&str>,
1929    page: Option<i32>,
1930    page_size: Option<i32>,
1931    search: Option<&str>,
1932) -> Result<models::PaginatedSmsDeviceList, Error<AuthenticatorsAdminSmsListError>> {
1933    // add a prefix to parameters to efficiently prevent name collisions
1934    let p_query_name = name;
1935    let p_query_ordering = ordering;
1936    let p_query_page = page;
1937    let p_query_page_size = page_size;
1938    let p_query_search = search;
1939
1940    let uri_str = format!("{}/authenticators/admin/sms/", configuration.base_path);
1941    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1942
1943    if let Some(ref param_value) = p_query_name {
1944        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
1945    }
1946    if let Some(ref param_value) = p_query_ordering {
1947        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
1948    }
1949    if let Some(ref param_value) = p_query_page {
1950        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1951    }
1952    if let Some(ref param_value) = p_query_page_size {
1953        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1954    }
1955    if let Some(ref param_value) = p_query_search {
1956        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
1957    }
1958    if let Some(ref user_agent) = configuration.user_agent {
1959        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1960    }
1961    if let Some(ref token) = configuration.bearer_access_token {
1962        req_builder = req_builder.bearer_auth(token.to_owned());
1963    };
1964
1965    let req = req_builder.build()?;
1966    let resp = configuration.client.execute(req).await?;
1967
1968    let status = resp.status();
1969    let content_type = resp
1970        .headers()
1971        .get("content-type")
1972        .and_then(|v| v.to_str().ok())
1973        .unwrap_or("application/octet-stream");
1974    let content_type = super::ContentType::from(content_type);
1975
1976    if !status.is_client_error() && !status.is_server_error() {
1977        let content = resp.text().await?;
1978        match content_type {
1979            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1980            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedSmsDeviceList`"))),
1981            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedSmsDeviceList`")))),
1982        }
1983    } else {
1984        let content = resp.text().await?;
1985        let entity: Option<AuthenticatorsAdminSmsListError> = serde_json::from_str(&content).ok();
1986        Err(Error::ResponseError(ResponseContent {
1987            status,
1988            content,
1989            entity,
1990        }))
1991    }
1992}
1993
1994/// Viewset for sms authenticator devices (for admins)
1995pub async fn authenticators_admin_sms_partial_update(
1996    configuration: &configuration::Configuration,
1997    id: i32,
1998    patched_sms_device_request: Option<models::PatchedSmsDeviceRequest>,
1999) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsPartialUpdateError>> {
2000    // add a prefix to parameters to efficiently prevent name collisions
2001    let p_path_id = id;
2002    let p_body_patched_sms_device_request = patched_sms_device_request;
2003
2004    let uri_str = format!(
2005        "{}/authenticators/admin/sms/{id}/",
2006        configuration.base_path,
2007        id = p_path_id
2008    );
2009    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2010
2011    if let Some(ref user_agent) = configuration.user_agent {
2012        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2013    }
2014    if let Some(ref token) = configuration.bearer_access_token {
2015        req_builder = req_builder.bearer_auth(token.to_owned());
2016    };
2017    req_builder = req_builder.json(&p_body_patched_sms_device_request);
2018
2019    let req = req_builder.build()?;
2020    let resp = configuration.client.execute(req).await?;
2021
2022    let status = resp.status();
2023    let content_type = resp
2024        .headers()
2025        .get("content-type")
2026        .and_then(|v| v.to_str().ok())
2027        .unwrap_or("application/octet-stream");
2028    let content_type = super::ContentType::from(content_type);
2029
2030    if !status.is_client_error() && !status.is_server_error() {
2031        let content = resp.text().await?;
2032        match content_type {
2033            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2034            ContentType::Text => {
2035                return Err(Error::from(serde_json::Error::custom(
2036                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
2037                )))
2038            }
2039            ContentType::Unsupported(unknown_type) => {
2040                return Err(Error::from(serde_json::Error::custom(format!(
2041                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
2042                ))))
2043            }
2044        }
2045    } else {
2046        let content = resp.text().await?;
2047        let entity: Option<AuthenticatorsAdminSmsPartialUpdateError> = serde_json::from_str(&content).ok();
2048        Err(Error::ResponseError(ResponseContent {
2049            status,
2050            content,
2051            entity,
2052        }))
2053    }
2054}
2055
2056/// Viewset for sms authenticator devices (for admins)
2057pub async fn authenticators_admin_sms_retrieve(
2058    configuration: &configuration::Configuration,
2059    id: i32,
2060) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsRetrieveError>> {
2061    // add a prefix to parameters to efficiently prevent name collisions
2062    let p_path_id = id;
2063
2064    let uri_str = format!(
2065        "{}/authenticators/admin/sms/{id}/",
2066        configuration.base_path,
2067        id = p_path_id
2068    );
2069    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2070
2071    if let Some(ref user_agent) = configuration.user_agent {
2072        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2073    }
2074    if let Some(ref token) = configuration.bearer_access_token {
2075        req_builder = req_builder.bearer_auth(token.to_owned());
2076    };
2077
2078    let req = req_builder.build()?;
2079    let resp = configuration.client.execute(req).await?;
2080
2081    let status = resp.status();
2082    let content_type = resp
2083        .headers()
2084        .get("content-type")
2085        .and_then(|v| v.to_str().ok())
2086        .unwrap_or("application/octet-stream");
2087    let content_type = super::ContentType::from(content_type);
2088
2089    if !status.is_client_error() && !status.is_server_error() {
2090        let content = resp.text().await?;
2091        match content_type {
2092            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2093            ContentType::Text => {
2094                return Err(Error::from(serde_json::Error::custom(
2095                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
2096                )))
2097            }
2098            ContentType::Unsupported(unknown_type) => {
2099                return Err(Error::from(serde_json::Error::custom(format!(
2100                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
2101                ))))
2102            }
2103        }
2104    } else {
2105        let content = resp.text().await?;
2106        let entity: Option<AuthenticatorsAdminSmsRetrieveError> = serde_json::from_str(&content).ok();
2107        Err(Error::ResponseError(ResponseContent {
2108            status,
2109            content,
2110            entity,
2111        }))
2112    }
2113}
2114
2115/// Viewset for sms authenticator devices (for admins)
2116pub async fn authenticators_admin_sms_update(
2117    configuration: &configuration::Configuration,
2118    id: i32,
2119    sms_device_request: models::SmsDeviceRequest,
2120) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsUpdateError>> {
2121    // add a prefix to parameters to efficiently prevent name collisions
2122    let p_path_id = id;
2123    let p_body_sms_device_request = sms_device_request;
2124
2125    let uri_str = format!(
2126        "{}/authenticators/admin/sms/{id}/",
2127        configuration.base_path,
2128        id = p_path_id
2129    );
2130    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2131
2132    if let Some(ref user_agent) = configuration.user_agent {
2133        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2134    }
2135    if let Some(ref token) = configuration.bearer_access_token {
2136        req_builder = req_builder.bearer_auth(token.to_owned());
2137    };
2138    req_builder = req_builder.json(&p_body_sms_device_request);
2139
2140    let req = req_builder.build()?;
2141    let resp = configuration.client.execute(req).await?;
2142
2143    let status = resp.status();
2144    let content_type = resp
2145        .headers()
2146        .get("content-type")
2147        .and_then(|v| v.to_str().ok())
2148        .unwrap_or("application/octet-stream");
2149    let content_type = super::ContentType::from(content_type);
2150
2151    if !status.is_client_error() && !status.is_server_error() {
2152        let content = resp.text().await?;
2153        match content_type {
2154            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2155            ContentType::Text => {
2156                return Err(Error::from(serde_json::Error::custom(
2157                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
2158                )))
2159            }
2160            ContentType::Unsupported(unknown_type) => {
2161                return Err(Error::from(serde_json::Error::custom(format!(
2162                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
2163                ))))
2164            }
2165        }
2166    } else {
2167        let content = resp.text().await?;
2168        let entity: Option<AuthenticatorsAdminSmsUpdateError> = serde_json::from_str(&content).ok();
2169        Err(Error::ResponseError(ResponseContent {
2170            status,
2171            content,
2172            entity,
2173        }))
2174    }
2175}
2176
2177/// Viewset for static authenticator devices (for admins)
2178pub async fn authenticators_admin_static_create(
2179    configuration: &configuration::Configuration,
2180    static_device_request: models::StaticDeviceRequest,
2181) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticCreateError>> {
2182    // add a prefix to parameters to efficiently prevent name collisions
2183    let p_body_static_device_request = static_device_request;
2184
2185    let uri_str = format!("{}/authenticators/admin/static/", configuration.base_path);
2186    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2187
2188    if let Some(ref user_agent) = configuration.user_agent {
2189        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2190    }
2191    if let Some(ref token) = configuration.bearer_access_token {
2192        req_builder = req_builder.bearer_auth(token.to_owned());
2193    };
2194    req_builder = req_builder.json(&p_body_static_device_request);
2195
2196    let req = req_builder.build()?;
2197    let resp = configuration.client.execute(req).await?;
2198
2199    let status = resp.status();
2200    let content_type = resp
2201        .headers()
2202        .get("content-type")
2203        .and_then(|v| v.to_str().ok())
2204        .unwrap_or("application/octet-stream");
2205    let content_type = super::ContentType::from(content_type);
2206
2207    if !status.is_client_error() && !status.is_server_error() {
2208        let content = resp.text().await?;
2209        match content_type {
2210            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2211            ContentType::Text => {
2212                return Err(Error::from(serde_json::Error::custom(
2213                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2214                )))
2215            }
2216            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2217                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2218            )))),
2219        }
2220    } else {
2221        let content = resp.text().await?;
2222        let entity: Option<AuthenticatorsAdminStaticCreateError> = serde_json::from_str(&content).ok();
2223        Err(Error::ResponseError(ResponseContent {
2224            status,
2225            content,
2226            entity,
2227        }))
2228    }
2229}
2230
2231/// Viewset for static authenticator devices (for admins)
2232pub async fn authenticators_admin_static_destroy(
2233    configuration: &configuration::Configuration,
2234    id: i32,
2235) -> Result<(), Error<AuthenticatorsAdminStaticDestroyError>> {
2236    // add a prefix to parameters to efficiently prevent name collisions
2237    let p_path_id = id;
2238
2239    let uri_str = format!(
2240        "{}/authenticators/admin/static/{id}/",
2241        configuration.base_path,
2242        id = p_path_id
2243    );
2244    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2245
2246    if let Some(ref user_agent) = configuration.user_agent {
2247        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2248    }
2249    if let Some(ref token) = configuration.bearer_access_token {
2250        req_builder = req_builder.bearer_auth(token.to_owned());
2251    };
2252
2253    let req = req_builder.build()?;
2254    let resp = configuration.client.execute(req).await?;
2255
2256    let status = resp.status();
2257
2258    if !status.is_client_error() && !status.is_server_error() {
2259        Ok(())
2260    } else {
2261        let content = resp.text().await?;
2262        let entity: Option<AuthenticatorsAdminStaticDestroyError> = serde_json::from_str(&content).ok();
2263        Err(Error::ResponseError(ResponseContent {
2264            status,
2265            content,
2266            entity,
2267        }))
2268    }
2269}
2270
2271/// Viewset for static authenticator devices (for admins)
2272pub async fn authenticators_admin_static_list(
2273    configuration: &configuration::Configuration,
2274    name: Option<&str>,
2275    ordering: Option<&str>,
2276    page: Option<i32>,
2277    page_size: Option<i32>,
2278    search: Option<&str>,
2279) -> Result<models::PaginatedStaticDeviceList, Error<AuthenticatorsAdminStaticListError>> {
2280    // add a prefix to parameters to efficiently prevent name collisions
2281    let p_query_name = name;
2282    let p_query_ordering = ordering;
2283    let p_query_page = page;
2284    let p_query_page_size = page_size;
2285    let p_query_search = search;
2286
2287    let uri_str = format!("{}/authenticators/admin/static/", configuration.base_path);
2288    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2289
2290    if let Some(ref param_value) = p_query_name {
2291        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2292    }
2293    if let Some(ref param_value) = p_query_ordering {
2294        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
2295    }
2296    if let Some(ref param_value) = p_query_page {
2297        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2298    }
2299    if let Some(ref param_value) = p_query_page_size {
2300        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
2301    }
2302    if let Some(ref param_value) = p_query_search {
2303        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
2304    }
2305    if let Some(ref user_agent) = configuration.user_agent {
2306        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2307    }
2308    if let Some(ref token) = configuration.bearer_access_token {
2309        req_builder = req_builder.bearer_auth(token.to_owned());
2310    };
2311
2312    let req = req_builder.build()?;
2313    let resp = configuration.client.execute(req).await?;
2314
2315    let status = resp.status();
2316    let content_type = resp
2317        .headers()
2318        .get("content-type")
2319        .and_then(|v| v.to_str().ok())
2320        .unwrap_or("application/octet-stream");
2321    let content_type = super::ContentType::from(content_type);
2322
2323    if !status.is_client_error() && !status.is_server_error() {
2324        let content = resp.text().await?;
2325        match content_type {
2326            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2327            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedStaticDeviceList`"))),
2328            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedStaticDeviceList`")))),
2329        }
2330    } else {
2331        let content = resp.text().await?;
2332        let entity: Option<AuthenticatorsAdminStaticListError> = serde_json::from_str(&content).ok();
2333        Err(Error::ResponseError(ResponseContent {
2334            status,
2335            content,
2336            entity,
2337        }))
2338    }
2339}
2340
2341/// Viewset for static authenticator devices (for admins)
2342pub async fn authenticators_admin_static_partial_update(
2343    configuration: &configuration::Configuration,
2344    id: i32,
2345    patched_static_device_request: Option<models::PatchedStaticDeviceRequest>,
2346) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticPartialUpdateError>> {
2347    // add a prefix to parameters to efficiently prevent name collisions
2348    let p_path_id = id;
2349    let p_body_patched_static_device_request = patched_static_device_request;
2350
2351    let uri_str = format!(
2352        "{}/authenticators/admin/static/{id}/",
2353        configuration.base_path,
2354        id = p_path_id
2355    );
2356    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2357
2358    if let Some(ref user_agent) = configuration.user_agent {
2359        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2360    }
2361    if let Some(ref token) = configuration.bearer_access_token {
2362        req_builder = req_builder.bearer_auth(token.to_owned());
2363    };
2364    req_builder = req_builder.json(&p_body_patched_static_device_request);
2365
2366    let req = req_builder.build()?;
2367    let resp = configuration.client.execute(req).await?;
2368
2369    let status = resp.status();
2370    let content_type = resp
2371        .headers()
2372        .get("content-type")
2373        .and_then(|v| v.to_str().ok())
2374        .unwrap_or("application/octet-stream");
2375    let content_type = super::ContentType::from(content_type);
2376
2377    if !status.is_client_error() && !status.is_server_error() {
2378        let content = resp.text().await?;
2379        match content_type {
2380            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2381            ContentType::Text => {
2382                return Err(Error::from(serde_json::Error::custom(
2383                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2384                )))
2385            }
2386            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2387                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2388            )))),
2389        }
2390    } else {
2391        let content = resp.text().await?;
2392        let entity: Option<AuthenticatorsAdminStaticPartialUpdateError> = serde_json::from_str(&content).ok();
2393        Err(Error::ResponseError(ResponseContent {
2394            status,
2395            content,
2396            entity,
2397        }))
2398    }
2399}
2400
2401/// Viewset for static authenticator devices (for admins)
2402pub async fn authenticators_admin_static_retrieve(
2403    configuration: &configuration::Configuration,
2404    id: i32,
2405) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticRetrieveError>> {
2406    // add a prefix to parameters to efficiently prevent name collisions
2407    let p_path_id = id;
2408
2409    let uri_str = format!(
2410        "{}/authenticators/admin/static/{id}/",
2411        configuration.base_path,
2412        id = p_path_id
2413    );
2414    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2415
2416    if let Some(ref user_agent) = configuration.user_agent {
2417        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2418    }
2419    if let Some(ref token) = configuration.bearer_access_token {
2420        req_builder = req_builder.bearer_auth(token.to_owned());
2421    };
2422
2423    let req = req_builder.build()?;
2424    let resp = configuration.client.execute(req).await?;
2425
2426    let status = resp.status();
2427    let content_type = resp
2428        .headers()
2429        .get("content-type")
2430        .and_then(|v| v.to_str().ok())
2431        .unwrap_or("application/octet-stream");
2432    let content_type = super::ContentType::from(content_type);
2433
2434    if !status.is_client_error() && !status.is_server_error() {
2435        let content = resp.text().await?;
2436        match content_type {
2437            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2438            ContentType::Text => {
2439                return Err(Error::from(serde_json::Error::custom(
2440                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2441                )))
2442            }
2443            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2444                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2445            )))),
2446        }
2447    } else {
2448        let content = resp.text().await?;
2449        let entity: Option<AuthenticatorsAdminStaticRetrieveError> = serde_json::from_str(&content).ok();
2450        Err(Error::ResponseError(ResponseContent {
2451            status,
2452            content,
2453            entity,
2454        }))
2455    }
2456}
2457
2458/// Viewset for static authenticator devices (for admins)
2459pub async fn authenticators_admin_static_update(
2460    configuration: &configuration::Configuration,
2461    id: i32,
2462    static_device_request: models::StaticDeviceRequest,
2463) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticUpdateError>> {
2464    // add a prefix to parameters to efficiently prevent name collisions
2465    let p_path_id = id;
2466    let p_body_static_device_request = static_device_request;
2467
2468    let uri_str = format!(
2469        "{}/authenticators/admin/static/{id}/",
2470        configuration.base_path,
2471        id = p_path_id
2472    );
2473    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2474
2475    if let Some(ref user_agent) = configuration.user_agent {
2476        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2477    }
2478    if let Some(ref token) = configuration.bearer_access_token {
2479        req_builder = req_builder.bearer_auth(token.to_owned());
2480    };
2481    req_builder = req_builder.json(&p_body_static_device_request);
2482
2483    let req = req_builder.build()?;
2484    let resp = configuration.client.execute(req).await?;
2485
2486    let status = resp.status();
2487    let content_type = resp
2488        .headers()
2489        .get("content-type")
2490        .and_then(|v| v.to_str().ok())
2491        .unwrap_or("application/octet-stream");
2492    let content_type = super::ContentType::from(content_type);
2493
2494    if !status.is_client_error() && !status.is_server_error() {
2495        let content = resp.text().await?;
2496        match content_type {
2497            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2498            ContentType::Text => {
2499                return Err(Error::from(serde_json::Error::custom(
2500                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2501                )))
2502            }
2503            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2504                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2505            )))),
2506        }
2507    } else {
2508        let content = resp.text().await?;
2509        let entity: Option<AuthenticatorsAdminStaticUpdateError> = serde_json::from_str(&content).ok();
2510        Err(Error::ResponseError(ResponseContent {
2511            status,
2512            content,
2513            entity,
2514        }))
2515    }
2516}
2517
2518/// Viewset for totp authenticator devices (for admins)
2519pub async fn authenticators_admin_totp_create(
2520    configuration: &configuration::Configuration,
2521    totp_device_request: models::TotpDeviceRequest,
2522) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpCreateError>> {
2523    // add a prefix to parameters to efficiently prevent name collisions
2524    let p_body_totp_device_request = totp_device_request;
2525
2526    let uri_str = format!("{}/authenticators/admin/totp/", configuration.base_path);
2527    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2528
2529    if let Some(ref user_agent) = configuration.user_agent {
2530        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2531    }
2532    if let Some(ref token) = configuration.bearer_access_token {
2533        req_builder = req_builder.bearer_auth(token.to_owned());
2534    };
2535    req_builder = req_builder.json(&p_body_totp_device_request);
2536
2537    let req = req_builder.build()?;
2538    let resp = configuration.client.execute(req).await?;
2539
2540    let status = resp.status();
2541    let content_type = resp
2542        .headers()
2543        .get("content-type")
2544        .and_then(|v| v.to_str().ok())
2545        .unwrap_or("application/octet-stream");
2546    let content_type = super::ContentType::from(content_type);
2547
2548    if !status.is_client_error() && !status.is_server_error() {
2549        let content = resp.text().await?;
2550        match content_type {
2551            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2552            ContentType::Text => {
2553                return Err(Error::from(serde_json::Error::custom(
2554                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2555                )))
2556            }
2557            ContentType::Unsupported(unknown_type) => {
2558                return Err(Error::from(serde_json::Error::custom(format!(
2559                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2560                ))))
2561            }
2562        }
2563    } else {
2564        let content = resp.text().await?;
2565        let entity: Option<AuthenticatorsAdminTotpCreateError> = serde_json::from_str(&content).ok();
2566        Err(Error::ResponseError(ResponseContent {
2567            status,
2568            content,
2569            entity,
2570        }))
2571    }
2572}
2573
2574/// Viewset for totp authenticator devices (for admins)
2575pub async fn authenticators_admin_totp_destroy(
2576    configuration: &configuration::Configuration,
2577    id: i32,
2578) -> Result<(), Error<AuthenticatorsAdminTotpDestroyError>> {
2579    // add a prefix to parameters to efficiently prevent name collisions
2580    let p_path_id = id;
2581
2582    let uri_str = format!(
2583        "{}/authenticators/admin/totp/{id}/",
2584        configuration.base_path,
2585        id = p_path_id
2586    );
2587    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2588
2589    if let Some(ref user_agent) = configuration.user_agent {
2590        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2591    }
2592    if let Some(ref token) = configuration.bearer_access_token {
2593        req_builder = req_builder.bearer_auth(token.to_owned());
2594    };
2595
2596    let req = req_builder.build()?;
2597    let resp = configuration.client.execute(req).await?;
2598
2599    let status = resp.status();
2600
2601    if !status.is_client_error() && !status.is_server_error() {
2602        Ok(())
2603    } else {
2604        let content = resp.text().await?;
2605        let entity: Option<AuthenticatorsAdminTotpDestroyError> = serde_json::from_str(&content).ok();
2606        Err(Error::ResponseError(ResponseContent {
2607            status,
2608            content,
2609            entity,
2610        }))
2611    }
2612}
2613
2614/// Viewset for totp authenticator devices (for admins)
2615pub async fn authenticators_admin_totp_list(
2616    configuration: &configuration::Configuration,
2617    name: Option<&str>,
2618    ordering: Option<&str>,
2619    page: Option<i32>,
2620    page_size: Option<i32>,
2621    search: Option<&str>,
2622) -> Result<models::PaginatedTotpDeviceList, Error<AuthenticatorsAdminTotpListError>> {
2623    // add a prefix to parameters to efficiently prevent name collisions
2624    let p_query_name = name;
2625    let p_query_ordering = ordering;
2626    let p_query_page = page;
2627    let p_query_page_size = page_size;
2628    let p_query_search = search;
2629
2630    let uri_str = format!("{}/authenticators/admin/totp/", configuration.base_path);
2631    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2632
2633    if let Some(ref param_value) = p_query_name {
2634        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2635    }
2636    if let Some(ref param_value) = p_query_ordering {
2637        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
2638    }
2639    if let Some(ref param_value) = p_query_page {
2640        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2641    }
2642    if let Some(ref param_value) = p_query_page_size {
2643        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
2644    }
2645    if let Some(ref param_value) = p_query_search {
2646        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
2647    }
2648    if let Some(ref user_agent) = configuration.user_agent {
2649        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2650    }
2651    if let Some(ref token) = configuration.bearer_access_token {
2652        req_builder = req_builder.bearer_auth(token.to_owned());
2653    };
2654
2655    let req = req_builder.build()?;
2656    let resp = configuration.client.execute(req).await?;
2657
2658    let status = resp.status();
2659    let content_type = resp
2660        .headers()
2661        .get("content-type")
2662        .and_then(|v| v.to_str().ok())
2663        .unwrap_or("application/octet-stream");
2664    let content_type = super::ContentType::from(content_type);
2665
2666    if !status.is_client_error() && !status.is_server_error() {
2667        let content = resp.text().await?;
2668        match content_type {
2669            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2670            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTotpDeviceList`"))),
2671            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedTotpDeviceList`")))),
2672        }
2673    } else {
2674        let content = resp.text().await?;
2675        let entity: Option<AuthenticatorsAdminTotpListError> = serde_json::from_str(&content).ok();
2676        Err(Error::ResponseError(ResponseContent {
2677            status,
2678            content,
2679            entity,
2680        }))
2681    }
2682}
2683
2684/// Viewset for totp authenticator devices (for admins)
2685pub async fn authenticators_admin_totp_partial_update(
2686    configuration: &configuration::Configuration,
2687    id: i32,
2688    patched_totp_device_request: Option<models::PatchedTotpDeviceRequest>,
2689) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpPartialUpdateError>> {
2690    // add a prefix to parameters to efficiently prevent name collisions
2691    let p_path_id = id;
2692    let p_body_patched_totp_device_request = patched_totp_device_request;
2693
2694    let uri_str = format!(
2695        "{}/authenticators/admin/totp/{id}/",
2696        configuration.base_path,
2697        id = p_path_id
2698    );
2699    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2700
2701    if let Some(ref user_agent) = configuration.user_agent {
2702        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2703    }
2704    if let Some(ref token) = configuration.bearer_access_token {
2705        req_builder = req_builder.bearer_auth(token.to_owned());
2706    };
2707    req_builder = req_builder.json(&p_body_patched_totp_device_request);
2708
2709    let req = req_builder.build()?;
2710    let resp = configuration.client.execute(req).await?;
2711
2712    let status = resp.status();
2713    let content_type = resp
2714        .headers()
2715        .get("content-type")
2716        .and_then(|v| v.to_str().ok())
2717        .unwrap_or("application/octet-stream");
2718    let content_type = super::ContentType::from(content_type);
2719
2720    if !status.is_client_error() && !status.is_server_error() {
2721        let content = resp.text().await?;
2722        match content_type {
2723            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2724            ContentType::Text => {
2725                return Err(Error::from(serde_json::Error::custom(
2726                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2727                )))
2728            }
2729            ContentType::Unsupported(unknown_type) => {
2730                return Err(Error::from(serde_json::Error::custom(format!(
2731                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2732                ))))
2733            }
2734        }
2735    } else {
2736        let content = resp.text().await?;
2737        let entity: Option<AuthenticatorsAdminTotpPartialUpdateError> = serde_json::from_str(&content).ok();
2738        Err(Error::ResponseError(ResponseContent {
2739            status,
2740            content,
2741            entity,
2742        }))
2743    }
2744}
2745
2746/// Viewset for totp authenticator devices (for admins)
2747pub async fn authenticators_admin_totp_retrieve(
2748    configuration: &configuration::Configuration,
2749    id: i32,
2750) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpRetrieveError>> {
2751    // add a prefix to parameters to efficiently prevent name collisions
2752    let p_path_id = id;
2753
2754    let uri_str = format!(
2755        "{}/authenticators/admin/totp/{id}/",
2756        configuration.base_path,
2757        id = p_path_id
2758    );
2759    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2760
2761    if let Some(ref user_agent) = configuration.user_agent {
2762        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2763    }
2764    if let Some(ref token) = configuration.bearer_access_token {
2765        req_builder = req_builder.bearer_auth(token.to_owned());
2766    };
2767
2768    let req = req_builder.build()?;
2769    let resp = configuration.client.execute(req).await?;
2770
2771    let status = resp.status();
2772    let content_type = resp
2773        .headers()
2774        .get("content-type")
2775        .and_then(|v| v.to_str().ok())
2776        .unwrap_or("application/octet-stream");
2777    let content_type = super::ContentType::from(content_type);
2778
2779    if !status.is_client_error() && !status.is_server_error() {
2780        let content = resp.text().await?;
2781        match content_type {
2782            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2783            ContentType::Text => {
2784                return Err(Error::from(serde_json::Error::custom(
2785                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2786                )))
2787            }
2788            ContentType::Unsupported(unknown_type) => {
2789                return Err(Error::from(serde_json::Error::custom(format!(
2790                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2791                ))))
2792            }
2793        }
2794    } else {
2795        let content = resp.text().await?;
2796        let entity: Option<AuthenticatorsAdminTotpRetrieveError> = serde_json::from_str(&content).ok();
2797        Err(Error::ResponseError(ResponseContent {
2798            status,
2799            content,
2800            entity,
2801        }))
2802    }
2803}
2804
2805/// Viewset for totp authenticator devices (for admins)
2806pub async fn authenticators_admin_totp_update(
2807    configuration: &configuration::Configuration,
2808    id: i32,
2809    totp_device_request: models::TotpDeviceRequest,
2810) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpUpdateError>> {
2811    // add a prefix to parameters to efficiently prevent name collisions
2812    let p_path_id = id;
2813    let p_body_totp_device_request = totp_device_request;
2814
2815    let uri_str = format!(
2816        "{}/authenticators/admin/totp/{id}/",
2817        configuration.base_path,
2818        id = p_path_id
2819    );
2820    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2821
2822    if let Some(ref user_agent) = configuration.user_agent {
2823        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2824    }
2825    if let Some(ref token) = configuration.bearer_access_token {
2826        req_builder = req_builder.bearer_auth(token.to_owned());
2827    };
2828    req_builder = req_builder.json(&p_body_totp_device_request);
2829
2830    let req = req_builder.build()?;
2831    let resp = configuration.client.execute(req).await?;
2832
2833    let status = resp.status();
2834    let content_type = resp
2835        .headers()
2836        .get("content-type")
2837        .and_then(|v| v.to_str().ok())
2838        .unwrap_or("application/octet-stream");
2839    let content_type = super::ContentType::from(content_type);
2840
2841    if !status.is_client_error() && !status.is_server_error() {
2842        let content = resp.text().await?;
2843        match content_type {
2844            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2845            ContentType::Text => {
2846                return Err(Error::from(serde_json::Error::custom(
2847                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2848                )))
2849            }
2850            ContentType::Unsupported(unknown_type) => {
2851                return Err(Error::from(serde_json::Error::custom(format!(
2852                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2853                ))))
2854            }
2855        }
2856    } else {
2857        let content = resp.text().await?;
2858        let entity: Option<AuthenticatorsAdminTotpUpdateError> = serde_json::from_str(&content).ok();
2859        Err(Error::ResponseError(ResponseContent {
2860            status,
2861            content,
2862            entity,
2863        }))
2864    }
2865}
2866
2867/// Viewset for WebAuthn authenticator devices (for admins)
2868pub async fn authenticators_admin_webauthn_create(
2869    configuration: &configuration::Configuration,
2870    web_authn_device_request: models::WebAuthnDeviceRequest,
2871) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnCreateError>> {
2872    // add a prefix to parameters to efficiently prevent name collisions
2873    let p_body_web_authn_device_request = web_authn_device_request;
2874
2875    let uri_str = format!("{}/authenticators/admin/webauthn/", configuration.base_path);
2876    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2877
2878    if let Some(ref user_agent) = configuration.user_agent {
2879        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2880    }
2881    if let Some(ref token) = configuration.bearer_access_token {
2882        req_builder = req_builder.bearer_auth(token.to_owned());
2883    };
2884    req_builder = req_builder.json(&p_body_web_authn_device_request);
2885
2886    let req = req_builder.build()?;
2887    let resp = configuration.client.execute(req).await?;
2888
2889    let status = resp.status();
2890    let content_type = resp
2891        .headers()
2892        .get("content-type")
2893        .and_then(|v| v.to_str().ok())
2894        .unwrap_or("application/octet-stream");
2895    let content_type = super::ContentType::from(content_type);
2896
2897    if !status.is_client_error() && !status.is_server_error() {
2898        let content = resp.text().await?;
2899        match content_type {
2900            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2901            ContentType::Text => {
2902                return Err(Error::from(serde_json::Error::custom(
2903                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
2904                )))
2905            }
2906            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2907                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
2908            )))),
2909        }
2910    } else {
2911        let content = resp.text().await?;
2912        let entity: Option<AuthenticatorsAdminWebauthnCreateError> = serde_json::from_str(&content).ok();
2913        Err(Error::ResponseError(ResponseContent {
2914            status,
2915            content,
2916            entity,
2917        }))
2918    }
2919}
2920
2921/// Viewset for WebAuthn authenticator devices (for admins)
2922pub async fn authenticators_admin_webauthn_destroy(
2923    configuration: &configuration::Configuration,
2924    id: i32,
2925) -> Result<(), Error<AuthenticatorsAdminWebauthnDestroyError>> {
2926    // add a prefix to parameters to efficiently prevent name collisions
2927    let p_path_id = id;
2928
2929    let uri_str = format!(
2930        "{}/authenticators/admin/webauthn/{id}/",
2931        configuration.base_path,
2932        id = p_path_id
2933    );
2934    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2935
2936    if let Some(ref user_agent) = configuration.user_agent {
2937        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2938    }
2939    if let Some(ref token) = configuration.bearer_access_token {
2940        req_builder = req_builder.bearer_auth(token.to_owned());
2941    };
2942
2943    let req = req_builder.build()?;
2944    let resp = configuration.client.execute(req).await?;
2945
2946    let status = resp.status();
2947
2948    if !status.is_client_error() && !status.is_server_error() {
2949        Ok(())
2950    } else {
2951        let content = resp.text().await?;
2952        let entity: Option<AuthenticatorsAdminWebauthnDestroyError> = serde_json::from_str(&content).ok();
2953        Err(Error::ResponseError(ResponseContent {
2954            status,
2955            content,
2956            entity,
2957        }))
2958    }
2959}
2960
2961/// Viewset for WebAuthn authenticator devices (for admins)
2962pub async fn authenticators_admin_webauthn_list(
2963    configuration: &configuration::Configuration,
2964    name: Option<&str>,
2965    ordering: Option<&str>,
2966    page: Option<i32>,
2967    page_size: Option<i32>,
2968    search: Option<&str>,
2969) -> Result<models::PaginatedWebAuthnDeviceList, Error<AuthenticatorsAdminWebauthnListError>> {
2970    // add a prefix to parameters to efficiently prevent name collisions
2971    let p_query_name = name;
2972    let p_query_ordering = ordering;
2973    let p_query_page = page;
2974    let p_query_page_size = page_size;
2975    let p_query_search = search;
2976
2977    let uri_str = format!("{}/authenticators/admin/webauthn/", configuration.base_path);
2978    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2979
2980    if let Some(ref param_value) = p_query_name {
2981        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2982    }
2983    if let Some(ref param_value) = p_query_ordering {
2984        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
2985    }
2986    if let Some(ref param_value) = p_query_page {
2987        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2988    }
2989    if let Some(ref param_value) = p_query_page_size {
2990        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
2991    }
2992    if let Some(ref param_value) = p_query_search {
2993        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
2994    }
2995    if let Some(ref user_agent) = configuration.user_agent {
2996        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2997    }
2998    if let Some(ref token) = configuration.bearer_access_token {
2999        req_builder = req_builder.bearer_auth(token.to_owned());
3000    };
3001
3002    let req = req_builder.build()?;
3003    let resp = configuration.client.execute(req).await?;
3004
3005    let status = resp.status();
3006    let content_type = resp
3007        .headers()
3008        .get("content-type")
3009        .and_then(|v| v.to_str().ok())
3010        .unwrap_or("application/octet-stream");
3011    let content_type = super::ContentType::from(content_type);
3012
3013    if !status.is_client_error() && !status.is_server_error() {
3014        let content = resp.text().await?;
3015        match content_type {
3016            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3017            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedWebAuthnDeviceList`"))),
3018            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedWebAuthnDeviceList`")))),
3019        }
3020    } else {
3021        let content = resp.text().await?;
3022        let entity: Option<AuthenticatorsAdminWebauthnListError> = serde_json::from_str(&content).ok();
3023        Err(Error::ResponseError(ResponseContent {
3024            status,
3025            content,
3026            entity,
3027        }))
3028    }
3029}
3030
3031/// Viewset for WebAuthn authenticator devices (for admins)
3032pub async fn authenticators_admin_webauthn_partial_update(
3033    configuration: &configuration::Configuration,
3034    id: i32,
3035    patched_web_authn_device_request: Option<models::PatchedWebAuthnDeviceRequest>,
3036) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnPartialUpdateError>> {
3037    // add a prefix to parameters to efficiently prevent name collisions
3038    let p_path_id = id;
3039    let p_body_patched_web_authn_device_request = patched_web_authn_device_request;
3040
3041    let uri_str = format!(
3042        "{}/authenticators/admin/webauthn/{id}/",
3043        configuration.base_path,
3044        id = p_path_id
3045    );
3046    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3047
3048    if let Some(ref user_agent) = configuration.user_agent {
3049        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3050    }
3051    if let Some(ref token) = configuration.bearer_access_token {
3052        req_builder = req_builder.bearer_auth(token.to_owned());
3053    };
3054    req_builder = req_builder.json(&p_body_patched_web_authn_device_request);
3055
3056    let req = req_builder.build()?;
3057    let resp = configuration.client.execute(req).await?;
3058
3059    let status = resp.status();
3060    let content_type = resp
3061        .headers()
3062        .get("content-type")
3063        .and_then(|v| v.to_str().ok())
3064        .unwrap_or("application/octet-stream");
3065    let content_type = super::ContentType::from(content_type);
3066
3067    if !status.is_client_error() && !status.is_server_error() {
3068        let content = resp.text().await?;
3069        match content_type {
3070            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3071            ContentType::Text => {
3072                return Err(Error::from(serde_json::Error::custom(
3073                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
3074                )))
3075            }
3076            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3077                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
3078            )))),
3079        }
3080    } else {
3081        let content = resp.text().await?;
3082        let entity: Option<AuthenticatorsAdminWebauthnPartialUpdateError> = serde_json::from_str(&content).ok();
3083        Err(Error::ResponseError(ResponseContent {
3084            status,
3085            content,
3086            entity,
3087        }))
3088    }
3089}
3090
3091/// Viewset for WebAuthn authenticator devices (for admins)
3092pub async fn authenticators_admin_webauthn_retrieve(
3093    configuration: &configuration::Configuration,
3094    id: i32,
3095) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnRetrieveError>> {
3096    // add a prefix to parameters to efficiently prevent name collisions
3097    let p_path_id = id;
3098
3099    let uri_str = format!(
3100        "{}/authenticators/admin/webauthn/{id}/",
3101        configuration.base_path,
3102        id = p_path_id
3103    );
3104    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3105
3106    if let Some(ref user_agent) = configuration.user_agent {
3107        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3108    }
3109    if let Some(ref token) = configuration.bearer_access_token {
3110        req_builder = req_builder.bearer_auth(token.to_owned());
3111    };
3112
3113    let req = req_builder.build()?;
3114    let resp = configuration.client.execute(req).await?;
3115
3116    let status = resp.status();
3117    let content_type = resp
3118        .headers()
3119        .get("content-type")
3120        .and_then(|v| v.to_str().ok())
3121        .unwrap_or("application/octet-stream");
3122    let content_type = super::ContentType::from(content_type);
3123
3124    if !status.is_client_error() && !status.is_server_error() {
3125        let content = resp.text().await?;
3126        match content_type {
3127            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3128            ContentType::Text => {
3129                return Err(Error::from(serde_json::Error::custom(
3130                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
3131                )))
3132            }
3133            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3134                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
3135            )))),
3136        }
3137    } else {
3138        let content = resp.text().await?;
3139        let entity: Option<AuthenticatorsAdminWebauthnRetrieveError> = serde_json::from_str(&content).ok();
3140        Err(Error::ResponseError(ResponseContent {
3141            status,
3142            content,
3143            entity,
3144        }))
3145    }
3146}
3147
3148/// Viewset for WebAuthn authenticator devices (for admins)
3149pub async fn authenticators_admin_webauthn_update(
3150    configuration: &configuration::Configuration,
3151    id: i32,
3152    web_authn_device_request: models::WebAuthnDeviceRequest,
3153) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnUpdateError>> {
3154    // add a prefix to parameters to efficiently prevent name collisions
3155    let p_path_id = id;
3156    let p_body_web_authn_device_request = web_authn_device_request;
3157
3158    let uri_str = format!(
3159        "{}/authenticators/admin/webauthn/{id}/",
3160        configuration.base_path,
3161        id = p_path_id
3162    );
3163    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3164
3165    if let Some(ref user_agent) = configuration.user_agent {
3166        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3167    }
3168    if let Some(ref token) = configuration.bearer_access_token {
3169        req_builder = req_builder.bearer_auth(token.to_owned());
3170    };
3171    req_builder = req_builder.json(&p_body_web_authn_device_request);
3172
3173    let req = req_builder.build()?;
3174    let resp = configuration.client.execute(req).await?;
3175
3176    let status = resp.status();
3177    let content_type = resp
3178        .headers()
3179        .get("content-type")
3180        .and_then(|v| v.to_str().ok())
3181        .unwrap_or("application/octet-stream");
3182    let content_type = super::ContentType::from(content_type);
3183
3184    if !status.is_client_error() && !status.is_server_error() {
3185        let content = resp.text().await?;
3186        match content_type {
3187            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3188            ContentType::Text => {
3189                return Err(Error::from(serde_json::Error::custom(
3190                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
3191                )))
3192            }
3193            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3194                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
3195            )))),
3196        }
3197    } else {
3198        let content = resp.text().await?;
3199        let entity: Option<AuthenticatorsAdminWebauthnUpdateError> = serde_json::from_str(&content).ok();
3200        Err(Error::ResponseError(ResponseContent {
3201            status,
3202            content,
3203            entity,
3204        }))
3205    }
3206}
3207
3208/// Get all devices for current user
3209pub async fn authenticators_all_list(
3210    configuration: &configuration::Configuration,
3211) -> Result<Vec<models::Device>, Error<AuthenticatorsAllListError>> {
3212    let uri_str = format!("{}/authenticators/all/", configuration.base_path);
3213    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3214
3215    if let Some(ref user_agent) = configuration.user_agent {
3216        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3217    }
3218    if let Some(ref token) = configuration.bearer_access_token {
3219        req_builder = req_builder.bearer_auth(token.to_owned());
3220    };
3221
3222    let req = req_builder.build()?;
3223    let resp = configuration.client.execute(req).await?;
3224
3225    let status = resp.status();
3226    let content_type = resp
3227        .headers()
3228        .get("content-type")
3229        .and_then(|v| v.to_str().ok())
3230        .unwrap_or("application/octet-stream");
3231    let content_type = super::ContentType::from(content_type);
3232
3233    if !status.is_client_error() && !status.is_server_error() {
3234        let content = resp.text().await?;
3235        match content_type {
3236            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3237            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Device&gt;`"))),
3238            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Device&gt;`")))),
3239        }
3240    } else {
3241        let content = resp.text().await?;
3242        let entity: Option<AuthenticatorsAllListError> = serde_json::from_str(&content).ok();
3243        Err(Error::ResponseError(ResponseContent {
3244            status,
3245            content,
3246            entity,
3247        }))
3248    }
3249}
3250
3251/// Viewset for Duo authenticator devices
3252pub async fn authenticators_duo_destroy(
3253    configuration: &configuration::Configuration,
3254    id: i32,
3255) -> Result<(), Error<AuthenticatorsDuoDestroyError>> {
3256    // add a prefix to parameters to efficiently prevent name collisions
3257    let p_path_id = id;
3258
3259    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3260    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3261
3262    if let Some(ref user_agent) = configuration.user_agent {
3263        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3264    }
3265    if let Some(ref token) = configuration.bearer_access_token {
3266        req_builder = req_builder.bearer_auth(token.to_owned());
3267    };
3268
3269    let req = req_builder.build()?;
3270    let resp = configuration.client.execute(req).await?;
3271
3272    let status = resp.status();
3273
3274    if !status.is_client_error() && !status.is_server_error() {
3275        Ok(())
3276    } else {
3277        let content = resp.text().await?;
3278        let entity: Option<AuthenticatorsDuoDestroyError> = serde_json::from_str(&content).ok();
3279        Err(Error::ResponseError(ResponseContent {
3280            status,
3281            content,
3282            entity,
3283        }))
3284    }
3285}
3286
3287/// Viewset for Duo authenticator devices
3288pub async fn authenticators_duo_list(
3289    configuration: &configuration::Configuration,
3290    name: Option<&str>,
3291    ordering: Option<&str>,
3292    page: Option<i32>,
3293    page_size: Option<i32>,
3294    search: Option<&str>,
3295) -> Result<models::PaginatedDuoDeviceList, Error<AuthenticatorsDuoListError>> {
3296    // add a prefix to parameters to efficiently prevent name collisions
3297    let p_query_name = name;
3298    let p_query_ordering = ordering;
3299    let p_query_page = page;
3300    let p_query_page_size = page_size;
3301    let p_query_search = search;
3302
3303    let uri_str = format!("{}/authenticators/duo/", configuration.base_path);
3304    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3305
3306    if let Some(ref param_value) = p_query_name {
3307        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3308    }
3309    if let Some(ref param_value) = p_query_ordering {
3310        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3311    }
3312    if let Some(ref param_value) = p_query_page {
3313        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3314    }
3315    if let Some(ref param_value) = p_query_page_size {
3316        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3317    }
3318    if let Some(ref param_value) = p_query_search {
3319        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3320    }
3321    if let Some(ref user_agent) = configuration.user_agent {
3322        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3323    }
3324    if let Some(ref token) = configuration.bearer_access_token {
3325        req_builder = req_builder.bearer_auth(token.to_owned());
3326    };
3327
3328    let req = req_builder.build()?;
3329    let resp = configuration.client.execute(req).await?;
3330
3331    let status = resp.status();
3332    let content_type = resp
3333        .headers()
3334        .get("content-type")
3335        .and_then(|v| v.to_str().ok())
3336        .unwrap_or("application/octet-stream");
3337    let content_type = super::ContentType::from(content_type);
3338
3339    if !status.is_client_error() && !status.is_server_error() {
3340        let content = resp.text().await?;
3341        match content_type {
3342            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3343            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDuoDeviceList`"))),
3344            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedDuoDeviceList`")))),
3345        }
3346    } else {
3347        let content = resp.text().await?;
3348        let entity: Option<AuthenticatorsDuoListError> = serde_json::from_str(&content).ok();
3349        Err(Error::ResponseError(ResponseContent {
3350            status,
3351            content,
3352            entity,
3353        }))
3354    }
3355}
3356
3357/// Viewset for Duo authenticator devices
3358pub async fn authenticators_duo_partial_update(
3359    configuration: &configuration::Configuration,
3360    id: i32,
3361    patched_duo_device_request: Option<models::PatchedDuoDeviceRequest>,
3362) -> Result<models::DuoDevice, Error<AuthenticatorsDuoPartialUpdateError>> {
3363    // add a prefix to parameters to efficiently prevent name collisions
3364    let p_path_id = id;
3365    let p_body_patched_duo_device_request = patched_duo_device_request;
3366
3367    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3368    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3369
3370    if let Some(ref user_agent) = configuration.user_agent {
3371        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3372    }
3373    if let Some(ref token) = configuration.bearer_access_token {
3374        req_builder = req_builder.bearer_auth(token.to_owned());
3375    };
3376    req_builder = req_builder.json(&p_body_patched_duo_device_request);
3377
3378    let req = req_builder.build()?;
3379    let resp = configuration.client.execute(req).await?;
3380
3381    let status = resp.status();
3382    let content_type = resp
3383        .headers()
3384        .get("content-type")
3385        .and_then(|v| v.to_str().ok())
3386        .unwrap_or("application/octet-stream");
3387    let content_type = super::ContentType::from(content_type);
3388
3389    if !status.is_client_error() && !status.is_server_error() {
3390        let content = resp.text().await?;
3391        match content_type {
3392            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3393            ContentType::Text => {
3394                return Err(Error::from(serde_json::Error::custom(
3395                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
3396                )))
3397            }
3398            ContentType::Unsupported(unknown_type) => {
3399                return Err(Error::from(serde_json::Error::custom(format!(
3400                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
3401                ))))
3402            }
3403        }
3404    } else {
3405        let content = resp.text().await?;
3406        let entity: Option<AuthenticatorsDuoPartialUpdateError> = serde_json::from_str(&content).ok();
3407        Err(Error::ResponseError(ResponseContent {
3408            status,
3409            content,
3410            entity,
3411        }))
3412    }
3413}
3414
3415/// Viewset for Duo authenticator devices
3416pub async fn authenticators_duo_retrieve(
3417    configuration: &configuration::Configuration,
3418    id: i32,
3419) -> Result<models::DuoDevice, Error<AuthenticatorsDuoRetrieveError>> {
3420    // add a prefix to parameters to efficiently prevent name collisions
3421    let p_path_id = id;
3422
3423    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3424    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3425
3426    if let Some(ref user_agent) = configuration.user_agent {
3427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3428    }
3429    if let Some(ref token) = configuration.bearer_access_token {
3430        req_builder = req_builder.bearer_auth(token.to_owned());
3431    };
3432
3433    let req = req_builder.build()?;
3434    let resp = configuration.client.execute(req).await?;
3435
3436    let status = resp.status();
3437    let content_type = resp
3438        .headers()
3439        .get("content-type")
3440        .and_then(|v| v.to_str().ok())
3441        .unwrap_or("application/octet-stream");
3442    let content_type = super::ContentType::from(content_type);
3443
3444    if !status.is_client_error() && !status.is_server_error() {
3445        let content = resp.text().await?;
3446        match content_type {
3447            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3448            ContentType::Text => {
3449                return Err(Error::from(serde_json::Error::custom(
3450                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
3451                )))
3452            }
3453            ContentType::Unsupported(unknown_type) => {
3454                return Err(Error::from(serde_json::Error::custom(format!(
3455                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
3456                ))))
3457            }
3458        }
3459    } else {
3460        let content = resp.text().await?;
3461        let entity: Option<AuthenticatorsDuoRetrieveError> = serde_json::from_str(&content).ok();
3462        Err(Error::ResponseError(ResponseContent {
3463            status,
3464            content,
3465            entity,
3466        }))
3467    }
3468}
3469
3470/// Viewset for Duo authenticator devices
3471pub async fn authenticators_duo_update(
3472    configuration: &configuration::Configuration,
3473    id: i32,
3474    duo_device_request: models::DuoDeviceRequest,
3475) -> Result<models::DuoDevice, Error<AuthenticatorsDuoUpdateError>> {
3476    // add a prefix to parameters to efficiently prevent name collisions
3477    let p_path_id = id;
3478    let p_body_duo_device_request = duo_device_request;
3479
3480    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3481    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3482
3483    if let Some(ref user_agent) = configuration.user_agent {
3484        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3485    }
3486    if let Some(ref token) = configuration.bearer_access_token {
3487        req_builder = req_builder.bearer_auth(token.to_owned());
3488    };
3489    req_builder = req_builder.json(&p_body_duo_device_request);
3490
3491    let req = req_builder.build()?;
3492    let resp = configuration.client.execute(req).await?;
3493
3494    let status = resp.status();
3495    let content_type = resp
3496        .headers()
3497        .get("content-type")
3498        .and_then(|v| v.to_str().ok())
3499        .unwrap_or("application/octet-stream");
3500    let content_type = super::ContentType::from(content_type);
3501
3502    if !status.is_client_error() && !status.is_server_error() {
3503        let content = resp.text().await?;
3504        match content_type {
3505            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3506            ContentType::Text => {
3507                return Err(Error::from(serde_json::Error::custom(
3508                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
3509                )))
3510            }
3511            ContentType::Unsupported(unknown_type) => {
3512                return Err(Error::from(serde_json::Error::custom(format!(
3513                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
3514                ))))
3515            }
3516        }
3517    } else {
3518        let content = resp.text().await?;
3519        let entity: Option<AuthenticatorsDuoUpdateError> = serde_json::from_str(&content).ok();
3520        Err(Error::ResponseError(ResponseContent {
3521            status,
3522            content,
3523            entity,
3524        }))
3525    }
3526}
3527
3528/// Get a list of all objects that use this object
3529pub async fn authenticators_duo_used_by_list(
3530    configuration: &configuration::Configuration,
3531    id: i32,
3532) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsDuoUsedByListError>> {
3533    // add a prefix to parameters to efficiently prevent name collisions
3534    let p_path_id = id;
3535
3536    let uri_str = format!(
3537        "{}/authenticators/duo/{id}/used_by/",
3538        configuration.base_path,
3539        id = p_path_id
3540    );
3541    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3542
3543    if let Some(ref user_agent) = configuration.user_agent {
3544        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3545    }
3546    if let Some(ref token) = configuration.bearer_access_token {
3547        req_builder = req_builder.bearer_auth(token.to_owned());
3548    };
3549
3550    let req = req_builder.build()?;
3551    let resp = configuration.client.execute(req).await?;
3552
3553    let status = resp.status();
3554    let content_type = resp
3555        .headers()
3556        .get("content-type")
3557        .and_then(|v| v.to_str().ok())
3558        .unwrap_or("application/octet-stream");
3559    let content_type = super::ContentType::from(content_type);
3560
3561    if !status.is_client_error() && !status.is_server_error() {
3562        let content = resp.text().await?;
3563        match content_type {
3564            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3565            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
3566            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
3567        }
3568    } else {
3569        let content = resp.text().await?;
3570        let entity: Option<AuthenticatorsDuoUsedByListError> = serde_json::from_str(&content).ok();
3571        Err(Error::ResponseError(ResponseContent {
3572            status,
3573            content,
3574            entity,
3575        }))
3576    }
3577}
3578
3579/// Viewset for email authenticator devices
3580pub async fn authenticators_email_destroy(
3581    configuration: &configuration::Configuration,
3582    id: i32,
3583) -> Result<(), Error<AuthenticatorsEmailDestroyError>> {
3584    // add a prefix to parameters to efficiently prevent name collisions
3585    let p_path_id = id;
3586
3587    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3588    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3589
3590    if let Some(ref user_agent) = configuration.user_agent {
3591        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3592    }
3593    if let Some(ref token) = configuration.bearer_access_token {
3594        req_builder = req_builder.bearer_auth(token.to_owned());
3595    };
3596
3597    let req = req_builder.build()?;
3598    let resp = configuration.client.execute(req).await?;
3599
3600    let status = resp.status();
3601
3602    if !status.is_client_error() && !status.is_server_error() {
3603        Ok(())
3604    } else {
3605        let content = resp.text().await?;
3606        let entity: Option<AuthenticatorsEmailDestroyError> = serde_json::from_str(&content).ok();
3607        Err(Error::ResponseError(ResponseContent {
3608            status,
3609            content,
3610            entity,
3611        }))
3612    }
3613}
3614
3615/// Viewset for email authenticator devices
3616pub async fn authenticators_email_list(
3617    configuration: &configuration::Configuration,
3618    name: Option<&str>,
3619    ordering: Option<&str>,
3620    page: Option<i32>,
3621    page_size: Option<i32>,
3622    search: Option<&str>,
3623) -> Result<models::PaginatedEmailDeviceList, Error<AuthenticatorsEmailListError>> {
3624    // add a prefix to parameters to efficiently prevent name collisions
3625    let p_query_name = name;
3626    let p_query_ordering = ordering;
3627    let p_query_page = page;
3628    let p_query_page_size = page_size;
3629    let p_query_search = search;
3630
3631    let uri_str = format!("{}/authenticators/email/", configuration.base_path);
3632    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3633
3634    if let Some(ref param_value) = p_query_name {
3635        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3636    }
3637    if let Some(ref param_value) = p_query_ordering {
3638        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3639    }
3640    if let Some(ref param_value) = p_query_page {
3641        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3642    }
3643    if let Some(ref param_value) = p_query_page_size {
3644        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3645    }
3646    if let Some(ref param_value) = p_query_search {
3647        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3648    }
3649    if let Some(ref user_agent) = configuration.user_agent {
3650        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3651    }
3652    if let Some(ref token) = configuration.bearer_access_token {
3653        req_builder = req_builder.bearer_auth(token.to_owned());
3654    };
3655
3656    let req = req_builder.build()?;
3657    let resp = configuration.client.execute(req).await?;
3658
3659    let status = resp.status();
3660    let content_type = resp
3661        .headers()
3662        .get("content-type")
3663        .and_then(|v| v.to_str().ok())
3664        .unwrap_or("application/octet-stream");
3665    let content_type = super::ContentType::from(content_type);
3666
3667    if !status.is_client_error() && !status.is_server_error() {
3668        let content = resp.text().await?;
3669        match content_type {
3670            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3671            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEmailDeviceList`"))),
3672            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedEmailDeviceList`")))),
3673        }
3674    } else {
3675        let content = resp.text().await?;
3676        let entity: Option<AuthenticatorsEmailListError> = serde_json::from_str(&content).ok();
3677        Err(Error::ResponseError(ResponseContent {
3678            status,
3679            content,
3680            entity,
3681        }))
3682    }
3683}
3684
3685/// Viewset for email authenticator devices
3686pub async fn authenticators_email_partial_update(
3687    configuration: &configuration::Configuration,
3688    id: i32,
3689    patched_email_device_request: Option<models::PatchedEmailDeviceRequest>,
3690) -> Result<models::EmailDevice, Error<AuthenticatorsEmailPartialUpdateError>> {
3691    // add a prefix to parameters to efficiently prevent name collisions
3692    let p_path_id = id;
3693    let p_body_patched_email_device_request = patched_email_device_request;
3694
3695    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3696    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3697
3698    if let Some(ref user_agent) = configuration.user_agent {
3699        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3700    }
3701    if let Some(ref token) = configuration.bearer_access_token {
3702        req_builder = req_builder.bearer_auth(token.to_owned());
3703    };
3704    req_builder = req_builder.json(&p_body_patched_email_device_request);
3705
3706    let req = req_builder.build()?;
3707    let resp = configuration.client.execute(req).await?;
3708
3709    let status = resp.status();
3710    let content_type = resp
3711        .headers()
3712        .get("content-type")
3713        .and_then(|v| v.to_str().ok())
3714        .unwrap_or("application/octet-stream");
3715    let content_type = super::ContentType::from(content_type);
3716
3717    if !status.is_client_error() && !status.is_server_error() {
3718        let content = resp.text().await?;
3719        match content_type {
3720            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3721            ContentType::Text => {
3722                return Err(Error::from(serde_json::Error::custom(
3723                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
3724                )))
3725            }
3726            ContentType::Unsupported(unknown_type) => {
3727                return Err(Error::from(serde_json::Error::custom(format!(
3728                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
3729                ))))
3730            }
3731        }
3732    } else {
3733        let content = resp.text().await?;
3734        let entity: Option<AuthenticatorsEmailPartialUpdateError> = serde_json::from_str(&content).ok();
3735        Err(Error::ResponseError(ResponseContent {
3736            status,
3737            content,
3738            entity,
3739        }))
3740    }
3741}
3742
3743/// Viewset for email authenticator devices
3744pub async fn authenticators_email_retrieve(
3745    configuration: &configuration::Configuration,
3746    id: i32,
3747) -> Result<models::EmailDevice, Error<AuthenticatorsEmailRetrieveError>> {
3748    // add a prefix to parameters to efficiently prevent name collisions
3749    let p_path_id = id;
3750
3751    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3752    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3753
3754    if let Some(ref user_agent) = configuration.user_agent {
3755        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3756    }
3757    if let Some(ref token) = configuration.bearer_access_token {
3758        req_builder = req_builder.bearer_auth(token.to_owned());
3759    };
3760
3761    let req = req_builder.build()?;
3762    let resp = configuration.client.execute(req).await?;
3763
3764    let status = resp.status();
3765    let content_type = resp
3766        .headers()
3767        .get("content-type")
3768        .and_then(|v| v.to_str().ok())
3769        .unwrap_or("application/octet-stream");
3770    let content_type = super::ContentType::from(content_type);
3771
3772    if !status.is_client_error() && !status.is_server_error() {
3773        let content = resp.text().await?;
3774        match content_type {
3775            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3776            ContentType::Text => {
3777                return Err(Error::from(serde_json::Error::custom(
3778                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
3779                )))
3780            }
3781            ContentType::Unsupported(unknown_type) => {
3782                return Err(Error::from(serde_json::Error::custom(format!(
3783                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
3784                ))))
3785            }
3786        }
3787    } else {
3788        let content = resp.text().await?;
3789        let entity: Option<AuthenticatorsEmailRetrieveError> = serde_json::from_str(&content).ok();
3790        Err(Error::ResponseError(ResponseContent {
3791            status,
3792            content,
3793            entity,
3794        }))
3795    }
3796}
3797
3798/// Viewset for email authenticator devices
3799pub async fn authenticators_email_update(
3800    configuration: &configuration::Configuration,
3801    id: i32,
3802    email_device_request: models::EmailDeviceRequest,
3803) -> Result<models::EmailDevice, Error<AuthenticatorsEmailUpdateError>> {
3804    // add a prefix to parameters to efficiently prevent name collisions
3805    let p_path_id = id;
3806    let p_body_email_device_request = email_device_request;
3807
3808    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3809    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3810
3811    if let Some(ref user_agent) = configuration.user_agent {
3812        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3813    }
3814    if let Some(ref token) = configuration.bearer_access_token {
3815        req_builder = req_builder.bearer_auth(token.to_owned());
3816    };
3817    req_builder = req_builder.json(&p_body_email_device_request);
3818
3819    let req = req_builder.build()?;
3820    let resp = configuration.client.execute(req).await?;
3821
3822    let status = resp.status();
3823    let content_type = resp
3824        .headers()
3825        .get("content-type")
3826        .and_then(|v| v.to_str().ok())
3827        .unwrap_or("application/octet-stream");
3828    let content_type = super::ContentType::from(content_type);
3829
3830    if !status.is_client_error() && !status.is_server_error() {
3831        let content = resp.text().await?;
3832        match content_type {
3833            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3834            ContentType::Text => {
3835                return Err(Error::from(serde_json::Error::custom(
3836                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
3837                )))
3838            }
3839            ContentType::Unsupported(unknown_type) => {
3840                return Err(Error::from(serde_json::Error::custom(format!(
3841                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
3842                ))))
3843            }
3844        }
3845    } else {
3846        let content = resp.text().await?;
3847        let entity: Option<AuthenticatorsEmailUpdateError> = serde_json::from_str(&content).ok();
3848        Err(Error::ResponseError(ResponseContent {
3849            status,
3850            content,
3851            entity,
3852        }))
3853    }
3854}
3855
3856/// Get a list of all objects that use this object
3857pub async fn authenticators_email_used_by_list(
3858    configuration: &configuration::Configuration,
3859    id: i32,
3860) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsEmailUsedByListError>> {
3861    // add a prefix to parameters to efficiently prevent name collisions
3862    let p_path_id = id;
3863
3864    let uri_str = format!(
3865        "{}/authenticators/email/{id}/used_by/",
3866        configuration.base_path,
3867        id = p_path_id
3868    );
3869    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3870
3871    if let Some(ref user_agent) = configuration.user_agent {
3872        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3873    }
3874    if let Some(ref token) = configuration.bearer_access_token {
3875        req_builder = req_builder.bearer_auth(token.to_owned());
3876    };
3877
3878    let req = req_builder.build()?;
3879    let resp = configuration.client.execute(req).await?;
3880
3881    let status = resp.status();
3882    let content_type = resp
3883        .headers()
3884        .get("content-type")
3885        .and_then(|v| v.to_str().ok())
3886        .unwrap_or("application/octet-stream");
3887    let content_type = super::ContentType::from(content_type);
3888
3889    if !status.is_client_error() && !status.is_server_error() {
3890        let content = resp.text().await?;
3891        match content_type {
3892            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3893            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
3894            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
3895        }
3896    } else {
3897        let content = resp.text().await?;
3898        let entity: Option<AuthenticatorsEmailUsedByListError> = serde_json::from_str(&content).ok();
3899        Err(Error::ResponseError(ResponseContent {
3900            status,
3901            content,
3902            entity,
3903        }))
3904    }
3905}
3906
3907/// Viewset for Endpoint authenticator devices
3908pub async fn authenticators_endpoint_list(
3909    configuration: &configuration::Configuration,
3910    name: Option<&str>,
3911    ordering: Option<&str>,
3912    page: Option<i32>,
3913    page_size: Option<i32>,
3914    search: Option<&str>,
3915) -> Result<models::PaginatedGoogleEndpointDeviceList, Error<AuthenticatorsEndpointListError>> {
3916    // add a prefix to parameters to efficiently prevent name collisions
3917    let p_query_name = name;
3918    let p_query_ordering = ordering;
3919    let p_query_page = page;
3920    let p_query_page_size = page_size;
3921    let p_query_search = search;
3922
3923    let uri_str = format!("{}/authenticators/endpoint/", configuration.base_path);
3924    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3925
3926    if let Some(ref param_value) = p_query_name {
3927        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3928    }
3929    if let Some(ref param_value) = p_query_ordering {
3930        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3931    }
3932    if let Some(ref param_value) = p_query_page {
3933        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3934    }
3935    if let Some(ref param_value) = p_query_page_size {
3936        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3937    }
3938    if let Some(ref param_value) = p_query_search {
3939        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3940    }
3941    if let Some(ref user_agent) = configuration.user_agent {
3942        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3943    }
3944    if let Some(ref token) = configuration.bearer_access_token {
3945        req_builder = req_builder.bearer_auth(token.to_owned());
3946    };
3947
3948    let req = req_builder.build()?;
3949    let resp = configuration.client.execute(req).await?;
3950
3951    let status = resp.status();
3952    let content_type = resp
3953        .headers()
3954        .get("content-type")
3955        .and_then(|v| v.to_str().ok())
3956        .unwrap_or("application/octet-stream");
3957    let content_type = super::ContentType::from(content_type);
3958
3959    if !status.is_client_error() && !status.is_server_error() {
3960        let content = resp.text().await?;
3961        match content_type {
3962            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3963            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedGoogleEndpointDeviceList`"))),
3964            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedGoogleEndpointDeviceList`")))),
3965        }
3966    } else {
3967        let content = resp.text().await?;
3968        let entity: Option<AuthenticatorsEndpointListError> = serde_json::from_str(&content).ok();
3969        Err(Error::ResponseError(ResponseContent {
3970            status,
3971            content,
3972            entity,
3973        }))
3974    }
3975}
3976
3977/// Viewset for Endpoint authenticator devices
3978pub async fn authenticators_endpoint_retrieve(
3979    configuration: &configuration::Configuration,
3980    uuid: &str,
3981) -> Result<models::GoogleEndpointDevice, Error<AuthenticatorsEndpointRetrieveError>> {
3982    // add a prefix to parameters to efficiently prevent name collisions
3983    let p_path_uuid = uuid;
3984
3985    let uri_str = format!(
3986        "{}/authenticators/endpoint/{uuid}/",
3987        configuration.base_path,
3988        uuid = crate::apis::urlencode(p_path_uuid)
3989    );
3990    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3991
3992    if let Some(ref user_agent) = configuration.user_agent {
3993        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3994    }
3995    if let Some(ref token) = configuration.bearer_access_token {
3996        req_builder = req_builder.bearer_auth(token.to_owned());
3997    };
3998
3999    let req = req_builder.build()?;
4000    let resp = configuration.client.execute(req).await?;
4001
4002    let status = resp.status();
4003    let content_type = resp
4004        .headers()
4005        .get("content-type")
4006        .and_then(|v| v.to_str().ok())
4007        .unwrap_or("application/octet-stream");
4008    let content_type = super::ContentType::from(content_type);
4009
4010    if !status.is_client_error() && !status.is_server_error() {
4011        let content = resp.text().await?;
4012        match content_type {
4013            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4014            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GoogleEndpointDevice`"))),
4015            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GoogleEndpointDevice`")))),
4016        }
4017    } else {
4018        let content = resp.text().await?;
4019        let entity: Option<AuthenticatorsEndpointRetrieveError> = serde_json::from_str(&content).ok();
4020        Err(Error::ResponseError(ResponseContent {
4021            status,
4022            content,
4023            entity,
4024        }))
4025    }
4026}
4027
4028/// Get a list of all objects that use this object
4029pub async fn authenticators_endpoint_used_by_list(
4030    configuration: &configuration::Configuration,
4031    uuid: &str,
4032) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsEndpointUsedByListError>> {
4033    // add a prefix to parameters to efficiently prevent name collisions
4034    let p_path_uuid = uuid;
4035
4036    let uri_str = format!(
4037        "{}/authenticators/endpoint/{uuid}/used_by/",
4038        configuration.base_path,
4039        uuid = crate::apis::urlencode(p_path_uuid)
4040    );
4041    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4042
4043    if let Some(ref user_agent) = configuration.user_agent {
4044        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4045    }
4046    if let Some(ref token) = configuration.bearer_access_token {
4047        req_builder = req_builder.bearer_auth(token.to_owned());
4048    };
4049
4050    let req = req_builder.build()?;
4051    let resp = configuration.client.execute(req).await?;
4052
4053    let status = resp.status();
4054    let content_type = resp
4055        .headers()
4056        .get("content-type")
4057        .and_then(|v| v.to_str().ok())
4058        .unwrap_or("application/octet-stream");
4059    let content_type = super::ContentType::from(content_type);
4060
4061    if !status.is_client_error() && !status.is_server_error() {
4062        let content = resp.text().await?;
4063        match content_type {
4064            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4065            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
4066            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
4067        }
4068    } else {
4069        let content = resp.text().await?;
4070        let entity: Option<AuthenticatorsEndpointUsedByListError> = serde_json::from_str(&content).ok();
4071        Err(Error::ResponseError(ResponseContent {
4072            status,
4073            content,
4074            entity,
4075        }))
4076    }
4077}
4078
4079/// Viewset for sms authenticator devices
4080pub async fn authenticators_sms_destroy(
4081    configuration: &configuration::Configuration,
4082    id: i32,
4083) -> Result<(), Error<AuthenticatorsSmsDestroyError>> {
4084    // add a prefix to parameters to efficiently prevent name collisions
4085    let p_path_id = id;
4086
4087    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4088    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4089
4090    if let Some(ref user_agent) = configuration.user_agent {
4091        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4092    }
4093    if let Some(ref token) = configuration.bearer_access_token {
4094        req_builder = req_builder.bearer_auth(token.to_owned());
4095    };
4096
4097    let req = req_builder.build()?;
4098    let resp = configuration.client.execute(req).await?;
4099
4100    let status = resp.status();
4101
4102    if !status.is_client_error() && !status.is_server_error() {
4103        Ok(())
4104    } else {
4105        let content = resp.text().await?;
4106        let entity: Option<AuthenticatorsSmsDestroyError> = serde_json::from_str(&content).ok();
4107        Err(Error::ResponseError(ResponseContent {
4108            status,
4109            content,
4110            entity,
4111        }))
4112    }
4113}
4114
4115/// Viewset for sms authenticator devices
4116pub async fn authenticators_sms_list(
4117    configuration: &configuration::Configuration,
4118    name: Option<&str>,
4119    ordering: Option<&str>,
4120    page: Option<i32>,
4121    page_size: Option<i32>,
4122    search: Option<&str>,
4123) -> Result<models::PaginatedSmsDeviceList, Error<AuthenticatorsSmsListError>> {
4124    // add a prefix to parameters to efficiently prevent name collisions
4125    let p_query_name = name;
4126    let p_query_ordering = ordering;
4127    let p_query_page = page;
4128    let p_query_page_size = page_size;
4129    let p_query_search = search;
4130
4131    let uri_str = format!("{}/authenticators/sms/", configuration.base_path);
4132    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4133
4134    if let Some(ref param_value) = p_query_name {
4135        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
4136    }
4137    if let Some(ref param_value) = p_query_ordering {
4138        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
4139    }
4140    if let Some(ref param_value) = p_query_page {
4141        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
4142    }
4143    if let Some(ref param_value) = p_query_page_size {
4144        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
4145    }
4146    if let Some(ref param_value) = p_query_search {
4147        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
4148    }
4149    if let Some(ref user_agent) = configuration.user_agent {
4150        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4151    }
4152    if let Some(ref token) = configuration.bearer_access_token {
4153        req_builder = req_builder.bearer_auth(token.to_owned());
4154    };
4155
4156    let req = req_builder.build()?;
4157    let resp = configuration.client.execute(req).await?;
4158
4159    let status = resp.status();
4160    let content_type = resp
4161        .headers()
4162        .get("content-type")
4163        .and_then(|v| v.to_str().ok())
4164        .unwrap_or("application/octet-stream");
4165    let content_type = super::ContentType::from(content_type);
4166
4167    if !status.is_client_error() && !status.is_server_error() {
4168        let content = resp.text().await?;
4169        match content_type {
4170            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4171            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedSmsDeviceList`"))),
4172            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedSmsDeviceList`")))),
4173        }
4174    } else {
4175        let content = resp.text().await?;
4176        let entity: Option<AuthenticatorsSmsListError> = serde_json::from_str(&content).ok();
4177        Err(Error::ResponseError(ResponseContent {
4178            status,
4179            content,
4180            entity,
4181        }))
4182    }
4183}
4184
4185/// Viewset for sms authenticator devices
4186pub async fn authenticators_sms_partial_update(
4187    configuration: &configuration::Configuration,
4188    id: i32,
4189    patched_sms_device_request: Option<models::PatchedSmsDeviceRequest>,
4190) -> Result<models::SmsDevice, Error<AuthenticatorsSmsPartialUpdateError>> {
4191    // add a prefix to parameters to efficiently prevent name collisions
4192    let p_path_id = id;
4193    let p_body_patched_sms_device_request = patched_sms_device_request;
4194
4195    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4196    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4197
4198    if let Some(ref user_agent) = configuration.user_agent {
4199        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4200    }
4201    if let Some(ref token) = configuration.bearer_access_token {
4202        req_builder = req_builder.bearer_auth(token.to_owned());
4203    };
4204    req_builder = req_builder.json(&p_body_patched_sms_device_request);
4205
4206    let req = req_builder.build()?;
4207    let resp = configuration.client.execute(req).await?;
4208
4209    let status = resp.status();
4210    let content_type = resp
4211        .headers()
4212        .get("content-type")
4213        .and_then(|v| v.to_str().ok())
4214        .unwrap_or("application/octet-stream");
4215    let content_type = super::ContentType::from(content_type);
4216
4217    if !status.is_client_error() && !status.is_server_error() {
4218        let content = resp.text().await?;
4219        match content_type {
4220            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4221            ContentType::Text => {
4222                return Err(Error::from(serde_json::Error::custom(
4223                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
4224                )))
4225            }
4226            ContentType::Unsupported(unknown_type) => {
4227                return Err(Error::from(serde_json::Error::custom(format!(
4228                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
4229                ))))
4230            }
4231        }
4232    } else {
4233        let content = resp.text().await?;
4234        let entity: Option<AuthenticatorsSmsPartialUpdateError> = serde_json::from_str(&content).ok();
4235        Err(Error::ResponseError(ResponseContent {
4236            status,
4237            content,
4238            entity,
4239        }))
4240    }
4241}
4242
4243/// Viewset for sms authenticator devices
4244pub async fn authenticators_sms_retrieve(
4245    configuration: &configuration::Configuration,
4246    id: i32,
4247) -> Result<models::SmsDevice, Error<AuthenticatorsSmsRetrieveError>> {
4248    // add a prefix to parameters to efficiently prevent name collisions
4249    let p_path_id = id;
4250
4251    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4252    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4253
4254    if let Some(ref user_agent) = configuration.user_agent {
4255        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4256    }
4257    if let Some(ref token) = configuration.bearer_access_token {
4258        req_builder = req_builder.bearer_auth(token.to_owned());
4259    };
4260
4261    let req = req_builder.build()?;
4262    let resp = configuration.client.execute(req).await?;
4263
4264    let status = resp.status();
4265    let content_type = resp
4266        .headers()
4267        .get("content-type")
4268        .and_then(|v| v.to_str().ok())
4269        .unwrap_or("application/octet-stream");
4270    let content_type = super::ContentType::from(content_type);
4271
4272    if !status.is_client_error() && !status.is_server_error() {
4273        let content = resp.text().await?;
4274        match content_type {
4275            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4276            ContentType::Text => {
4277                return Err(Error::from(serde_json::Error::custom(
4278                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
4279                )))
4280            }
4281            ContentType::Unsupported(unknown_type) => {
4282                return Err(Error::from(serde_json::Error::custom(format!(
4283                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
4284                ))))
4285            }
4286        }
4287    } else {
4288        let content = resp.text().await?;
4289        let entity: Option<AuthenticatorsSmsRetrieveError> = serde_json::from_str(&content).ok();
4290        Err(Error::ResponseError(ResponseContent {
4291            status,
4292            content,
4293            entity,
4294        }))
4295    }
4296}
4297
4298/// Viewset for sms authenticator devices
4299pub async fn authenticators_sms_update(
4300    configuration: &configuration::Configuration,
4301    id: i32,
4302    sms_device_request: models::SmsDeviceRequest,
4303) -> Result<models::SmsDevice, Error<AuthenticatorsSmsUpdateError>> {
4304    // add a prefix to parameters to efficiently prevent name collisions
4305    let p_path_id = id;
4306    let p_body_sms_device_request = sms_device_request;
4307
4308    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4309    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4310
4311    if let Some(ref user_agent) = configuration.user_agent {
4312        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4313    }
4314    if let Some(ref token) = configuration.bearer_access_token {
4315        req_builder = req_builder.bearer_auth(token.to_owned());
4316    };
4317    req_builder = req_builder.json(&p_body_sms_device_request);
4318
4319    let req = req_builder.build()?;
4320    let resp = configuration.client.execute(req).await?;
4321
4322    let status = resp.status();
4323    let content_type = resp
4324        .headers()
4325        .get("content-type")
4326        .and_then(|v| v.to_str().ok())
4327        .unwrap_or("application/octet-stream");
4328    let content_type = super::ContentType::from(content_type);
4329
4330    if !status.is_client_error() && !status.is_server_error() {
4331        let content = resp.text().await?;
4332        match content_type {
4333            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4334            ContentType::Text => {
4335                return Err(Error::from(serde_json::Error::custom(
4336                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
4337                )))
4338            }
4339            ContentType::Unsupported(unknown_type) => {
4340                return Err(Error::from(serde_json::Error::custom(format!(
4341                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
4342                ))))
4343            }
4344        }
4345    } else {
4346        let content = resp.text().await?;
4347        let entity: Option<AuthenticatorsSmsUpdateError> = serde_json::from_str(&content).ok();
4348        Err(Error::ResponseError(ResponseContent {
4349            status,
4350            content,
4351            entity,
4352        }))
4353    }
4354}
4355
4356/// Get a list of all objects that use this object
4357pub async fn authenticators_sms_used_by_list(
4358    configuration: &configuration::Configuration,
4359    id: i32,
4360) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsSmsUsedByListError>> {
4361    // add a prefix to parameters to efficiently prevent name collisions
4362    let p_path_id = id;
4363
4364    let uri_str = format!(
4365        "{}/authenticators/sms/{id}/used_by/",
4366        configuration.base_path,
4367        id = p_path_id
4368    );
4369    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4370
4371    if let Some(ref user_agent) = configuration.user_agent {
4372        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4373    }
4374    if let Some(ref token) = configuration.bearer_access_token {
4375        req_builder = req_builder.bearer_auth(token.to_owned());
4376    };
4377
4378    let req = req_builder.build()?;
4379    let resp = configuration.client.execute(req).await?;
4380
4381    let status = resp.status();
4382    let content_type = resp
4383        .headers()
4384        .get("content-type")
4385        .and_then(|v| v.to_str().ok())
4386        .unwrap_or("application/octet-stream");
4387    let content_type = super::ContentType::from(content_type);
4388
4389    if !status.is_client_error() && !status.is_server_error() {
4390        let content = resp.text().await?;
4391        match content_type {
4392            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4393            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
4394            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
4395        }
4396    } else {
4397        let content = resp.text().await?;
4398        let entity: Option<AuthenticatorsSmsUsedByListError> = serde_json::from_str(&content).ok();
4399        Err(Error::ResponseError(ResponseContent {
4400            status,
4401            content,
4402            entity,
4403        }))
4404    }
4405}
4406
4407/// Viewset for static authenticator devices
4408pub async fn authenticators_static_destroy(
4409    configuration: &configuration::Configuration,
4410    id: i32,
4411) -> Result<(), Error<AuthenticatorsStaticDestroyError>> {
4412    // add a prefix to parameters to efficiently prevent name collisions
4413    let p_path_id = id;
4414
4415    let uri_str = format!(
4416        "{}/authenticators/static/{id}/",
4417        configuration.base_path,
4418        id = p_path_id
4419    );
4420    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4421
4422    if let Some(ref user_agent) = configuration.user_agent {
4423        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4424    }
4425    if let Some(ref token) = configuration.bearer_access_token {
4426        req_builder = req_builder.bearer_auth(token.to_owned());
4427    };
4428
4429    let req = req_builder.build()?;
4430    let resp = configuration.client.execute(req).await?;
4431
4432    let status = resp.status();
4433
4434    if !status.is_client_error() && !status.is_server_error() {
4435        Ok(())
4436    } else {
4437        let content = resp.text().await?;
4438        let entity: Option<AuthenticatorsStaticDestroyError> = serde_json::from_str(&content).ok();
4439        Err(Error::ResponseError(ResponseContent {
4440            status,
4441            content,
4442            entity,
4443        }))
4444    }
4445}
4446
4447/// Viewset for static authenticator devices
4448pub async fn authenticators_static_list(
4449    configuration: &configuration::Configuration,
4450    name: Option<&str>,
4451    ordering: Option<&str>,
4452    page: Option<i32>,
4453    page_size: Option<i32>,
4454    search: Option<&str>,
4455) -> Result<models::PaginatedStaticDeviceList, Error<AuthenticatorsStaticListError>> {
4456    // add a prefix to parameters to efficiently prevent name collisions
4457    let p_query_name = name;
4458    let p_query_ordering = ordering;
4459    let p_query_page = page;
4460    let p_query_page_size = page_size;
4461    let p_query_search = search;
4462
4463    let uri_str = format!("{}/authenticators/static/", configuration.base_path);
4464    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4465
4466    if let Some(ref param_value) = p_query_name {
4467        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
4468    }
4469    if let Some(ref param_value) = p_query_ordering {
4470        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
4471    }
4472    if let Some(ref param_value) = p_query_page {
4473        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
4474    }
4475    if let Some(ref param_value) = p_query_page_size {
4476        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
4477    }
4478    if let Some(ref param_value) = p_query_search {
4479        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
4480    }
4481    if let Some(ref user_agent) = configuration.user_agent {
4482        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4483    }
4484    if let Some(ref token) = configuration.bearer_access_token {
4485        req_builder = req_builder.bearer_auth(token.to_owned());
4486    };
4487
4488    let req = req_builder.build()?;
4489    let resp = configuration.client.execute(req).await?;
4490
4491    let status = resp.status();
4492    let content_type = resp
4493        .headers()
4494        .get("content-type")
4495        .and_then(|v| v.to_str().ok())
4496        .unwrap_or("application/octet-stream");
4497    let content_type = super::ContentType::from(content_type);
4498
4499    if !status.is_client_error() && !status.is_server_error() {
4500        let content = resp.text().await?;
4501        match content_type {
4502            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4503            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedStaticDeviceList`"))),
4504            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedStaticDeviceList`")))),
4505        }
4506    } else {
4507        let content = resp.text().await?;
4508        let entity: Option<AuthenticatorsStaticListError> = serde_json::from_str(&content).ok();
4509        Err(Error::ResponseError(ResponseContent {
4510            status,
4511            content,
4512            entity,
4513        }))
4514    }
4515}
4516
4517/// Viewset for static authenticator devices
4518pub async fn authenticators_static_partial_update(
4519    configuration: &configuration::Configuration,
4520    id: i32,
4521    patched_static_device_request: Option<models::PatchedStaticDeviceRequest>,
4522) -> Result<models::StaticDevice, Error<AuthenticatorsStaticPartialUpdateError>> {
4523    // add a prefix to parameters to efficiently prevent name collisions
4524    let p_path_id = id;
4525    let p_body_patched_static_device_request = patched_static_device_request;
4526
4527    let uri_str = format!(
4528        "{}/authenticators/static/{id}/",
4529        configuration.base_path,
4530        id = p_path_id
4531    );
4532    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4533
4534    if let Some(ref user_agent) = configuration.user_agent {
4535        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4536    }
4537    if let Some(ref token) = configuration.bearer_access_token {
4538        req_builder = req_builder.bearer_auth(token.to_owned());
4539    };
4540    req_builder = req_builder.json(&p_body_patched_static_device_request);
4541
4542    let req = req_builder.build()?;
4543    let resp = configuration.client.execute(req).await?;
4544
4545    let status = resp.status();
4546    let content_type = resp
4547        .headers()
4548        .get("content-type")
4549        .and_then(|v| v.to_str().ok())
4550        .unwrap_or("application/octet-stream");
4551    let content_type = super::ContentType::from(content_type);
4552
4553    if !status.is_client_error() && !status.is_server_error() {
4554        let content = resp.text().await?;
4555        match content_type {
4556            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4557            ContentType::Text => {
4558                return Err(Error::from(serde_json::Error::custom(
4559                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
4560                )))
4561            }
4562            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4563                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
4564            )))),
4565        }
4566    } else {
4567        let content = resp.text().await?;
4568        let entity: Option<AuthenticatorsStaticPartialUpdateError> = serde_json::from_str(&content).ok();
4569        Err(Error::ResponseError(ResponseContent {
4570            status,
4571            content,
4572            entity,
4573        }))
4574    }
4575}
4576
4577/// Viewset for static authenticator devices
4578pub async fn authenticators_static_retrieve(
4579    configuration: &configuration::Configuration,
4580    id: i32,
4581) -> Result<models::StaticDevice, Error<AuthenticatorsStaticRetrieveError>> {
4582    // add a prefix to parameters to efficiently prevent name collisions
4583    let p_path_id = id;
4584
4585    let uri_str = format!(
4586        "{}/authenticators/static/{id}/",
4587        configuration.base_path,
4588        id = p_path_id
4589    );
4590    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4591
4592    if let Some(ref user_agent) = configuration.user_agent {
4593        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4594    }
4595    if let Some(ref token) = configuration.bearer_access_token {
4596        req_builder = req_builder.bearer_auth(token.to_owned());
4597    };
4598
4599    let req = req_builder.build()?;
4600    let resp = configuration.client.execute(req).await?;
4601
4602    let status = resp.status();
4603    let content_type = resp
4604        .headers()
4605        .get("content-type")
4606        .and_then(|v| v.to_str().ok())
4607        .unwrap_or("application/octet-stream");
4608    let content_type = super::ContentType::from(content_type);
4609
4610    if !status.is_client_error() && !status.is_server_error() {
4611        let content = resp.text().await?;
4612        match content_type {
4613            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4614            ContentType::Text => {
4615                return Err(Error::from(serde_json::Error::custom(
4616                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
4617                )))
4618            }
4619            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4620                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
4621            )))),
4622        }
4623    } else {
4624        let content = resp.text().await?;
4625        let entity: Option<AuthenticatorsStaticRetrieveError> = serde_json::from_str(&content).ok();
4626        Err(Error::ResponseError(ResponseContent {
4627            status,
4628            content,
4629            entity,
4630        }))
4631    }
4632}
4633
4634/// Viewset for static authenticator devices
4635pub async fn authenticators_static_update(
4636    configuration: &configuration::Configuration,
4637    id: i32,
4638    static_device_request: models::StaticDeviceRequest,
4639) -> Result<models::StaticDevice, Error<AuthenticatorsStaticUpdateError>> {
4640    // add a prefix to parameters to efficiently prevent name collisions
4641    let p_path_id = id;
4642    let p_body_static_device_request = static_device_request;
4643
4644    let uri_str = format!(
4645        "{}/authenticators/static/{id}/",
4646        configuration.base_path,
4647        id = p_path_id
4648    );
4649    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4650
4651    if let Some(ref user_agent) = configuration.user_agent {
4652        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4653    }
4654    if let Some(ref token) = configuration.bearer_access_token {
4655        req_builder = req_builder.bearer_auth(token.to_owned());
4656    };
4657    req_builder = req_builder.json(&p_body_static_device_request);
4658
4659    let req = req_builder.build()?;
4660    let resp = configuration.client.execute(req).await?;
4661
4662    let status = resp.status();
4663    let content_type = resp
4664        .headers()
4665        .get("content-type")
4666        .and_then(|v| v.to_str().ok())
4667        .unwrap_or("application/octet-stream");
4668    let content_type = super::ContentType::from(content_type);
4669
4670    if !status.is_client_error() && !status.is_server_error() {
4671        let content = resp.text().await?;
4672        match content_type {
4673            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4674            ContentType::Text => {
4675                return Err(Error::from(serde_json::Error::custom(
4676                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
4677                )))
4678            }
4679            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4680                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
4681            )))),
4682        }
4683    } else {
4684        let content = resp.text().await?;
4685        let entity: Option<AuthenticatorsStaticUpdateError> = serde_json::from_str(&content).ok();
4686        Err(Error::ResponseError(ResponseContent {
4687            status,
4688            content,
4689            entity,
4690        }))
4691    }
4692}
4693
4694/// Get a list of all objects that use this object
4695pub async fn authenticators_static_used_by_list(
4696    configuration: &configuration::Configuration,
4697    id: i32,
4698) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsStaticUsedByListError>> {
4699    // add a prefix to parameters to efficiently prevent name collisions
4700    let p_path_id = id;
4701
4702    let uri_str = format!(
4703        "{}/authenticators/static/{id}/used_by/",
4704        configuration.base_path,
4705        id = p_path_id
4706    );
4707    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4708
4709    if let Some(ref user_agent) = configuration.user_agent {
4710        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4711    }
4712    if let Some(ref token) = configuration.bearer_access_token {
4713        req_builder = req_builder.bearer_auth(token.to_owned());
4714    };
4715
4716    let req = req_builder.build()?;
4717    let resp = configuration.client.execute(req).await?;
4718
4719    let status = resp.status();
4720    let content_type = resp
4721        .headers()
4722        .get("content-type")
4723        .and_then(|v| v.to_str().ok())
4724        .unwrap_or("application/octet-stream");
4725    let content_type = super::ContentType::from(content_type);
4726
4727    if !status.is_client_error() && !status.is_server_error() {
4728        let content = resp.text().await?;
4729        match content_type {
4730            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4731            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
4732            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
4733        }
4734    } else {
4735        let content = resp.text().await?;
4736        let entity: Option<AuthenticatorsStaticUsedByListError> = serde_json::from_str(&content).ok();
4737        Err(Error::ResponseError(ResponseContent {
4738            status,
4739            content,
4740            entity,
4741        }))
4742    }
4743}
4744
4745/// Viewset for totp authenticator devices
4746pub async fn authenticators_totp_destroy(
4747    configuration: &configuration::Configuration,
4748    id: i32,
4749) -> Result<(), Error<AuthenticatorsTotpDestroyError>> {
4750    // add a prefix to parameters to efficiently prevent name collisions
4751    let p_path_id = id;
4752
4753    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4754    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4755
4756    if let Some(ref user_agent) = configuration.user_agent {
4757        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4758    }
4759    if let Some(ref token) = configuration.bearer_access_token {
4760        req_builder = req_builder.bearer_auth(token.to_owned());
4761    };
4762
4763    let req = req_builder.build()?;
4764    let resp = configuration.client.execute(req).await?;
4765
4766    let status = resp.status();
4767
4768    if !status.is_client_error() && !status.is_server_error() {
4769        Ok(())
4770    } else {
4771        let content = resp.text().await?;
4772        let entity: Option<AuthenticatorsTotpDestroyError> = serde_json::from_str(&content).ok();
4773        Err(Error::ResponseError(ResponseContent {
4774            status,
4775            content,
4776            entity,
4777        }))
4778    }
4779}
4780
4781/// Viewset for totp authenticator devices
4782pub async fn authenticators_totp_list(
4783    configuration: &configuration::Configuration,
4784    name: Option<&str>,
4785    ordering: Option<&str>,
4786    page: Option<i32>,
4787    page_size: Option<i32>,
4788    search: Option<&str>,
4789) -> Result<models::PaginatedTotpDeviceList, Error<AuthenticatorsTotpListError>> {
4790    // add a prefix to parameters to efficiently prevent name collisions
4791    let p_query_name = name;
4792    let p_query_ordering = ordering;
4793    let p_query_page = page;
4794    let p_query_page_size = page_size;
4795    let p_query_search = search;
4796
4797    let uri_str = format!("{}/authenticators/totp/", configuration.base_path);
4798    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4799
4800    if let Some(ref param_value) = p_query_name {
4801        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
4802    }
4803    if let Some(ref param_value) = p_query_ordering {
4804        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
4805    }
4806    if let Some(ref param_value) = p_query_page {
4807        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
4808    }
4809    if let Some(ref param_value) = p_query_page_size {
4810        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
4811    }
4812    if let Some(ref param_value) = p_query_search {
4813        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
4814    }
4815    if let Some(ref user_agent) = configuration.user_agent {
4816        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4817    }
4818    if let Some(ref token) = configuration.bearer_access_token {
4819        req_builder = req_builder.bearer_auth(token.to_owned());
4820    };
4821
4822    let req = req_builder.build()?;
4823    let resp = configuration.client.execute(req).await?;
4824
4825    let status = resp.status();
4826    let content_type = resp
4827        .headers()
4828        .get("content-type")
4829        .and_then(|v| v.to_str().ok())
4830        .unwrap_or("application/octet-stream");
4831    let content_type = super::ContentType::from(content_type);
4832
4833    if !status.is_client_error() && !status.is_server_error() {
4834        let content = resp.text().await?;
4835        match content_type {
4836            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4837            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTotpDeviceList`"))),
4838            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedTotpDeviceList`")))),
4839        }
4840    } else {
4841        let content = resp.text().await?;
4842        let entity: Option<AuthenticatorsTotpListError> = serde_json::from_str(&content).ok();
4843        Err(Error::ResponseError(ResponseContent {
4844            status,
4845            content,
4846            entity,
4847        }))
4848    }
4849}
4850
4851/// Viewset for totp authenticator devices
4852pub async fn authenticators_totp_partial_update(
4853    configuration: &configuration::Configuration,
4854    id: i32,
4855    patched_totp_device_request: Option<models::PatchedTotpDeviceRequest>,
4856) -> Result<models::TotpDevice, Error<AuthenticatorsTotpPartialUpdateError>> {
4857    // add a prefix to parameters to efficiently prevent name collisions
4858    let p_path_id = id;
4859    let p_body_patched_totp_device_request = patched_totp_device_request;
4860
4861    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4862    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4863
4864    if let Some(ref user_agent) = configuration.user_agent {
4865        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4866    }
4867    if let Some(ref token) = configuration.bearer_access_token {
4868        req_builder = req_builder.bearer_auth(token.to_owned());
4869    };
4870    req_builder = req_builder.json(&p_body_patched_totp_device_request);
4871
4872    let req = req_builder.build()?;
4873    let resp = configuration.client.execute(req).await?;
4874
4875    let status = resp.status();
4876    let content_type = resp
4877        .headers()
4878        .get("content-type")
4879        .and_then(|v| v.to_str().ok())
4880        .unwrap_or("application/octet-stream");
4881    let content_type = super::ContentType::from(content_type);
4882
4883    if !status.is_client_error() && !status.is_server_error() {
4884        let content = resp.text().await?;
4885        match content_type {
4886            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4887            ContentType::Text => {
4888                return Err(Error::from(serde_json::Error::custom(
4889                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
4890                )))
4891            }
4892            ContentType::Unsupported(unknown_type) => {
4893                return Err(Error::from(serde_json::Error::custom(format!(
4894                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
4895                ))))
4896            }
4897        }
4898    } else {
4899        let content = resp.text().await?;
4900        let entity: Option<AuthenticatorsTotpPartialUpdateError> = serde_json::from_str(&content).ok();
4901        Err(Error::ResponseError(ResponseContent {
4902            status,
4903            content,
4904            entity,
4905        }))
4906    }
4907}
4908
4909/// Viewset for totp authenticator devices
4910pub async fn authenticators_totp_retrieve(
4911    configuration: &configuration::Configuration,
4912    id: i32,
4913) -> Result<models::TotpDevice, Error<AuthenticatorsTotpRetrieveError>> {
4914    // add a prefix to parameters to efficiently prevent name collisions
4915    let p_path_id = id;
4916
4917    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4918    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4919
4920    if let Some(ref user_agent) = configuration.user_agent {
4921        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4922    }
4923    if let Some(ref token) = configuration.bearer_access_token {
4924        req_builder = req_builder.bearer_auth(token.to_owned());
4925    };
4926
4927    let req = req_builder.build()?;
4928    let resp = configuration.client.execute(req).await?;
4929
4930    let status = resp.status();
4931    let content_type = resp
4932        .headers()
4933        .get("content-type")
4934        .and_then(|v| v.to_str().ok())
4935        .unwrap_or("application/octet-stream");
4936    let content_type = super::ContentType::from(content_type);
4937
4938    if !status.is_client_error() && !status.is_server_error() {
4939        let content = resp.text().await?;
4940        match content_type {
4941            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4942            ContentType::Text => {
4943                return Err(Error::from(serde_json::Error::custom(
4944                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
4945                )))
4946            }
4947            ContentType::Unsupported(unknown_type) => {
4948                return Err(Error::from(serde_json::Error::custom(format!(
4949                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
4950                ))))
4951            }
4952        }
4953    } else {
4954        let content = resp.text().await?;
4955        let entity: Option<AuthenticatorsTotpRetrieveError> = serde_json::from_str(&content).ok();
4956        Err(Error::ResponseError(ResponseContent {
4957            status,
4958            content,
4959            entity,
4960        }))
4961    }
4962}
4963
4964/// Viewset for totp authenticator devices
4965pub async fn authenticators_totp_update(
4966    configuration: &configuration::Configuration,
4967    id: i32,
4968    totp_device_request: models::TotpDeviceRequest,
4969) -> Result<models::TotpDevice, Error<AuthenticatorsTotpUpdateError>> {
4970    // add a prefix to parameters to efficiently prevent name collisions
4971    let p_path_id = id;
4972    let p_body_totp_device_request = totp_device_request;
4973
4974    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4975    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4976
4977    if let Some(ref user_agent) = configuration.user_agent {
4978        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4979    }
4980    if let Some(ref token) = configuration.bearer_access_token {
4981        req_builder = req_builder.bearer_auth(token.to_owned());
4982    };
4983    req_builder = req_builder.json(&p_body_totp_device_request);
4984
4985    let req = req_builder.build()?;
4986    let resp = configuration.client.execute(req).await?;
4987
4988    let status = resp.status();
4989    let content_type = resp
4990        .headers()
4991        .get("content-type")
4992        .and_then(|v| v.to_str().ok())
4993        .unwrap_or("application/octet-stream");
4994    let content_type = super::ContentType::from(content_type);
4995
4996    if !status.is_client_error() && !status.is_server_error() {
4997        let content = resp.text().await?;
4998        match content_type {
4999            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5000            ContentType::Text => {
5001                return Err(Error::from(serde_json::Error::custom(
5002                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
5003                )))
5004            }
5005            ContentType::Unsupported(unknown_type) => {
5006                return Err(Error::from(serde_json::Error::custom(format!(
5007                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
5008                ))))
5009            }
5010        }
5011    } else {
5012        let content = resp.text().await?;
5013        let entity: Option<AuthenticatorsTotpUpdateError> = serde_json::from_str(&content).ok();
5014        Err(Error::ResponseError(ResponseContent {
5015            status,
5016            content,
5017            entity,
5018        }))
5019    }
5020}
5021
5022/// Get a list of all objects that use this object
5023pub async fn authenticators_totp_used_by_list(
5024    configuration: &configuration::Configuration,
5025    id: i32,
5026) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsTotpUsedByListError>> {
5027    // add a prefix to parameters to efficiently prevent name collisions
5028    let p_path_id = id;
5029
5030    let uri_str = format!(
5031        "{}/authenticators/totp/{id}/used_by/",
5032        configuration.base_path,
5033        id = p_path_id
5034    );
5035    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5036
5037    if let Some(ref user_agent) = configuration.user_agent {
5038        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5039    }
5040    if let Some(ref token) = configuration.bearer_access_token {
5041        req_builder = req_builder.bearer_auth(token.to_owned());
5042    };
5043
5044    let req = req_builder.build()?;
5045    let resp = configuration.client.execute(req).await?;
5046
5047    let status = resp.status();
5048    let content_type = resp
5049        .headers()
5050        .get("content-type")
5051        .and_then(|v| v.to_str().ok())
5052        .unwrap_or("application/octet-stream");
5053    let content_type = super::ContentType::from(content_type);
5054
5055    if !status.is_client_error() && !status.is_server_error() {
5056        let content = resp.text().await?;
5057        match content_type {
5058            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5059            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
5060            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
5061        }
5062    } else {
5063        let content = resp.text().await?;
5064        let entity: Option<AuthenticatorsTotpUsedByListError> = serde_json::from_str(&content).ok();
5065        Err(Error::ResponseError(ResponseContent {
5066            status,
5067            content,
5068            entity,
5069        }))
5070    }
5071}
5072
5073/// Viewset for WebAuthn authenticator devices
5074pub async fn authenticators_webauthn_destroy(
5075    configuration: &configuration::Configuration,
5076    id: i32,
5077) -> Result<(), Error<AuthenticatorsWebauthnDestroyError>> {
5078    // add a prefix to parameters to efficiently prevent name collisions
5079    let p_path_id = id;
5080
5081    let uri_str = format!(
5082        "{}/authenticators/webauthn/{id}/",
5083        configuration.base_path,
5084        id = p_path_id
5085    );
5086    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5087
5088    if let Some(ref user_agent) = configuration.user_agent {
5089        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5090    }
5091    if let Some(ref token) = configuration.bearer_access_token {
5092        req_builder = req_builder.bearer_auth(token.to_owned());
5093    };
5094
5095    let req = req_builder.build()?;
5096    let resp = configuration.client.execute(req).await?;
5097
5098    let status = resp.status();
5099
5100    if !status.is_client_error() && !status.is_server_error() {
5101        Ok(())
5102    } else {
5103        let content = resp.text().await?;
5104        let entity: Option<AuthenticatorsWebauthnDestroyError> = serde_json::from_str(&content).ok();
5105        Err(Error::ResponseError(ResponseContent {
5106            status,
5107            content,
5108            entity,
5109        }))
5110    }
5111}
5112
5113/// Viewset for WebAuthn authenticator devices
5114pub async fn authenticators_webauthn_list(
5115    configuration: &configuration::Configuration,
5116    name: Option<&str>,
5117    ordering: Option<&str>,
5118    page: Option<i32>,
5119    page_size: Option<i32>,
5120    search: Option<&str>,
5121) -> Result<models::PaginatedWebAuthnDeviceList, Error<AuthenticatorsWebauthnListError>> {
5122    // add a prefix to parameters to efficiently prevent name collisions
5123    let p_query_name = name;
5124    let p_query_ordering = ordering;
5125    let p_query_page = page;
5126    let p_query_page_size = page_size;
5127    let p_query_search = search;
5128
5129    let uri_str = format!("{}/authenticators/webauthn/", configuration.base_path);
5130    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5131
5132    if let Some(ref param_value) = p_query_name {
5133        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
5134    }
5135    if let Some(ref param_value) = p_query_ordering {
5136        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
5137    }
5138    if let Some(ref param_value) = p_query_page {
5139        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
5140    }
5141    if let Some(ref param_value) = p_query_page_size {
5142        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
5143    }
5144    if let Some(ref param_value) = p_query_search {
5145        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
5146    }
5147    if let Some(ref user_agent) = configuration.user_agent {
5148        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5149    }
5150    if let Some(ref token) = configuration.bearer_access_token {
5151        req_builder = req_builder.bearer_auth(token.to_owned());
5152    };
5153
5154    let req = req_builder.build()?;
5155    let resp = configuration.client.execute(req).await?;
5156
5157    let status = resp.status();
5158    let content_type = resp
5159        .headers()
5160        .get("content-type")
5161        .and_then(|v| v.to_str().ok())
5162        .unwrap_or("application/octet-stream");
5163    let content_type = super::ContentType::from(content_type);
5164
5165    if !status.is_client_error() && !status.is_server_error() {
5166        let content = resp.text().await?;
5167        match content_type {
5168            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5169            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedWebAuthnDeviceList`"))),
5170            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedWebAuthnDeviceList`")))),
5171        }
5172    } else {
5173        let content = resp.text().await?;
5174        let entity: Option<AuthenticatorsWebauthnListError> = serde_json::from_str(&content).ok();
5175        Err(Error::ResponseError(ResponseContent {
5176            status,
5177            content,
5178            entity,
5179        }))
5180    }
5181}
5182
5183/// Viewset for WebAuthn authenticator devices
5184pub async fn authenticators_webauthn_partial_update(
5185    configuration: &configuration::Configuration,
5186    id: i32,
5187    patched_web_authn_device_request: Option<models::PatchedWebAuthnDeviceRequest>,
5188) -> Result<models::WebAuthnDevice, Error<AuthenticatorsWebauthnPartialUpdateError>> {
5189    // add a prefix to parameters to efficiently prevent name collisions
5190    let p_path_id = id;
5191    let p_body_patched_web_authn_device_request = patched_web_authn_device_request;
5192
5193    let uri_str = format!(
5194        "{}/authenticators/webauthn/{id}/",
5195        configuration.base_path,
5196        id = p_path_id
5197    );
5198    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
5199
5200    if let Some(ref user_agent) = configuration.user_agent {
5201        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5202    }
5203    if let Some(ref token) = configuration.bearer_access_token {
5204        req_builder = req_builder.bearer_auth(token.to_owned());
5205    };
5206    req_builder = req_builder.json(&p_body_patched_web_authn_device_request);
5207
5208    let req = req_builder.build()?;
5209    let resp = configuration.client.execute(req).await?;
5210
5211    let status = resp.status();
5212    let content_type = resp
5213        .headers()
5214        .get("content-type")
5215        .and_then(|v| v.to_str().ok())
5216        .unwrap_or("application/octet-stream");
5217    let content_type = super::ContentType::from(content_type);
5218
5219    if !status.is_client_error() && !status.is_server_error() {
5220        let content = resp.text().await?;
5221        match content_type {
5222            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5223            ContentType::Text => {
5224                return Err(Error::from(serde_json::Error::custom(
5225                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
5226                )))
5227            }
5228            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
5229                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
5230            )))),
5231        }
5232    } else {
5233        let content = resp.text().await?;
5234        let entity: Option<AuthenticatorsWebauthnPartialUpdateError> = serde_json::from_str(&content).ok();
5235        Err(Error::ResponseError(ResponseContent {
5236            status,
5237            content,
5238            entity,
5239        }))
5240    }
5241}
5242
5243/// Viewset for WebAuthn authenticator devices
5244pub async fn authenticators_webauthn_retrieve(
5245    configuration: &configuration::Configuration,
5246    id: i32,
5247) -> Result<models::WebAuthnDevice, Error<AuthenticatorsWebauthnRetrieveError>> {
5248    // add a prefix to parameters to efficiently prevent name collisions
5249    let p_path_id = id;
5250
5251    let uri_str = format!(
5252        "{}/authenticators/webauthn/{id}/",
5253        configuration.base_path,
5254        id = p_path_id
5255    );
5256    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5257
5258    if let Some(ref user_agent) = configuration.user_agent {
5259        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5260    }
5261    if let Some(ref token) = configuration.bearer_access_token {
5262        req_builder = req_builder.bearer_auth(token.to_owned());
5263    };
5264
5265    let req = req_builder.build()?;
5266    let resp = configuration.client.execute(req).await?;
5267
5268    let status = resp.status();
5269    let content_type = resp
5270        .headers()
5271        .get("content-type")
5272        .and_then(|v| v.to_str().ok())
5273        .unwrap_or("application/octet-stream");
5274    let content_type = super::ContentType::from(content_type);
5275
5276    if !status.is_client_error() && !status.is_server_error() {
5277        let content = resp.text().await?;
5278        match content_type {
5279            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5280            ContentType::Text => {
5281                return Err(Error::from(serde_json::Error::custom(
5282                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
5283                )))
5284            }
5285            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
5286                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
5287            )))),
5288        }
5289    } else {
5290        let content = resp.text().await?;
5291        let entity: Option<AuthenticatorsWebauthnRetrieveError> = serde_json::from_str(&content).ok();
5292        Err(Error::ResponseError(ResponseContent {
5293            status,
5294            content,
5295            entity,
5296        }))
5297    }
5298}
5299
5300/// Viewset for WebAuthn authenticator devices
5301pub async fn authenticators_webauthn_update(
5302    configuration: &configuration::Configuration,
5303    id: i32,
5304    web_authn_device_request: models::WebAuthnDeviceRequest,
5305) -> Result<models::WebAuthnDevice, Error<AuthenticatorsWebauthnUpdateError>> {
5306    // add a prefix to parameters to efficiently prevent name collisions
5307    let p_path_id = id;
5308    let p_body_web_authn_device_request = web_authn_device_request;
5309
5310    let uri_str = format!(
5311        "{}/authenticators/webauthn/{id}/",
5312        configuration.base_path,
5313        id = p_path_id
5314    );
5315    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5316
5317    if let Some(ref user_agent) = configuration.user_agent {
5318        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5319    }
5320    if let Some(ref token) = configuration.bearer_access_token {
5321        req_builder = req_builder.bearer_auth(token.to_owned());
5322    };
5323    req_builder = req_builder.json(&p_body_web_authn_device_request);
5324
5325    let req = req_builder.build()?;
5326    let resp = configuration.client.execute(req).await?;
5327
5328    let status = resp.status();
5329    let content_type = resp
5330        .headers()
5331        .get("content-type")
5332        .and_then(|v| v.to_str().ok())
5333        .unwrap_or("application/octet-stream");
5334    let content_type = super::ContentType::from(content_type);
5335
5336    if !status.is_client_error() && !status.is_server_error() {
5337        let content = resp.text().await?;
5338        match content_type {
5339            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5340            ContentType::Text => {
5341                return Err(Error::from(serde_json::Error::custom(
5342                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
5343                )))
5344            }
5345            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
5346                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
5347            )))),
5348        }
5349    } else {
5350        let content = resp.text().await?;
5351        let entity: Option<AuthenticatorsWebauthnUpdateError> = serde_json::from_str(&content).ok();
5352        Err(Error::ResponseError(ResponseContent {
5353            status,
5354            content,
5355            entity,
5356        }))
5357    }
5358}
5359
5360/// Get a list of all objects that use this object
5361pub async fn authenticators_webauthn_used_by_list(
5362    configuration: &configuration::Configuration,
5363    id: i32,
5364) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsWebauthnUsedByListError>> {
5365    // add a prefix to parameters to efficiently prevent name collisions
5366    let p_path_id = id;
5367
5368    let uri_str = format!(
5369        "{}/authenticators/webauthn/{id}/used_by/",
5370        configuration.base_path,
5371        id = p_path_id
5372    );
5373    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5374
5375    if let Some(ref user_agent) = configuration.user_agent {
5376        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5377    }
5378    if let Some(ref token) = configuration.bearer_access_token {
5379        req_builder = req_builder.bearer_auth(token.to_owned());
5380    };
5381
5382    let req = req_builder.build()?;
5383    let resp = configuration.client.execute(req).await?;
5384
5385    let status = resp.status();
5386    let content_type = resp
5387        .headers()
5388        .get("content-type")
5389        .and_then(|v| v.to_str().ok())
5390        .unwrap_or("application/octet-stream");
5391    let content_type = super::ContentType::from(content_type);
5392
5393    if !status.is_client_error() && !status.is_server_error() {
5394        let content = resp.text().await?;
5395        match content_type {
5396            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5397            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
5398            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`")))),
5399        }
5400    } else {
5401        let content = resp.text().await?;
5402        let entity: Option<AuthenticatorsWebauthnUsedByListError> = serde_json::from_str(&content).ok();
5403        Err(Error::ResponseError(ResponseContent {
5404            status,
5405            content,
5406            entity,
5407        }))
5408    }
5409}