bitwarden_api_api/apis/
two_factor_api.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`organizations_id_two_factor_disable_post`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum OrganizationsIdTwoFactorDisablePostError {
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`organizations_id_two_factor_disable_put`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum OrganizationsIdTwoFactorDisablePutError {
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`organizations_id_two_factor_duo_post`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum OrganizationsIdTwoFactorDuoPostError {
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`organizations_id_two_factor_duo_put`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum OrganizationsIdTwoFactorDuoPutError {
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`organizations_id_two_factor_get`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum OrganizationsIdTwoFactorGetError {
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`organizations_id_two_factor_get_duo_post`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum OrganizationsIdTwoFactorGetDuoPostError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`two_factor_authenticator_delete`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum TwoFactorAuthenticatorDeleteError {
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`two_factor_authenticator_post`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum TwoFactorAuthenticatorPostError {
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`two_factor_authenticator_put`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum TwoFactorAuthenticatorPutError {
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`two_factor_device_verification_settings_put`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum TwoFactorDeviceVerificationSettingsPutError {
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`two_factor_disable_post`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum TwoFactorDisablePostError {
91    UnknownValue(serde_json::Value),
92}
93
94/// struct for typed errors of method [`two_factor_disable_put`]
95#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum TwoFactorDisablePutError {
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`two_factor_duo_post`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum TwoFactorDuoPostError {
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`two_factor_duo_put`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum TwoFactorDuoPutError {
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`two_factor_email_post`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum TwoFactorEmailPostError {
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`two_factor_email_put`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum TwoFactorEmailPutError {
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`two_factor_get`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum TwoFactorGetError {
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`two_factor_get_authenticator_post`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum TwoFactorGetAuthenticatorPostError {
140    UnknownValue(serde_json::Value),
141}
142
143/// struct for typed errors of method [`two_factor_get_device_verification_settings_get`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum TwoFactorGetDeviceVerificationSettingsGetError {
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`two_factor_get_duo_post`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum TwoFactorGetDuoPostError {
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`two_factor_get_email_post`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum TwoFactorGetEmailPostError {
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`two_factor_get_recover_post`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum TwoFactorGetRecoverPostError {
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`two_factor_get_webauthn_post`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum TwoFactorGetWebauthnPostError {
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`two_factor_get_yubikey_post`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum TwoFactorGetYubikeyPostError {
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`two_factor_recover_post`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum TwoFactorRecoverPostError {
189    UnknownValue(serde_json::Value),
190}
191
192/// struct for typed errors of method [`two_factor_send_email_login_post`]
193#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum TwoFactorSendEmailLoginPostError {
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`two_factor_send_email_post`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum TwoFactorSendEmailPostError {
203    UnknownValue(serde_json::Value),
204}
205
206/// struct for typed errors of method [`two_factor_webauthn_delete`]
207#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum TwoFactorWebauthnDeleteError {
210    UnknownValue(serde_json::Value),
211}
212
213/// struct for typed errors of method [`two_factor_webauthn_post`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum TwoFactorWebauthnPostError {
217    UnknownValue(serde_json::Value),
218}
219
220/// struct for typed errors of method [`two_factor_webauthn_put`]
221#[derive(Debug, Clone, Serialize, Deserialize)]
222#[serde(untagged)]
223pub enum TwoFactorWebauthnPutError {
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`two_factor_yubikey_post`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum TwoFactorYubikeyPostError {
231    UnknownValue(serde_json::Value),
232}
233
234/// struct for typed errors of method [`two_factor_yubikey_put`]
235#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum TwoFactorYubikeyPutError {
238    UnknownValue(serde_json::Value),
239}
240
241pub async fn organizations_id_two_factor_disable_post(
242    configuration: &configuration::Configuration,
243    id: &str,
244    two_factor_provider_request_model: Option<models::TwoFactorProviderRequestModel>,
245) -> Result<models::TwoFactorProviderResponseModel, Error<OrganizationsIdTwoFactorDisablePostError>>
246{
247    // add a prefix to parameters to efficiently prevent name collisions
248    let p_id = id;
249    let p_two_factor_provider_request_model = two_factor_provider_request_model;
250
251    let uri_str = format!(
252        "{}/organizations/{id}/two-factor/disable",
253        configuration.base_path,
254        id = crate::apis::urlencode(p_id)
255    );
256    let mut req_builder = configuration
257        .client
258        .request(reqwest::Method::POST, &uri_str);
259
260    if let Some(ref user_agent) = configuration.user_agent {
261        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
262    }
263    if let Some(ref token) = configuration.oauth_access_token {
264        req_builder = req_builder.bearer_auth(token.to_owned());
265    };
266    req_builder = req_builder.json(&p_two_factor_provider_request_model);
267
268    let req = req_builder.build()?;
269    let resp = configuration.client.execute(req).await?;
270
271    let status = resp.status();
272    let content_type = resp
273        .headers()
274        .get("content-type")
275        .and_then(|v| v.to_str().ok())
276        .unwrap_or("application/octet-stream");
277    let content_type = super::ContentType::from(content_type);
278
279    if !status.is_client_error() && !status.is_server_error() {
280        let content = resp.text().await?;
281        match content_type {
282            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
283            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModel`"))),
284            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::TwoFactorProviderResponseModel`")))),
285        }
286    } else {
287        let content = resp.text().await?;
288        let entity: Option<OrganizationsIdTwoFactorDisablePostError> =
289            serde_json::from_str(&content).ok();
290        Err(Error::ResponseError(ResponseContent {
291            status,
292            content,
293            entity,
294        }))
295    }
296}
297
298pub async fn organizations_id_two_factor_disable_put(
299    configuration: &configuration::Configuration,
300    id: &str,
301    two_factor_provider_request_model: Option<models::TwoFactorProviderRequestModel>,
302) -> Result<models::TwoFactorProviderResponseModel, Error<OrganizationsIdTwoFactorDisablePutError>>
303{
304    // add a prefix to parameters to efficiently prevent name collisions
305    let p_id = id;
306    let p_two_factor_provider_request_model = two_factor_provider_request_model;
307
308    let uri_str = format!(
309        "{}/organizations/{id}/two-factor/disable",
310        configuration.base_path,
311        id = crate::apis::urlencode(p_id)
312    );
313    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
314
315    if let Some(ref user_agent) = configuration.user_agent {
316        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
317    }
318    if let Some(ref token) = configuration.oauth_access_token {
319        req_builder = req_builder.bearer_auth(token.to_owned());
320    };
321    req_builder = req_builder.json(&p_two_factor_provider_request_model);
322
323    let req = req_builder.build()?;
324    let resp = configuration.client.execute(req).await?;
325
326    let status = resp.status();
327    let content_type = resp
328        .headers()
329        .get("content-type")
330        .and_then(|v| v.to_str().ok())
331        .unwrap_or("application/octet-stream");
332    let content_type = super::ContentType::from(content_type);
333
334    if !status.is_client_error() && !status.is_server_error() {
335        let content = resp.text().await?;
336        match content_type {
337            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
338            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModel`"))),
339            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::TwoFactorProviderResponseModel`")))),
340        }
341    } else {
342        let content = resp.text().await?;
343        let entity: Option<OrganizationsIdTwoFactorDisablePutError> =
344            serde_json::from_str(&content).ok();
345        Err(Error::ResponseError(ResponseContent {
346            status,
347            content,
348            entity,
349        }))
350    }
351}
352
353pub async fn organizations_id_two_factor_duo_post(
354    configuration: &configuration::Configuration,
355    id: &str,
356    update_two_factor_duo_request_model: Option<models::UpdateTwoFactorDuoRequestModel>,
357) -> Result<models::TwoFactorDuoResponseModel, Error<OrganizationsIdTwoFactorDuoPostError>> {
358    // add a prefix to parameters to efficiently prevent name collisions
359    let p_id = id;
360    let p_update_two_factor_duo_request_model = update_two_factor_duo_request_model;
361
362    let uri_str = format!(
363        "{}/organizations/{id}/two-factor/duo",
364        configuration.base_path,
365        id = crate::apis::urlencode(p_id)
366    );
367    let mut req_builder = configuration
368        .client
369        .request(reqwest::Method::POST, &uri_str);
370
371    if let Some(ref user_agent) = configuration.user_agent {
372        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
373    }
374    if let Some(ref token) = configuration.oauth_access_token {
375        req_builder = req_builder.bearer_auth(token.to_owned());
376    };
377    req_builder = req_builder.json(&p_update_two_factor_duo_request_model);
378
379    let req = req_builder.build()?;
380    let resp = configuration.client.execute(req).await?;
381
382    let status = resp.status();
383    let content_type = resp
384        .headers()
385        .get("content-type")
386        .and_then(|v| v.to_str().ok())
387        .unwrap_or("application/octet-stream");
388    let content_type = super::ContentType::from(content_type);
389
390    if !status.is_client_error() && !status.is_server_error() {
391        let content = resp.text().await?;
392        match content_type {
393            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
394            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorDuoResponseModel`"))),
395            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::TwoFactorDuoResponseModel`")))),
396        }
397    } else {
398        let content = resp.text().await?;
399        let entity: Option<OrganizationsIdTwoFactorDuoPostError> =
400            serde_json::from_str(&content).ok();
401        Err(Error::ResponseError(ResponseContent {
402            status,
403            content,
404            entity,
405        }))
406    }
407}
408
409pub async fn organizations_id_two_factor_duo_put(
410    configuration: &configuration::Configuration,
411    id: &str,
412    update_two_factor_duo_request_model: Option<models::UpdateTwoFactorDuoRequestModel>,
413) -> Result<models::TwoFactorDuoResponseModel, Error<OrganizationsIdTwoFactorDuoPutError>> {
414    // add a prefix to parameters to efficiently prevent name collisions
415    let p_id = id;
416    let p_update_two_factor_duo_request_model = update_two_factor_duo_request_model;
417
418    let uri_str = format!(
419        "{}/organizations/{id}/two-factor/duo",
420        configuration.base_path,
421        id = crate::apis::urlencode(p_id)
422    );
423    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
424
425    if let Some(ref user_agent) = configuration.user_agent {
426        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
427    }
428    if let Some(ref token) = configuration.oauth_access_token {
429        req_builder = req_builder.bearer_auth(token.to_owned());
430    };
431    req_builder = req_builder.json(&p_update_two_factor_duo_request_model);
432
433    let req = req_builder.build()?;
434    let resp = configuration.client.execute(req).await?;
435
436    let status = resp.status();
437    let content_type = resp
438        .headers()
439        .get("content-type")
440        .and_then(|v| v.to_str().ok())
441        .unwrap_or("application/octet-stream");
442    let content_type = super::ContentType::from(content_type);
443
444    if !status.is_client_error() && !status.is_server_error() {
445        let content = resp.text().await?;
446        match content_type {
447            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
448            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorDuoResponseModel`"))),
449            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::TwoFactorDuoResponseModel`")))),
450        }
451    } else {
452        let content = resp.text().await?;
453        let entity: Option<OrganizationsIdTwoFactorDuoPutError> =
454            serde_json::from_str(&content).ok();
455        Err(Error::ResponseError(ResponseContent {
456            status,
457            content,
458            entity,
459        }))
460    }
461}
462
463pub async fn organizations_id_two_factor_get(
464    configuration: &configuration::Configuration,
465    id: &str,
466) -> Result<
467    models::TwoFactorProviderResponseModelListResponseModel,
468    Error<OrganizationsIdTwoFactorGetError>,
469> {
470    // add a prefix to parameters to efficiently prevent name collisions
471    let p_id = id;
472
473    let uri_str = format!(
474        "{}/organizations/{id}/two-factor",
475        configuration.base_path,
476        id = crate::apis::urlencode(p_id)
477    );
478    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
479
480    if let Some(ref user_agent) = configuration.user_agent {
481        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
482    }
483    if let Some(ref token) = configuration.oauth_access_token {
484        req_builder = req_builder.bearer_auth(token.to_owned());
485    };
486
487    let req = req_builder.build()?;
488    let resp = configuration.client.execute(req).await?;
489
490    let status = resp.status();
491    let content_type = resp
492        .headers()
493        .get("content-type")
494        .and_then(|v| v.to_str().ok())
495        .unwrap_or("application/octet-stream");
496    let content_type = super::ContentType::from(content_type);
497
498    if !status.is_client_error() && !status.is_server_error() {
499        let content = resp.text().await?;
500        match content_type {
501            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
502            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModelListResponseModel`"))),
503            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::TwoFactorProviderResponseModelListResponseModel`")))),
504        }
505    } else {
506        let content = resp.text().await?;
507        let entity: Option<OrganizationsIdTwoFactorGetError> = serde_json::from_str(&content).ok();
508        Err(Error::ResponseError(ResponseContent {
509            status,
510            content,
511            entity,
512        }))
513    }
514}
515
516pub async fn organizations_id_two_factor_get_duo_post(
517    configuration: &configuration::Configuration,
518    id: &str,
519    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
520) -> Result<models::TwoFactorDuoResponseModel, Error<OrganizationsIdTwoFactorGetDuoPostError>> {
521    // add a prefix to parameters to efficiently prevent name collisions
522    let p_id = id;
523    let p_secret_verification_request_model = secret_verification_request_model;
524
525    let uri_str = format!(
526        "{}/organizations/{id}/two-factor/get-duo",
527        configuration.base_path,
528        id = crate::apis::urlencode(p_id)
529    );
530    let mut req_builder = configuration
531        .client
532        .request(reqwest::Method::POST, &uri_str);
533
534    if let Some(ref user_agent) = configuration.user_agent {
535        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
536    }
537    if let Some(ref token) = configuration.oauth_access_token {
538        req_builder = req_builder.bearer_auth(token.to_owned());
539    };
540    req_builder = req_builder.json(&p_secret_verification_request_model);
541
542    let req = req_builder.build()?;
543    let resp = configuration.client.execute(req).await?;
544
545    let status = resp.status();
546    let content_type = resp
547        .headers()
548        .get("content-type")
549        .and_then(|v| v.to_str().ok())
550        .unwrap_or("application/octet-stream");
551    let content_type = super::ContentType::from(content_type);
552
553    if !status.is_client_error() && !status.is_server_error() {
554        let content = resp.text().await?;
555        match content_type {
556            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
557            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorDuoResponseModel`"))),
558            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::TwoFactorDuoResponseModel`")))),
559        }
560    } else {
561        let content = resp.text().await?;
562        let entity: Option<OrganizationsIdTwoFactorGetDuoPostError> =
563            serde_json::from_str(&content).ok();
564        Err(Error::ResponseError(ResponseContent {
565            status,
566            content,
567            entity,
568        }))
569    }
570}
571
572pub async fn two_factor_authenticator_delete(
573    configuration: &configuration::Configuration,
574    two_factor_authenticator_disable_request_model: Option<
575        models::TwoFactorAuthenticatorDisableRequestModel,
576    >,
577) -> Result<models::TwoFactorProviderResponseModel, Error<TwoFactorAuthenticatorDeleteError>> {
578    // add a prefix to parameters to efficiently prevent name collisions
579    let p_two_factor_authenticator_disable_request_model =
580        two_factor_authenticator_disable_request_model;
581
582    let uri_str = format!("{}/two-factor/authenticator", configuration.base_path);
583    let mut req_builder = configuration
584        .client
585        .request(reqwest::Method::DELETE, &uri_str);
586
587    if let Some(ref user_agent) = configuration.user_agent {
588        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
589    }
590    if let Some(ref token) = configuration.oauth_access_token {
591        req_builder = req_builder.bearer_auth(token.to_owned());
592    };
593    req_builder = req_builder.json(&p_two_factor_authenticator_disable_request_model);
594
595    let req = req_builder.build()?;
596    let resp = configuration.client.execute(req).await?;
597
598    let status = resp.status();
599    let content_type = resp
600        .headers()
601        .get("content-type")
602        .and_then(|v| v.to_str().ok())
603        .unwrap_or("application/octet-stream");
604    let content_type = super::ContentType::from(content_type);
605
606    if !status.is_client_error() && !status.is_server_error() {
607        let content = resp.text().await?;
608        match content_type {
609            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
610            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModel`"))),
611            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::TwoFactorProviderResponseModel`")))),
612        }
613    } else {
614        let content = resp.text().await?;
615        let entity: Option<TwoFactorAuthenticatorDeleteError> = serde_json::from_str(&content).ok();
616        Err(Error::ResponseError(ResponseContent {
617            status,
618            content,
619            entity,
620        }))
621    }
622}
623
624pub async fn two_factor_authenticator_post(
625    configuration: &configuration::Configuration,
626    update_two_factor_authenticator_request_model: Option<
627        models::UpdateTwoFactorAuthenticatorRequestModel,
628    >,
629) -> Result<models::TwoFactorAuthenticatorResponseModel, Error<TwoFactorAuthenticatorPostError>> {
630    // add a prefix to parameters to efficiently prevent name collisions
631    let p_update_two_factor_authenticator_request_model =
632        update_two_factor_authenticator_request_model;
633
634    let uri_str = format!("{}/two-factor/authenticator", configuration.base_path);
635    let mut req_builder = configuration
636        .client
637        .request(reqwest::Method::POST, &uri_str);
638
639    if let Some(ref user_agent) = configuration.user_agent {
640        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
641    }
642    if let Some(ref token) = configuration.oauth_access_token {
643        req_builder = req_builder.bearer_auth(token.to_owned());
644    };
645    req_builder = req_builder.json(&p_update_two_factor_authenticator_request_model);
646
647    let req = req_builder.build()?;
648    let resp = configuration.client.execute(req).await?;
649
650    let status = resp.status();
651    let content_type = resp
652        .headers()
653        .get("content-type")
654        .and_then(|v| v.to_str().ok())
655        .unwrap_or("application/octet-stream");
656    let content_type = super::ContentType::from(content_type);
657
658    if !status.is_client_error() && !status.is_server_error() {
659        let content = resp.text().await?;
660        match content_type {
661            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
662            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorAuthenticatorResponseModel`"))),
663            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::TwoFactorAuthenticatorResponseModel`")))),
664        }
665    } else {
666        let content = resp.text().await?;
667        let entity: Option<TwoFactorAuthenticatorPostError> = serde_json::from_str(&content).ok();
668        Err(Error::ResponseError(ResponseContent {
669            status,
670            content,
671            entity,
672        }))
673    }
674}
675
676pub async fn two_factor_authenticator_put(
677    configuration: &configuration::Configuration,
678    update_two_factor_authenticator_request_model: Option<
679        models::UpdateTwoFactorAuthenticatorRequestModel,
680    >,
681) -> Result<models::TwoFactorAuthenticatorResponseModel, Error<TwoFactorAuthenticatorPutError>> {
682    // add a prefix to parameters to efficiently prevent name collisions
683    let p_update_two_factor_authenticator_request_model =
684        update_two_factor_authenticator_request_model;
685
686    let uri_str = format!("{}/two-factor/authenticator", configuration.base_path);
687    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
688
689    if let Some(ref user_agent) = configuration.user_agent {
690        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
691    }
692    if let Some(ref token) = configuration.oauth_access_token {
693        req_builder = req_builder.bearer_auth(token.to_owned());
694    };
695    req_builder = req_builder.json(&p_update_two_factor_authenticator_request_model);
696
697    let req = req_builder.build()?;
698    let resp = configuration.client.execute(req).await?;
699
700    let status = resp.status();
701    let content_type = resp
702        .headers()
703        .get("content-type")
704        .and_then(|v| v.to_str().ok())
705        .unwrap_or("application/octet-stream");
706    let content_type = super::ContentType::from(content_type);
707
708    if !status.is_client_error() && !status.is_server_error() {
709        let content = resp.text().await?;
710        match content_type {
711            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
712            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorAuthenticatorResponseModel`"))),
713            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::TwoFactorAuthenticatorResponseModel`")))),
714        }
715    } else {
716        let content = resp.text().await?;
717        let entity: Option<TwoFactorAuthenticatorPutError> = serde_json::from_str(&content).ok();
718        Err(Error::ResponseError(ResponseContent {
719            status,
720            content,
721            entity,
722        }))
723    }
724}
725
726pub async fn two_factor_device_verification_settings_put(
727    configuration: &configuration::Configuration,
728    device_verification_request_model: Option<models::DeviceVerificationRequestModel>,
729) -> Result<
730    models::DeviceVerificationResponseModel,
731    Error<TwoFactorDeviceVerificationSettingsPutError>,
732> {
733    // add a prefix to parameters to efficiently prevent name collisions
734    let p_device_verification_request_model = device_verification_request_model;
735
736    let uri_str = format!(
737        "{}/two-factor/device-verification-settings",
738        configuration.base_path
739    );
740    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
741
742    if let Some(ref user_agent) = configuration.user_agent {
743        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
744    }
745    if let Some(ref token) = configuration.oauth_access_token {
746        req_builder = req_builder.bearer_auth(token.to_owned());
747    };
748    req_builder = req_builder.json(&p_device_verification_request_model);
749
750    let req = req_builder.build()?;
751    let resp = configuration.client.execute(req).await?;
752
753    let status = resp.status();
754    let content_type = resp
755        .headers()
756        .get("content-type")
757        .and_then(|v| v.to_str().ok())
758        .unwrap_or("application/octet-stream");
759    let content_type = super::ContentType::from(content_type);
760
761    if !status.is_client_error() && !status.is_server_error() {
762        let content = resp.text().await?;
763        match content_type {
764            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
765            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceVerificationResponseModel`"))),
766            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::DeviceVerificationResponseModel`")))),
767        }
768    } else {
769        let content = resp.text().await?;
770        let entity: Option<TwoFactorDeviceVerificationSettingsPutError> =
771            serde_json::from_str(&content).ok();
772        Err(Error::ResponseError(ResponseContent {
773            status,
774            content,
775            entity,
776        }))
777    }
778}
779
780pub async fn two_factor_disable_post(
781    configuration: &configuration::Configuration,
782    two_factor_provider_request_model: Option<models::TwoFactorProviderRequestModel>,
783) -> Result<models::TwoFactorProviderResponseModel, Error<TwoFactorDisablePostError>> {
784    // add a prefix to parameters to efficiently prevent name collisions
785    let p_two_factor_provider_request_model = two_factor_provider_request_model;
786
787    let uri_str = format!("{}/two-factor/disable", configuration.base_path);
788    let mut req_builder = configuration
789        .client
790        .request(reqwest::Method::POST, &uri_str);
791
792    if let Some(ref user_agent) = configuration.user_agent {
793        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
794    }
795    if let Some(ref token) = configuration.oauth_access_token {
796        req_builder = req_builder.bearer_auth(token.to_owned());
797    };
798    req_builder = req_builder.json(&p_two_factor_provider_request_model);
799
800    let req = req_builder.build()?;
801    let resp = configuration.client.execute(req).await?;
802
803    let status = resp.status();
804    let content_type = resp
805        .headers()
806        .get("content-type")
807        .and_then(|v| v.to_str().ok())
808        .unwrap_or("application/octet-stream");
809    let content_type = super::ContentType::from(content_type);
810
811    if !status.is_client_error() && !status.is_server_error() {
812        let content = resp.text().await?;
813        match content_type {
814            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
815            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModel`"))),
816            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::TwoFactorProviderResponseModel`")))),
817        }
818    } else {
819        let content = resp.text().await?;
820        let entity: Option<TwoFactorDisablePostError> = serde_json::from_str(&content).ok();
821        Err(Error::ResponseError(ResponseContent {
822            status,
823            content,
824            entity,
825        }))
826    }
827}
828
829pub async fn two_factor_disable_put(
830    configuration: &configuration::Configuration,
831    two_factor_provider_request_model: Option<models::TwoFactorProviderRequestModel>,
832) -> Result<models::TwoFactorProviderResponseModel, Error<TwoFactorDisablePutError>> {
833    // add a prefix to parameters to efficiently prevent name collisions
834    let p_two_factor_provider_request_model = two_factor_provider_request_model;
835
836    let uri_str = format!("{}/two-factor/disable", configuration.base_path);
837    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
838
839    if let Some(ref user_agent) = configuration.user_agent {
840        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
841    }
842    if let Some(ref token) = configuration.oauth_access_token {
843        req_builder = req_builder.bearer_auth(token.to_owned());
844    };
845    req_builder = req_builder.json(&p_two_factor_provider_request_model);
846
847    let req = req_builder.build()?;
848    let resp = configuration.client.execute(req).await?;
849
850    let status = resp.status();
851    let content_type = resp
852        .headers()
853        .get("content-type")
854        .and_then(|v| v.to_str().ok())
855        .unwrap_or("application/octet-stream");
856    let content_type = super::ContentType::from(content_type);
857
858    if !status.is_client_error() && !status.is_server_error() {
859        let content = resp.text().await?;
860        match content_type {
861            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
862            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModel`"))),
863            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::TwoFactorProviderResponseModel`")))),
864        }
865    } else {
866        let content = resp.text().await?;
867        let entity: Option<TwoFactorDisablePutError> = serde_json::from_str(&content).ok();
868        Err(Error::ResponseError(ResponseContent {
869            status,
870            content,
871            entity,
872        }))
873    }
874}
875
876pub async fn two_factor_duo_post(
877    configuration: &configuration::Configuration,
878    update_two_factor_duo_request_model: Option<models::UpdateTwoFactorDuoRequestModel>,
879) -> Result<models::TwoFactorDuoResponseModel, Error<TwoFactorDuoPostError>> {
880    // add a prefix to parameters to efficiently prevent name collisions
881    let p_update_two_factor_duo_request_model = update_two_factor_duo_request_model;
882
883    let uri_str = format!("{}/two-factor/duo", configuration.base_path);
884    let mut req_builder = configuration
885        .client
886        .request(reqwest::Method::POST, &uri_str);
887
888    if let Some(ref user_agent) = configuration.user_agent {
889        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
890    }
891    if let Some(ref token) = configuration.oauth_access_token {
892        req_builder = req_builder.bearer_auth(token.to_owned());
893    };
894    req_builder = req_builder.json(&p_update_two_factor_duo_request_model);
895
896    let req = req_builder.build()?;
897    let resp = configuration.client.execute(req).await?;
898
899    let status = resp.status();
900    let content_type = resp
901        .headers()
902        .get("content-type")
903        .and_then(|v| v.to_str().ok())
904        .unwrap_or("application/octet-stream");
905    let content_type = super::ContentType::from(content_type);
906
907    if !status.is_client_error() && !status.is_server_error() {
908        let content = resp.text().await?;
909        match content_type {
910            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
911            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorDuoResponseModel`"))),
912            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::TwoFactorDuoResponseModel`")))),
913        }
914    } else {
915        let content = resp.text().await?;
916        let entity: Option<TwoFactorDuoPostError> = serde_json::from_str(&content).ok();
917        Err(Error::ResponseError(ResponseContent {
918            status,
919            content,
920            entity,
921        }))
922    }
923}
924
925pub async fn two_factor_duo_put(
926    configuration: &configuration::Configuration,
927    update_two_factor_duo_request_model: Option<models::UpdateTwoFactorDuoRequestModel>,
928) -> Result<models::TwoFactorDuoResponseModel, Error<TwoFactorDuoPutError>> {
929    // add a prefix to parameters to efficiently prevent name collisions
930    let p_update_two_factor_duo_request_model = update_two_factor_duo_request_model;
931
932    let uri_str = format!("{}/two-factor/duo", configuration.base_path);
933    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
934
935    if let Some(ref user_agent) = configuration.user_agent {
936        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
937    }
938    if let Some(ref token) = configuration.oauth_access_token {
939        req_builder = req_builder.bearer_auth(token.to_owned());
940    };
941    req_builder = req_builder.json(&p_update_two_factor_duo_request_model);
942
943    let req = req_builder.build()?;
944    let resp = configuration.client.execute(req).await?;
945
946    let status = resp.status();
947    let content_type = resp
948        .headers()
949        .get("content-type")
950        .and_then(|v| v.to_str().ok())
951        .unwrap_or("application/octet-stream");
952    let content_type = super::ContentType::from(content_type);
953
954    if !status.is_client_error() && !status.is_server_error() {
955        let content = resp.text().await?;
956        match content_type {
957            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
958            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorDuoResponseModel`"))),
959            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::TwoFactorDuoResponseModel`")))),
960        }
961    } else {
962        let content = resp.text().await?;
963        let entity: Option<TwoFactorDuoPutError> = serde_json::from_str(&content).ok();
964        Err(Error::ResponseError(ResponseContent {
965            status,
966            content,
967            entity,
968        }))
969    }
970}
971
972pub async fn two_factor_email_post(
973    configuration: &configuration::Configuration,
974    update_two_factor_email_request_model: Option<models::UpdateTwoFactorEmailRequestModel>,
975) -> Result<models::TwoFactorEmailResponseModel, Error<TwoFactorEmailPostError>> {
976    // add a prefix to parameters to efficiently prevent name collisions
977    let p_update_two_factor_email_request_model = update_two_factor_email_request_model;
978
979    let uri_str = format!("{}/two-factor/email", configuration.base_path);
980    let mut req_builder = configuration
981        .client
982        .request(reqwest::Method::POST, &uri_str);
983
984    if let Some(ref user_agent) = configuration.user_agent {
985        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
986    }
987    if let Some(ref token) = configuration.oauth_access_token {
988        req_builder = req_builder.bearer_auth(token.to_owned());
989    };
990    req_builder = req_builder.json(&p_update_two_factor_email_request_model);
991
992    let req = req_builder.build()?;
993    let resp = configuration.client.execute(req).await?;
994
995    let status = resp.status();
996    let content_type = resp
997        .headers()
998        .get("content-type")
999        .and_then(|v| v.to_str().ok())
1000        .unwrap_or("application/octet-stream");
1001    let content_type = super::ContentType::from(content_type);
1002
1003    if !status.is_client_error() && !status.is_server_error() {
1004        let content = resp.text().await?;
1005        match content_type {
1006            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1007            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorEmailResponseModel`"))),
1008            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::TwoFactorEmailResponseModel`")))),
1009        }
1010    } else {
1011        let content = resp.text().await?;
1012        let entity: Option<TwoFactorEmailPostError> = serde_json::from_str(&content).ok();
1013        Err(Error::ResponseError(ResponseContent {
1014            status,
1015            content,
1016            entity,
1017        }))
1018    }
1019}
1020
1021pub async fn two_factor_email_put(
1022    configuration: &configuration::Configuration,
1023    update_two_factor_email_request_model: Option<models::UpdateTwoFactorEmailRequestModel>,
1024) -> Result<models::TwoFactorEmailResponseModel, Error<TwoFactorEmailPutError>> {
1025    // add a prefix to parameters to efficiently prevent name collisions
1026    let p_update_two_factor_email_request_model = update_two_factor_email_request_model;
1027
1028    let uri_str = format!("{}/two-factor/email", configuration.base_path);
1029    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1030
1031    if let Some(ref user_agent) = configuration.user_agent {
1032        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1033    }
1034    if let Some(ref token) = configuration.oauth_access_token {
1035        req_builder = req_builder.bearer_auth(token.to_owned());
1036    };
1037    req_builder = req_builder.json(&p_update_two_factor_email_request_model);
1038
1039    let req = req_builder.build()?;
1040    let resp = configuration.client.execute(req).await?;
1041
1042    let status = resp.status();
1043    let content_type = resp
1044        .headers()
1045        .get("content-type")
1046        .and_then(|v| v.to_str().ok())
1047        .unwrap_or("application/octet-stream");
1048    let content_type = super::ContentType::from(content_type);
1049
1050    if !status.is_client_error() && !status.is_server_error() {
1051        let content = resp.text().await?;
1052        match content_type {
1053            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1054            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorEmailResponseModel`"))),
1055            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::TwoFactorEmailResponseModel`")))),
1056        }
1057    } else {
1058        let content = resp.text().await?;
1059        let entity: Option<TwoFactorEmailPutError> = serde_json::from_str(&content).ok();
1060        Err(Error::ResponseError(ResponseContent {
1061            status,
1062            content,
1063            entity,
1064        }))
1065    }
1066}
1067
1068pub async fn two_factor_get(
1069    configuration: &configuration::Configuration,
1070) -> Result<models::TwoFactorProviderResponseModelListResponseModel, Error<TwoFactorGetError>> {
1071    let uri_str = format!("{}/two-factor", configuration.base_path);
1072    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1073
1074    if let Some(ref user_agent) = configuration.user_agent {
1075        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1076    }
1077    if let Some(ref token) = configuration.oauth_access_token {
1078        req_builder = req_builder.bearer_auth(token.to_owned());
1079    };
1080
1081    let req = req_builder.build()?;
1082    let resp = configuration.client.execute(req).await?;
1083
1084    let status = resp.status();
1085    let content_type = resp
1086        .headers()
1087        .get("content-type")
1088        .and_then(|v| v.to_str().ok())
1089        .unwrap_or("application/octet-stream");
1090    let content_type = super::ContentType::from(content_type);
1091
1092    if !status.is_client_error() && !status.is_server_error() {
1093        let content = resp.text().await?;
1094        match content_type {
1095            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1096            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorProviderResponseModelListResponseModel`"))),
1097            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::TwoFactorProviderResponseModelListResponseModel`")))),
1098        }
1099    } else {
1100        let content = resp.text().await?;
1101        let entity: Option<TwoFactorGetError> = serde_json::from_str(&content).ok();
1102        Err(Error::ResponseError(ResponseContent {
1103            status,
1104            content,
1105            entity,
1106        }))
1107    }
1108}
1109
1110pub async fn two_factor_get_authenticator_post(
1111    configuration: &configuration::Configuration,
1112    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1113) -> Result<models::TwoFactorAuthenticatorResponseModel, Error<TwoFactorGetAuthenticatorPostError>>
1114{
1115    // add a prefix to parameters to efficiently prevent name collisions
1116    let p_secret_verification_request_model = secret_verification_request_model;
1117
1118    let uri_str = format!("{}/two-factor/get-authenticator", configuration.base_path);
1119    let mut req_builder = configuration
1120        .client
1121        .request(reqwest::Method::POST, &uri_str);
1122
1123    if let Some(ref user_agent) = configuration.user_agent {
1124        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1125    }
1126    if let Some(ref token) = configuration.oauth_access_token {
1127        req_builder = req_builder.bearer_auth(token.to_owned());
1128    };
1129    req_builder = req_builder.json(&p_secret_verification_request_model);
1130
1131    let req = req_builder.build()?;
1132    let resp = configuration.client.execute(req).await?;
1133
1134    let status = resp.status();
1135    let content_type = resp
1136        .headers()
1137        .get("content-type")
1138        .and_then(|v| v.to_str().ok())
1139        .unwrap_or("application/octet-stream");
1140    let content_type = super::ContentType::from(content_type);
1141
1142    if !status.is_client_error() && !status.is_server_error() {
1143        let content = resp.text().await?;
1144        match content_type {
1145            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1146            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorAuthenticatorResponseModel`"))),
1147            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::TwoFactorAuthenticatorResponseModel`")))),
1148        }
1149    } else {
1150        let content = resp.text().await?;
1151        let entity: Option<TwoFactorGetAuthenticatorPostError> =
1152            serde_json::from_str(&content).ok();
1153        Err(Error::ResponseError(ResponseContent {
1154            status,
1155            content,
1156            entity,
1157        }))
1158    }
1159}
1160
1161pub async fn two_factor_get_device_verification_settings_get(
1162    configuration: &configuration::Configuration,
1163) -> Result<
1164    models::DeviceVerificationResponseModel,
1165    Error<TwoFactorGetDeviceVerificationSettingsGetError>,
1166> {
1167    let uri_str = format!(
1168        "{}/two-factor/get-device-verification-settings",
1169        configuration.base_path
1170    );
1171    let mut req_builder = configuration.client.request(reqwest::Method::GET, &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.oauth_access_token {
1177        req_builder = req_builder.bearer_auth(token.to_owned());
1178    };
1179
1180    let req = req_builder.build()?;
1181    let resp = configuration.client.execute(req).await?;
1182
1183    let status = resp.status();
1184    let content_type = resp
1185        .headers()
1186        .get("content-type")
1187        .and_then(|v| v.to_str().ok())
1188        .unwrap_or("application/octet-stream");
1189    let content_type = super::ContentType::from(content_type);
1190
1191    if !status.is_client_error() && !status.is_server_error() {
1192        let content = resp.text().await?;
1193        match content_type {
1194            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1195            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceVerificationResponseModel`"))),
1196            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::DeviceVerificationResponseModel`")))),
1197        }
1198    } else {
1199        let content = resp.text().await?;
1200        let entity: Option<TwoFactorGetDeviceVerificationSettingsGetError> =
1201            serde_json::from_str(&content).ok();
1202        Err(Error::ResponseError(ResponseContent {
1203            status,
1204            content,
1205            entity,
1206        }))
1207    }
1208}
1209
1210pub async fn two_factor_get_duo_post(
1211    configuration: &configuration::Configuration,
1212    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1213) -> Result<models::TwoFactorDuoResponseModel, Error<TwoFactorGetDuoPostError>> {
1214    // add a prefix to parameters to efficiently prevent name collisions
1215    let p_secret_verification_request_model = secret_verification_request_model;
1216
1217    let uri_str = format!("{}/two-factor/get-duo", configuration.base_path);
1218    let mut req_builder = configuration
1219        .client
1220        .request(reqwest::Method::POST, &uri_str);
1221
1222    if let Some(ref user_agent) = configuration.user_agent {
1223        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1224    }
1225    if let Some(ref token) = configuration.oauth_access_token {
1226        req_builder = req_builder.bearer_auth(token.to_owned());
1227    };
1228    req_builder = req_builder.json(&p_secret_verification_request_model);
1229
1230    let req = req_builder.build()?;
1231    let resp = configuration.client.execute(req).await?;
1232
1233    let status = resp.status();
1234    let content_type = resp
1235        .headers()
1236        .get("content-type")
1237        .and_then(|v| v.to_str().ok())
1238        .unwrap_or("application/octet-stream");
1239    let content_type = super::ContentType::from(content_type);
1240
1241    if !status.is_client_error() && !status.is_server_error() {
1242        let content = resp.text().await?;
1243        match content_type {
1244            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1245            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorDuoResponseModel`"))),
1246            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::TwoFactorDuoResponseModel`")))),
1247        }
1248    } else {
1249        let content = resp.text().await?;
1250        let entity: Option<TwoFactorGetDuoPostError> = serde_json::from_str(&content).ok();
1251        Err(Error::ResponseError(ResponseContent {
1252            status,
1253            content,
1254            entity,
1255        }))
1256    }
1257}
1258
1259pub async fn two_factor_get_email_post(
1260    configuration: &configuration::Configuration,
1261    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1262) -> Result<models::TwoFactorEmailResponseModel, Error<TwoFactorGetEmailPostError>> {
1263    // add a prefix to parameters to efficiently prevent name collisions
1264    let p_secret_verification_request_model = secret_verification_request_model;
1265
1266    let uri_str = format!("{}/two-factor/get-email", configuration.base_path);
1267    let mut req_builder = configuration
1268        .client
1269        .request(reqwest::Method::POST, &uri_str);
1270
1271    if let Some(ref user_agent) = configuration.user_agent {
1272        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1273    }
1274    if let Some(ref token) = configuration.oauth_access_token {
1275        req_builder = req_builder.bearer_auth(token.to_owned());
1276    };
1277    req_builder = req_builder.json(&p_secret_verification_request_model);
1278
1279    let req = req_builder.build()?;
1280    let resp = configuration.client.execute(req).await?;
1281
1282    let status = resp.status();
1283    let content_type = resp
1284        .headers()
1285        .get("content-type")
1286        .and_then(|v| v.to_str().ok())
1287        .unwrap_or("application/octet-stream");
1288    let content_type = super::ContentType::from(content_type);
1289
1290    if !status.is_client_error() && !status.is_server_error() {
1291        let content = resp.text().await?;
1292        match content_type {
1293            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1294            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorEmailResponseModel`"))),
1295            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::TwoFactorEmailResponseModel`")))),
1296        }
1297    } else {
1298        let content = resp.text().await?;
1299        let entity: Option<TwoFactorGetEmailPostError> = serde_json::from_str(&content).ok();
1300        Err(Error::ResponseError(ResponseContent {
1301            status,
1302            content,
1303            entity,
1304        }))
1305    }
1306}
1307
1308pub async fn two_factor_get_recover_post(
1309    configuration: &configuration::Configuration,
1310    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1311) -> Result<models::TwoFactorRecoverResponseModel, Error<TwoFactorGetRecoverPostError>> {
1312    // add a prefix to parameters to efficiently prevent name collisions
1313    let p_secret_verification_request_model = secret_verification_request_model;
1314
1315    let uri_str = format!("{}/two-factor/get-recover", configuration.base_path);
1316    let mut req_builder = configuration
1317        .client
1318        .request(reqwest::Method::POST, &uri_str);
1319
1320    if let Some(ref user_agent) = configuration.user_agent {
1321        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1322    }
1323    if let Some(ref token) = configuration.oauth_access_token {
1324        req_builder = req_builder.bearer_auth(token.to_owned());
1325    };
1326    req_builder = req_builder.json(&p_secret_verification_request_model);
1327
1328    let req = req_builder.build()?;
1329    let resp = configuration.client.execute(req).await?;
1330
1331    let status = resp.status();
1332    let content_type = resp
1333        .headers()
1334        .get("content-type")
1335        .and_then(|v| v.to_str().ok())
1336        .unwrap_or("application/octet-stream");
1337    let content_type = super::ContentType::from(content_type);
1338
1339    if !status.is_client_error() && !status.is_server_error() {
1340        let content = resp.text().await?;
1341        match content_type {
1342            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1343            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorRecoverResponseModel`"))),
1344            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::TwoFactorRecoverResponseModel`")))),
1345        }
1346    } else {
1347        let content = resp.text().await?;
1348        let entity: Option<TwoFactorGetRecoverPostError> = serde_json::from_str(&content).ok();
1349        Err(Error::ResponseError(ResponseContent {
1350            status,
1351            content,
1352            entity,
1353        }))
1354    }
1355}
1356
1357pub async fn two_factor_get_webauthn_post(
1358    configuration: &configuration::Configuration,
1359    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1360) -> Result<models::TwoFactorWebAuthnResponseModel, Error<TwoFactorGetWebauthnPostError>> {
1361    // add a prefix to parameters to efficiently prevent name collisions
1362    let p_secret_verification_request_model = secret_verification_request_model;
1363
1364    let uri_str = format!("{}/two-factor/get-webauthn", configuration.base_path);
1365    let mut req_builder = configuration
1366        .client
1367        .request(reqwest::Method::POST, &uri_str);
1368
1369    if let Some(ref user_agent) = configuration.user_agent {
1370        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1371    }
1372    if let Some(ref token) = configuration.oauth_access_token {
1373        req_builder = req_builder.bearer_auth(token.to_owned());
1374    };
1375    req_builder = req_builder.json(&p_secret_verification_request_model);
1376
1377    let req = req_builder.build()?;
1378    let resp = configuration.client.execute(req).await?;
1379
1380    let status = resp.status();
1381    let content_type = resp
1382        .headers()
1383        .get("content-type")
1384        .and_then(|v| v.to_str().ok())
1385        .unwrap_or("application/octet-stream");
1386    let content_type = super::ContentType::from(content_type);
1387
1388    if !status.is_client_error() && !status.is_server_error() {
1389        let content = resp.text().await?;
1390        match content_type {
1391            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1392            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorWebAuthnResponseModel`"))),
1393            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::TwoFactorWebAuthnResponseModel`")))),
1394        }
1395    } else {
1396        let content = resp.text().await?;
1397        let entity: Option<TwoFactorGetWebauthnPostError> = serde_json::from_str(&content).ok();
1398        Err(Error::ResponseError(ResponseContent {
1399            status,
1400            content,
1401            entity,
1402        }))
1403    }
1404}
1405
1406pub async fn two_factor_get_yubikey_post(
1407    configuration: &configuration::Configuration,
1408    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1409) -> Result<models::TwoFactorYubiKeyResponseModel, Error<TwoFactorGetYubikeyPostError>> {
1410    // add a prefix to parameters to efficiently prevent name collisions
1411    let p_secret_verification_request_model = secret_verification_request_model;
1412
1413    let uri_str = format!("{}/two-factor/get-yubikey", configuration.base_path);
1414    let mut req_builder = configuration
1415        .client
1416        .request(reqwest::Method::POST, &uri_str);
1417
1418    if let Some(ref user_agent) = configuration.user_agent {
1419        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1420    }
1421    if let Some(ref token) = configuration.oauth_access_token {
1422        req_builder = req_builder.bearer_auth(token.to_owned());
1423    };
1424    req_builder = req_builder.json(&p_secret_verification_request_model);
1425
1426    let req = req_builder.build()?;
1427    let resp = configuration.client.execute(req).await?;
1428
1429    let status = resp.status();
1430    let content_type = resp
1431        .headers()
1432        .get("content-type")
1433        .and_then(|v| v.to_str().ok())
1434        .unwrap_or("application/octet-stream");
1435    let content_type = super::ContentType::from(content_type);
1436
1437    if !status.is_client_error() && !status.is_server_error() {
1438        let content = resp.text().await?;
1439        match content_type {
1440            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1441            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorYubiKeyResponseModel`"))),
1442            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::TwoFactorYubiKeyResponseModel`")))),
1443        }
1444    } else {
1445        let content = resp.text().await?;
1446        let entity: Option<TwoFactorGetYubikeyPostError> = serde_json::from_str(&content).ok();
1447        Err(Error::ResponseError(ResponseContent {
1448            status,
1449            content,
1450            entity,
1451        }))
1452    }
1453}
1454
1455pub async fn two_factor_recover_post(
1456    configuration: &configuration::Configuration,
1457    two_factor_recovery_request_model: Option<models::TwoFactorRecoveryRequestModel>,
1458) -> Result<(), Error<TwoFactorRecoverPostError>> {
1459    // add a prefix to parameters to efficiently prevent name collisions
1460    let p_two_factor_recovery_request_model = two_factor_recovery_request_model;
1461
1462    let uri_str = format!("{}/two-factor/recover", configuration.base_path);
1463    let mut req_builder = configuration
1464        .client
1465        .request(reqwest::Method::POST, &uri_str);
1466
1467    if let Some(ref user_agent) = configuration.user_agent {
1468        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1469    }
1470    if let Some(ref token) = configuration.oauth_access_token {
1471        req_builder = req_builder.bearer_auth(token.to_owned());
1472    };
1473    req_builder = req_builder.json(&p_two_factor_recovery_request_model);
1474
1475    let req = req_builder.build()?;
1476    let resp = configuration.client.execute(req).await?;
1477
1478    let status = resp.status();
1479
1480    if !status.is_client_error() && !status.is_server_error() {
1481        Ok(())
1482    } else {
1483        let content = resp.text().await?;
1484        let entity: Option<TwoFactorRecoverPostError> = serde_json::from_str(&content).ok();
1485        Err(Error::ResponseError(ResponseContent {
1486            status,
1487            content,
1488            entity,
1489        }))
1490    }
1491}
1492
1493pub async fn two_factor_send_email_login_post(
1494    configuration: &configuration::Configuration,
1495    two_factor_email_request_model: Option<models::TwoFactorEmailRequestModel>,
1496) -> Result<(), Error<TwoFactorSendEmailLoginPostError>> {
1497    // add a prefix to parameters to efficiently prevent name collisions
1498    let p_two_factor_email_request_model = two_factor_email_request_model;
1499
1500    let uri_str = format!("{}/two-factor/send-email-login", configuration.base_path);
1501    let mut req_builder = configuration
1502        .client
1503        .request(reqwest::Method::POST, &uri_str);
1504
1505    if let Some(ref user_agent) = configuration.user_agent {
1506        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1507    }
1508    if let Some(ref token) = configuration.oauth_access_token {
1509        req_builder = req_builder.bearer_auth(token.to_owned());
1510    };
1511    req_builder = req_builder.json(&p_two_factor_email_request_model);
1512
1513    let req = req_builder.build()?;
1514    let resp = configuration.client.execute(req).await?;
1515
1516    let status = resp.status();
1517
1518    if !status.is_client_error() && !status.is_server_error() {
1519        Ok(())
1520    } else {
1521        let content = resp.text().await?;
1522        let entity: Option<TwoFactorSendEmailLoginPostError> = serde_json::from_str(&content).ok();
1523        Err(Error::ResponseError(ResponseContent {
1524            status,
1525            content,
1526            entity,
1527        }))
1528    }
1529}
1530
1531pub async fn two_factor_send_email_post(
1532    configuration: &configuration::Configuration,
1533    two_factor_email_request_model: Option<models::TwoFactorEmailRequestModel>,
1534) -> Result<(), Error<TwoFactorSendEmailPostError>> {
1535    // add a prefix to parameters to efficiently prevent name collisions
1536    let p_two_factor_email_request_model = two_factor_email_request_model;
1537
1538    let uri_str = format!("{}/two-factor/send-email", configuration.base_path);
1539    let mut req_builder = configuration
1540        .client
1541        .request(reqwest::Method::POST, &uri_str);
1542
1543    if let Some(ref user_agent) = configuration.user_agent {
1544        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1545    }
1546    if let Some(ref token) = configuration.oauth_access_token {
1547        req_builder = req_builder.bearer_auth(token.to_owned());
1548    };
1549    req_builder = req_builder.json(&p_two_factor_email_request_model);
1550
1551    let req = req_builder.build()?;
1552    let resp = configuration.client.execute(req).await?;
1553
1554    let status = resp.status();
1555
1556    if !status.is_client_error() && !status.is_server_error() {
1557        Ok(())
1558    } else {
1559        let content = resp.text().await?;
1560        let entity: Option<TwoFactorSendEmailPostError> = serde_json::from_str(&content).ok();
1561        Err(Error::ResponseError(ResponseContent {
1562            status,
1563            content,
1564            entity,
1565        }))
1566    }
1567}
1568
1569pub async fn two_factor_webauthn_delete(
1570    configuration: &configuration::Configuration,
1571    two_factor_web_authn_delete_request_model: Option<models::TwoFactorWebAuthnDeleteRequestModel>,
1572) -> Result<models::TwoFactorWebAuthnResponseModel, Error<TwoFactorWebauthnDeleteError>> {
1573    // add a prefix to parameters to efficiently prevent name collisions
1574    let p_two_factor_web_authn_delete_request_model = two_factor_web_authn_delete_request_model;
1575
1576    let uri_str = format!("{}/two-factor/webauthn", configuration.base_path);
1577    let mut req_builder = configuration
1578        .client
1579        .request(reqwest::Method::DELETE, &uri_str);
1580
1581    if let Some(ref user_agent) = configuration.user_agent {
1582        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1583    }
1584    if let Some(ref token) = configuration.oauth_access_token {
1585        req_builder = req_builder.bearer_auth(token.to_owned());
1586    };
1587    req_builder = req_builder.json(&p_two_factor_web_authn_delete_request_model);
1588
1589    let req = req_builder.build()?;
1590    let resp = configuration.client.execute(req).await?;
1591
1592    let status = resp.status();
1593    let content_type = resp
1594        .headers()
1595        .get("content-type")
1596        .and_then(|v| v.to_str().ok())
1597        .unwrap_or("application/octet-stream");
1598    let content_type = super::ContentType::from(content_type);
1599
1600    if !status.is_client_error() && !status.is_server_error() {
1601        let content = resp.text().await?;
1602        match content_type {
1603            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1604            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorWebAuthnResponseModel`"))),
1605            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::TwoFactorWebAuthnResponseModel`")))),
1606        }
1607    } else {
1608        let content = resp.text().await?;
1609        let entity: Option<TwoFactorWebauthnDeleteError> = serde_json::from_str(&content).ok();
1610        Err(Error::ResponseError(ResponseContent {
1611            status,
1612            content,
1613            entity,
1614        }))
1615    }
1616}
1617
1618pub async fn two_factor_webauthn_post(
1619    configuration: &configuration::Configuration,
1620    two_factor_web_authn_request_model: Option<models::TwoFactorWebAuthnRequestModel>,
1621) -> Result<models::TwoFactorWebAuthnResponseModel, Error<TwoFactorWebauthnPostError>> {
1622    // add a prefix to parameters to efficiently prevent name collisions
1623    let p_two_factor_web_authn_request_model = two_factor_web_authn_request_model;
1624
1625    let uri_str = format!("{}/two-factor/webauthn", configuration.base_path);
1626    let mut req_builder = configuration
1627        .client
1628        .request(reqwest::Method::POST, &uri_str);
1629
1630    if let Some(ref user_agent) = configuration.user_agent {
1631        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1632    }
1633    if let Some(ref token) = configuration.oauth_access_token {
1634        req_builder = req_builder.bearer_auth(token.to_owned());
1635    };
1636    req_builder = req_builder.json(&p_two_factor_web_authn_request_model);
1637
1638    let req = req_builder.build()?;
1639    let resp = configuration.client.execute(req).await?;
1640
1641    let status = resp.status();
1642    let content_type = resp
1643        .headers()
1644        .get("content-type")
1645        .and_then(|v| v.to_str().ok())
1646        .unwrap_or("application/octet-stream");
1647    let content_type = super::ContentType::from(content_type);
1648
1649    if !status.is_client_error() && !status.is_server_error() {
1650        let content = resp.text().await?;
1651        match content_type {
1652            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1653            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorWebAuthnResponseModel`"))),
1654            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::TwoFactorWebAuthnResponseModel`")))),
1655        }
1656    } else {
1657        let content = resp.text().await?;
1658        let entity: Option<TwoFactorWebauthnPostError> = serde_json::from_str(&content).ok();
1659        Err(Error::ResponseError(ResponseContent {
1660            status,
1661            content,
1662            entity,
1663        }))
1664    }
1665}
1666
1667pub async fn two_factor_webauthn_put(
1668    configuration: &configuration::Configuration,
1669    two_factor_web_authn_request_model: Option<models::TwoFactorWebAuthnRequestModel>,
1670) -> Result<models::TwoFactorWebAuthnResponseModel, Error<TwoFactorWebauthnPutError>> {
1671    // add a prefix to parameters to efficiently prevent name collisions
1672    let p_two_factor_web_authn_request_model = two_factor_web_authn_request_model;
1673
1674    let uri_str = format!("{}/two-factor/webauthn", configuration.base_path);
1675    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1676
1677    if let Some(ref user_agent) = configuration.user_agent {
1678        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1679    }
1680    if let Some(ref token) = configuration.oauth_access_token {
1681        req_builder = req_builder.bearer_auth(token.to_owned());
1682    };
1683    req_builder = req_builder.json(&p_two_factor_web_authn_request_model);
1684
1685    let req = req_builder.build()?;
1686    let resp = configuration.client.execute(req).await?;
1687
1688    let status = resp.status();
1689    let content_type = resp
1690        .headers()
1691        .get("content-type")
1692        .and_then(|v| v.to_str().ok())
1693        .unwrap_or("application/octet-stream");
1694    let content_type = super::ContentType::from(content_type);
1695
1696    if !status.is_client_error() && !status.is_server_error() {
1697        let content = resp.text().await?;
1698        match content_type {
1699            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1700            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorWebAuthnResponseModel`"))),
1701            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::TwoFactorWebAuthnResponseModel`")))),
1702        }
1703    } else {
1704        let content = resp.text().await?;
1705        let entity: Option<TwoFactorWebauthnPutError> = serde_json::from_str(&content).ok();
1706        Err(Error::ResponseError(ResponseContent {
1707            status,
1708            content,
1709            entity,
1710        }))
1711    }
1712}
1713
1714pub async fn two_factor_yubikey_post(
1715    configuration: &configuration::Configuration,
1716    update_two_factor_yubico_otp_request_model: Option<
1717        models::UpdateTwoFactorYubicoOtpRequestModel,
1718    >,
1719) -> Result<models::TwoFactorYubiKeyResponseModel, Error<TwoFactorYubikeyPostError>> {
1720    // add a prefix to parameters to efficiently prevent name collisions
1721    let p_update_two_factor_yubico_otp_request_model = update_two_factor_yubico_otp_request_model;
1722
1723    let uri_str = format!("{}/two-factor/yubikey", configuration.base_path);
1724    let mut req_builder = configuration
1725        .client
1726        .request(reqwest::Method::POST, &uri_str);
1727
1728    if let Some(ref user_agent) = configuration.user_agent {
1729        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1730    }
1731    if let Some(ref token) = configuration.oauth_access_token {
1732        req_builder = req_builder.bearer_auth(token.to_owned());
1733    };
1734    req_builder = req_builder.json(&p_update_two_factor_yubico_otp_request_model);
1735
1736    let req = req_builder.build()?;
1737    let resp = configuration.client.execute(req).await?;
1738
1739    let status = resp.status();
1740    let content_type = resp
1741        .headers()
1742        .get("content-type")
1743        .and_then(|v| v.to_str().ok())
1744        .unwrap_or("application/octet-stream");
1745    let content_type = super::ContentType::from(content_type);
1746
1747    if !status.is_client_error() && !status.is_server_error() {
1748        let content = resp.text().await?;
1749        match content_type {
1750            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1751            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorYubiKeyResponseModel`"))),
1752            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::TwoFactorYubiKeyResponseModel`")))),
1753        }
1754    } else {
1755        let content = resp.text().await?;
1756        let entity: Option<TwoFactorYubikeyPostError> = serde_json::from_str(&content).ok();
1757        Err(Error::ResponseError(ResponseContent {
1758            status,
1759            content,
1760            entity,
1761        }))
1762    }
1763}
1764
1765pub async fn two_factor_yubikey_put(
1766    configuration: &configuration::Configuration,
1767    update_two_factor_yubico_otp_request_model: Option<
1768        models::UpdateTwoFactorYubicoOtpRequestModel,
1769    >,
1770) -> Result<models::TwoFactorYubiKeyResponseModel, Error<TwoFactorYubikeyPutError>> {
1771    // add a prefix to parameters to efficiently prevent name collisions
1772    let p_update_two_factor_yubico_otp_request_model = update_two_factor_yubico_otp_request_model;
1773
1774    let uri_str = format!("{}/two-factor/yubikey", configuration.base_path);
1775    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1776
1777    if let Some(ref user_agent) = configuration.user_agent {
1778        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1779    }
1780    if let Some(ref token) = configuration.oauth_access_token {
1781        req_builder = req_builder.bearer_auth(token.to_owned());
1782    };
1783    req_builder = req_builder.json(&p_update_two_factor_yubico_otp_request_model);
1784
1785    let req = req_builder.build()?;
1786    let resp = configuration.client.execute(req).await?;
1787
1788    let status = resp.status();
1789    let content_type = resp
1790        .headers()
1791        .get("content-type")
1792        .and_then(|v| v.to_str().ok())
1793        .unwrap_or("application/octet-stream");
1794    let content_type = super::ContentType::from(content_type);
1795
1796    if !status.is_client_error() && !status.is_server_error() {
1797        let content = resp.text().await?;
1798        match content_type {
1799            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1800            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TwoFactorYubiKeyResponseModel`"))),
1801            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::TwoFactorYubiKeyResponseModel`")))),
1802        }
1803    } else {
1804        let content = resp.text().await?;
1805        let entity: Option<TwoFactorYubikeyPutError> = serde_json::from_str(&content).ok();
1806        Err(Error::ResponseError(ResponseContent {
1807            status,
1808            content,
1809            entity,
1810        }))
1811    }
1812}