Skip to main content

bitwarden_api_api/models/
two_factor_email_update_request_model.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 serde::{Deserialize, Serialize};
12
13use crate::models;
14
15/// TwoFactorEmailUpdateRequestModel : Request body for the authenticated setup endpoint that
16/// completes Email 2FA enrollment by replaying the OTP from the previous setup step. Authenticated
17/// by the same user-verification token.
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct TwoFactorEmailUpdateRequestModel {
20    #[serde(rename = "email", alias = "Email")]
21    pub email: String,
22    /// User-verification token bound to `UserId + ProviderType`. Minted by the matching GET
23    /// endpoint and replayed on subsequent management calls so the user does not have to
24    /// re-verify.
25    #[serde(rename = "userVerificationToken", alias = "UserVerificationToken")]
26    pub user_verification_token: String,
27    #[serde(rename = "token", alias = "Token")]
28    pub token: String,
29}
30
31impl TwoFactorEmailUpdateRequestModel {
32    /// Request body for the authenticated setup endpoint that completes Email 2FA enrollment by
33    /// replaying the OTP from the previous setup step. Authenticated by the same user-verification
34    /// token.
35    pub fn new(
36        email: String,
37        user_verification_token: String,
38        token: String,
39    ) -> TwoFactorEmailUpdateRequestModel {
40        TwoFactorEmailUpdateRequestModel {
41            email,
42            user_verification_token,
43            token,
44        }
45    }
46}