Skip to main content

steam_user/types/
apps.rs

1use serde::{Deserialize, Serialize};
2
3/// Represents an application owned by the user.
4#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5pub struct OwnedApp {
6    #[serde(rename = "appid")]
7    pub app_id: u32,
8    #[serde(default)]
9    pub name: String,
10    #[serde(default)]
11    pub playtime_forever: u32,
12    pub playtime_2weeks: Option<u32>,
13    pub capsule_filename: Option<String>,
14    pub sort_as: Option<String>,
15}
16
17/// Detailed information about a Steam application.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct AppDetail {
20    #[serde(rename = "type")]
21    pub app_type: String,
22    pub name: String,
23    pub steam_appid: u32,
24    pub required_age: serde_json::Value,
25    pub is_free: bool,
26    pub detailed_description: String,
27    pub about_the_game: String,
28    pub short_description: String,
29    pub supported_languages: String,
30    pub header_image: String,
31    pub website: Option<String>,
32    pub developers: Vec<String>,
33    pub publishers: Vec<String>,
34    pub price_overview: Option<AppPriceOverview>,
35    pub platforms: Platforms,
36    pub categories: Option<Vec<Category>>,
37    pub release_date: ReleaseDate,
38    pub background: String,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct AppPriceOverview {
43    pub currency: String,
44    pub initial: u32,
45    pub r#final: u32,
46    pub discount_percent: u32,
47    pub initial_formatted: String,
48    pub final_formatted: String,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct Platforms {
53    pub windows: bool,
54    pub mac: bool,
55    pub linux: bool,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59pub struct Category {
60    pub id: u32,
61    pub description: String,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct ReleaseDate {
66    pub coming_soon: bool,
67    pub date: String,
68}
69
70/// CS:GO account statistics.
71#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct CsgoAccountStats {
73    pub last_logout_csgo: Option<String>,
74    pub last_launch_steam_client: Option<String>,
75    pub start_play_csgo: Option<String>,
76    pub first_played_cs_franchise: Option<String>,
77    pub last_known_ip: Option<String>,
78    pub earned_service_medal: Option<String>,
79    pub profile_rank: Option<u32>,
80    pub xp_to_next_rank: Option<u32>,
81    pub anti_addiction_online_time: Option<String>,
82}
83
84/// Detailed information about an owned game from the games page.
85#[derive(Debug, Clone, Serialize, Deserialize)]
86pub struct OwnedAppDetail {
87    #[serde(rename = "appid")]
88    pub app_id: u32,
89    pub name: String,
90    #[serde(default)]
91    pub logo: String,
92    #[serde(default)]
93    pub hours: Option<String>,
94    #[serde(default)]
95    pub hours_forever: Option<String>,
96    #[serde(default)]
97    pub last_played: Option<u64>,
98    #[serde(default)]
99    pub friendly_name: Option<String>,
100    #[serde(default)]
101    pub availstatlinks: Option<serde_json::Value>,
102    #[serde(default)]
103    pub has_community_visible_stats: Option<bool>,
104}
105
106/// Dynamic store user data from Steam store.
107#[derive(Debug, Clone, Serialize, Deserialize)]
108pub struct DynamicStoreUserData {
109    #[serde(rename = "rgOwnedApps", default)]
110    pub owned_apps: Vec<u32>,
111    #[serde(rename = "rgOwnedPackages", default)]
112    pub owned_packages: Vec<u32>,
113    #[serde(rename = "rgWishlist", default)]
114    pub wishlist: Vec<u32>,
115    #[serde(rename = "rgIgnoredApps", default)]
116    pub ignored_apps: std::collections::HashMap<String, u32>,
117    #[serde(rename = "rgRecommendedTags", default)]
118    pub recommended_tags: Vec<serde_json::Value>,
119}
120
121/// Steam app version/update check response.
122#[derive(Debug, Clone, Serialize, Deserialize)]
123pub struct SteamAppVersionInfo {
124    pub response: SteamAppVersionResponse,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
128pub struct SteamAppVersionResponse {
129    pub success: bool,
130    pub up_to_date: Option<bool>,
131    pub version_is_listable: Option<bool>,
132    pub required_version: Option<u32>,
133    pub message: Option<String>,
134}
135
136/// Steam app search result item.
137#[derive(Debug, Clone, Serialize, Deserialize)]
138pub struct AppListItem {
139    pub appid: u32,
140    pub name: String,
141    #[serde(default)]
142    pub img: String,
143    #[serde(default)]
144    pub price: String,
145}
146
147/// Simple Steam app list from GetAppList API.
148#[derive(Debug, Clone, Serialize, Deserialize)]
149pub struct SimpleSteamAppList {
150    pub applist: SimpleSteamAppListInner,
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize)]
154pub struct SimpleSteamAppListInner {
155    pub apps: Vec<SimpleSteamApp>,
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
159pub struct SimpleSteamApp {
160    pub appid: u32,
161    pub name: String,
162}
163
164/// CS2/CS:GO matchmaking stats parsed from the GCPD matchmaking page.
165#[derive(Debug, Clone, Serialize, Deserialize)]
166pub struct MatchmakingStats {
167    pub matchmaking_cooldown: Option<Vec<CooldownInfo>>,
168    pub matchmaking_summary: Vec<MatchmakingSummary>,
169    pub matchmaking_per_map: Vec<MatchmakingPerMap>,
170    pub last_played_modes: Option<Vec<LastPlayedMode>>,
171}
172
173/// Expiration state for a competitive cooldown entry.
174#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum CooldownExpiration {
177    /// No expiration — cooldown does not expire.
178    Never,
179    /// Expires at the given UTC timestamp.
180    At(chrono::DateTime<chrono::Utc>),
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize)]
184pub struct CooldownInfo {
185    pub competitive_cooldown_expiration: Option<CooldownExpiration>,
186    pub competitive_cooldown_level: Option<u32>,
187    pub acknowledged: bool,
188}
189
190/// Per-mode win/loss summary (table 2).
191#[derive(Debug, Clone, Serialize, Deserialize)]
192pub struct MatchmakingSummary {
193    pub matchmaking_mode: Option<String>,
194    pub wins: Option<u32>,
195    pub ties: Option<u32>,
196    pub losses: Option<u32>,
197    pub skill_group: Option<String>,
198    pub last_match: Option<String>,
199    pub region: Option<u32>,
200}
201
202/// Per-mode per-map win/loss breakdown (table 3).
203#[derive(Debug, Clone, Serialize, Deserialize)]
204pub struct MatchmakingPerMap {
205    pub matchmaking_mode: Option<String>,
206    pub map: Option<String>,
207    pub wins: Option<u32>,
208    pub ties: Option<u32>,
209    pub losses: Option<u32>,
210    pub skill_group: Option<String>,
211    pub last_match: Option<String>,
212    pub region: Option<u32>,
213}
214
215/// Last-played timestamps for each mode (table 4).
216#[derive(Debug, Clone, Serialize, Deserialize)]
217pub struct LastPlayedMode {
218    pub matchmaking_mode: Option<String>,
219    pub last_match: Option<String>,
220}
221
222/// Eligible event app from Steam Points Shop.
223#[derive(Debug, Clone, Serialize, Deserialize)]
224pub struct EligibleEventApp {
225    pub appid: u32,
226    pub event_app: bool,
227    #[serde(default)]
228    pub name: Option<String>,
229}
230
231/// Friend ownership info for gifting.
232#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
233pub struct FriendOwnershipResponse {
234    pub ownership_info: Vec<FriendOwnershipInfo>,
235}
236
237#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
238pub struct FriendOwnershipInfo {
239    pub friend_ownership: Vec<FriendOwnership>,
240    pub item_id: Option<OwnershipItemId>,
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
244pub struct FriendOwnership {
245    pub partial_owns_appids: Vec<u32>,
246    pub partial_wishes_for: Vec<u32>,
247    pub accountid: u32,
248    pub already_owns: bool,
249    pub wishes_for: bool,
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
253pub struct OwnershipItemId {
254    pub appid: Option<u32>,
255    pub packageid: Option<u32>,
256    pub bundleid: Option<u32>,
257    pub tagid: Option<u32>,
258    pub creatorid: Option<u32>,
259    pub hubcategoryid: Option<u32>,
260}