1use serde::{Deserialize, Serialize};
4use steamid::SteamID;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct TwoFactorResponse {
9 pub status: i32,
11 pub shared_secret: Option<String>,
13 pub identity_secret: Option<String>,
15 pub secret_1: Option<String>,
17 pub revocation_code: Option<String>,
19 pub serial_number: Option<u64>,
21 pub uri: Option<String>,
23 pub server_time: Option<u64>,
25 pub account_name: Option<String>,
27 pub token_gid: Option<String>,
29 pub confirm_type: Option<i32>,
31 pub phone_number_hint: Option<String>,
33}
34
35impl TwoFactorResponse {
36 pub fn setup_instructions(&self) -> String {
39 let mut s = String::new();
40 s.push_str("=== Steam Authenticator Setup ===\n");
41 if let Some(ref secret) = self.shared_secret {
42 s.push_str(&format!("Shared Secret: {}\n", secret));
43 }
44 if let Some(ref secret) = self.identity_secret {
45 s.push_str(&format!("Identity Secret: {}\n", secret));
46 }
47 if let Some(ref code) = self.revocation_code {
48 s.push_str(&format!("Revocation Code: {}\n", code));
49 }
50 if let Some(ref serial) = self.serial_number {
51 s.push_str(&format!("Serial Number: {}\n", serial));
52 }
53 if let Some(ref uri) = self.uri {
54 s.push_str(&format!("OTP URI: {}\n", uri));
55 }
56 s.push_str("==================================\n");
57 s.push_str("IMPORTANT: Save your Revocation Code! You will need it if you lose access to your authenticator.\n");
58 s.push_str("To finalize, call `finalize_authenticator(sms_code)` with the code you received via SMS.\n");
59 s
60 }
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct UserComment {
66 pub id: String,
68 pub author: CommentAuthor,
70 pub timestamp: u64,
72 pub content: String,
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
78pub struct CommentAuthor {
79 pub steam_id: Option<SteamID>,
81 pub name: String,
83 pub avatar: String,
85 pub avatar_hash: String,
87 pub profile_url: Option<String>,
89 pub custom_url: Option<String>,
91 pub miniprofile: Option<u64>,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97pub struct AliasEntry {
98 pub newname: String,
100 pub timechanged: String,
102}
103
104#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
106#[non_exhaustive]
107pub enum SteamGuardStatus {
108 Mobile,
110 Email,
112 None,
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize, Default)]
121pub struct FriendPageInfo {
122 #[serde(default)]
124 pub persona_name: String,
125 #[serde(default)]
127 pub profile_url: String,
128 #[serde(default)]
130 pub steam_id: SteamID,
131 #[serde(default)]
133 pub friends_count: u32,
134 #[serde(default)]
136 pub friends_pending_count: u32,
137 #[serde(default)]
139 pub blocked_count: u32,
140 #[serde(default)]
142 pub following_count: u32,
143 #[serde(default)]
145 pub groups_count: u32,
146 #[serde(default)]
148 pub groups_pending_count: u32,
149 #[serde(default)]
151 pub friends_limit: u32,
152 #[serde(default)]
154 pub wallet_balance: Option<super::account::WalletBalance>,
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize, Default)]
162pub struct FriendListPage {
163 pub friends: Vec<FriendDetails>,
165 pub page_info: Option<FriendPageInfo>,
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize, Default)]
171pub struct FriendDetails {
172 #[serde(alias = "name")]
174 pub username: String,
175 #[serde(default)]
177 pub steam_id: SteamID,
178 #[serde(default)]
180 pub game: String,
181 #[serde(default)]
183 pub online_status: String,
184 #[serde(default)]
186 pub last_online: String,
187 #[serde(default)]
189 pub miniprofile: u64,
190 #[serde(default)]
192 pub is_nickname: bool,
193 #[serde(default)]
195 pub avatar: String,
196 #[serde(default)]
198 pub avatar_hash: String,
199 #[serde(default)]
201 pub profile_url: String,
202 #[serde(default)]
204 pub custom_url: Option<String>,
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209pub struct CommunitySearchPlayer {
210 pub miniprofile: u64,
212 pub steam_id: SteamID,
214 pub avatar_hash: String,
216 pub name: String,
218 pub profile_url: String,
220 pub custom_url: Option<String>,
222}
223
224#[derive(Debug, Clone, Serialize, Deserialize)]
226pub struct CommunitySearchResult {
227 pub players: Vec<CommunitySearchPlayer>,
229 pub prev_page: Option<u32>,
231 pub next_page: Option<u32>,
233 pub search_filter: String,
235 pub search_page: u32,
237 pub search_result_count: u32,
239 pub search_text: String,
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245pub struct QuickInviteData {
246 pub success: bool,
248 pub invite_token: Option<String>,
250 pub invite_limit: Option<i32>,
252 pub invite_duration: Option<i32>,
254 pub time_created: Option<u64>,
256 pub steam_id: Option<SteamID>,
258}
259
260#[derive(Debug, Clone, Serialize, Deserialize)]
262pub struct QuickInviteTokensResponse {
263 pub success: bool,
265 pub tokens: Vec<QuickInviteToken>,
267}
268
269#[derive(Debug, Clone, Serialize, Deserialize)]
271pub struct QuickInviteToken {
272 pub invite_token: String,
274 pub invite_limit: i32,
276 pub invite_duration: i32,
278 pub time_created: u64,
280 pub steam_id: Option<SteamID>,
282}
283
284#[derive(Debug, Clone, Serialize, Deserialize)]
286pub struct PendingFriend {
287 pub name: String,
289 pub link: String,
291 pub avatar: String,
293 pub steam_id: SteamID,
295 pub account_id: u32,
297 pub level: u32,
299}
300
301#[derive(Debug, Clone, Serialize, Deserialize)]
303pub struct PendingFriendList {
304 pub sent_invites: Vec<PendingFriend>,
306 pub received_invites: Vec<PendingFriend>,
308}