Skip to main content

bitwarden_api_api/models/
email_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/// EmailRequestModel : This model is used in the second step of self service email change after the
16/// master password hash has been verified. The token is used to verify ownership of the new email.
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
18pub struct EmailRequestModel {
19    #[serde(
20        rename = "masterPasswordHash",
21        alias = "MasterPasswordHash",
22        skip_serializing_if = "Option::is_none"
23    )]
24    pub master_password_hash: Option<String>,
25    #[serde(rename = "otp", alias = "Otp", skip_serializing_if = "Option::is_none")]
26    pub otp: Option<String>,
27    #[serde(
28        rename = "authRequestAccessCode",
29        alias = "AuthRequestAccessCode",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub auth_request_access_code: Option<String>,
33    #[serde(
34        rename = "secret",
35        alias = "Secret",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub secret: Option<String>,
39    #[serde(rename = "newEmail", alias = "NewEmail")]
40    pub new_email: String,
41    #[serde(
42        rename = "newMasterPasswordHash",
43        alias = "NewMasterPasswordHash",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub new_master_password_hash: Option<String>,
47    #[serde(rename = "token", alias = "Token")]
48    pub token: String,
49    #[serde(rename = "key", alias = "Key", skip_serializing_if = "Option::is_none")]
50    pub key: Option<String>,
51}
52
53impl EmailRequestModel {
54    /// This model is used in the second step of self service email change after the master password
55    /// hash has been verified. The token is used to verify ownership of the new email.
56    pub fn new(new_email: String, token: String) -> EmailRequestModel {
57        EmailRequestModel {
58            master_password_hash: None,
59            otp: None,
60            auth_request_access_code: None,
61            secret: None,
62            new_email,
63            new_master_password_hash: None,
64            token,
65            key: None,
66        }
67    }
68}