authentik_client/apis/
authenticators_api.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.8.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    endpoint_device_request: models::EndpointDeviceRequest,
1515) -> Result<models::EndpointDevice, Error<AuthenticatorsAdminEndpointCreateError>> {
1516    // add a prefix to parameters to efficiently prevent name collisions
1517    let p_body_endpoint_device_request = 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_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 => {
1546                return Err(Error::from(serde_json::Error::custom(
1547                    "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
1548                )))
1549            }
1550            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1551                "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
1552            )))),
1553        }
1554    } else {
1555        let content = resp.text().await?;
1556        let entity: Option<AuthenticatorsAdminEndpointCreateError> = serde_json::from_str(&content).ok();
1557        Err(Error::ResponseError(ResponseContent {
1558            status,
1559            content,
1560            entity,
1561        }))
1562    }
1563}
1564
1565/// Viewset for Endpoint authenticator devices (for admins)
1566pub async fn authenticators_admin_endpoint_destroy(
1567    configuration: &configuration::Configuration,
1568    uuid: &str,
1569) -> Result<(), Error<AuthenticatorsAdminEndpointDestroyError>> {
1570    // add a prefix to parameters to efficiently prevent name collisions
1571    let p_path_uuid = uuid;
1572
1573    let uri_str = format!(
1574        "{}/authenticators/admin/endpoint/{uuid}/",
1575        configuration.base_path,
1576        uuid = crate::apis::urlencode(p_path_uuid)
1577    );
1578    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1579
1580    if let Some(ref user_agent) = configuration.user_agent {
1581        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1582    }
1583    if let Some(ref token) = configuration.bearer_access_token {
1584        req_builder = req_builder.bearer_auth(token.to_owned());
1585    };
1586
1587    let req = req_builder.build()?;
1588    let resp = configuration.client.execute(req).await?;
1589
1590    let status = resp.status();
1591
1592    if !status.is_client_error() && !status.is_server_error() {
1593        Ok(())
1594    } else {
1595        let content = resp.text().await?;
1596        let entity: Option<AuthenticatorsAdminEndpointDestroyError> = serde_json::from_str(&content).ok();
1597        Err(Error::ResponseError(ResponseContent {
1598            status,
1599            content,
1600            entity,
1601        }))
1602    }
1603}
1604
1605/// Viewset for Endpoint authenticator devices (for admins)
1606pub async fn authenticators_admin_endpoint_list(
1607    configuration: &configuration::Configuration,
1608    name: Option<&str>,
1609    ordering: Option<&str>,
1610    page: Option<i32>,
1611    page_size: Option<i32>,
1612    search: Option<&str>,
1613) -> Result<models::PaginatedEndpointDeviceList, Error<AuthenticatorsAdminEndpointListError>> {
1614    // add a prefix to parameters to efficiently prevent name collisions
1615    let p_query_name = name;
1616    let p_query_ordering = ordering;
1617    let p_query_page = page;
1618    let p_query_page_size = page_size;
1619    let p_query_search = search;
1620
1621    let uri_str = format!("{}/authenticators/admin/endpoint/", configuration.base_path);
1622    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1623
1624    if let Some(ref param_value) = p_query_name {
1625        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
1626    }
1627    if let Some(ref param_value) = p_query_ordering {
1628        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
1629    }
1630    if let Some(ref param_value) = p_query_page {
1631        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1632    }
1633    if let Some(ref param_value) = p_query_page_size {
1634        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1635    }
1636    if let Some(ref param_value) = p_query_search {
1637        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
1638    }
1639    if let Some(ref user_agent) = configuration.user_agent {
1640        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1641    }
1642    if let Some(ref token) = configuration.bearer_access_token {
1643        req_builder = req_builder.bearer_auth(token.to_owned());
1644    };
1645
1646    let req = req_builder.build()?;
1647    let resp = configuration.client.execute(req).await?;
1648
1649    let status = resp.status();
1650    let content_type = resp
1651        .headers()
1652        .get("content-type")
1653        .and_then(|v| v.to_str().ok())
1654        .unwrap_or("application/octet-stream");
1655    let content_type = super::ContentType::from(content_type);
1656
1657    if !status.is_client_error() && !status.is_server_error() {
1658        let content = resp.text().await?;
1659        match content_type {
1660            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1661            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEndpointDeviceList`"))),
1662            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::PaginatedEndpointDeviceList`")))),
1663        }
1664    } else {
1665        let content = resp.text().await?;
1666        let entity: Option<AuthenticatorsAdminEndpointListError> = serde_json::from_str(&content).ok();
1667        Err(Error::ResponseError(ResponseContent {
1668            status,
1669            content,
1670            entity,
1671        }))
1672    }
1673}
1674
1675/// Viewset for Endpoint authenticator devices (for admins)
1676pub async fn authenticators_admin_endpoint_partial_update(
1677    configuration: &configuration::Configuration,
1678    uuid: &str,
1679    patched_endpoint_device_request: Option<models::PatchedEndpointDeviceRequest>,
1680) -> Result<models::EndpointDevice, Error<AuthenticatorsAdminEndpointPartialUpdateError>> {
1681    // add a prefix to parameters to efficiently prevent name collisions
1682    let p_path_uuid = uuid;
1683    let p_body_patched_endpoint_device_request = patched_endpoint_device_request;
1684
1685    let uri_str = format!(
1686        "{}/authenticators/admin/endpoint/{uuid}/",
1687        configuration.base_path,
1688        uuid = crate::apis::urlencode(p_path_uuid)
1689    );
1690    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1691
1692    if let Some(ref user_agent) = configuration.user_agent {
1693        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1694    }
1695    if let Some(ref token) = configuration.bearer_access_token {
1696        req_builder = req_builder.bearer_auth(token.to_owned());
1697    };
1698    req_builder = req_builder.json(&p_body_patched_endpoint_device_request);
1699
1700    let req = req_builder.build()?;
1701    let resp = configuration.client.execute(req).await?;
1702
1703    let status = resp.status();
1704    let content_type = resp
1705        .headers()
1706        .get("content-type")
1707        .and_then(|v| v.to_str().ok())
1708        .unwrap_or("application/octet-stream");
1709    let content_type = super::ContentType::from(content_type);
1710
1711    if !status.is_client_error() && !status.is_server_error() {
1712        let content = resp.text().await?;
1713        match content_type {
1714            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1715            ContentType::Text => {
1716                return Err(Error::from(serde_json::Error::custom(
1717                    "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
1718                )))
1719            }
1720            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1721                "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
1722            )))),
1723        }
1724    } else {
1725        let content = resp.text().await?;
1726        let entity: Option<AuthenticatorsAdminEndpointPartialUpdateError> = serde_json::from_str(&content).ok();
1727        Err(Error::ResponseError(ResponseContent {
1728            status,
1729            content,
1730            entity,
1731        }))
1732    }
1733}
1734
1735/// Viewset for Endpoint authenticator devices (for admins)
1736pub async fn authenticators_admin_endpoint_retrieve(
1737    configuration: &configuration::Configuration,
1738    uuid: &str,
1739) -> Result<models::EndpointDevice, Error<AuthenticatorsAdminEndpointRetrieveError>> {
1740    // add a prefix to parameters to efficiently prevent name collisions
1741    let p_path_uuid = uuid;
1742
1743    let uri_str = format!(
1744        "{}/authenticators/admin/endpoint/{uuid}/",
1745        configuration.base_path,
1746        uuid = crate::apis::urlencode(p_path_uuid)
1747    );
1748    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1749
1750    if let Some(ref user_agent) = configuration.user_agent {
1751        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1752    }
1753    if let Some(ref token) = configuration.bearer_access_token {
1754        req_builder = req_builder.bearer_auth(token.to_owned());
1755    };
1756
1757    let req = req_builder.build()?;
1758    let resp = configuration.client.execute(req).await?;
1759
1760    let status = resp.status();
1761    let content_type = resp
1762        .headers()
1763        .get("content-type")
1764        .and_then(|v| v.to_str().ok())
1765        .unwrap_or("application/octet-stream");
1766    let content_type = super::ContentType::from(content_type);
1767
1768    if !status.is_client_error() && !status.is_server_error() {
1769        let content = resp.text().await?;
1770        match content_type {
1771            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1772            ContentType::Text => {
1773                return Err(Error::from(serde_json::Error::custom(
1774                    "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
1775                )))
1776            }
1777            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1778                "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
1779            )))),
1780        }
1781    } else {
1782        let content = resp.text().await?;
1783        let entity: Option<AuthenticatorsAdminEndpointRetrieveError> = serde_json::from_str(&content).ok();
1784        Err(Error::ResponseError(ResponseContent {
1785            status,
1786            content,
1787            entity,
1788        }))
1789    }
1790}
1791
1792/// Viewset for Endpoint authenticator devices (for admins)
1793pub async fn authenticators_admin_endpoint_update(
1794    configuration: &configuration::Configuration,
1795    uuid: &str,
1796    endpoint_device_request: models::EndpointDeviceRequest,
1797) -> Result<models::EndpointDevice, Error<AuthenticatorsAdminEndpointUpdateError>> {
1798    // add a prefix to parameters to efficiently prevent name collisions
1799    let p_path_uuid = uuid;
1800    let p_body_endpoint_device_request = endpoint_device_request;
1801
1802    let uri_str = format!(
1803        "{}/authenticators/admin/endpoint/{uuid}/",
1804        configuration.base_path,
1805        uuid = crate::apis::urlencode(p_path_uuid)
1806    );
1807    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1808
1809    if let Some(ref user_agent) = configuration.user_agent {
1810        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1811    }
1812    if let Some(ref token) = configuration.bearer_access_token {
1813        req_builder = req_builder.bearer_auth(token.to_owned());
1814    };
1815    req_builder = req_builder.json(&p_body_endpoint_device_request);
1816
1817    let req = req_builder.build()?;
1818    let resp = configuration.client.execute(req).await?;
1819
1820    let status = resp.status();
1821    let content_type = resp
1822        .headers()
1823        .get("content-type")
1824        .and_then(|v| v.to_str().ok())
1825        .unwrap_or("application/octet-stream");
1826    let content_type = super::ContentType::from(content_type);
1827
1828    if !status.is_client_error() && !status.is_server_error() {
1829        let content = resp.text().await?;
1830        match content_type {
1831            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1832            ContentType::Text => {
1833                return Err(Error::from(serde_json::Error::custom(
1834                    "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
1835                )))
1836            }
1837            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1838                "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
1839            )))),
1840        }
1841    } else {
1842        let content = resp.text().await?;
1843        let entity: Option<AuthenticatorsAdminEndpointUpdateError> = serde_json::from_str(&content).ok();
1844        Err(Error::ResponseError(ResponseContent {
1845            status,
1846            content,
1847            entity,
1848        }))
1849    }
1850}
1851
1852/// Viewset for sms authenticator devices (for admins)
1853pub async fn authenticators_admin_sms_create(
1854    configuration: &configuration::Configuration,
1855    sms_device_request: models::SmsDeviceRequest,
1856) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsCreateError>> {
1857    // add a prefix to parameters to efficiently prevent name collisions
1858    let p_body_sms_device_request = sms_device_request;
1859
1860    let uri_str = format!("{}/authenticators/admin/sms/", configuration.base_path);
1861    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1862
1863    if let Some(ref user_agent) = configuration.user_agent {
1864        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1865    }
1866    if let Some(ref token) = configuration.bearer_access_token {
1867        req_builder = req_builder.bearer_auth(token.to_owned());
1868    };
1869    req_builder = req_builder.json(&p_body_sms_device_request);
1870
1871    let req = req_builder.build()?;
1872    let resp = configuration.client.execute(req).await?;
1873
1874    let status = resp.status();
1875    let content_type = resp
1876        .headers()
1877        .get("content-type")
1878        .and_then(|v| v.to_str().ok())
1879        .unwrap_or("application/octet-stream");
1880    let content_type = super::ContentType::from(content_type);
1881
1882    if !status.is_client_error() && !status.is_server_error() {
1883        let content = resp.text().await?;
1884        match content_type {
1885            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1886            ContentType::Text => {
1887                return Err(Error::from(serde_json::Error::custom(
1888                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
1889                )))
1890            }
1891            ContentType::Unsupported(unknown_type) => {
1892                return Err(Error::from(serde_json::Error::custom(format!(
1893                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
1894                ))))
1895            }
1896        }
1897    } else {
1898        let content = resp.text().await?;
1899        let entity: Option<AuthenticatorsAdminSmsCreateError> = serde_json::from_str(&content).ok();
1900        Err(Error::ResponseError(ResponseContent {
1901            status,
1902            content,
1903            entity,
1904        }))
1905    }
1906}
1907
1908/// Viewset for sms authenticator devices (for admins)
1909pub async fn authenticators_admin_sms_destroy(
1910    configuration: &configuration::Configuration,
1911    id: i32,
1912) -> Result<(), Error<AuthenticatorsAdminSmsDestroyError>> {
1913    // add a prefix to parameters to efficiently prevent name collisions
1914    let p_path_id = id;
1915
1916    let uri_str = format!(
1917        "{}/authenticators/admin/sms/{id}/",
1918        configuration.base_path,
1919        id = p_path_id
1920    );
1921    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1922
1923    if let Some(ref user_agent) = configuration.user_agent {
1924        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1925    }
1926    if let Some(ref token) = configuration.bearer_access_token {
1927        req_builder = req_builder.bearer_auth(token.to_owned());
1928    };
1929
1930    let req = req_builder.build()?;
1931    let resp = configuration.client.execute(req).await?;
1932
1933    let status = resp.status();
1934
1935    if !status.is_client_error() && !status.is_server_error() {
1936        Ok(())
1937    } else {
1938        let content = resp.text().await?;
1939        let entity: Option<AuthenticatorsAdminSmsDestroyError> = serde_json::from_str(&content).ok();
1940        Err(Error::ResponseError(ResponseContent {
1941            status,
1942            content,
1943            entity,
1944        }))
1945    }
1946}
1947
1948/// Viewset for sms authenticator devices (for admins)
1949pub async fn authenticators_admin_sms_list(
1950    configuration: &configuration::Configuration,
1951    name: Option<&str>,
1952    ordering: Option<&str>,
1953    page: Option<i32>,
1954    page_size: Option<i32>,
1955    search: Option<&str>,
1956) -> Result<models::PaginatedSmsDeviceList, Error<AuthenticatorsAdminSmsListError>> {
1957    // add a prefix to parameters to efficiently prevent name collisions
1958    let p_query_name = name;
1959    let p_query_ordering = ordering;
1960    let p_query_page = page;
1961    let p_query_page_size = page_size;
1962    let p_query_search = search;
1963
1964    let uri_str = format!("{}/authenticators/admin/sms/", configuration.base_path);
1965    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1966
1967    if let Some(ref param_value) = p_query_name {
1968        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
1969    }
1970    if let Some(ref param_value) = p_query_ordering {
1971        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
1972    }
1973    if let Some(ref param_value) = p_query_page {
1974        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1975    }
1976    if let Some(ref param_value) = p_query_page_size {
1977        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1978    }
1979    if let Some(ref param_value) = p_query_search {
1980        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
1981    }
1982    if let Some(ref user_agent) = configuration.user_agent {
1983        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1984    }
1985    if let Some(ref token) = configuration.bearer_access_token {
1986        req_builder = req_builder.bearer_auth(token.to_owned());
1987    };
1988
1989    let req = req_builder.build()?;
1990    let resp = configuration.client.execute(req).await?;
1991
1992    let status = resp.status();
1993    let content_type = resp
1994        .headers()
1995        .get("content-type")
1996        .and_then(|v| v.to_str().ok())
1997        .unwrap_or("application/octet-stream");
1998    let content_type = super::ContentType::from(content_type);
1999
2000    if !status.is_client_error() && !status.is_server_error() {
2001        let content = resp.text().await?;
2002        match content_type {
2003            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2004            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedSmsDeviceList`"))),
2005            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`")))),
2006        }
2007    } else {
2008        let content = resp.text().await?;
2009        let entity: Option<AuthenticatorsAdminSmsListError> = serde_json::from_str(&content).ok();
2010        Err(Error::ResponseError(ResponseContent {
2011            status,
2012            content,
2013            entity,
2014        }))
2015    }
2016}
2017
2018/// Viewset for sms authenticator devices (for admins)
2019pub async fn authenticators_admin_sms_partial_update(
2020    configuration: &configuration::Configuration,
2021    id: i32,
2022    patched_sms_device_request: Option<models::PatchedSmsDeviceRequest>,
2023) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsPartialUpdateError>> {
2024    // add a prefix to parameters to efficiently prevent name collisions
2025    let p_path_id = id;
2026    let p_body_patched_sms_device_request = patched_sms_device_request;
2027
2028    let uri_str = format!(
2029        "{}/authenticators/admin/sms/{id}/",
2030        configuration.base_path,
2031        id = p_path_id
2032    );
2033    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2034
2035    if let Some(ref user_agent) = configuration.user_agent {
2036        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2037    }
2038    if let Some(ref token) = configuration.bearer_access_token {
2039        req_builder = req_builder.bearer_auth(token.to_owned());
2040    };
2041    req_builder = req_builder.json(&p_body_patched_sms_device_request);
2042
2043    let req = req_builder.build()?;
2044    let resp = configuration.client.execute(req).await?;
2045
2046    let status = resp.status();
2047    let content_type = resp
2048        .headers()
2049        .get("content-type")
2050        .and_then(|v| v.to_str().ok())
2051        .unwrap_or("application/octet-stream");
2052    let content_type = super::ContentType::from(content_type);
2053
2054    if !status.is_client_error() && !status.is_server_error() {
2055        let content = resp.text().await?;
2056        match content_type {
2057            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2058            ContentType::Text => {
2059                return Err(Error::from(serde_json::Error::custom(
2060                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
2061                )))
2062            }
2063            ContentType::Unsupported(unknown_type) => {
2064                return Err(Error::from(serde_json::Error::custom(format!(
2065                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
2066                ))))
2067            }
2068        }
2069    } else {
2070        let content = resp.text().await?;
2071        let entity: Option<AuthenticatorsAdminSmsPartialUpdateError> = serde_json::from_str(&content).ok();
2072        Err(Error::ResponseError(ResponseContent {
2073            status,
2074            content,
2075            entity,
2076        }))
2077    }
2078}
2079
2080/// Viewset for sms authenticator devices (for admins)
2081pub async fn authenticators_admin_sms_retrieve(
2082    configuration: &configuration::Configuration,
2083    id: i32,
2084) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsRetrieveError>> {
2085    // add a prefix to parameters to efficiently prevent name collisions
2086    let p_path_id = id;
2087
2088    let uri_str = format!(
2089        "{}/authenticators/admin/sms/{id}/",
2090        configuration.base_path,
2091        id = p_path_id
2092    );
2093    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2094
2095    if let Some(ref user_agent) = configuration.user_agent {
2096        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2097    }
2098    if let Some(ref token) = configuration.bearer_access_token {
2099        req_builder = req_builder.bearer_auth(token.to_owned());
2100    };
2101
2102    let req = req_builder.build()?;
2103    let resp = configuration.client.execute(req).await?;
2104
2105    let status = resp.status();
2106    let content_type = resp
2107        .headers()
2108        .get("content-type")
2109        .and_then(|v| v.to_str().ok())
2110        .unwrap_or("application/octet-stream");
2111    let content_type = super::ContentType::from(content_type);
2112
2113    if !status.is_client_error() && !status.is_server_error() {
2114        let content = resp.text().await?;
2115        match content_type {
2116            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2117            ContentType::Text => {
2118                return Err(Error::from(serde_json::Error::custom(
2119                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
2120                )))
2121            }
2122            ContentType::Unsupported(unknown_type) => {
2123                return Err(Error::from(serde_json::Error::custom(format!(
2124                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
2125                ))))
2126            }
2127        }
2128    } else {
2129        let content = resp.text().await?;
2130        let entity: Option<AuthenticatorsAdminSmsRetrieveError> = serde_json::from_str(&content).ok();
2131        Err(Error::ResponseError(ResponseContent {
2132            status,
2133            content,
2134            entity,
2135        }))
2136    }
2137}
2138
2139/// Viewset for sms authenticator devices (for admins)
2140pub async fn authenticators_admin_sms_update(
2141    configuration: &configuration::Configuration,
2142    id: i32,
2143    sms_device_request: models::SmsDeviceRequest,
2144) -> Result<models::SmsDevice, Error<AuthenticatorsAdminSmsUpdateError>> {
2145    // add a prefix to parameters to efficiently prevent name collisions
2146    let p_path_id = id;
2147    let p_body_sms_device_request = sms_device_request;
2148
2149    let uri_str = format!(
2150        "{}/authenticators/admin/sms/{id}/",
2151        configuration.base_path,
2152        id = p_path_id
2153    );
2154    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2155
2156    if let Some(ref user_agent) = configuration.user_agent {
2157        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2158    }
2159    if let Some(ref token) = configuration.bearer_access_token {
2160        req_builder = req_builder.bearer_auth(token.to_owned());
2161    };
2162    req_builder = req_builder.json(&p_body_sms_device_request);
2163
2164    let req = req_builder.build()?;
2165    let resp = configuration.client.execute(req).await?;
2166
2167    let status = resp.status();
2168    let content_type = resp
2169        .headers()
2170        .get("content-type")
2171        .and_then(|v| v.to_str().ok())
2172        .unwrap_or("application/octet-stream");
2173    let content_type = super::ContentType::from(content_type);
2174
2175    if !status.is_client_error() && !status.is_server_error() {
2176        let content = resp.text().await?;
2177        match content_type {
2178            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2179            ContentType::Text => {
2180                return Err(Error::from(serde_json::Error::custom(
2181                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
2182                )))
2183            }
2184            ContentType::Unsupported(unknown_type) => {
2185                return Err(Error::from(serde_json::Error::custom(format!(
2186                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
2187                ))))
2188            }
2189        }
2190    } else {
2191        let content = resp.text().await?;
2192        let entity: Option<AuthenticatorsAdminSmsUpdateError> = serde_json::from_str(&content).ok();
2193        Err(Error::ResponseError(ResponseContent {
2194            status,
2195            content,
2196            entity,
2197        }))
2198    }
2199}
2200
2201/// Viewset for static authenticator devices (for admins)
2202pub async fn authenticators_admin_static_create(
2203    configuration: &configuration::Configuration,
2204    static_device_request: models::StaticDeviceRequest,
2205) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticCreateError>> {
2206    // add a prefix to parameters to efficiently prevent name collisions
2207    let p_body_static_device_request = static_device_request;
2208
2209    let uri_str = format!("{}/authenticators/admin/static/", configuration.base_path);
2210    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2211
2212    if let Some(ref user_agent) = configuration.user_agent {
2213        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2214    }
2215    if let Some(ref token) = configuration.bearer_access_token {
2216        req_builder = req_builder.bearer_auth(token.to_owned());
2217    };
2218    req_builder = req_builder.json(&p_body_static_device_request);
2219
2220    let req = req_builder.build()?;
2221    let resp = configuration.client.execute(req).await?;
2222
2223    let status = resp.status();
2224    let content_type = resp
2225        .headers()
2226        .get("content-type")
2227        .and_then(|v| v.to_str().ok())
2228        .unwrap_or("application/octet-stream");
2229    let content_type = super::ContentType::from(content_type);
2230
2231    if !status.is_client_error() && !status.is_server_error() {
2232        let content = resp.text().await?;
2233        match content_type {
2234            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2235            ContentType::Text => {
2236                return Err(Error::from(serde_json::Error::custom(
2237                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2238                )))
2239            }
2240            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2241                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2242            )))),
2243        }
2244    } else {
2245        let content = resp.text().await?;
2246        let entity: Option<AuthenticatorsAdminStaticCreateError> = serde_json::from_str(&content).ok();
2247        Err(Error::ResponseError(ResponseContent {
2248            status,
2249            content,
2250            entity,
2251        }))
2252    }
2253}
2254
2255/// Viewset for static authenticator devices (for admins)
2256pub async fn authenticators_admin_static_destroy(
2257    configuration: &configuration::Configuration,
2258    id: i32,
2259) -> Result<(), Error<AuthenticatorsAdminStaticDestroyError>> {
2260    // add a prefix to parameters to efficiently prevent name collisions
2261    let p_path_id = id;
2262
2263    let uri_str = format!(
2264        "{}/authenticators/admin/static/{id}/",
2265        configuration.base_path,
2266        id = p_path_id
2267    );
2268    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2269
2270    if let Some(ref user_agent) = configuration.user_agent {
2271        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2272    }
2273    if let Some(ref token) = configuration.bearer_access_token {
2274        req_builder = req_builder.bearer_auth(token.to_owned());
2275    };
2276
2277    let req = req_builder.build()?;
2278    let resp = configuration.client.execute(req).await?;
2279
2280    let status = resp.status();
2281
2282    if !status.is_client_error() && !status.is_server_error() {
2283        Ok(())
2284    } else {
2285        let content = resp.text().await?;
2286        let entity: Option<AuthenticatorsAdminStaticDestroyError> = serde_json::from_str(&content).ok();
2287        Err(Error::ResponseError(ResponseContent {
2288            status,
2289            content,
2290            entity,
2291        }))
2292    }
2293}
2294
2295/// Viewset for static authenticator devices (for admins)
2296pub async fn authenticators_admin_static_list(
2297    configuration: &configuration::Configuration,
2298    name: Option<&str>,
2299    ordering: Option<&str>,
2300    page: Option<i32>,
2301    page_size: Option<i32>,
2302    search: Option<&str>,
2303) -> Result<models::PaginatedStaticDeviceList, Error<AuthenticatorsAdminStaticListError>> {
2304    // add a prefix to parameters to efficiently prevent name collisions
2305    let p_query_name = name;
2306    let p_query_ordering = ordering;
2307    let p_query_page = page;
2308    let p_query_page_size = page_size;
2309    let p_query_search = search;
2310
2311    let uri_str = format!("{}/authenticators/admin/static/", configuration.base_path);
2312    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2313
2314    if let Some(ref param_value) = p_query_name {
2315        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2316    }
2317    if let Some(ref param_value) = p_query_ordering {
2318        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
2319    }
2320    if let Some(ref param_value) = p_query_page {
2321        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2322    }
2323    if let Some(ref param_value) = p_query_page_size {
2324        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
2325    }
2326    if let Some(ref param_value) = p_query_search {
2327        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
2328    }
2329    if let Some(ref user_agent) = configuration.user_agent {
2330        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2331    }
2332    if let Some(ref token) = configuration.bearer_access_token {
2333        req_builder = req_builder.bearer_auth(token.to_owned());
2334    };
2335
2336    let req = req_builder.build()?;
2337    let resp = configuration.client.execute(req).await?;
2338
2339    let status = resp.status();
2340    let content_type = resp
2341        .headers()
2342        .get("content-type")
2343        .and_then(|v| v.to_str().ok())
2344        .unwrap_or("application/octet-stream");
2345    let content_type = super::ContentType::from(content_type);
2346
2347    if !status.is_client_error() && !status.is_server_error() {
2348        let content = resp.text().await?;
2349        match content_type {
2350            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2351            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedStaticDeviceList`"))),
2352            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`")))),
2353        }
2354    } else {
2355        let content = resp.text().await?;
2356        let entity: Option<AuthenticatorsAdminStaticListError> = serde_json::from_str(&content).ok();
2357        Err(Error::ResponseError(ResponseContent {
2358            status,
2359            content,
2360            entity,
2361        }))
2362    }
2363}
2364
2365/// Viewset for static authenticator devices (for admins)
2366pub async fn authenticators_admin_static_partial_update(
2367    configuration: &configuration::Configuration,
2368    id: i32,
2369    patched_static_device_request: Option<models::PatchedStaticDeviceRequest>,
2370) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticPartialUpdateError>> {
2371    // add a prefix to parameters to efficiently prevent name collisions
2372    let p_path_id = id;
2373    let p_body_patched_static_device_request = patched_static_device_request;
2374
2375    let uri_str = format!(
2376        "{}/authenticators/admin/static/{id}/",
2377        configuration.base_path,
2378        id = p_path_id
2379    );
2380    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2381
2382    if let Some(ref user_agent) = configuration.user_agent {
2383        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2384    }
2385    if let Some(ref token) = configuration.bearer_access_token {
2386        req_builder = req_builder.bearer_auth(token.to_owned());
2387    };
2388    req_builder = req_builder.json(&p_body_patched_static_device_request);
2389
2390    let req = req_builder.build()?;
2391    let resp = configuration.client.execute(req).await?;
2392
2393    let status = resp.status();
2394    let content_type = resp
2395        .headers()
2396        .get("content-type")
2397        .and_then(|v| v.to_str().ok())
2398        .unwrap_or("application/octet-stream");
2399    let content_type = super::ContentType::from(content_type);
2400
2401    if !status.is_client_error() && !status.is_server_error() {
2402        let content = resp.text().await?;
2403        match content_type {
2404            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2405            ContentType::Text => {
2406                return Err(Error::from(serde_json::Error::custom(
2407                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2408                )))
2409            }
2410            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2411                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2412            )))),
2413        }
2414    } else {
2415        let content = resp.text().await?;
2416        let entity: Option<AuthenticatorsAdminStaticPartialUpdateError> = serde_json::from_str(&content).ok();
2417        Err(Error::ResponseError(ResponseContent {
2418            status,
2419            content,
2420            entity,
2421        }))
2422    }
2423}
2424
2425/// Viewset for static authenticator devices (for admins)
2426pub async fn authenticators_admin_static_retrieve(
2427    configuration: &configuration::Configuration,
2428    id: i32,
2429) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticRetrieveError>> {
2430    // add a prefix to parameters to efficiently prevent name collisions
2431    let p_path_id = id;
2432
2433    let uri_str = format!(
2434        "{}/authenticators/admin/static/{id}/",
2435        configuration.base_path,
2436        id = p_path_id
2437    );
2438    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2439
2440    if let Some(ref user_agent) = configuration.user_agent {
2441        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2442    }
2443    if let Some(ref token) = configuration.bearer_access_token {
2444        req_builder = req_builder.bearer_auth(token.to_owned());
2445    };
2446
2447    let req = req_builder.build()?;
2448    let resp = configuration.client.execute(req).await?;
2449
2450    let status = resp.status();
2451    let content_type = resp
2452        .headers()
2453        .get("content-type")
2454        .and_then(|v| v.to_str().ok())
2455        .unwrap_or("application/octet-stream");
2456    let content_type = super::ContentType::from(content_type);
2457
2458    if !status.is_client_error() && !status.is_server_error() {
2459        let content = resp.text().await?;
2460        match content_type {
2461            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2462            ContentType::Text => {
2463                return Err(Error::from(serde_json::Error::custom(
2464                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2465                )))
2466            }
2467            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2468                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2469            )))),
2470        }
2471    } else {
2472        let content = resp.text().await?;
2473        let entity: Option<AuthenticatorsAdminStaticRetrieveError> = serde_json::from_str(&content).ok();
2474        Err(Error::ResponseError(ResponseContent {
2475            status,
2476            content,
2477            entity,
2478        }))
2479    }
2480}
2481
2482/// Viewset for static authenticator devices (for admins)
2483pub async fn authenticators_admin_static_update(
2484    configuration: &configuration::Configuration,
2485    id: i32,
2486    static_device_request: models::StaticDeviceRequest,
2487) -> Result<models::StaticDevice, Error<AuthenticatorsAdminStaticUpdateError>> {
2488    // add a prefix to parameters to efficiently prevent name collisions
2489    let p_path_id = id;
2490    let p_body_static_device_request = static_device_request;
2491
2492    let uri_str = format!(
2493        "{}/authenticators/admin/static/{id}/",
2494        configuration.base_path,
2495        id = p_path_id
2496    );
2497    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2498
2499    if let Some(ref user_agent) = configuration.user_agent {
2500        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2501    }
2502    if let Some(ref token) = configuration.bearer_access_token {
2503        req_builder = req_builder.bearer_auth(token.to_owned());
2504    };
2505    req_builder = req_builder.json(&p_body_static_device_request);
2506
2507    let req = req_builder.build()?;
2508    let resp = configuration.client.execute(req).await?;
2509
2510    let status = resp.status();
2511    let content_type = resp
2512        .headers()
2513        .get("content-type")
2514        .and_then(|v| v.to_str().ok())
2515        .unwrap_or("application/octet-stream");
2516    let content_type = super::ContentType::from(content_type);
2517
2518    if !status.is_client_error() && !status.is_server_error() {
2519        let content = resp.text().await?;
2520        match content_type {
2521            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2522            ContentType::Text => {
2523                return Err(Error::from(serde_json::Error::custom(
2524                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
2525                )))
2526            }
2527            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2528                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
2529            )))),
2530        }
2531    } else {
2532        let content = resp.text().await?;
2533        let entity: Option<AuthenticatorsAdminStaticUpdateError> = serde_json::from_str(&content).ok();
2534        Err(Error::ResponseError(ResponseContent {
2535            status,
2536            content,
2537            entity,
2538        }))
2539    }
2540}
2541
2542/// Viewset for totp authenticator devices (for admins)
2543pub async fn authenticators_admin_totp_create(
2544    configuration: &configuration::Configuration,
2545    totp_device_request: models::TotpDeviceRequest,
2546) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpCreateError>> {
2547    // add a prefix to parameters to efficiently prevent name collisions
2548    let p_body_totp_device_request = totp_device_request;
2549
2550    let uri_str = format!("{}/authenticators/admin/totp/", configuration.base_path);
2551    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2552
2553    if let Some(ref user_agent) = configuration.user_agent {
2554        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2555    }
2556    if let Some(ref token) = configuration.bearer_access_token {
2557        req_builder = req_builder.bearer_auth(token.to_owned());
2558    };
2559    req_builder = req_builder.json(&p_body_totp_device_request);
2560
2561    let req = req_builder.build()?;
2562    let resp = configuration.client.execute(req).await?;
2563
2564    let status = resp.status();
2565    let content_type = resp
2566        .headers()
2567        .get("content-type")
2568        .and_then(|v| v.to_str().ok())
2569        .unwrap_or("application/octet-stream");
2570    let content_type = super::ContentType::from(content_type);
2571
2572    if !status.is_client_error() && !status.is_server_error() {
2573        let content = resp.text().await?;
2574        match content_type {
2575            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2576            ContentType::Text => {
2577                return Err(Error::from(serde_json::Error::custom(
2578                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2579                )))
2580            }
2581            ContentType::Unsupported(unknown_type) => {
2582                return Err(Error::from(serde_json::Error::custom(format!(
2583                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2584                ))))
2585            }
2586        }
2587    } else {
2588        let content = resp.text().await?;
2589        let entity: Option<AuthenticatorsAdminTotpCreateError> = serde_json::from_str(&content).ok();
2590        Err(Error::ResponseError(ResponseContent {
2591            status,
2592            content,
2593            entity,
2594        }))
2595    }
2596}
2597
2598/// Viewset for totp authenticator devices (for admins)
2599pub async fn authenticators_admin_totp_destroy(
2600    configuration: &configuration::Configuration,
2601    id: i32,
2602) -> Result<(), Error<AuthenticatorsAdminTotpDestroyError>> {
2603    // add a prefix to parameters to efficiently prevent name collisions
2604    let p_path_id = id;
2605
2606    let uri_str = format!(
2607        "{}/authenticators/admin/totp/{id}/",
2608        configuration.base_path,
2609        id = p_path_id
2610    );
2611    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2612
2613    if let Some(ref user_agent) = configuration.user_agent {
2614        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2615    }
2616    if let Some(ref token) = configuration.bearer_access_token {
2617        req_builder = req_builder.bearer_auth(token.to_owned());
2618    };
2619
2620    let req = req_builder.build()?;
2621    let resp = configuration.client.execute(req).await?;
2622
2623    let status = resp.status();
2624
2625    if !status.is_client_error() && !status.is_server_error() {
2626        Ok(())
2627    } else {
2628        let content = resp.text().await?;
2629        let entity: Option<AuthenticatorsAdminTotpDestroyError> = serde_json::from_str(&content).ok();
2630        Err(Error::ResponseError(ResponseContent {
2631            status,
2632            content,
2633            entity,
2634        }))
2635    }
2636}
2637
2638/// Viewset for totp authenticator devices (for admins)
2639pub async fn authenticators_admin_totp_list(
2640    configuration: &configuration::Configuration,
2641    name: Option<&str>,
2642    ordering: Option<&str>,
2643    page: Option<i32>,
2644    page_size: Option<i32>,
2645    search: Option<&str>,
2646) -> Result<models::PaginatedTotpDeviceList, Error<AuthenticatorsAdminTotpListError>> {
2647    // add a prefix to parameters to efficiently prevent name collisions
2648    let p_query_name = name;
2649    let p_query_ordering = ordering;
2650    let p_query_page = page;
2651    let p_query_page_size = page_size;
2652    let p_query_search = search;
2653
2654    let uri_str = format!("{}/authenticators/admin/totp/", configuration.base_path);
2655    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2656
2657    if let Some(ref param_value) = p_query_name {
2658        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2659    }
2660    if let Some(ref param_value) = p_query_ordering {
2661        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
2662    }
2663    if let Some(ref param_value) = p_query_page {
2664        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2665    }
2666    if let Some(ref param_value) = p_query_page_size {
2667        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
2668    }
2669    if let Some(ref param_value) = p_query_search {
2670        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
2671    }
2672    if let Some(ref user_agent) = configuration.user_agent {
2673        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2674    }
2675    if let Some(ref token) = configuration.bearer_access_token {
2676        req_builder = req_builder.bearer_auth(token.to_owned());
2677    };
2678
2679    let req = req_builder.build()?;
2680    let resp = configuration.client.execute(req).await?;
2681
2682    let status = resp.status();
2683    let content_type = resp
2684        .headers()
2685        .get("content-type")
2686        .and_then(|v| v.to_str().ok())
2687        .unwrap_or("application/octet-stream");
2688    let content_type = super::ContentType::from(content_type);
2689
2690    if !status.is_client_error() && !status.is_server_error() {
2691        let content = resp.text().await?;
2692        match content_type {
2693            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2694            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTotpDeviceList`"))),
2695            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`")))),
2696        }
2697    } else {
2698        let content = resp.text().await?;
2699        let entity: Option<AuthenticatorsAdminTotpListError> = serde_json::from_str(&content).ok();
2700        Err(Error::ResponseError(ResponseContent {
2701            status,
2702            content,
2703            entity,
2704        }))
2705    }
2706}
2707
2708/// Viewset for totp authenticator devices (for admins)
2709pub async fn authenticators_admin_totp_partial_update(
2710    configuration: &configuration::Configuration,
2711    id: i32,
2712    patched_totp_device_request: Option<models::PatchedTotpDeviceRequest>,
2713) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpPartialUpdateError>> {
2714    // add a prefix to parameters to efficiently prevent name collisions
2715    let p_path_id = id;
2716    let p_body_patched_totp_device_request = patched_totp_device_request;
2717
2718    let uri_str = format!(
2719        "{}/authenticators/admin/totp/{id}/",
2720        configuration.base_path,
2721        id = p_path_id
2722    );
2723    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2724
2725    if let Some(ref user_agent) = configuration.user_agent {
2726        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2727    }
2728    if let Some(ref token) = configuration.bearer_access_token {
2729        req_builder = req_builder.bearer_auth(token.to_owned());
2730    };
2731    req_builder = req_builder.json(&p_body_patched_totp_device_request);
2732
2733    let req = req_builder.build()?;
2734    let resp = configuration.client.execute(req).await?;
2735
2736    let status = resp.status();
2737    let content_type = resp
2738        .headers()
2739        .get("content-type")
2740        .and_then(|v| v.to_str().ok())
2741        .unwrap_or("application/octet-stream");
2742    let content_type = super::ContentType::from(content_type);
2743
2744    if !status.is_client_error() && !status.is_server_error() {
2745        let content = resp.text().await?;
2746        match content_type {
2747            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2748            ContentType::Text => {
2749                return Err(Error::from(serde_json::Error::custom(
2750                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2751                )))
2752            }
2753            ContentType::Unsupported(unknown_type) => {
2754                return Err(Error::from(serde_json::Error::custom(format!(
2755                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2756                ))))
2757            }
2758        }
2759    } else {
2760        let content = resp.text().await?;
2761        let entity: Option<AuthenticatorsAdminTotpPartialUpdateError> = serde_json::from_str(&content).ok();
2762        Err(Error::ResponseError(ResponseContent {
2763            status,
2764            content,
2765            entity,
2766        }))
2767    }
2768}
2769
2770/// Viewset for totp authenticator devices (for admins)
2771pub async fn authenticators_admin_totp_retrieve(
2772    configuration: &configuration::Configuration,
2773    id: i32,
2774) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpRetrieveError>> {
2775    // add a prefix to parameters to efficiently prevent name collisions
2776    let p_path_id = id;
2777
2778    let uri_str = format!(
2779        "{}/authenticators/admin/totp/{id}/",
2780        configuration.base_path,
2781        id = p_path_id
2782    );
2783    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2784
2785    if let Some(ref user_agent) = configuration.user_agent {
2786        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2787    }
2788    if let Some(ref token) = configuration.bearer_access_token {
2789        req_builder = req_builder.bearer_auth(token.to_owned());
2790    };
2791
2792    let req = req_builder.build()?;
2793    let resp = configuration.client.execute(req).await?;
2794
2795    let status = resp.status();
2796    let content_type = resp
2797        .headers()
2798        .get("content-type")
2799        .and_then(|v| v.to_str().ok())
2800        .unwrap_or("application/octet-stream");
2801    let content_type = super::ContentType::from(content_type);
2802
2803    if !status.is_client_error() && !status.is_server_error() {
2804        let content = resp.text().await?;
2805        match content_type {
2806            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2807            ContentType::Text => {
2808                return Err(Error::from(serde_json::Error::custom(
2809                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2810                )))
2811            }
2812            ContentType::Unsupported(unknown_type) => {
2813                return Err(Error::from(serde_json::Error::custom(format!(
2814                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2815                ))))
2816            }
2817        }
2818    } else {
2819        let content = resp.text().await?;
2820        let entity: Option<AuthenticatorsAdminTotpRetrieveError> = serde_json::from_str(&content).ok();
2821        Err(Error::ResponseError(ResponseContent {
2822            status,
2823            content,
2824            entity,
2825        }))
2826    }
2827}
2828
2829/// Viewset for totp authenticator devices (for admins)
2830pub async fn authenticators_admin_totp_update(
2831    configuration: &configuration::Configuration,
2832    id: i32,
2833    totp_device_request: models::TotpDeviceRequest,
2834) -> Result<models::TotpDevice, Error<AuthenticatorsAdminTotpUpdateError>> {
2835    // add a prefix to parameters to efficiently prevent name collisions
2836    let p_path_id = id;
2837    let p_body_totp_device_request = totp_device_request;
2838
2839    let uri_str = format!(
2840        "{}/authenticators/admin/totp/{id}/",
2841        configuration.base_path,
2842        id = p_path_id
2843    );
2844    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2845
2846    if let Some(ref user_agent) = configuration.user_agent {
2847        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2848    }
2849    if let Some(ref token) = configuration.bearer_access_token {
2850        req_builder = req_builder.bearer_auth(token.to_owned());
2851    };
2852    req_builder = req_builder.json(&p_body_totp_device_request);
2853
2854    let req = req_builder.build()?;
2855    let resp = configuration.client.execute(req).await?;
2856
2857    let status = resp.status();
2858    let content_type = resp
2859        .headers()
2860        .get("content-type")
2861        .and_then(|v| v.to_str().ok())
2862        .unwrap_or("application/octet-stream");
2863    let content_type = super::ContentType::from(content_type);
2864
2865    if !status.is_client_error() && !status.is_server_error() {
2866        let content = resp.text().await?;
2867        match content_type {
2868            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2869            ContentType::Text => {
2870                return Err(Error::from(serde_json::Error::custom(
2871                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
2872                )))
2873            }
2874            ContentType::Unsupported(unknown_type) => {
2875                return Err(Error::from(serde_json::Error::custom(format!(
2876                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
2877                ))))
2878            }
2879        }
2880    } else {
2881        let content = resp.text().await?;
2882        let entity: Option<AuthenticatorsAdminTotpUpdateError> = serde_json::from_str(&content).ok();
2883        Err(Error::ResponseError(ResponseContent {
2884            status,
2885            content,
2886            entity,
2887        }))
2888    }
2889}
2890
2891/// Viewset for WebAuthn authenticator devices (for admins)
2892pub async fn authenticators_admin_webauthn_create(
2893    configuration: &configuration::Configuration,
2894    web_authn_device_request: models::WebAuthnDeviceRequest,
2895) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnCreateError>> {
2896    // add a prefix to parameters to efficiently prevent name collisions
2897    let p_body_web_authn_device_request = web_authn_device_request;
2898
2899    let uri_str = format!("{}/authenticators/admin/webauthn/", configuration.base_path);
2900    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2901
2902    if let Some(ref user_agent) = configuration.user_agent {
2903        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2904    }
2905    if let Some(ref token) = configuration.bearer_access_token {
2906        req_builder = req_builder.bearer_auth(token.to_owned());
2907    };
2908    req_builder = req_builder.json(&p_body_web_authn_device_request);
2909
2910    let req = req_builder.build()?;
2911    let resp = configuration.client.execute(req).await?;
2912
2913    let status = resp.status();
2914    let content_type = resp
2915        .headers()
2916        .get("content-type")
2917        .and_then(|v| v.to_str().ok())
2918        .unwrap_or("application/octet-stream");
2919    let content_type = super::ContentType::from(content_type);
2920
2921    if !status.is_client_error() && !status.is_server_error() {
2922        let content = resp.text().await?;
2923        match content_type {
2924            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2925            ContentType::Text => {
2926                return Err(Error::from(serde_json::Error::custom(
2927                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
2928                )))
2929            }
2930            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2931                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
2932            )))),
2933        }
2934    } else {
2935        let content = resp.text().await?;
2936        let entity: Option<AuthenticatorsAdminWebauthnCreateError> = serde_json::from_str(&content).ok();
2937        Err(Error::ResponseError(ResponseContent {
2938            status,
2939            content,
2940            entity,
2941        }))
2942    }
2943}
2944
2945/// Viewset for WebAuthn authenticator devices (for admins)
2946pub async fn authenticators_admin_webauthn_destroy(
2947    configuration: &configuration::Configuration,
2948    id: i32,
2949) -> Result<(), Error<AuthenticatorsAdminWebauthnDestroyError>> {
2950    // add a prefix to parameters to efficiently prevent name collisions
2951    let p_path_id = id;
2952
2953    let uri_str = format!(
2954        "{}/authenticators/admin/webauthn/{id}/",
2955        configuration.base_path,
2956        id = p_path_id
2957    );
2958    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2959
2960    if let Some(ref user_agent) = configuration.user_agent {
2961        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2962    }
2963    if let Some(ref token) = configuration.bearer_access_token {
2964        req_builder = req_builder.bearer_auth(token.to_owned());
2965    };
2966
2967    let req = req_builder.build()?;
2968    let resp = configuration.client.execute(req).await?;
2969
2970    let status = resp.status();
2971
2972    if !status.is_client_error() && !status.is_server_error() {
2973        Ok(())
2974    } else {
2975        let content = resp.text().await?;
2976        let entity: Option<AuthenticatorsAdminWebauthnDestroyError> = serde_json::from_str(&content).ok();
2977        Err(Error::ResponseError(ResponseContent {
2978            status,
2979            content,
2980            entity,
2981        }))
2982    }
2983}
2984
2985/// Viewset for WebAuthn authenticator devices (for admins)
2986pub async fn authenticators_admin_webauthn_list(
2987    configuration: &configuration::Configuration,
2988    name: Option<&str>,
2989    ordering: Option<&str>,
2990    page: Option<i32>,
2991    page_size: Option<i32>,
2992    search: Option<&str>,
2993) -> Result<models::PaginatedWebAuthnDeviceList, Error<AuthenticatorsAdminWebauthnListError>> {
2994    // add a prefix to parameters to efficiently prevent name collisions
2995    let p_query_name = name;
2996    let p_query_ordering = ordering;
2997    let p_query_page = page;
2998    let p_query_page_size = page_size;
2999    let p_query_search = search;
3000
3001    let uri_str = format!("{}/authenticators/admin/webauthn/", configuration.base_path);
3002    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3003
3004    if let Some(ref param_value) = p_query_name {
3005        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3006    }
3007    if let Some(ref param_value) = p_query_ordering {
3008        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3009    }
3010    if let Some(ref param_value) = p_query_page {
3011        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3012    }
3013    if let Some(ref param_value) = p_query_page_size {
3014        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3015    }
3016    if let Some(ref param_value) = p_query_search {
3017        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3018    }
3019    if let Some(ref user_agent) = configuration.user_agent {
3020        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3021    }
3022    if let Some(ref token) = configuration.bearer_access_token {
3023        req_builder = req_builder.bearer_auth(token.to_owned());
3024    };
3025
3026    let req = req_builder.build()?;
3027    let resp = configuration.client.execute(req).await?;
3028
3029    let status = resp.status();
3030    let content_type = resp
3031        .headers()
3032        .get("content-type")
3033        .and_then(|v| v.to_str().ok())
3034        .unwrap_or("application/octet-stream");
3035    let content_type = super::ContentType::from(content_type);
3036
3037    if !status.is_client_error() && !status.is_server_error() {
3038        let content = resp.text().await?;
3039        match content_type {
3040            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3041            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedWebAuthnDeviceList`"))),
3042            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`")))),
3043        }
3044    } else {
3045        let content = resp.text().await?;
3046        let entity: Option<AuthenticatorsAdminWebauthnListError> = serde_json::from_str(&content).ok();
3047        Err(Error::ResponseError(ResponseContent {
3048            status,
3049            content,
3050            entity,
3051        }))
3052    }
3053}
3054
3055/// Viewset for WebAuthn authenticator devices (for admins)
3056pub async fn authenticators_admin_webauthn_partial_update(
3057    configuration: &configuration::Configuration,
3058    id: i32,
3059    patched_web_authn_device_request: Option<models::PatchedWebAuthnDeviceRequest>,
3060) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnPartialUpdateError>> {
3061    // add a prefix to parameters to efficiently prevent name collisions
3062    let p_path_id = id;
3063    let p_body_patched_web_authn_device_request = patched_web_authn_device_request;
3064
3065    let uri_str = format!(
3066        "{}/authenticators/admin/webauthn/{id}/",
3067        configuration.base_path,
3068        id = p_path_id
3069    );
3070    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3071
3072    if let Some(ref user_agent) = configuration.user_agent {
3073        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3074    }
3075    if let Some(ref token) = configuration.bearer_access_token {
3076        req_builder = req_builder.bearer_auth(token.to_owned());
3077    };
3078    req_builder = req_builder.json(&p_body_patched_web_authn_device_request);
3079
3080    let req = req_builder.build()?;
3081    let resp = configuration.client.execute(req).await?;
3082
3083    let status = resp.status();
3084    let content_type = resp
3085        .headers()
3086        .get("content-type")
3087        .and_then(|v| v.to_str().ok())
3088        .unwrap_or("application/octet-stream");
3089    let content_type = super::ContentType::from(content_type);
3090
3091    if !status.is_client_error() && !status.is_server_error() {
3092        let content = resp.text().await?;
3093        match content_type {
3094            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3095            ContentType::Text => {
3096                return Err(Error::from(serde_json::Error::custom(
3097                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
3098                )))
3099            }
3100            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3101                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
3102            )))),
3103        }
3104    } else {
3105        let content = resp.text().await?;
3106        let entity: Option<AuthenticatorsAdminWebauthnPartialUpdateError> = serde_json::from_str(&content).ok();
3107        Err(Error::ResponseError(ResponseContent {
3108            status,
3109            content,
3110            entity,
3111        }))
3112    }
3113}
3114
3115/// Viewset for WebAuthn authenticator devices (for admins)
3116pub async fn authenticators_admin_webauthn_retrieve(
3117    configuration: &configuration::Configuration,
3118    id: i32,
3119) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnRetrieveError>> {
3120    // add a prefix to parameters to efficiently prevent name collisions
3121    let p_path_id = id;
3122
3123    let uri_str = format!(
3124        "{}/authenticators/admin/webauthn/{id}/",
3125        configuration.base_path,
3126        id = p_path_id
3127    );
3128    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3129
3130    if let Some(ref user_agent) = configuration.user_agent {
3131        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3132    }
3133    if let Some(ref token) = configuration.bearer_access_token {
3134        req_builder = req_builder.bearer_auth(token.to_owned());
3135    };
3136
3137    let req = req_builder.build()?;
3138    let resp = configuration.client.execute(req).await?;
3139
3140    let status = resp.status();
3141    let content_type = resp
3142        .headers()
3143        .get("content-type")
3144        .and_then(|v| v.to_str().ok())
3145        .unwrap_or("application/octet-stream");
3146    let content_type = super::ContentType::from(content_type);
3147
3148    if !status.is_client_error() && !status.is_server_error() {
3149        let content = resp.text().await?;
3150        match content_type {
3151            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3152            ContentType::Text => {
3153                return Err(Error::from(serde_json::Error::custom(
3154                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
3155                )))
3156            }
3157            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3158                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
3159            )))),
3160        }
3161    } else {
3162        let content = resp.text().await?;
3163        let entity: Option<AuthenticatorsAdminWebauthnRetrieveError> = serde_json::from_str(&content).ok();
3164        Err(Error::ResponseError(ResponseContent {
3165            status,
3166            content,
3167            entity,
3168        }))
3169    }
3170}
3171
3172/// Viewset for WebAuthn authenticator devices (for admins)
3173pub async fn authenticators_admin_webauthn_update(
3174    configuration: &configuration::Configuration,
3175    id: i32,
3176    web_authn_device_request: models::WebAuthnDeviceRequest,
3177) -> Result<models::WebAuthnDevice, Error<AuthenticatorsAdminWebauthnUpdateError>> {
3178    // add a prefix to parameters to efficiently prevent name collisions
3179    let p_path_id = id;
3180    let p_body_web_authn_device_request = web_authn_device_request;
3181
3182    let uri_str = format!(
3183        "{}/authenticators/admin/webauthn/{id}/",
3184        configuration.base_path,
3185        id = p_path_id
3186    );
3187    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3188
3189    if let Some(ref user_agent) = configuration.user_agent {
3190        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3191    }
3192    if let Some(ref token) = configuration.bearer_access_token {
3193        req_builder = req_builder.bearer_auth(token.to_owned());
3194    };
3195    req_builder = req_builder.json(&p_body_web_authn_device_request);
3196
3197    let req = req_builder.build()?;
3198    let resp = configuration.client.execute(req).await?;
3199
3200    let status = resp.status();
3201    let content_type = resp
3202        .headers()
3203        .get("content-type")
3204        .and_then(|v| v.to_str().ok())
3205        .unwrap_or("application/octet-stream");
3206    let content_type = super::ContentType::from(content_type);
3207
3208    if !status.is_client_error() && !status.is_server_error() {
3209        let content = resp.text().await?;
3210        match content_type {
3211            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3212            ContentType::Text => {
3213                return Err(Error::from(serde_json::Error::custom(
3214                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
3215                )))
3216            }
3217            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3218                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
3219            )))),
3220        }
3221    } else {
3222        let content = resp.text().await?;
3223        let entity: Option<AuthenticatorsAdminWebauthnUpdateError> = serde_json::from_str(&content).ok();
3224        Err(Error::ResponseError(ResponseContent {
3225            status,
3226            content,
3227            entity,
3228        }))
3229    }
3230}
3231
3232/// Get all devices for current user
3233pub async fn authenticators_all_list(
3234    configuration: &configuration::Configuration,
3235) -> Result<Vec<models::Device>, Error<AuthenticatorsAllListError>> {
3236    let uri_str = format!("{}/authenticators/all/", configuration.base_path);
3237    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3238
3239    if let Some(ref user_agent) = configuration.user_agent {
3240        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3241    }
3242    if let Some(ref token) = configuration.bearer_access_token {
3243        req_builder = req_builder.bearer_auth(token.to_owned());
3244    };
3245
3246    let req = req_builder.build()?;
3247    let resp = configuration.client.execute(req).await?;
3248
3249    let status = resp.status();
3250    let content_type = resp
3251        .headers()
3252        .get("content-type")
3253        .and_then(|v| v.to_str().ok())
3254        .unwrap_or("application/octet-stream");
3255    let content_type = super::ContentType::from(content_type);
3256
3257    if !status.is_client_error() && !status.is_server_error() {
3258        let content = resp.text().await?;
3259        match content_type {
3260            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3261            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;`"))),
3262            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;`")))),
3263        }
3264    } else {
3265        let content = resp.text().await?;
3266        let entity: Option<AuthenticatorsAllListError> = serde_json::from_str(&content).ok();
3267        Err(Error::ResponseError(ResponseContent {
3268            status,
3269            content,
3270            entity,
3271        }))
3272    }
3273}
3274
3275/// Viewset for Duo authenticator devices
3276pub async fn authenticators_duo_destroy(
3277    configuration: &configuration::Configuration,
3278    id: i32,
3279) -> Result<(), Error<AuthenticatorsDuoDestroyError>> {
3280    // add a prefix to parameters to efficiently prevent name collisions
3281    let p_path_id = id;
3282
3283    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3284    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3285
3286    if let Some(ref user_agent) = configuration.user_agent {
3287        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3288    }
3289    if let Some(ref token) = configuration.bearer_access_token {
3290        req_builder = req_builder.bearer_auth(token.to_owned());
3291    };
3292
3293    let req = req_builder.build()?;
3294    let resp = configuration.client.execute(req).await?;
3295
3296    let status = resp.status();
3297
3298    if !status.is_client_error() && !status.is_server_error() {
3299        Ok(())
3300    } else {
3301        let content = resp.text().await?;
3302        let entity: Option<AuthenticatorsDuoDestroyError> = serde_json::from_str(&content).ok();
3303        Err(Error::ResponseError(ResponseContent {
3304            status,
3305            content,
3306            entity,
3307        }))
3308    }
3309}
3310
3311/// Viewset for Duo authenticator devices
3312pub async fn authenticators_duo_list(
3313    configuration: &configuration::Configuration,
3314    name: Option<&str>,
3315    ordering: Option<&str>,
3316    page: Option<i32>,
3317    page_size: Option<i32>,
3318    search: Option<&str>,
3319) -> Result<models::PaginatedDuoDeviceList, Error<AuthenticatorsDuoListError>> {
3320    // add a prefix to parameters to efficiently prevent name collisions
3321    let p_query_name = name;
3322    let p_query_ordering = ordering;
3323    let p_query_page = page;
3324    let p_query_page_size = page_size;
3325    let p_query_search = search;
3326
3327    let uri_str = format!("{}/authenticators/duo/", configuration.base_path);
3328    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3329
3330    if let Some(ref param_value) = p_query_name {
3331        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3332    }
3333    if let Some(ref param_value) = p_query_ordering {
3334        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3335    }
3336    if let Some(ref param_value) = p_query_page {
3337        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3338    }
3339    if let Some(ref param_value) = p_query_page_size {
3340        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3341    }
3342    if let Some(ref param_value) = p_query_search {
3343        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3344    }
3345    if let Some(ref user_agent) = configuration.user_agent {
3346        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3347    }
3348    if let Some(ref token) = configuration.bearer_access_token {
3349        req_builder = req_builder.bearer_auth(token.to_owned());
3350    };
3351
3352    let req = req_builder.build()?;
3353    let resp = configuration.client.execute(req).await?;
3354
3355    let status = resp.status();
3356    let content_type = resp
3357        .headers()
3358        .get("content-type")
3359        .and_then(|v| v.to_str().ok())
3360        .unwrap_or("application/octet-stream");
3361    let content_type = super::ContentType::from(content_type);
3362
3363    if !status.is_client_error() && !status.is_server_error() {
3364        let content = resp.text().await?;
3365        match content_type {
3366            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3367            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDuoDeviceList`"))),
3368            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedDuoDeviceList`")))),
3369        }
3370    } else {
3371        let content = resp.text().await?;
3372        let entity: Option<AuthenticatorsDuoListError> = serde_json::from_str(&content).ok();
3373        Err(Error::ResponseError(ResponseContent {
3374            status,
3375            content,
3376            entity,
3377        }))
3378    }
3379}
3380
3381/// Viewset for Duo authenticator devices
3382pub async fn authenticators_duo_partial_update(
3383    configuration: &configuration::Configuration,
3384    id: i32,
3385    patched_duo_device_request: Option<models::PatchedDuoDeviceRequest>,
3386) -> Result<models::DuoDevice, Error<AuthenticatorsDuoPartialUpdateError>> {
3387    // add a prefix to parameters to efficiently prevent name collisions
3388    let p_path_id = id;
3389    let p_body_patched_duo_device_request = patched_duo_device_request;
3390
3391    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3392    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3393
3394    if let Some(ref user_agent) = configuration.user_agent {
3395        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3396    }
3397    if let Some(ref token) = configuration.bearer_access_token {
3398        req_builder = req_builder.bearer_auth(token.to_owned());
3399    };
3400    req_builder = req_builder.json(&p_body_patched_duo_device_request);
3401
3402    let req = req_builder.build()?;
3403    let resp = configuration.client.execute(req).await?;
3404
3405    let status = resp.status();
3406    let content_type = resp
3407        .headers()
3408        .get("content-type")
3409        .and_then(|v| v.to_str().ok())
3410        .unwrap_or("application/octet-stream");
3411    let content_type = super::ContentType::from(content_type);
3412
3413    if !status.is_client_error() && !status.is_server_error() {
3414        let content = resp.text().await?;
3415        match content_type {
3416            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3417            ContentType::Text => {
3418                return Err(Error::from(serde_json::Error::custom(
3419                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
3420                )))
3421            }
3422            ContentType::Unsupported(unknown_type) => {
3423                return Err(Error::from(serde_json::Error::custom(format!(
3424                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
3425                ))))
3426            }
3427        }
3428    } else {
3429        let content = resp.text().await?;
3430        let entity: Option<AuthenticatorsDuoPartialUpdateError> = serde_json::from_str(&content).ok();
3431        Err(Error::ResponseError(ResponseContent {
3432            status,
3433            content,
3434            entity,
3435        }))
3436    }
3437}
3438
3439/// Viewset for Duo authenticator devices
3440pub async fn authenticators_duo_retrieve(
3441    configuration: &configuration::Configuration,
3442    id: i32,
3443) -> Result<models::DuoDevice, Error<AuthenticatorsDuoRetrieveError>> {
3444    // add a prefix to parameters to efficiently prevent name collisions
3445    let p_path_id = id;
3446
3447    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3448    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3449
3450    if let Some(ref user_agent) = configuration.user_agent {
3451        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3452    }
3453    if let Some(ref token) = configuration.bearer_access_token {
3454        req_builder = req_builder.bearer_auth(token.to_owned());
3455    };
3456
3457    let req = req_builder.build()?;
3458    let resp = configuration.client.execute(req).await?;
3459
3460    let status = resp.status();
3461    let content_type = resp
3462        .headers()
3463        .get("content-type")
3464        .and_then(|v| v.to_str().ok())
3465        .unwrap_or("application/octet-stream");
3466    let content_type = super::ContentType::from(content_type);
3467
3468    if !status.is_client_error() && !status.is_server_error() {
3469        let content = resp.text().await?;
3470        match content_type {
3471            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3472            ContentType::Text => {
3473                return Err(Error::from(serde_json::Error::custom(
3474                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
3475                )))
3476            }
3477            ContentType::Unsupported(unknown_type) => {
3478                return Err(Error::from(serde_json::Error::custom(format!(
3479                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
3480                ))))
3481            }
3482        }
3483    } else {
3484        let content = resp.text().await?;
3485        let entity: Option<AuthenticatorsDuoRetrieveError> = serde_json::from_str(&content).ok();
3486        Err(Error::ResponseError(ResponseContent {
3487            status,
3488            content,
3489            entity,
3490        }))
3491    }
3492}
3493
3494/// Viewset for Duo authenticator devices
3495pub async fn authenticators_duo_update(
3496    configuration: &configuration::Configuration,
3497    id: i32,
3498    duo_device_request: models::DuoDeviceRequest,
3499) -> Result<models::DuoDevice, Error<AuthenticatorsDuoUpdateError>> {
3500    // add a prefix to parameters to efficiently prevent name collisions
3501    let p_path_id = id;
3502    let p_body_duo_device_request = duo_device_request;
3503
3504    let uri_str = format!("{}/authenticators/duo/{id}/", configuration.base_path, id = p_path_id);
3505    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3506
3507    if let Some(ref user_agent) = configuration.user_agent {
3508        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3509    }
3510    if let Some(ref token) = configuration.bearer_access_token {
3511        req_builder = req_builder.bearer_auth(token.to_owned());
3512    };
3513    req_builder = req_builder.json(&p_body_duo_device_request);
3514
3515    let req = req_builder.build()?;
3516    let resp = configuration.client.execute(req).await?;
3517
3518    let status = resp.status();
3519    let content_type = resp
3520        .headers()
3521        .get("content-type")
3522        .and_then(|v| v.to_str().ok())
3523        .unwrap_or("application/octet-stream");
3524    let content_type = super::ContentType::from(content_type);
3525
3526    if !status.is_client_error() && !status.is_server_error() {
3527        let content = resp.text().await?;
3528        match content_type {
3529            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3530            ContentType::Text => {
3531                return Err(Error::from(serde_json::Error::custom(
3532                    "Received `text/plain` content type response that cannot be converted to `models::DuoDevice`",
3533                )))
3534            }
3535            ContentType::Unsupported(unknown_type) => {
3536                return Err(Error::from(serde_json::Error::custom(format!(
3537                    "Received `{unknown_type}` content type response that cannot be converted to `models::DuoDevice`"
3538                ))))
3539            }
3540        }
3541    } else {
3542        let content = resp.text().await?;
3543        let entity: Option<AuthenticatorsDuoUpdateError> = serde_json::from_str(&content).ok();
3544        Err(Error::ResponseError(ResponseContent {
3545            status,
3546            content,
3547            entity,
3548        }))
3549    }
3550}
3551
3552/// Get a list of all objects that use this object
3553pub async fn authenticators_duo_used_by_list(
3554    configuration: &configuration::Configuration,
3555    id: i32,
3556) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsDuoUsedByListError>> {
3557    // add a prefix to parameters to efficiently prevent name collisions
3558    let p_path_id = id;
3559
3560    let uri_str = format!(
3561        "{}/authenticators/duo/{id}/used_by/",
3562        configuration.base_path,
3563        id = p_path_id
3564    );
3565    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3566
3567    if let Some(ref user_agent) = configuration.user_agent {
3568        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3569    }
3570    if let Some(ref token) = configuration.bearer_access_token {
3571        req_builder = req_builder.bearer_auth(token.to_owned());
3572    };
3573
3574    let req = req_builder.build()?;
3575    let resp = configuration.client.execute(req).await?;
3576
3577    let status = resp.status();
3578    let content_type = resp
3579        .headers()
3580        .get("content-type")
3581        .and_then(|v| v.to_str().ok())
3582        .unwrap_or("application/octet-stream");
3583    let content_type = super::ContentType::from(content_type);
3584
3585    if !status.is_client_error() && !status.is_server_error() {
3586        let content = resp.text().await?;
3587        match content_type {
3588            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3589            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;`"))),
3590            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;`")))),
3591        }
3592    } else {
3593        let content = resp.text().await?;
3594        let entity: Option<AuthenticatorsDuoUsedByListError> = serde_json::from_str(&content).ok();
3595        Err(Error::ResponseError(ResponseContent {
3596            status,
3597            content,
3598            entity,
3599        }))
3600    }
3601}
3602
3603/// Viewset for email authenticator devices
3604pub async fn authenticators_email_destroy(
3605    configuration: &configuration::Configuration,
3606    id: i32,
3607) -> Result<(), Error<AuthenticatorsEmailDestroyError>> {
3608    // add a prefix to parameters to efficiently prevent name collisions
3609    let p_path_id = id;
3610
3611    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3612    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3613
3614    if let Some(ref user_agent) = configuration.user_agent {
3615        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3616    }
3617    if let Some(ref token) = configuration.bearer_access_token {
3618        req_builder = req_builder.bearer_auth(token.to_owned());
3619    };
3620
3621    let req = req_builder.build()?;
3622    let resp = configuration.client.execute(req).await?;
3623
3624    let status = resp.status();
3625
3626    if !status.is_client_error() && !status.is_server_error() {
3627        Ok(())
3628    } else {
3629        let content = resp.text().await?;
3630        let entity: Option<AuthenticatorsEmailDestroyError> = serde_json::from_str(&content).ok();
3631        Err(Error::ResponseError(ResponseContent {
3632            status,
3633            content,
3634            entity,
3635        }))
3636    }
3637}
3638
3639/// Viewset for email authenticator devices
3640pub async fn authenticators_email_list(
3641    configuration: &configuration::Configuration,
3642    name: Option<&str>,
3643    ordering: Option<&str>,
3644    page: Option<i32>,
3645    page_size: Option<i32>,
3646    search: Option<&str>,
3647) -> Result<models::PaginatedEmailDeviceList, Error<AuthenticatorsEmailListError>> {
3648    // add a prefix to parameters to efficiently prevent name collisions
3649    let p_query_name = name;
3650    let p_query_ordering = ordering;
3651    let p_query_page = page;
3652    let p_query_page_size = page_size;
3653    let p_query_search = search;
3654
3655    let uri_str = format!("{}/authenticators/email/", configuration.base_path);
3656    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3657
3658    if let Some(ref param_value) = p_query_name {
3659        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3660    }
3661    if let Some(ref param_value) = p_query_ordering {
3662        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3663    }
3664    if let Some(ref param_value) = p_query_page {
3665        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3666    }
3667    if let Some(ref param_value) = p_query_page_size {
3668        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3669    }
3670    if let Some(ref param_value) = p_query_search {
3671        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3672    }
3673    if let Some(ref user_agent) = configuration.user_agent {
3674        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3675    }
3676    if let Some(ref token) = configuration.bearer_access_token {
3677        req_builder = req_builder.bearer_auth(token.to_owned());
3678    };
3679
3680    let req = req_builder.build()?;
3681    let resp = configuration.client.execute(req).await?;
3682
3683    let status = resp.status();
3684    let content_type = resp
3685        .headers()
3686        .get("content-type")
3687        .and_then(|v| v.to_str().ok())
3688        .unwrap_or("application/octet-stream");
3689    let content_type = super::ContentType::from(content_type);
3690
3691    if !status.is_client_error() && !status.is_server_error() {
3692        let content = resp.text().await?;
3693        match content_type {
3694            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3695            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEmailDeviceList`"))),
3696            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`")))),
3697        }
3698    } else {
3699        let content = resp.text().await?;
3700        let entity: Option<AuthenticatorsEmailListError> = serde_json::from_str(&content).ok();
3701        Err(Error::ResponseError(ResponseContent {
3702            status,
3703            content,
3704            entity,
3705        }))
3706    }
3707}
3708
3709/// Viewset for email authenticator devices
3710pub async fn authenticators_email_partial_update(
3711    configuration: &configuration::Configuration,
3712    id: i32,
3713    patched_email_device_request: Option<models::PatchedEmailDeviceRequest>,
3714) -> Result<models::EmailDevice, Error<AuthenticatorsEmailPartialUpdateError>> {
3715    // add a prefix to parameters to efficiently prevent name collisions
3716    let p_path_id = id;
3717    let p_body_patched_email_device_request = patched_email_device_request;
3718
3719    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3720    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3721
3722    if let Some(ref user_agent) = configuration.user_agent {
3723        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3724    }
3725    if let Some(ref token) = configuration.bearer_access_token {
3726        req_builder = req_builder.bearer_auth(token.to_owned());
3727    };
3728    req_builder = req_builder.json(&p_body_patched_email_device_request);
3729
3730    let req = req_builder.build()?;
3731    let resp = configuration.client.execute(req).await?;
3732
3733    let status = resp.status();
3734    let content_type = resp
3735        .headers()
3736        .get("content-type")
3737        .and_then(|v| v.to_str().ok())
3738        .unwrap_or("application/octet-stream");
3739    let content_type = super::ContentType::from(content_type);
3740
3741    if !status.is_client_error() && !status.is_server_error() {
3742        let content = resp.text().await?;
3743        match content_type {
3744            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3745            ContentType::Text => {
3746                return Err(Error::from(serde_json::Error::custom(
3747                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
3748                )))
3749            }
3750            ContentType::Unsupported(unknown_type) => {
3751                return Err(Error::from(serde_json::Error::custom(format!(
3752                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
3753                ))))
3754            }
3755        }
3756    } else {
3757        let content = resp.text().await?;
3758        let entity: Option<AuthenticatorsEmailPartialUpdateError> = serde_json::from_str(&content).ok();
3759        Err(Error::ResponseError(ResponseContent {
3760            status,
3761            content,
3762            entity,
3763        }))
3764    }
3765}
3766
3767/// Viewset for email authenticator devices
3768pub async fn authenticators_email_retrieve(
3769    configuration: &configuration::Configuration,
3770    id: i32,
3771) -> Result<models::EmailDevice, Error<AuthenticatorsEmailRetrieveError>> {
3772    // add a prefix to parameters to efficiently prevent name collisions
3773    let p_path_id = id;
3774
3775    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3776    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3777
3778    if let Some(ref user_agent) = configuration.user_agent {
3779        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3780    }
3781    if let Some(ref token) = configuration.bearer_access_token {
3782        req_builder = req_builder.bearer_auth(token.to_owned());
3783    };
3784
3785    let req = req_builder.build()?;
3786    let resp = configuration.client.execute(req).await?;
3787
3788    let status = resp.status();
3789    let content_type = resp
3790        .headers()
3791        .get("content-type")
3792        .and_then(|v| v.to_str().ok())
3793        .unwrap_or("application/octet-stream");
3794    let content_type = super::ContentType::from(content_type);
3795
3796    if !status.is_client_error() && !status.is_server_error() {
3797        let content = resp.text().await?;
3798        match content_type {
3799            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3800            ContentType::Text => {
3801                return Err(Error::from(serde_json::Error::custom(
3802                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
3803                )))
3804            }
3805            ContentType::Unsupported(unknown_type) => {
3806                return Err(Error::from(serde_json::Error::custom(format!(
3807                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
3808                ))))
3809            }
3810        }
3811    } else {
3812        let content = resp.text().await?;
3813        let entity: Option<AuthenticatorsEmailRetrieveError> = serde_json::from_str(&content).ok();
3814        Err(Error::ResponseError(ResponseContent {
3815            status,
3816            content,
3817            entity,
3818        }))
3819    }
3820}
3821
3822/// Viewset for email authenticator devices
3823pub async fn authenticators_email_update(
3824    configuration: &configuration::Configuration,
3825    id: i32,
3826    email_device_request: models::EmailDeviceRequest,
3827) -> Result<models::EmailDevice, Error<AuthenticatorsEmailUpdateError>> {
3828    // add a prefix to parameters to efficiently prevent name collisions
3829    let p_path_id = id;
3830    let p_body_email_device_request = email_device_request;
3831
3832    let uri_str = format!("{}/authenticators/email/{id}/", configuration.base_path, id = p_path_id);
3833    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3834
3835    if let Some(ref user_agent) = configuration.user_agent {
3836        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3837    }
3838    if let Some(ref token) = configuration.bearer_access_token {
3839        req_builder = req_builder.bearer_auth(token.to_owned());
3840    };
3841    req_builder = req_builder.json(&p_body_email_device_request);
3842
3843    let req = req_builder.build()?;
3844    let resp = configuration.client.execute(req).await?;
3845
3846    let status = resp.status();
3847    let content_type = resp
3848        .headers()
3849        .get("content-type")
3850        .and_then(|v| v.to_str().ok())
3851        .unwrap_or("application/octet-stream");
3852    let content_type = super::ContentType::from(content_type);
3853
3854    if !status.is_client_error() && !status.is_server_error() {
3855        let content = resp.text().await?;
3856        match content_type {
3857            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3858            ContentType::Text => {
3859                return Err(Error::from(serde_json::Error::custom(
3860                    "Received `text/plain` content type response that cannot be converted to `models::EmailDevice`",
3861                )))
3862            }
3863            ContentType::Unsupported(unknown_type) => {
3864                return Err(Error::from(serde_json::Error::custom(format!(
3865                    "Received `{unknown_type}` content type response that cannot be converted to `models::EmailDevice`"
3866                ))))
3867            }
3868        }
3869    } else {
3870        let content = resp.text().await?;
3871        let entity: Option<AuthenticatorsEmailUpdateError> = serde_json::from_str(&content).ok();
3872        Err(Error::ResponseError(ResponseContent {
3873            status,
3874            content,
3875            entity,
3876        }))
3877    }
3878}
3879
3880/// Get a list of all objects that use this object
3881pub async fn authenticators_email_used_by_list(
3882    configuration: &configuration::Configuration,
3883    id: i32,
3884) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsEmailUsedByListError>> {
3885    // add a prefix to parameters to efficiently prevent name collisions
3886    let p_path_id = id;
3887
3888    let uri_str = format!(
3889        "{}/authenticators/email/{id}/used_by/",
3890        configuration.base_path,
3891        id = p_path_id
3892    );
3893    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3894
3895    if let Some(ref user_agent) = configuration.user_agent {
3896        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3897    }
3898    if let Some(ref token) = configuration.bearer_access_token {
3899        req_builder = req_builder.bearer_auth(token.to_owned());
3900    };
3901
3902    let req = req_builder.build()?;
3903    let resp = configuration.client.execute(req).await?;
3904
3905    let status = resp.status();
3906    let content_type = resp
3907        .headers()
3908        .get("content-type")
3909        .and_then(|v| v.to_str().ok())
3910        .unwrap_or("application/octet-stream");
3911    let content_type = super::ContentType::from(content_type);
3912
3913    if !status.is_client_error() && !status.is_server_error() {
3914        let content = resp.text().await?;
3915        match content_type {
3916            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3917            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;`"))),
3918            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;`")))),
3919        }
3920    } else {
3921        let content = resp.text().await?;
3922        let entity: Option<AuthenticatorsEmailUsedByListError> = serde_json::from_str(&content).ok();
3923        Err(Error::ResponseError(ResponseContent {
3924            status,
3925            content,
3926            entity,
3927        }))
3928    }
3929}
3930
3931/// Viewset for Endpoint authenticator devices
3932pub async fn authenticators_endpoint_list(
3933    configuration: &configuration::Configuration,
3934    name: Option<&str>,
3935    ordering: Option<&str>,
3936    page: Option<i32>,
3937    page_size: Option<i32>,
3938    search: Option<&str>,
3939) -> Result<models::PaginatedEndpointDeviceList, Error<AuthenticatorsEndpointListError>> {
3940    // add a prefix to parameters to efficiently prevent name collisions
3941    let p_query_name = name;
3942    let p_query_ordering = ordering;
3943    let p_query_page = page;
3944    let p_query_page_size = page_size;
3945    let p_query_search = search;
3946
3947    let uri_str = format!("{}/authenticators/endpoint/", configuration.base_path);
3948    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3949
3950    if let Some(ref param_value) = p_query_name {
3951        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
3952    }
3953    if let Some(ref param_value) = p_query_ordering {
3954        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
3955    }
3956    if let Some(ref param_value) = p_query_page {
3957        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3958    }
3959    if let Some(ref param_value) = p_query_page_size {
3960        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
3961    }
3962    if let Some(ref param_value) = p_query_search {
3963        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
3964    }
3965    if let Some(ref user_agent) = configuration.user_agent {
3966        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3967    }
3968    if let Some(ref token) = configuration.bearer_access_token {
3969        req_builder = req_builder.bearer_auth(token.to_owned());
3970    };
3971
3972    let req = req_builder.build()?;
3973    let resp = configuration.client.execute(req).await?;
3974
3975    let status = resp.status();
3976    let content_type = resp
3977        .headers()
3978        .get("content-type")
3979        .and_then(|v| v.to_str().ok())
3980        .unwrap_or("application/octet-stream");
3981    let content_type = super::ContentType::from(content_type);
3982
3983    if !status.is_client_error() && !status.is_server_error() {
3984        let content = resp.text().await?;
3985        match content_type {
3986            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3987            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEndpointDeviceList`"))),
3988            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::PaginatedEndpointDeviceList`")))),
3989        }
3990    } else {
3991        let content = resp.text().await?;
3992        let entity: Option<AuthenticatorsEndpointListError> = serde_json::from_str(&content).ok();
3993        Err(Error::ResponseError(ResponseContent {
3994            status,
3995            content,
3996            entity,
3997        }))
3998    }
3999}
4000
4001/// Viewset for Endpoint authenticator devices
4002pub async fn authenticators_endpoint_retrieve(
4003    configuration: &configuration::Configuration,
4004    uuid: &str,
4005) -> Result<models::EndpointDevice, Error<AuthenticatorsEndpointRetrieveError>> {
4006    // add a prefix to parameters to efficiently prevent name collisions
4007    let p_path_uuid = uuid;
4008
4009    let uri_str = format!(
4010        "{}/authenticators/endpoint/{uuid}/",
4011        configuration.base_path,
4012        uuid = crate::apis::urlencode(p_path_uuid)
4013    );
4014    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4015
4016    if let Some(ref user_agent) = configuration.user_agent {
4017        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4018    }
4019    if let Some(ref token) = configuration.bearer_access_token {
4020        req_builder = req_builder.bearer_auth(token.to_owned());
4021    };
4022
4023    let req = req_builder.build()?;
4024    let resp = configuration.client.execute(req).await?;
4025
4026    let status = resp.status();
4027    let content_type = resp
4028        .headers()
4029        .get("content-type")
4030        .and_then(|v| v.to_str().ok())
4031        .unwrap_or("application/octet-stream");
4032    let content_type = super::ContentType::from(content_type);
4033
4034    if !status.is_client_error() && !status.is_server_error() {
4035        let content = resp.text().await?;
4036        match content_type {
4037            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4038            ContentType::Text => {
4039                return Err(Error::from(serde_json::Error::custom(
4040                    "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
4041                )))
4042            }
4043            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4044                "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
4045            )))),
4046        }
4047    } else {
4048        let content = resp.text().await?;
4049        let entity: Option<AuthenticatorsEndpointRetrieveError> = serde_json::from_str(&content).ok();
4050        Err(Error::ResponseError(ResponseContent {
4051            status,
4052            content,
4053            entity,
4054        }))
4055    }
4056}
4057
4058/// Get a list of all objects that use this object
4059pub async fn authenticators_endpoint_used_by_list(
4060    configuration: &configuration::Configuration,
4061    uuid: &str,
4062) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsEndpointUsedByListError>> {
4063    // add a prefix to parameters to efficiently prevent name collisions
4064    let p_path_uuid = uuid;
4065
4066    let uri_str = format!(
4067        "{}/authenticators/endpoint/{uuid}/used_by/",
4068        configuration.base_path,
4069        uuid = crate::apis::urlencode(p_path_uuid)
4070    );
4071    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4072
4073    if let Some(ref user_agent) = configuration.user_agent {
4074        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4075    }
4076    if let Some(ref token) = configuration.bearer_access_token {
4077        req_builder = req_builder.bearer_auth(token.to_owned());
4078    };
4079
4080    let req = req_builder.build()?;
4081    let resp = configuration.client.execute(req).await?;
4082
4083    let status = resp.status();
4084    let content_type = resp
4085        .headers()
4086        .get("content-type")
4087        .and_then(|v| v.to_str().ok())
4088        .unwrap_or("application/octet-stream");
4089    let content_type = super::ContentType::from(content_type);
4090
4091    if !status.is_client_error() && !status.is_server_error() {
4092        let content = resp.text().await?;
4093        match content_type {
4094            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4095            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;`"))),
4096            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;`")))),
4097        }
4098    } else {
4099        let content = resp.text().await?;
4100        let entity: Option<AuthenticatorsEndpointUsedByListError> = serde_json::from_str(&content).ok();
4101        Err(Error::ResponseError(ResponseContent {
4102            status,
4103            content,
4104            entity,
4105        }))
4106    }
4107}
4108
4109/// Viewset for sms authenticator devices
4110pub async fn authenticators_sms_destroy(
4111    configuration: &configuration::Configuration,
4112    id: i32,
4113) -> Result<(), Error<AuthenticatorsSmsDestroyError>> {
4114    // add a prefix to parameters to efficiently prevent name collisions
4115    let p_path_id = id;
4116
4117    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4118    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4119
4120    if let Some(ref user_agent) = configuration.user_agent {
4121        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4122    }
4123    if let Some(ref token) = configuration.bearer_access_token {
4124        req_builder = req_builder.bearer_auth(token.to_owned());
4125    };
4126
4127    let req = req_builder.build()?;
4128    let resp = configuration.client.execute(req).await?;
4129
4130    let status = resp.status();
4131
4132    if !status.is_client_error() && !status.is_server_error() {
4133        Ok(())
4134    } else {
4135        let content = resp.text().await?;
4136        let entity: Option<AuthenticatorsSmsDestroyError> = serde_json::from_str(&content).ok();
4137        Err(Error::ResponseError(ResponseContent {
4138            status,
4139            content,
4140            entity,
4141        }))
4142    }
4143}
4144
4145/// Viewset for sms authenticator devices
4146pub async fn authenticators_sms_list(
4147    configuration: &configuration::Configuration,
4148    name: Option<&str>,
4149    ordering: Option<&str>,
4150    page: Option<i32>,
4151    page_size: Option<i32>,
4152    search: Option<&str>,
4153) -> Result<models::PaginatedSmsDeviceList, Error<AuthenticatorsSmsListError>> {
4154    // add a prefix to parameters to efficiently prevent name collisions
4155    let p_query_name = name;
4156    let p_query_ordering = ordering;
4157    let p_query_page = page;
4158    let p_query_page_size = page_size;
4159    let p_query_search = search;
4160
4161    let uri_str = format!("{}/authenticators/sms/", configuration.base_path);
4162    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4163
4164    if let Some(ref param_value) = p_query_name {
4165        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
4166    }
4167    if let Some(ref param_value) = p_query_ordering {
4168        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
4169    }
4170    if let Some(ref param_value) = p_query_page {
4171        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
4172    }
4173    if let Some(ref param_value) = p_query_page_size {
4174        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
4175    }
4176    if let Some(ref param_value) = p_query_search {
4177        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
4178    }
4179    if let Some(ref user_agent) = configuration.user_agent {
4180        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4181    }
4182    if let Some(ref token) = configuration.bearer_access_token {
4183        req_builder = req_builder.bearer_auth(token.to_owned());
4184    };
4185
4186    let req = req_builder.build()?;
4187    let resp = configuration.client.execute(req).await?;
4188
4189    let status = resp.status();
4190    let content_type = resp
4191        .headers()
4192        .get("content-type")
4193        .and_then(|v| v.to_str().ok())
4194        .unwrap_or("application/octet-stream");
4195    let content_type = super::ContentType::from(content_type);
4196
4197    if !status.is_client_error() && !status.is_server_error() {
4198        let content = resp.text().await?;
4199        match content_type {
4200            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4201            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedSmsDeviceList`"))),
4202            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`")))),
4203        }
4204    } else {
4205        let content = resp.text().await?;
4206        let entity: Option<AuthenticatorsSmsListError> = serde_json::from_str(&content).ok();
4207        Err(Error::ResponseError(ResponseContent {
4208            status,
4209            content,
4210            entity,
4211        }))
4212    }
4213}
4214
4215/// Viewset for sms authenticator devices
4216pub async fn authenticators_sms_partial_update(
4217    configuration: &configuration::Configuration,
4218    id: i32,
4219    patched_sms_device_request: Option<models::PatchedSmsDeviceRequest>,
4220) -> Result<models::SmsDevice, Error<AuthenticatorsSmsPartialUpdateError>> {
4221    // add a prefix to parameters to efficiently prevent name collisions
4222    let p_path_id = id;
4223    let p_body_patched_sms_device_request = patched_sms_device_request;
4224
4225    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4226    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4227
4228    if let Some(ref user_agent) = configuration.user_agent {
4229        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4230    }
4231    if let Some(ref token) = configuration.bearer_access_token {
4232        req_builder = req_builder.bearer_auth(token.to_owned());
4233    };
4234    req_builder = req_builder.json(&p_body_patched_sms_device_request);
4235
4236    let req = req_builder.build()?;
4237    let resp = configuration.client.execute(req).await?;
4238
4239    let status = resp.status();
4240    let content_type = resp
4241        .headers()
4242        .get("content-type")
4243        .and_then(|v| v.to_str().ok())
4244        .unwrap_or("application/octet-stream");
4245    let content_type = super::ContentType::from(content_type);
4246
4247    if !status.is_client_error() && !status.is_server_error() {
4248        let content = resp.text().await?;
4249        match content_type {
4250            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4251            ContentType::Text => {
4252                return Err(Error::from(serde_json::Error::custom(
4253                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
4254                )))
4255            }
4256            ContentType::Unsupported(unknown_type) => {
4257                return Err(Error::from(serde_json::Error::custom(format!(
4258                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
4259                ))))
4260            }
4261        }
4262    } else {
4263        let content = resp.text().await?;
4264        let entity: Option<AuthenticatorsSmsPartialUpdateError> = serde_json::from_str(&content).ok();
4265        Err(Error::ResponseError(ResponseContent {
4266            status,
4267            content,
4268            entity,
4269        }))
4270    }
4271}
4272
4273/// Viewset for sms authenticator devices
4274pub async fn authenticators_sms_retrieve(
4275    configuration: &configuration::Configuration,
4276    id: i32,
4277) -> Result<models::SmsDevice, Error<AuthenticatorsSmsRetrieveError>> {
4278    // add a prefix to parameters to efficiently prevent name collisions
4279    let p_path_id = id;
4280
4281    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4282    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4283
4284    if let Some(ref user_agent) = configuration.user_agent {
4285        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4286    }
4287    if let Some(ref token) = configuration.bearer_access_token {
4288        req_builder = req_builder.bearer_auth(token.to_owned());
4289    };
4290
4291    let req = req_builder.build()?;
4292    let resp = configuration.client.execute(req).await?;
4293
4294    let status = resp.status();
4295    let content_type = resp
4296        .headers()
4297        .get("content-type")
4298        .and_then(|v| v.to_str().ok())
4299        .unwrap_or("application/octet-stream");
4300    let content_type = super::ContentType::from(content_type);
4301
4302    if !status.is_client_error() && !status.is_server_error() {
4303        let content = resp.text().await?;
4304        match content_type {
4305            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4306            ContentType::Text => {
4307                return Err(Error::from(serde_json::Error::custom(
4308                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
4309                )))
4310            }
4311            ContentType::Unsupported(unknown_type) => {
4312                return Err(Error::from(serde_json::Error::custom(format!(
4313                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
4314                ))))
4315            }
4316        }
4317    } else {
4318        let content = resp.text().await?;
4319        let entity: Option<AuthenticatorsSmsRetrieveError> = serde_json::from_str(&content).ok();
4320        Err(Error::ResponseError(ResponseContent {
4321            status,
4322            content,
4323            entity,
4324        }))
4325    }
4326}
4327
4328/// Viewset for sms authenticator devices
4329pub async fn authenticators_sms_update(
4330    configuration: &configuration::Configuration,
4331    id: i32,
4332    sms_device_request: models::SmsDeviceRequest,
4333) -> Result<models::SmsDevice, Error<AuthenticatorsSmsUpdateError>> {
4334    // add a prefix to parameters to efficiently prevent name collisions
4335    let p_path_id = id;
4336    let p_body_sms_device_request = sms_device_request;
4337
4338    let uri_str = format!("{}/authenticators/sms/{id}/", configuration.base_path, id = p_path_id);
4339    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4340
4341    if let Some(ref user_agent) = configuration.user_agent {
4342        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4343    }
4344    if let Some(ref token) = configuration.bearer_access_token {
4345        req_builder = req_builder.bearer_auth(token.to_owned());
4346    };
4347    req_builder = req_builder.json(&p_body_sms_device_request);
4348
4349    let req = req_builder.build()?;
4350    let resp = configuration.client.execute(req).await?;
4351
4352    let status = resp.status();
4353    let content_type = resp
4354        .headers()
4355        .get("content-type")
4356        .and_then(|v| v.to_str().ok())
4357        .unwrap_or("application/octet-stream");
4358    let content_type = super::ContentType::from(content_type);
4359
4360    if !status.is_client_error() && !status.is_server_error() {
4361        let content = resp.text().await?;
4362        match content_type {
4363            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4364            ContentType::Text => {
4365                return Err(Error::from(serde_json::Error::custom(
4366                    "Received `text/plain` content type response that cannot be converted to `models::SmsDevice`",
4367                )))
4368            }
4369            ContentType::Unsupported(unknown_type) => {
4370                return Err(Error::from(serde_json::Error::custom(format!(
4371                    "Received `{unknown_type}` content type response that cannot be converted to `models::SmsDevice`"
4372                ))))
4373            }
4374        }
4375    } else {
4376        let content = resp.text().await?;
4377        let entity: Option<AuthenticatorsSmsUpdateError> = serde_json::from_str(&content).ok();
4378        Err(Error::ResponseError(ResponseContent {
4379            status,
4380            content,
4381            entity,
4382        }))
4383    }
4384}
4385
4386/// Get a list of all objects that use this object
4387pub async fn authenticators_sms_used_by_list(
4388    configuration: &configuration::Configuration,
4389    id: i32,
4390) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsSmsUsedByListError>> {
4391    // add a prefix to parameters to efficiently prevent name collisions
4392    let p_path_id = id;
4393
4394    let uri_str = format!(
4395        "{}/authenticators/sms/{id}/used_by/",
4396        configuration.base_path,
4397        id = p_path_id
4398    );
4399    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4400
4401    if let Some(ref user_agent) = configuration.user_agent {
4402        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4403    }
4404    if let Some(ref token) = configuration.bearer_access_token {
4405        req_builder = req_builder.bearer_auth(token.to_owned());
4406    };
4407
4408    let req = req_builder.build()?;
4409    let resp = configuration.client.execute(req).await?;
4410
4411    let status = resp.status();
4412    let content_type = resp
4413        .headers()
4414        .get("content-type")
4415        .and_then(|v| v.to_str().ok())
4416        .unwrap_or("application/octet-stream");
4417    let content_type = super::ContentType::from(content_type);
4418
4419    if !status.is_client_error() && !status.is_server_error() {
4420        let content = resp.text().await?;
4421        match content_type {
4422            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4423            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;`"))),
4424            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;`")))),
4425        }
4426    } else {
4427        let content = resp.text().await?;
4428        let entity: Option<AuthenticatorsSmsUsedByListError> = serde_json::from_str(&content).ok();
4429        Err(Error::ResponseError(ResponseContent {
4430            status,
4431            content,
4432            entity,
4433        }))
4434    }
4435}
4436
4437/// Viewset for static authenticator devices
4438pub async fn authenticators_static_destroy(
4439    configuration: &configuration::Configuration,
4440    id: i32,
4441) -> Result<(), Error<AuthenticatorsStaticDestroyError>> {
4442    // add a prefix to parameters to efficiently prevent name collisions
4443    let p_path_id = id;
4444
4445    let uri_str = format!(
4446        "{}/authenticators/static/{id}/",
4447        configuration.base_path,
4448        id = p_path_id
4449    );
4450    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4451
4452    if let Some(ref user_agent) = configuration.user_agent {
4453        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4454    }
4455    if let Some(ref token) = configuration.bearer_access_token {
4456        req_builder = req_builder.bearer_auth(token.to_owned());
4457    };
4458
4459    let req = req_builder.build()?;
4460    let resp = configuration.client.execute(req).await?;
4461
4462    let status = resp.status();
4463
4464    if !status.is_client_error() && !status.is_server_error() {
4465        Ok(())
4466    } else {
4467        let content = resp.text().await?;
4468        let entity: Option<AuthenticatorsStaticDestroyError> = serde_json::from_str(&content).ok();
4469        Err(Error::ResponseError(ResponseContent {
4470            status,
4471            content,
4472            entity,
4473        }))
4474    }
4475}
4476
4477/// Viewset for static authenticator devices
4478pub async fn authenticators_static_list(
4479    configuration: &configuration::Configuration,
4480    name: Option<&str>,
4481    ordering: Option<&str>,
4482    page: Option<i32>,
4483    page_size: Option<i32>,
4484    search: Option<&str>,
4485) -> Result<models::PaginatedStaticDeviceList, Error<AuthenticatorsStaticListError>> {
4486    // add a prefix to parameters to efficiently prevent name collisions
4487    let p_query_name = name;
4488    let p_query_ordering = ordering;
4489    let p_query_page = page;
4490    let p_query_page_size = page_size;
4491    let p_query_search = search;
4492
4493    let uri_str = format!("{}/authenticators/static/", configuration.base_path);
4494    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4495
4496    if let Some(ref param_value) = p_query_name {
4497        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
4498    }
4499    if let Some(ref param_value) = p_query_ordering {
4500        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
4501    }
4502    if let Some(ref param_value) = p_query_page {
4503        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
4504    }
4505    if let Some(ref param_value) = p_query_page_size {
4506        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
4507    }
4508    if let Some(ref param_value) = p_query_search {
4509        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
4510    }
4511    if let Some(ref user_agent) = configuration.user_agent {
4512        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4513    }
4514    if let Some(ref token) = configuration.bearer_access_token {
4515        req_builder = req_builder.bearer_auth(token.to_owned());
4516    };
4517
4518    let req = req_builder.build()?;
4519    let resp = configuration.client.execute(req).await?;
4520
4521    let status = resp.status();
4522    let content_type = resp
4523        .headers()
4524        .get("content-type")
4525        .and_then(|v| v.to_str().ok())
4526        .unwrap_or("application/octet-stream");
4527    let content_type = super::ContentType::from(content_type);
4528
4529    if !status.is_client_error() && !status.is_server_error() {
4530        let content = resp.text().await?;
4531        match content_type {
4532            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4533            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedStaticDeviceList`"))),
4534            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`")))),
4535        }
4536    } else {
4537        let content = resp.text().await?;
4538        let entity: Option<AuthenticatorsStaticListError> = serde_json::from_str(&content).ok();
4539        Err(Error::ResponseError(ResponseContent {
4540            status,
4541            content,
4542            entity,
4543        }))
4544    }
4545}
4546
4547/// Viewset for static authenticator devices
4548pub async fn authenticators_static_partial_update(
4549    configuration: &configuration::Configuration,
4550    id: i32,
4551    patched_static_device_request: Option<models::PatchedStaticDeviceRequest>,
4552) -> Result<models::StaticDevice, Error<AuthenticatorsStaticPartialUpdateError>> {
4553    // add a prefix to parameters to efficiently prevent name collisions
4554    let p_path_id = id;
4555    let p_body_patched_static_device_request = patched_static_device_request;
4556
4557    let uri_str = format!(
4558        "{}/authenticators/static/{id}/",
4559        configuration.base_path,
4560        id = p_path_id
4561    );
4562    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4563
4564    if let Some(ref user_agent) = configuration.user_agent {
4565        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4566    }
4567    if let Some(ref token) = configuration.bearer_access_token {
4568        req_builder = req_builder.bearer_auth(token.to_owned());
4569    };
4570    req_builder = req_builder.json(&p_body_patched_static_device_request);
4571
4572    let req = req_builder.build()?;
4573    let resp = configuration.client.execute(req).await?;
4574
4575    let status = resp.status();
4576    let content_type = resp
4577        .headers()
4578        .get("content-type")
4579        .and_then(|v| v.to_str().ok())
4580        .unwrap_or("application/octet-stream");
4581    let content_type = super::ContentType::from(content_type);
4582
4583    if !status.is_client_error() && !status.is_server_error() {
4584        let content = resp.text().await?;
4585        match content_type {
4586            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4587            ContentType::Text => {
4588                return Err(Error::from(serde_json::Error::custom(
4589                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
4590                )))
4591            }
4592            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4593                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
4594            )))),
4595        }
4596    } else {
4597        let content = resp.text().await?;
4598        let entity: Option<AuthenticatorsStaticPartialUpdateError> = serde_json::from_str(&content).ok();
4599        Err(Error::ResponseError(ResponseContent {
4600            status,
4601            content,
4602            entity,
4603        }))
4604    }
4605}
4606
4607/// Viewset for static authenticator devices
4608pub async fn authenticators_static_retrieve(
4609    configuration: &configuration::Configuration,
4610    id: i32,
4611) -> Result<models::StaticDevice, Error<AuthenticatorsStaticRetrieveError>> {
4612    // add a prefix to parameters to efficiently prevent name collisions
4613    let p_path_id = id;
4614
4615    let uri_str = format!(
4616        "{}/authenticators/static/{id}/",
4617        configuration.base_path,
4618        id = p_path_id
4619    );
4620    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4621
4622    if let Some(ref user_agent) = configuration.user_agent {
4623        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4624    }
4625    if let Some(ref token) = configuration.bearer_access_token {
4626        req_builder = req_builder.bearer_auth(token.to_owned());
4627    };
4628
4629    let req = req_builder.build()?;
4630    let resp = configuration.client.execute(req).await?;
4631
4632    let status = resp.status();
4633    let content_type = resp
4634        .headers()
4635        .get("content-type")
4636        .and_then(|v| v.to_str().ok())
4637        .unwrap_or("application/octet-stream");
4638    let content_type = super::ContentType::from(content_type);
4639
4640    if !status.is_client_error() && !status.is_server_error() {
4641        let content = resp.text().await?;
4642        match content_type {
4643            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4644            ContentType::Text => {
4645                return Err(Error::from(serde_json::Error::custom(
4646                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
4647                )))
4648            }
4649            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4650                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
4651            )))),
4652        }
4653    } else {
4654        let content = resp.text().await?;
4655        let entity: Option<AuthenticatorsStaticRetrieveError> = serde_json::from_str(&content).ok();
4656        Err(Error::ResponseError(ResponseContent {
4657            status,
4658            content,
4659            entity,
4660        }))
4661    }
4662}
4663
4664/// Viewset for static authenticator devices
4665pub async fn authenticators_static_update(
4666    configuration: &configuration::Configuration,
4667    id: i32,
4668    static_device_request: models::StaticDeviceRequest,
4669) -> Result<models::StaticDevice, Error<AuthenticatorsStaticUpdateError>> {
4670    // add a prefix to parameters to efficiently prevent name collisions
4671    let p_path_id = id;
4672    let p_body_static_device_request = static_device_request;
4673
4674    let uri_str = format!(
4675        "{}/authenticators/static/{id}/",
4676        configuration.base_path,
4677        id = p_path_id
4678    );
4679    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4680
4681    if let Some(ref user_agent) = configuration.user_agent {
4682        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4683    }
4684    if let Some(ref token) = configuration.bearer_access_token {
4685        req_builder = req_builder.bearer_auth(token.to_owned());
4686    };
4687    req_builder = req_builder.json(&p_body_static_device_request);
4688
4689    let req = req_builder.build()?;
4690    let resp = configuration.client.execute(req).await?;
4691
4692    let status = resp.status();
4693    let content_type = resp
4694        .headers()
4695        .get("content-type")
4696        .and_then(|v| v.to_str().ok())
4697        .unwrap_or("application/octet-stream");
4698    let content_type = super::ContentType::from(content_type);
4699
4700    if !status.is_client_error() && !status.is_server_error() {
4701        let content = resp.text().await?;
4702        match content_type {
4703            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4704            ContentType::Text => {
4705                return Err(Error::from(serde_json::Error::custom(
4706                    "Received `text/plain` content type response that cannot be converted to `models::StaticDevice`",
4707                )))
4708            }
4709            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4710                "Received `{unknown_type}` content type response that cannot be converted to `models::StaticDevice`"
4711            )))),
4712        }
4713    } else {
4714        let content = resp.text().await?;
4715        let entity: Option<AuthenticatorsStaticUpdateError> = serde_json::from_str(&content).ok();
4716        Err(Error::ResponseError(ResponseContent {
4717            status,
4718            content,
4719            entity,
4720        }))
4721    }
4722}
4723
4724/// Get a list of all objects that use this object
4725pub async fn authenticators_static_used_by_list(
4726    configuration: &configuration::Configuration,
4727    id: i32,
4728) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsStaticUsedByListError>> {
4729    // add a prefix to parameters to efficiently prevent name collisions
4730    let p_path_id = id;
4731
4732    let uri_str = format!(
4733        "{}/authenticators/static/{id}/used_by/",
4734        configuration.base_path,
4735        id = p_path_id
4736    );
4737    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4738
4739    if let Some(ref user_agent) = configuration.user_agent {
4740        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4741    }
4742    if let Some(ref token) = configuration.bearer_access_token {
4743        req_builder = req_builder.bearer_auth(token.to_owned());
4744    };
4745
4746    let req = req_builder.build()?;
4747    let resp = configuration.client.execute(req).await?;
4748
4749    let status = resp.status();
4750    let content_type = resp
4751        .headers()
4752        .get("content-type")
4753        .and_then(|v| v.to_str().ok())
4754        .unwrap_or("application/octet-stream");
4755    let content_type = super::ContentType::from(content_type);
4756
4757    if !status.is_client_error() && !status.is_server_error() {
4758        let content = resp.text().await?;
4759        match content_type {
4760            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4761            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;`"))),
4762            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;`")))),
4763        }
4764    } else {
4765        let content = resp.text().await?;
4766        let entity: Option<AuthenticatorsStaticUsedByListError> = serde_json::from_str(&content).ok();
4767        Err(Error::ResponseError(ResponseContent {
4768            status,
4769            content,
4770            entity,
4771        }))
4772    }
4773}
4774
4775/// Viewset for totp authenticator devices
4776pub async fn authenticators_totp_destroy(
4777    configuration: &configuration::Configuration,
4778    id: i32,
4779) -> Result<(), Error<AuthenticatorsTotpDestroyError>> {
4780    // add a prefix to parameters to efficiently prevent name collisions
4781    let p_path_id = id;
4782
4783    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4784    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4785
4786    if let Some(ref user_agent) = configuration.user_agent {
4787        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4788    }
4789    if let Some(ref token) = configuration.bearer_access_token {
4790        req_builder = req_builder.bearer_auth(token.to_owned());
4791    };
4792
4793    let req = req_builder.build()?;
4794    let resp = configuration.client.execute(req).await?;
4795
4796    let status = resp.status();
4797
4798    if !status.is_client_error() && !status.is_server_error() {
4799        Ok(())
4800    } else {
4801        let content = resp.text().await?;
4802        let entity: Option<AuthenticatorsTotpDestroyError> = serde_json::from_str(&content).ok();
4803        Err(Error::ResponseError(ResponseContent {
4804            status,
4805            content,
4806            entity,
4807        }))
4808    }
4809}
4810
4811/// Viewset for totp authenticator devices
4812pub async fn authenticators_totp_list(
4813    configuration: &configuration::Configuration,
4814    name: Option<&str>,
4815    ordering: Option<&str>,
4816    page: Option<i32>,
4817    page_size: Option<i32>,
4818    search: Option<&str>,
4819) -> Result<models::PaginatedTotpDeviceList, Error<AuthenticatorsTotpListError>> {
4820    // add a prefix to parameters to efficiently prevent name collisions
4821    let p_query_name = name;
4822    let p_query_ordering = ordering;
4823    let p_query_page = page;
4824    let p_query_page_size = page_size;
4825    let p_query_search = search;
4826
4827    let uri_str = format!("{}/authenticators/totp/", configuration.base_path);
4828    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4829
4830    if let Some(ref param_value) = p_query_name {
4831        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
4832    }
4833    if let Some(ref param_value) = p_query_ordering {
4834        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
4835    }
4836    if let Some(ref param_value) = p_query_page {
4837        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
4838    }
4839    if let Some(ref param_value) = p_query_page_size {
4840        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
4841    }
4842    if let Some(ref param_value) = p_query_search {
4843        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
4844    }
4845    if let Some(ref user_agent) = configuration.user_agent {
4846        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4847    }
4848    if let Some(ref token) = configuration.bearer_access_token {
4849        req_builder = req_builder.bearer_auth(token.to_owned());
4850    };
4851
4852    let req = req_builder.build()?;
4853    let resp = configuration.client.execute(req).await?;
4854
4855    let status = resp.status();
4856    let content_type = resp
4857        .headers()
4858        .get("content-type")
4859        .and_then(|v| v.to_str().ok())
4860        .unwrap_or("application/octet-stream");
4861    let content_type = super::ContentType::from(content_type);
4862
4863    if !status.is_client_error() && !status.is_server_error() {
4864        let content = resp.text().await?;
4865        match content_type {
4866            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4867            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTotpDeviceList`"))),
4868            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`")))),
4869        }
4870    } else {
4871        let content = resp.text().await?;
4872        let entity: Option<AuthenticatorsTotpListError> = serde_json::from_str(&content).ok();
4873        Err(Error::ResponseError(ResponseContent {
4874            status,
4875            content,
4876            entity,
4877        }))
4878    }
4879}
4880
4881/// Viewset for totp authenticator devices
4882pub async fn authenticators_totp_partial_update(
4883    configuration: &configuration::Configuration,
4884    id: i32,
4885    patched_totp_device_request: Option<models::PatchedTotpDeviceRequest>,
4886) -> Result<models::TotpDevice, Error<AuthenticatorsTotpPartialUpdateError>> {
4887    // add a prefix to parameters to efficiently prevent name collisions
4888    let p_path_id = id;
4889    let p_body_patched_totp_device_request = patched_totp_device_request;
4890
4891    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4892    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4893
4894    if let Some(ref user_agent) = configuration.user_agent {
4895        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4896    }
4897    if let Some(ref token) = configuration.bearer_access_token {
4898        req_builder = req_builder.bearer_auth(token.to_owned());
4899    };
4900    req_builder = req_builder.json(&p_body_patched_totp_device_request);
4901
4902    let req = req_builder.build()?;
4903    let resp = configuration.client.execute(req).await?;
4904
4905    let status = resp.status();
4906    let content_type = resp
4907        .headers()
4908        .get("content-type")
4909        .and_then(|v| v.to_str().ok())
4910        .unwrap_or("application/octet-stream");
4911    let content_type = super::ContentType::from(content_type);
4912
4913    if !status.is_client_error() && !status.is_server_error() {
4914        let content = resp.text().await?;
4915        match content_type {
4916            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4917            ContentType::Text => {
4918                return Err(Error::from(serde_json::Error::custom(
4919                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
4920                )))
4921            }
4922            ContentType::Unsupported(unknown_type) => {
4923                return Err(Error::from(serde_json::Error::custom(format!(
4924                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
4925                ))))
4926            }
4927        }
4928    } else {
4929        let content = resp.text().await?;
4930        let entity: Option<AuthenticatorsTotpPartialUpdateError> = serde_json::from_str(&content).ok();
4931        Err(Error::ResponseError(ResponseContent {
4932            status,
4933            content,
4934            entity,
4935        }))
4936    }
4937}
4938
4939/// Viewset for totp authenticator devices
4940pub async fn authenticators_totp_retrieve(
4941    configuration: &configuration::Configuration,
4942    id: i32,
4943) -> Result<models::TotpDevice, Error<AuthenticatorsTotpRetrieveError>> {
4944    // add a prefix to parameters to efficiently prevent name collisions
4945    let p_path_id = id;
4946
4947    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
4948    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4949
4950    if let Some(ref user_agent) = configuration.user_agent {
4951        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4952    }
4953    if let Some(ref token) = configuration.bearer_access_token {
4954        req_builder = req_builder.bearer_auth(token.to_owned());
4955    };
4956
4957    let req = req_builder.build()?;
4958    let resp = configuration.client.execute(req).await?;
4959
4960    let status = resp.status();
4961    let content_type = resp
4962        .headers()
4963        .get("content-type")
4964        .and_then(|v| v.to_str().ok())
4965        .unwrap_or("application/octet-stream");
4966    let content_type = super::ContentType::from(content_type);
4967
4968    if !status.is_client_error() && !status.is_server_error() {
4969        let content = resp.text().await?;
4970        match content_type {
4971            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4972            ContentType::Text => {
4973                return Err(Error::from(serde_json::Error::custom(
4974                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
4975                )))
4976            }
4977            ContentType::Unsupported(unknown_type) => {
4978                return Err(Error::from(serde_json::Error::custom(format!(
4979                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
4980                ))))
4981            }
4982        }
4983    } else {
4984        let content = resp.text().await?;
4985        let entity: Option<AuthenticatorsTotpRetrieveError> = serde_json::from_str(&content).ok();
4986        Err(Error::ResponseError(ResponseContent {
4987            status,
4988            content,
4989            entity,
4990        }))
4991    }
4992}
4993
4994/// Viewset for totp authenticator devices
4995pub async fn authenticators_totp_update(
4996    configuration: &configuration::Configuration,
4997    id: i32,
4998    totp_device_request: models::TotpDeviceRequest,
4999) -> Result<models::TotpDevice, Error<AuthenticatorsTotpUpdateError>> {
5000    // add a prefix to parameters to efficiently prevent name collisions
5001    let p_path_id = id;
5002    let p_body_totp_device_request = totp_device_request;
5003
5004    let uri_str = format!("{}/authenticators/totp/{id}/", configuration.base_path, id = p_path_id);
5005    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5006
5007    if let Some(ref user_agent) = configuration.user_agent {
5008        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5009    }
5010    if let Some(ref token) = configuration.bearer_access_token {
5011        req_builder = req_builder.bearer_auth(token.to_owned());
5012    };
5013    req_builder = req_builder.json(&p_body_totp_device_request);
5014
5015    let req = req_builder.build()?;
5016    let resp = configuration.client.execute(req).await?;
5017
5018    let status = resp.status();
5019    let content_type = resp
5020        .headers()
5021        .get("content-type")
5022        .and_then(|v| v.to_str().ok())
5023        .unwrap_or("application/octet-stream");
5024    let content_type = super::ContentType::from(content_type);
5025
5026    if !status.is_client_error() && !status.is_server_error() {
5027        let content = resp.text().await?;
5028        match content_type {
5029            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5030            ContentType::Text => {
5031                return Err(Error::from(serde_json::Error::custom(
5032                    "Received `text/plain` content type response that cannot be converted to `models::TotpDevice`",
5033                )))
5034            }
5035            ContentType::Unsupported(unknown_type) => {
5036                return Err(Error::from(serde_json::Error::custom(format!(
5037                    "Received `{unknown_type}` content type response that cannot be converted to `models::TotpDevice`"
5038                ))))
5039            }
5040        }
5041    } else {
5042        let content = resp.text().await?;
5043        let entity: Option<AuthenticatorsTotpUpdateError> = serde_json::from_str(&content).ok();
5044        Err(Error::ResponseError(ResponseContent {
5045            status,
5046            content,
5047            entity,
5048        }))
5049    }
5050}
5051
5052/// Get a list of all objects that use this object
5053pub async fn authenticators_totp_used_by_list(
5054    configuration: &configuration::Configuration,
5055    id: i32,
5056) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsTotpUsedByListError>> {
5057    // add a prefix to parameters to efficiently prevent name collisions
5058    let p_path_id = id;
5059
5060    let uri_str = format!(
5061        "{}/authenticators/totp/{id}/used_by/",
5062        configuration.base_path,
5063        id = p_path_id
5064    );
5065    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5066
5067    if let Some(ref user_agent) = configuration.user_agent {
5068        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5069    }
5070    if let Some(ref token) = configuration.bearer_access_token {
5071        req_builder = req_builder.bearer_auth(token.to_owned());
5072    };
5073
5074    let req = req_builder.build()?;
5075    let resp = configuration.client.execute(req).await?;
5076
5077    let status = resp.status();
5078    let content_type = resp
5079        .headers()
5080        .get("content-type")
5081        .and_then(|v| v.to_str().ok())
5082        .unwrap_or("application/octet-stream");
5083    let content_type = super::ContentType::from(content_type);
5084
5085    if !status.is_client_error() && !status.is_server_error() {
5086        let content = resp.text().await?;
5087        match content_type {
5088            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5089            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;`"))),
5090            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;`")))),
5091        }
5092    } else {
5093        let content = resp.text().await?;
5094        let entity: Option<AuthenticatorsTotpUsedByListError> = serde_json::from_str(&content).ok();
5095        Err(Error::ResponseError(ResponseContent {
5096            status,
5097            content,
5098            entity,
5099        }))
5100    }
5101}
5102
5103/// Viewset for WebAuthn authenticator devices
5104pub async fn authenticators_webauthn_destroy(
5105    configuration: &configuration::Configuration,
5106    id: i32,
5107) -> Result<(), Error<AuthenticatorsWebauthnDestroyError>> {
5108    // add a prefix to parameters to efficiently prevent name collisions
5109    let p_path_id = id;
5110
5111    let uri_str = format!(
5112        "{}/authenticators/webauthn/{id}/",
5113        configuration.base_path,
5114        id = p_path_id
5115    );
5116    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
5117
5118    if let Some(ref user_agent) = configuration.user_agent {
5119        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5120    }
5121    if let Some(ref token) = configuration.bearer_access_token {
5122        req_builder = req_builder.bearer_auth(token.to_owned());
5123    };
5124
5125    let req = req_builder.build()?;
5126    let resp = configuration.client.execute(req).await?;
5127
5128    let status = resp.status();
5129
5130    if !status.is_client_error() && !status.is_server_error() {
5131        Ok(())
5132    } else {
5133        let content = resp.text().await?;
5134        let entity: Option<AuthenticatorsWebauthnDestroyError> = serde_json::from_str(&content).ok();
5135        Err(Error::ResponseError(ResponseContent {
5136            status,
5137            content,
5138            entity,
5139        }))
5140    }
5141}
5142
5143/// Viewset for WebAuthn authenticator devices
5144pub async fn authenticators_webauthn_list(
5145    configuration: &configuration::Configuration,
5146    name: Option<&str>,
5147    ordering: Option<&str>,
5148    page: Option<i32>,
5149    page_size: Option<i32>,
5150    search: Option<&str>,
5151) -> Result<models::PaginatedWebAuthnDeviceList, Error<AuthenticatorsWebauthnListError>> {
5152    // add a prefix to parameters to efficiently prevent name collisions
5153    let p_query_name = name;
5154    let p_query_ordering = ordering;
5155    let p_query_page = page;
5156    let p_query_page_size = page_size;
5157    let p_query_search = search;
5158
5159    let uri_str = format!("{}/authenticators/webauthn/", configuration.base_path);
5160    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5161
5162    if let Some(ref param_value) = p_query_name {
5163        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
5164    }
5165    if let Some(ref param_value) = p_query_ordering {
5166        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
5167    }
5168    if let Some(ref param_value) = p_query_page {
5169        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
5170    }
5171    if let Some(ref param_value) = p_query_page_size {
5172        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
5173    }
5174    if let Some(ref param_value) = p_query_search {
5175        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
5176    }
5177    if let Some(ref user_agent) = configuration.user_agent {
5178        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5179    }
5180    if let Some(ref token) = configuration.bearer_access_token {
5181        req_builder = req_builder.bearer_auth(token.to_owned());
5182    };
5183
5184    let req = req_builder.build()?;
5185    let resp = configuration.client.execute(req).await?;
5186
5187    let status = resp.status();
5188    let content_type = resp
5189        .headers()
5190        .get("content-type")
5191        .and_then(|v| v.to_str().ok())
5192        .unwrap_or("application/octet-stream");
5193    let content_type = super::ContentType::from(content_type);
5194
5195    if !status.is_client_error() && !status.is_server_error() {
5196        let content = resp.text().await?;
5197        match content_type {
5198            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5199            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedWebAuthnDeviceList`"))),
5200            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`")))),
5201        }
5202    } else {
5203        let content = resp.text().await?;
5204        let entity: Option<AuthenticatorsWebauthnListError> = serde_json::from_str(&content).ok();
5205        Err(Error::ResponseError(ResponseContent {
5206            status,
5207            content,
5208            entity,
5209        }))
5210    }
5211}
5212
5213/// Viewset for WebAuthn authenticator devices
5214pub async fn authenticators_webauthn_partial_update(
5215    configuration: &configuration::Configuration,
5216    id: i32,
5217    patched_web_authn_device_request: Option<models::PatchedWebAuthnDeviceRequest>,
5218) -> Result<models::WebAuthnDevice, Error<AuthenticatorsWebauthnPartialUpdateError>> {
5219    // add a prefix to parameters to efficiently prevent name collisions
5220    let p_path_id = id;
5221    let p_body_patched_web_authn_device_request = patched_web_authn_device_request;
5222
5223    let uri_str = format!(
5224        "{}/authenticators/webauthn/{id}/",
5225        configuration.base_path,
5226        id = p_path_id
5227    );
5228    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
5229
5230    if let Some(ref user_agent) = configuration.user_agent {
5231        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5232    }
5233    if let Some(ref token) = configuration.bearer_access_token {
5234        req_builder = req_builder.bearer_auth(token.to_owned());
5235    };
5236    req_builder = req_builder.json(&p_body_patched_web_authn_device_request);
5237
5238    let req = req_builder.build()?;
5239    let resp = configuration.client.execute(req).await?;
5240
5241    let status = resp.status();
5242    let content_type = resp
5243        .headers()
5244        .get("content-type")
5245        .and_then(|v| v.to_str().ok())
5246        .unwrap_or("application/octet-stream");
5247    let content_type = super::ContentType::from(content_type);
5248
5249    if !status.is_client_error() && !status.is_server_error() {
5250        let content = resp.text().await?;
5251        match content_type {
5252            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5253            ContentType::Text => {
5254                return Err(Error::from(serde_json::Error::custom(
5255                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
5256                )))
5257            }
5258            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
5259                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
5260            )))),
5261        }
5262    } else {
5263        let content = resp.text().await?;
5264        let entity: Option<AuthenticatorsWebauthnPartialUpdateError> = serde_json::from_str(&content).ok();
5265        Err(Error::ResponseError(ResponseContent {
5266            status,
5267            content,
5268            entity,
5269        }))
5270    }
5271}
5272
5273/// Viewset for WebAuthn authenticator devices
5274pub async fn authenticators_webauthn_retrieve(
5275    configuration: &configuration::Configuration,
5276    id: i32,
5277) -> Result<models::WebAuthnDevice, Error<AuthenticatorsWebauthnRetrieveError>> {
5278    // add a prefix to parameters to efficiently prevent name collisions
5279    let p_path_id = id;
5280
5281    let uri_str = format!(
5282        "{}/authenticators/webauthn/{id}/",
5283        configuration.base_path,
5284        id = p_path_id
5285    );
5286    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5287
5288    if let Some(ref user_agent) = configuration.user_agent {
5289        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5290    }
5291    if let Some(ref token) = configuration.bearer_access_token {
5292        req_builder = req_builder.bearer_auth(token.to_owned());
5293    };
5294
5295    let req = req_builder.build()?;
5296    let resp = configuration.client.execute(req).await?;
5297
5298    let status = resp.status();
5299    let content_type = resp
5300        .headers()
5301        .get("content-type")
5302        .and_then(|v| v.to_str().ok())
5303        .unwrap_or("application/octet-stream");
5304    let content_type = super::ContentType::from(content_type);
5305
5306    if !status.is_client_error() && !status.is_server_error() {
5307        let content = resp.text().await?;
5308        match content_type {
5309            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5310            ContentType::Text => {
5311                return Err(Error::from(serde_json::Error::custom(
5312                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
5313                )))
5314            }
5315            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
5316                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
5317            )))),
5318        }
5319    } else {
5320        let content = resp.text().await?;
5321        let entity: Option<AuthenticatorsWebauthnRetrieveError> = serde_json::from_str(&content).ok();
5322        Err(Error::ResponseError(ResponseContent {
5323            status,
5324            content,
5325            entity,
5326        }))
5327    }
5328}
5329
5330/// Viewset for WebAuthn authenticator devices
5331pub async fn authenticators_webauthn_update(
5332    configuration: &configuration::Configuration,
5333    id: i32,
5334    web_authn_device_request: models::WebAuthnDeviceRequest,
5335) -> Result<models::WebAuthnDevice, Error<AuthenticatorsWebauthnUpdateError>> {
5336    // add a prefix to parameters to efficiently prevent name collisions
5337    let p_path_id = id;
5338    let p_body_web_authn_device_request = web_authn_device_request;
5339
5340    let uri_str = format!(
5341        "{}/authenticators/webauthn/{id}/",
5342        configuration.base_path,
5343        id = p_path_id
5344    );
5345    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5346
5347    if let Some(ref user_agent) = configuration.user_agent {
5348        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5349    }
5350    if let Some(ref token) = configuration.bearer_access_token {
5351        req_builder = req_builder.bearer_auth(token.to_owned());
5352    };
5353    req_builder = req_builder.json(&p_body_web_authn_device_request);
5354
5355    let req = req_builder.build()?;
5356    let resp = configuration.client.execute(req).await?;
5357
5358    let status = resp.status();
5359    let content_type = resp
5360        .headers()
5361        .get("content-type")
5362        .and_then(|v| v.to_str().ok())
5363        .unwrap_or("application/octet-stream");
5364    let content_type = super::ContentType::from(content_type);
5365
5366    if !status.is_client_error() && !status.is_server_error() {
5367        let content = resp.text().await?;
5368        match content_type {
5369            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5370            ContentType::Text => {
5371                return Err(Error::from(serde_json::Error::custom(
5372                    "Received `text/plain` content type response that cannot be converted to `models::WebAuthnDevice`",
5373                )))
5374            }
5375            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
5376                "Received `{unknown_type}` content type response that cannot be converted to `models::WebAuthnDevice`"
5377            )))),
5378        }
5379    } else {
5380        let content = resp.text().await?;
5381        let entity: Option<AuthenticatorsWebauthnUpdateError> = serde_json::from_str(&content).ok();
5382        Err(Error::ResponseError(ResponseContent {
5383            status,
5384            content,
5385            entity,
5386        }))
5387    }
5388}
5389
5390/// Get a list of all objects that use this object
5391pub async fn authenticators_webauthn_used_by_list(
5392    configuration: &configuration::Configuration,
5393    id: i32,
5394) -> Result<Vec<models::UsedBy>, Error<AuthenticatorsWebauthnUsedByListError>> {
5395    // add a prefix to parameters to efficiently prevent name collisions
5396    let p_path_id = id;
5397
5398    let uri_str = format!(
5399        "{}/authenticators/webauthn/{id}/used_by/",
5400        configuration.base_path,
5401        id = p_path_id
5402    );
5403    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5404
5405    if let Some(ref user_agent) = configuration.user_agent {
5406        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5407    }
5408    if let Some(ref token) = configuration.bearer_access_token {
5409        req_builder = req_builder.bearer_auth(token.to_owned());
5410    };
5411
5412    let req = req_builder.build()?;
5413    let resp = configuration.client.execute(req).await?;
5414
5415    let status = resp.status();
5416    let content_type = resp
5417        .headers()
5418        .get("content-type")
5419        .and_then(|v| v.to_str().ok())
5420        .unwrap_or("application/octet-stream");
5421    let content_type = super::ContentType::from(content_type);
5422
5423    if !status.is_client_error() && !status.is_server_error() {
5424        let content = resp.text().await?;
5425        match content_type {
5426            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5427            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;`"))),
5428            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;`")))),
5429        }
5430    } else {
5431        let content = resp.text().await?;
5432        let entity: Option<AuthenticatorsWebauthnUsedByListError> = serde_json::from_str(&content).ok();
5433        Err(Error::ResponseError(ResponseContent {
5434            status,
5435            content,
5436            entity,
5437        }))
5438    }
5439}