1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! Email management types.
use serde::{Deserialize, Serialize};
/// Parsed wizard page parameters from Steam Help pages.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct WizardPageParams {
/// Session ID for the wizard flow.
pub session_id: String,
/// Issue-specific parameters.
pub issue: WizardIssue,
/// Default wizard page parameters extracted from JavaScript.
pub default_params: WizardDefaultParams,
}
/// Issue-specific form fields for the wizard.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct WizardIssue {
/// The 's' parameter (session identifier).
pub s: String,
/// Reset parameter.
pub reset: String,
/// Lost parameter.
pub lost: String,
/// Method parameter (e.g., "8" for mobile confirmation).
pub method: String,
/// Issue ID.
pub issueid: String,
}
/// Default wizard parameters extracted from JavaScript.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct WizardDefaultParams {
/// Account ID (miniprofile).
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<u32>,
/// Wizard session token.
#[serde(skip_serializing_if = "Option::is_none")]
pub wizard: Option<String>,
/// Other parameters that may vary.
#[serde(flatten)]
pub extra: std::collections::HashMap<String, String>,
}
/// Result of an email change operation.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "status", content = "message")]
pub enum ChangeEmailResult {
/// Email change was successful.
Success,
/// Email change failed with an error message.
Error(String),
}
impl ChangeEmailResult {
/// Returns true if the email change was successful.
pub fn is_success(&self) -> bool {
matches!(self, ChangeEmailResult::Success)
}
/// Returns the error message if the operation failed.
pub fn error_message(&self) -> Option<&str> {
match self {
ChangeEmailResult::Error(msg) => Some(msg),
_ => None,
}
}
}
/// Status from polling account recovery confirmation.
#[derive(Debug, Clone, Deserialize)]
pub struct AccountRecoveryStatus {
/// Whether to continue polling.
#[serde(default)]
pub r#continue: bool,
/// Whether the confirmation was successful.
#[serde(default)]
pub success: bool,
/// Error message if any.
#[serde(default)]
pub error: Option<String>,
}
/// Response from submitting a new email.
#[derive(Debug, Clone, Deserialize)]
pub struct SubmitEmailResponse {
/// Hash/URL for next step if successful.
#[serde(default)]
pub hash: String,
/// Error message if failed.
#[serde(rename = "errorMsg", default)]
pub error_msg: String,
/// Whether to show confirmation dialog.
#[serde(default)]
pub show_confirmation: bool,
}
/// Response from confirming new email with OTP.
#[derive(Debug, Clone, Deserialize)]
pub struct ConfirmEmailResponse {
/// Hash/URL containing result - success if contains
/// "HelpWithLoginInfoComplete".
#[serde(default)]
pub hash: String,
/// Error message if failed.
#[serde(rename = "errorMsg", default)]
pub error_msg: String,
/// Whether to show confirmation dialog.
#[serde(default)]
pub show_confirmation: bool,
}
/// Response from sending account recovery code.
#[derive(Debug, Clone, Deserialize)]
pub struct SendRecoveryCodeResponse {
/// Whether the operation was successful.
#[serde(default)]
pub success: bool,
}