Skip to main content

steam_client/
types.rs

1//! Type definitions for Steam client.
2
3use steam_enums::EResult;
4use steamid::SteamID;
5
6/// Details for logging on to Steam.
7#[derive(Debug, Clone, Default)]
8pub struct LogOnDetails {
9    /// Anonymous login (no credentials required).
10    pub anonymous: bool,
11
12    /// Refresh token for authentication.
13    pub refresh_token: Option<String>,
14
15    /// Account name (for password auth).
16    pub account_name: Option<String>,
17
18    /// Password (for password auth).
19    pub password: Option<String>,
20
21    /// Steam Guard email code.
22    pub auth_code: Option<String>,
23
24    /// Two-factor authentication code.
25    pub two_factor_code: Option<String>,
26
27    /// Machine auth token for Steam Guard.
28    pub machine_auth_token: Option<String>,
29
30    /// Logon ID (for avoiding "logged in elsewhere" errors).
31    pub logon_id: Option<u32>,
32
33    /// Machine name to report to Steam.
34    pub machine_name: Option<String>,
35
36    /// Machine ID (binary blob) for Steam Guard.
37    pub machine_id: Option<Vec<u8>>,
38
39    /// Web logon token from /chat/clientjstoken endpoint.
40    /// Used with steam_id for cookie-based authentication.
41    pub web_logon_token: Option<String>,
42
43    /// SteamID for web logon token authentication.
44    /// Required when using web_logon_token.
45    pub steam_id: Option<SteamID>,
46
47    /// Client OS type.
48    pub client_os_type: Option<u32>,
49}
50
51/// Response from a successful login.
52#[derive(Debug, Clone)]
53pub struct LogOnResponse {
54    /// The result code.
55    pub eresult: EResult,
56
57    /// The logged-in SteamID.
58    pub steam_id: SteamID,
59
60    /// Public IP address as seen by Steam.
61    pub public_ip: Option<String>,
62
63    /// Cell ID for content servers.
64    pub cell_id: u32,
65
66    /// Vanity URL.
67    pub vanity_url: Option<String>,
68
69    /// Email domain for the account (if any).
70    pub email_domain: Option<String>,
71
72    /// Whether Steam Guard is enabled.
73    pub steam_guard_required: bool,
74
75    /// Heartbeat interval in seconds (for keep-alive).
76    pub heartbeat_seconds: Option<i32>,
77
78    /// Server time as Unix timestamp.
79    pub server_time: Option<u32>,
80
81    /// Account flags bitfield.
82    pub account_flags: Option<u32>,
83
84    /// User's country code.
85    pub user_country: Option<String>,
86
87    /// Country code based on IP address.
88    pub ip_country_code: Option<String>,
89
90    /// Client instance ID.
91    pub client_instance_id: Option<u64>,
92
93    /// Token ID for the session.
94    pub token_id: Option<u64>,
95
96    /// Family group ID (if in a family group).
97    pub family_group_id: Option<u64>,
98
99    /// Extended result code (for more detailed error info).
100    pub eresult_extended: Option<i32>,
101
102    /// Cell ID ping threshold.
103    pub cell_id_ping_threshold: Option<u32>,
104
105    /// Whether a client update check is required.
106    pub force_client_update_check: Option<bool>,
107
108    /// Agreement session URL (if user needs to accept agreements).
109    pub agreement_session_url: Option<String>,
110
111    /// Legacy out-of-game heartbeat interval.
112    pub legacy_out_of_game_heartbeat_seconds: Option<i32>,
113
114    /// Parental settings (serialized protobuf).
115    pub parental_settings: Option<Vec<u8>>,
116
117    /// Parental setting signature.
118    pub parental_setting_signature: Option<Vec<u8>>,
119
120    /// Count of login failures to migrate.
121    pub count_loginfailures_to_migrate: Option<i32>,
122
123    /// Count of disconnects to migrate.
124    pub count_disconnects_to_migrate: Option<i32>,
125
126    /// OGS data report time window.
127    pub ogs_data_report_time_window: Option<i32>,
128
129    /// Steam2 ticket (legacy).
130    pub steam2_ticket: Option<Vec<u8>>,
131}
132
133/// Account information received after login.
134#[derive(Debug, Clone)]
135pub struct AccountInfo {
136    /// Account name.
137    pub name: String,
138
139    /// Country code.
140    pub country: String,
141
142    /// Number of authenticated machines.
143    pub authed_machines: u32,
144
145    /// Account flags.
146    pub flags: u32,
147
148    /// Facebook ID (if linked).
149    pub facebook_id: Option<String>,
150
151    /// Facebook name (if linked).
152    pub facebook_name: Option<String>,
153}
154
155/// Email information for the account.
156#[derive(Debug, Clone)]
157pub struct EmailInfo {
158    /// Email address.
159    pub address: String,
160
161    /// Whether the email is validated.
162    pub validated: bool,
163}
164
165/// Account limitations.
166#[derive(Debug, Clone)]
167pub struct Limitations {
168    /// Whether this is a limited account.
169    pub limited: bool,
170
171    /// Whether the account is community banned.
172    pub community_banned: bool,
173
174    /// Whether the account is locked.
175    pub locked: bool,
176
177    /// Whether the account can invite friends.
178    pub can_invite_friends: bool,
179}
180
181/// VAC ban status.
182#[derive(Debug, Clone)]
183pub struct VacStatus {
184    /// Number of VAC bans.
185    pub num_bans: u32,
186
187    /// App IDs with VAC bans.
188    pub appids: Vec<u32>,
189
190    /// VAC ban ranges.
191    pub ranges: Vec<(u32, u32)>,
192}
193
194/// Wallet information.
195#[derive(Debug, Clone)]
196pub struct WalletInfo {
197    /// Whether the account has a wallet.
198    pub has_wallet: bool,
199
200    /// Currency code.
201    pub currency: u32,
202
203    /// Balance in cents.
204    pub balance: i64,
205}
206
207/// Quick invite link information.
208#[derive(Debug, Clone)]
209pub struct QuickInviteLink {
210    /// The full invite link URL.
211    pub invite_link: String,
212
213    /// The invite token (extracted from link).
214    pub invite_token: String,
215
216    /// Maximum number of times this link can be used.
217    pub invite_limit: Option<u64>,
218
219    /// Duration in seconds that the link is valid.
220    pub invite_duration: Option<u64>,
221
222    /// Unix timestamp when the link was created.
223    pub time_created: Option<u32>,
224
225    /// Whether the link is currently valid.
226    pub valid: bool,
227}
228
229/// Quick invite link validity check result.
230#[derive(Debug, Clone)]
231pub struct QuickInviteLinkValidity {
232    /// Whether the link is valid.
233    pub valid: bool,
234
235    /// The SteamID of the link owner (if valid).
236    pub steam_id: Option<SteamID>,
237
238    /// Duration in seconds that the link is valid for.
239    pub invite_duration: Option<u64>,
240}
241
242/// Persona name history entry.
243#[derive(Debug, Clone)]
244pub struct PersonaNameHistory {
245    /// The persona name.
246    pub name: String,
247    /// Timestamp when this name was used (Unix timestamp).
248    pub name_since: u32,
249}