1use std::collections::HashMap;
9
10use async_trait::async_trait;
11use steamid::SteamID;
12
13use crate::{
14 action::{ActionContext, ApiAction},
15 types::{
16 AccountDetails, ActiveInventory, ActivityCommentResponse, AddPhoneNumberResponse, AliasEntry, Amount, AppDetail, AppId, AppListItem, AssetId, AvatarHistoryEntry, AvatarUploadResponse, BoosterPackEntry, BoosterResult, CommunitySearchResult, ConfirmPhoneCodeResponse, Confirmation, ContextId, CsgoAccountStats, DynamicStoreUserData, EconItem, FriendActivity, FriendActivityResponse, FriendDetails, FriendListPage, GemResult, GemValue, GroupInfoXml, GroupOverview, HelpRequest, InventoryHistoryItem, InventoryHistoryResult, InvitableGroup, ItemNameId, ItemOrdersHistogramResponse, LoggedInResult, MarketHistoryResponse, MarketRestrictions,
17 MatchHistoryResponse, MyListingsResult, Notifications, OwnedApp, OwnedAppDetail, PendingFriendList, PlayerReport, PriceCents, PriceOverview, PrivacySettings, PurchaseHistoryItem, RedeemWalletCodeResponse, RemovePhoneResult, SellItemResult, SimpleSteamAppList, SteamAppVersionInfo, SteamGuardStatus, SteamProfile, SteamUserProfile, TradeOfferAsset, TradeOfferResult, TradeOffersResponse, TwoFactorResponse, UserComment, UserSummaryProfile, UserSummaryXml, WalletBalance,
18 },
19 SteamUser, SteamUserApi, SteamUserError,
20};
21
22#[async_trait]
23impl SteamUserApi for SteamUser {
24 type Error = SteamUserError;
25
26 async fn get_account_details(&self) -> Result<AccountDetails, Self::Error> {
31 self.get_account_details().await.with_action(ApiAction::GetAccountDetails)
32 }
33 async fn get_steam_wallet_balance(&self) -> Result<WalletBalance, Self::Error> {
34 self.get_steam_wallet_balance().await.with_action(ApiAction::GetSteamWalletBalance)
35 }
36 async fn get_amount_spent_on_steam(&self) -> Result<String, Self::Error> {
37 self.get_amount_spent_on_steam().await.with_action(ApiAction::GetAmountSpentOnSteam)
38 }
39 async fn get_purchase_history(&self) -> Result<Vec<PurchaseHistoryItem>, Self::Error> {
40 self.get_purchase_history().await.with_action(ApiAction::GetPurchaseHistory)
41 }
42 async fn redeem_wallet_code(&self, code: &str) -> Result<RedeemWalletCodeResponse, Self::Error> {
43 self.redeem_wallet_code(code).await.with_action(ApiAction::RedeemWalletCode)
44 }
45 async fn parental_unlock(&self, pin: &str) -> Result<(), Self::Error> {
46 self.parental_unlock(pin).await.with_action(ApiAction::ParentalUnlock)
47 }
48
49 async fn get_friend_activity(&self, start: Option<u64>) -> Result<FriendActivityResponse, Self::Error> {
54 self.get_friend_activity(start).await.with_action(ApiAction::GetFriendActivity)
55 }
56 async fn get_friend_activity_full(&self) -> Result<Vec<FriendActivity>, Self::Error> {
57 self.get_friend_activity_full().await.with_action(ApiAction::GetFriendActivityFull)
58 }
59 async fn comment_user_received_new_game(&self, steam_id: SteamID, thread_id: u64, comment: &str) -> Result<ActivityCommentResponse, Self::Error> {
60 self.comment_user_received_new_game(steam_id, thread_id, comment).await.with_action(ApiAction::CommentUserReceivedNewGame)
61 }
62 async fn rate_up_user_received_new_game(&self, steam_id: SteamID, thread_id: u64) -> Result<ActivityCommentResponse, Self::Error> {
63 self.rate_up_user_received_new_game(steam_id, thread_id).await.with_action(ApiAction::RateUpUserReceivedNewGame)
64 }
65 async fn delete_comment_user_received_new_game(&self, steam_id: SteamID, thread_id: u64, comment_id: &str) -> Result<ActivityCommentResponse, Self::Error> {
66 self.delete_comment_user_received_new_game(steam_id, thread_id, comment_id).await.with_action(ApiAction::DeleteCommentUserReceivedNewGame)
67 }
68
69 async fn get_owned_apps(&self) -> Result<Vec<OwnedApp>, Self::Error> {
74 self.get_owned_apps().await.with_action(ApiAction::GetOwnedApps)
75 }
76 async fn get_owned_apps_id(&self) -> Result<Vec<u32>, Self::Error> {
77 self.get_owned_apps_id().await.with_action(ApiAction::GetOwnedAppsId)
78 }
79 async fn get_owned_apps_detail(&self) -> Result<Vec<OwnedAppDetail>, Self::Error> {
80 self.get_owned_apps_detail().await.with_action(ApiAction::GetOwnedAppsDetail)
81 }
82 async fn get_app_detail(&self, app_ids: &[u32]) -> Result<HashMap<u32, AppDetail>, Self::Error> {
83 self.get_app_detail(app_ids).await.with_action(ApiAction::GetAppDetail)
84 }
85 async fn fetch_csgo_account_stats(&self) -> Result<CsgoAccountStats, Self::Error> {
86 self.fetch_csgo_account_stats().await.with_action(ApiAction::FetchCsgoAccountStats)
87 }
88 async fn get_app_list(&self) -> Result<SimpleSteamAppList, Self::Error> {
89 SteamUser::get_app_list().await.with_action(ApiAction::GetAppList)
90 }
91 async fn suggest_app_list(&self, term: &str) -> Result<Vec<AppListItem>, Self::Error> {
92 SteamUser::suggest_app_list(term).await.with_action(ApiAction::SuggestAppList)
93 }
94 async fn query_app_list(&self, term: &str) -> Result<Vec<AppListItem>, Self::Error> {
95 SteamUser::query_app_list(term).await.with_action(ApiAction::QueryAppList)
96 }
97 async fn get_steam_app_version_info(&self, app_id: u32) -> Result<SteamAppVersionInfo, Self::Error> {
98 SteamUser::get_steam_app_version_info(app_id).await.with_action(ApiAction::GetSteamAppVersionInfo)
99 }
100 async fn get_dynamic_store_user_data(&self) -> Result<DynamicStoreUserData, Self::Error> {
101 self.get_dynamic_store_user_data().await.with_action(ApiAction::GetDynamicStoreUserData)
102 }
103 async fn fetch_batched_loyalty_reward_items(&self, app_ids: &[u32]) -> Result<Vec<steam_protos::messages::CLoyaltyRewardsBatchedQueryRewardItemsResponseResponse>, Self::Error> {
104 self.fetch_batched_loyalty_reward_items(app_ids).await.with_action(ApiAction::FetchBatchedLoyaltyRewardItems)
105 }
106
107 async fn get_my_comments(&self) -> Result<Vec<UserComment>, Self::Error> {
112 self.get_my_comments().await.with_action(ApiAction::GetMyComments)
113 }
114 async fn get_user_comments(&self, steam_id: SteamID) -> Result<Vec<UserComment>, Self::Error> {
115 self.get_user_comments(steam_id).await.with_action(ApiAction::GetUserComments)
116 }
117 async fn post_comment(&self, steam_id: SteamID, message: &str) -> Result<Option<UserComment>, Self::Error> {
118 self.post_comment(steam_id, message).await.with_action(ApiAction::PostComment)
119 }
120 async fn delete_comment(&self, steam_id: SteamID, gidcomment: &str) -> Result<(), Self::Error> {
121 self.delete_comment(steam_id, gidcomment).await.with_action(ApiAction::DeleteComment)
122 }
123
124 async fn get_confirmations(&self, identity_secret: &str, tag: Option<&str>) -> Result<Vec<Confirmation>, Self::Error> {
129 self.get_confirmations(identity_secret, tag).await.with_action(ApiAction::GetConfirmations)
130 }
131 async fn accept_confirmation_for_object(&self, identity_secret: &str, object_id: u64) -> Result<(), Self::Error> {
132 self.accept_confirmation_for_object(identity_secret, object_id).await.with_action(ApiAction::AcceptConfirmationForObject)
133 }
134 async fn deny_confirmation_for_object(&self, identity_secret: &str, object_id: u64) -> Result<(), Self::Error> {
135 self.deny_confirmation_for_object(identity_secret, object_id).await.with_action(ApiAction::DenyConfirmationForObject)
136 }
137
138 async fn get_account_email(&self) -> Result<String, Self::Error> {
143 self.get_account_email().await.with_action(ApiAction::GetAccountEmail)
144 }
145 async fn get_current_steam_login(&self) -> Result<String, Self::Error> {
146 self.get_current_steam_login().await.with_action(ApiAction::GetCurrentSteamLogin)
147 }
148
149 async fn add_friend(&self, steam_id: SteamID) -> Result<(), Self::Error> {
154 self.add_friend(steam_id).await.with_action(ApiAction::AddFriend)
155 }
156 async fn remove_friend(&self, steam_id: SteamID) -> Result<(), Self::Error> {
157 self.remove_friend(steam_id).await.with_action(ApiAction::RemoveFriend)
158 }
159 async fn accept_friend_request(&self, steam_id: SteamID) -> Result<(), Self::Error> {
160 self.accept_friend_request(steam_id).await.with_action(ApiAction::AcceptFriendRequest)
161 }
162 async fn ignore_friend_request(&self, steam_id: SteamID) -> Result<(), Self::Error> {
163 self.ignore_friend_request(steam_id).await.with_action(ApiAction::IgnoreFriendRequest)
164 }
165 async fn block_user(&self, steam_id: SteamID) -> Result<(), Self::Error> {
166 self.block_user(steam_id).await.with_action(ApiAction::BlockUser)
167 }
168 async fn unblock_user(&self, steam_id: SteamID) -> Result<(), Self::Error> {
169 self.unblock_user(steam_id).await.with_action(ApiAction::UnblockUser)
170 }
171 async fn get_friends_list(&self) -> Result<HashMap<SteamID, i32>, Self::Error> {
172 self.get_friends_list().await.with_action(ApiAction::GetFriendsList)
173 }
174 async fn get_friends_details(&self) -> Result<FriendListPage, Self::Error> {
175 self.get_friends_details().await.with_action(ApiAction::GetFriendsDetails)
176 }
177 async fn get_friends_details_of_user(&self, steam_id: SteamID) -> Result<FriendListPage, Self::Error> {
178 self.get_friends_details_of_user(steam_id).await.with_action(ApiAction::GetFriendsDetailsOfUser)
179 }
180 async fn search_users(&self, query: &str, page: u32) -> Result<CommunitySearchResult, Self::Error> {
181 self.search_users(query, page).await.with_action(ApiAction::SearchUsers)
182 }
183 async fn create_instant_invite(&self) -> Result<String, Self::Error> {
184 self.create_instant_invite().await.with_action(ApiAction::CreateInstantInvite)
185 }
186 async fn follow_user(&self, steam_id: SteamID) -> Result<(), Self::Error> {
187 self.follow_user(steam_id).await.with_action(ApiAction::FollowUser)
188 }
189 async fn unfollow_user(&self, steam_id: SteamID) -> Result<(), Self::Error> {
190 self.unfollow_user(steam_id).await.with_action(ApiAction::UnfollowUser)
191 }
192 async fn get_following_list(&self) -> Result<FriendListPage, Self::Error> {
193 self.get_following_list().await.with_action(ApiAction::GetFollowingList)
194 }
195 async fn get_following_list_of_user(&self, steam_id: SteamID) -> Result<FriendListPage, Self::Error> {
196 self.get_following_list_of_user(steam_id).await.with_action(ApiAction::GetFollowingListOfUser)
197 }
198 async fn get_my_friends_id_list(&self) -> Result<Vec<SteamID>, Self::Error> {
199 self.get_my_friends_id_list().await.with_action(ApiAction::GetMyFriendsIdList)
200 }
201 async fn get_pending_friend_list(&self) -> Result<PendingFriendList, Self::Error> {
202 self.get_pending_friend_list().await.with_action(ApiAction::GetPendingFriendList)
203 }
204 async fn remove_friends(&self, steam_ids: &[SteamID]) -> Result<(), Self::Error> {
205 self.remove_friends(steam_ids).await.with_action(ApiAction::RemoveFriends)
206 }
207 async fn unfollow_users(&self, steam_ids: &[SteamID]) -> Result<(), Self::Error> {
208 self.unfollow_users(steam_ids).await.with_action(ApiAction::UnfollowUsers)
209 }
210 async fn cancel_friend_request(&self, steam_id: SteamID) -> Result<(), Self::Error> {
211 self.cancel_friend_request(steam_id).await.with_action(ApiAction::CancelFriendRequest)
212 }
213 async fn get_friends_in_common(&self, steam_id: SteamID) -> Result<Vec<FriendDetails>, Self::Error> {
214 self.get_friends_in_common(steam_id).await.with_action(ApiAction::GetFriendsInCommon)
215 }
216
217 async fn join_group(&self, group_id: SteamID) -> Result<(), Self::Error> {
222 self.join_group(group_id).await.with_action(ApiAction::JoinGroup)
223 }
224 async fn leave_group(&self, group_id: SteamID) -> Result<(), Self::Error> {
225 self.leave_group(group_id).await.with_action(ApiAction::LeaveGroup)
226 }
227 async fn get_group_members(&self, group_id: SteamID) -> Result<Vec<SteamID>, Self::Error> {
228 self.get_group_members(group_id).await.with_action(ApiAction::GetGroupMembers)
229 }
230 async fn post_group_announcement(&self, group_id: SteamID, headline: &str, content: &str) -> Result<(), Self::Error> {
231 self.post_group_announcement(group_id, headline, content).await.with_action(ApiAction::PostGroupAnnouncement)
232 }
233 async fn kick_group_member(&self, group_id: SteamID, member_id: SteamID) -> Result<(), Self::Error> {
234 self.kick_group_member(group_id, member_id).await.with_action(ApiAction::KickGroupMember)
235 }
236 async fn invite_user_to_group(&self, user_id: SteamID, group_id: SteamID) -> Result<(), Self::Error> {
237 self.invite_user_to_group(user_id, group_id).await.with_action(ApiAction::InviteUserToGroup)
238 }
239 async fn invite_users_to_group(&self, user_ids: &[SteamID], group_id: SteamID) -> Result<(), Self::Error> {
240 self.invite_users_to_group(user_ids, group_id).await.with_action(ApiAction::InviteUsersToGroup)
241 }
242 async fn accept_group_invite(&self, group_id: SteamID) -> Result<(), Self::Error> {
243 self.accept_group_invite(group_id).await.with_action(ApiAction::AcceptGroupInvite)
244 }
245 async fn ignore_group_invite(&self, group_id: SteamID) -> Result<(), Self::Error> {
246 self.ignore_group_invite(group_id).await.with_action(ApiAction::IgnoreGroupInvite)
247 }
248 async fn get_group_overview(&self, gid: Option<SteamID>, group_url: Option<&str>, page: Option<i32>, search_key: Option<&str>) -> Result<GroupOverview, Self::Error> {
249 let options = crate::types::GroupOverviewOptions {
250 gid,
251 group_url: group_url.map(String::from),
252 page: page.unwrap_or(1),
253 search_key: search_key.map(String::from),
254 };
255 self.get_group_overview(options).await.with_action(ApiAction::GetGroupOverview)
256 }
257 async fn get_group_steam_id_from_vanity_url(&self, vanity_url: &str) -> Result<String, Self::Error> {
258 self.get_group_steam_id_from_vanity_url(vanity_url).await.with_action(ApiAction::GetGroupSteamIdFromVanityUrl)
259 }
260 async fn get_group_info_xml(&self, gid: Option<SteamID>, group_url: Option<&str>, page: Option<u32>) -> Result<GroupInfoXml, Self::Error> {
261 self.get_group_info_xml(gid, group_url, page).await.with_action(ApiAction::GetGroupInfoXml)
262 }
263 async fn get_group_info_xml_full(&self, gid: Option<SteamID>, group_url: Option<&str>) -> Result<GroupInfoXml, Self::Error> {
264 self.get_group_info_xml_full(gid, group_url).await.with_action(ApiAction::GetGroupInfoXmlFull)
265 }
266 async fn get_invitable_groups(&self, user_steam_id: SteamID) -> Result<Vec<InvitableGroup>, Self::Error> {
267 self.get_invitable_groups(user_steam_id).await.with_action(ApiAction::GetInvitableGroups)
268 }
269 async fn invite_all_friends_to_group(&self, group_id: SteamID) -> Result<(), Self::Error> {
270 self.invite_all_friends_to_group(group_id).await.with_action(ApiAction::InviteAllFriendsToGroup)
271 }
272
273 async fn get_inventory(&self, appid: AppId, context_id: ContextId) -> Result<Vec<EconItem>, Self::Error> {
278 self.get_inventory(appid, context_id).await.with_action(ApiAction::GetInventory)
279 }
280 async fn get_user_inventory_contents(&self, steam_id: SteamID, appid: AppId, context_id: ContextId) -> Result<Vec<EconItem>, Self::Error> {
281 self.get_user_inventory_contents(steam_id, appid, context_id).await.with_action(ApiAction::GetUserInventoryContents)
282 }
283 async fn get_inventory_history(&self) -> Result<InventoryHistoryResult, Self::Error> {
284 self.get_inventory_history(None).await.with_action(ApiAction::GetInventoryHistory)
285 }
286 async fn get_price_overview(&self, appid: AppId, market_hash_name: &str) -> Result<PriceOverview, Self::Error> {
287 self.get_price_overview(appid, market_hash_name).await.with_action(ApiAction::GetPriceOverview)
288 }
289 async fn get_active_inventories(&self) -> Result<Vec<ActiveInventory>, Self::Error> {
290 self.get_active_inventories().await.with_action(ApiAction::GetActiveInventories)
291 }
292 async fn get_inventory_trading(&self, appid: AppId, context_id: ContextId) -> Result<serde_json::Value, Self::Error> {
293 self.get_inventory_trading(appid, context_id).await.with_action(ApiAction::GetInventoryTrading)
294 }
295 async fn get_inventory_trading_partner(&self, appid: AppId, partner: SteamID, context_id: ContextId) -> Result<serde_json::Value, Self::Error> {
296 self.get_inventory_trading_partner(appid, partner, context_id).await.with_action(ApiAction::GetInventoryTradingPartner)
297 }
298 async fn get_full_inventory_history(&self) -> Result<Vec<InventoryHistoryItem>, Self::Error> {
299 self.get_full_inventory_history().await.with_action(ApiAction::GetFullInventoryHistory)
300 }
301
302 async fn get_my_listings(&self) -> Result<MyListingsResult, Self::Error> {
307 let (listings, assets, total_count) = self.get_my_listings(0, 100).await.with_action(ApiAction::GetMyListings)?;
308 Ok(MyListingsResult { listings, assets, total_count })
309 }
310 async fn get_market_history(&self, start: u32, count: u32) -> Result<MarketHistoryResponse, Self::Error> {
311 self.get_market_history(start, count).await.with_action(ApiAction::GetMarketHistory)
312 }
313 async fn sell_item(&self, appid: AppId, contextid: ContextId, assetid: AssetId, amount: Amount, price: PriceCents) -> Result<SellItemResult, Self::Error> {
314 self.sell_item(appid, contextid, assetid, amount, price).await.with_action(ApiAction::SellItem)
315 }
316 async fn remove_listing(&self, listing_id: &str) -> Result<bool, Self::Error> {
317 self.remove_listing(listing_id).await.with_action(ApiAction::RemoveListing)
318 }
319 async fn get_gem_value(&self, appid: AppId, assetid: AssetId) -> Result<GemValue, Self::Error> {
320 self.get_gem_value(appid, assetid).await.with_action(ApiAction::GetGemValue)
321 }
322 async fn turn_item_into_gems(&self, appid: AppId, assetid: AssetId, expected_value: u32) -> Result<GemResult, Self::Error> {
323 self.turn_item_into_gems(appid, assetid, expected_value).await.with_action(ApiAction::TurnItemIntoGems)
324 }
325 async fn get_booster_pack_catalog(&self) -> Result<Vec<BoosterPackEntry>, Self::Error> {
326 self.get_booster_pack_catalog().await.with_action(ApiAction::GetBoosterPackCatalog)
327 }
328 async fn create_booster_pack(&self, appid: AppId, use_untradable_gems: bool) -> Result<BoosterResult, Self::Error> {
329 self.create_booster_pack(appid, use_untradable_gems).await.with_action(ApiAction::CreateBoosterPack)
330 }
331 async fn open_booster_pack(&self, appid: AppId, assetid: AssetId) -> Result<Vec<EconItem>, Self::Error> {
332 self.open_booster_pack(appid, assetid).await.with_action(ApiAction::OpenBoosterPack)
333 }
334 async fn get_market_restrictions(&self) -> Result<(MarketRestrictions, Option<WalletBalance>), Self::Error> {
335 self.get_market_restrictions().await.with_action(ApiAction::GetMarketRestrictions)
336 }
337 async fn get_market_apps(&self) -> Result<HashMap<u32, String>, Self::Error> {
338 self.get_market_apps().await.with_action(ApiAction::GetMarketApps)
339 }
340 async fn get_item_nameid(&self, app_id: AppId, market_hash_name: &str) -> Result<ItemNameId, Self::Error> {
341 self.get_item_nameid(app_id, market_hash_name).await.with_action(ApiAction::GetItemNameid)
342 }
343 async fn get_item_orders_histogram(&self, item_nameid: ItemNameId, country: &str, currency: u32) -> Result<ItemOrdersHistogramResponse, Self::Error> {
344 self.get_item_orders_histogram(item_nameid, country, currency).await.with_action(ApiAction::GetItemOrdersHistogram)
345 }
346
347 async fn get_phone_number_status(&self) -> Result<Option<String>, Self::Error> {
352 self.get_phone_number_status().await.with_action(ApiAction::GetPhoneNumberStatus)
353 }
354 async fn add_phone_number(&self, phone: &str) -> Result<AddPhoneNumberResponse, Self::Error> {
355 self.add_phone_number(phone).await.with_action(ApiAction::AddPhoneNumber)
356 }
357 async fn confirm_phone_code_for_add(&self, code: &str) -> Result<ConfirmPhoneCodeResponse, Self::Error> {
358 self.confirm_phone_code_for_add(code).await.with_action(ApiAction::ConfirmPhoneCodeForAdd)
359 }
360 async fn resend_phone_verification_code(&self) -> Result<serde_json::Value, Self::Error> {
361 self.resend_phone_verification_code().await.with_action(ApiAction::ResendPhoneVerificationCode)
362 }
363 async fn get_remove_phone_number_type(&self) -> Result<Option<RemovePhoneResult>, Self::Error> {
364 self.get_remove_phone_number_type().await.with_action(ApiAction::GetRemovePhoneNumberType)
365 }
366 async fn send_account_recovery_code(&self, wizard_param: serde_json::Value, method: i32) -> Result<serde_json::Value, Self::Error> {
367 self.send_account_recovery_code(wizard_param, method).await.with_action(ApiAction::SendAccountRecoveryCode)
368 }
369 async fn confirm_remove_phone_number_code(&self, wizard_param: serde_json::Value, code: &str) -> Result<serde_json::Value, Self::Error> {
370 self.confirm_remove_phone_number_code(wizard_param, code).await.with_action(ApiAction::ConfirmRemovePhoneNumberCode)
371 }
372 async fn send_confirmation_2_steam_mobile_app(&self, wizard_param: serde_json::Value) -> Result<serde_json::Value, Self::Error> {
373 self.send_confirmation_2_steam_mobile_app(wizard_param).await.with_action(ApiAction::SendConfirmation2SteamMobileApp)
374 }
375 async fn send_confirmation_2_steam_mobile_app_final(&self, wizard_param: serde_json::Value) -> Result<serde_json::Value, Self::Error> {
376 self.send_confirmation_2_steam_mobile_app_final(wizard_param).await.with_action(ApiAction::SendConfirmation2SteamMobileAppFinal)
377 }
378
379 async fn get_privacy_settings(&self) -> Result<PrivacySettings, Self::Error> {
384 self.get_privacy_settings().await.with_action(ApiAction::GetPrivacySettings)
385 }
386 async fn set_privacy_settings(&self, settings: PrivacySettings) -> Result<PrivacySettings, Self::Error> {
387 self.set_privacy_settings(settings).await.with_action(ApiAction::SetPrivacySettings)
388 }
389 async fn set_all_privacy(&self, level: &str) -> Result<PrivacySettings, Self::Error> {
390 let state: crate::types::PrivacyState = serde_json::from_value(serde_json::json!(level)).map_err(|e| SteamUserError::Other(format!("Invalid privacy level: {}", e)))?;
391 self.set_all_privacy(state).await.with_action(ApiAction::SetAllPrivacy)
392 }
393
394 async fn get_profile(&self, steam_id: Option<SteamID>) -> Result<SteamProfile, Self::Error> {
399 self.get_profile(steam_id).await.with_action(ApiAction::GetProfile)
400 }
401 async fn edit_profile(&self, _settings: serde_json::Value) -> Result<(), Self::Error> {
402 Err(SteamUserError::Other("edit_profile uses scraper (!Send) \u{2014} call the inherent method directly".into()))
403 }
404 async fn set_persona_name(&self, name: &str) -> Result<(), Self::Error> {
405 self.set_persona_name(name).await.with_action(ApiAction::SetPersonaName)
406 }
407 async fn get_alias_history(&self, steam_id: SteamID) -> Result<Vec<AliasEntry>, Self::Error> {
408 self.get_alias_history(steam_id).await.with_action(ApiAction::GetAliasHistory)
409 }
410 async fn clear_previous_aliases(&self) -> Result<(), Self::Error> {
411 self.clear_previous_aliases().await.with_action(ApiAction::ClearPreviousAliases)
412 }
413 async fn set_nickname(&self, steam_id: SteamID, nickname: &str) -> Result<(), Self::Error> {
414 self.set_nickname(steam_id, nickname).await.with_action(ApiAction::SetNickname)
415 }
416 async fn remove_nickname(&self, steam_id: SteamID) -> Result<(), Self::Error> {
417 self.remove_nickname(steam_id).await.with_action(ApiAction::RemoveNickname)
418 }
419 async fn post_profile_status(&self, text: &str, app_id: Option<u32>) -> Result<u64, Self::Error> {
420 self.post_profile_status(text, app_id).await.with_action(ApiAction::PostProfileStatus)
421 }
422 async fn select_previous_avatar(&self, avatar_hash: &str) -> Result<(), Self::Error> {
423 self.select_previous_avatar(avatar_hash).await.with_action(ApiAction::SelectPreviousAvatar)
424 }
425 async fn setup_profile(&self) -> Result<bool, Self::Error> {
426 self.setup_profile().await.with_action(ApiAction::SetupProfile)
427 }
428 async fn get_user_summary_from_xml(&self, steam_id: SteamID) -> Result<UserSummaryXml, Self::Error> {
429 self.get_user_summary_from_xml(steam_id).await.with_action(ApiAction::GetUserSummaryFromXml)
430 }
431 async fn get_user_summary_from_profile(&self, steam_id: Option<SteamID>) -> Result<UserSummaryProfile, Self::Error> {
432 self.get_user_summary_from_profile(steam_id).await.with_action(ApiAction::GetUserSummaryFromProfile)
433 }
434 async fn fetch_full_profile(&self, _steam_id: SteamID) -> Result<SteamProfile, Self::Error> {
435 Err(SteamUserError::Other("fetch_full_profile uses scraper (!Send) \u{2014} call the inherent method directly".into()))
436 }
437 async fn resolve_user(&self, steam_id: SteamID) -> Result<Option<SteamUserProfile>, Self::Error> {
438 self.resolve_user(steam_id).await.with_action(ApiAction::ResolveUser)
439 }
440 async fn get_avatar_history(&self) -> Result<Vec<AvatarHistoryEntry>, Self::Error> {
441 self.get_avatar_history().await.with_action(ApiAction::GetAvatarHistory)
442 }
443 async fn upload_avatar_from_url(&self, url: &str) -> Result<AvatarUploadResponse, Self::Error> {
444 self.upload_avatar_from_url(url).await.with_action(ApiAction::UploadAvatarFromUrl)
445 }
446
447 async fn enumerate_tokens(&self) -> Result<steam_protos::CAuthenticationRefreshTokenEnumerateResponse, Self::Error> {
452 self.enumerate_tokens().await.with_action(ApiAction::EnumerateTokens)
453 }
454 async fn check_token_exists(&self, token_id: &str) -> Result<bool, Self::Error> {
455 self.check_token_exists(token_id).await.with_action(ApiAction::CheckTokenExists)
456 }
457 async fn revoke_tokens(&self, token_ids: &[&str], shared_secret: Option<&str>) -> Result<crate::services::tokens::RevokeTokensResult, Self::Error> {
458 self.revoke_tokens(token_ids, shared_secret).await.with_action(ApiAction::RevokeTokens)
459 }
460
461 async fn get_trade_url(&self) -> Result<Option<String>, Self::Error> {
466 self.get_trade_url().await.with_action(ApiAction::GetTradeUrl)
467 }
468 async fn get_trade_offer(&self) -> Result<TradeOffersResponse, Self::Error> {
469 self.get_trade_offer().await.with_action(ApiAction::GetTradeOffer)
470 }
471 async fn accept_trade_offer(&self, trade_offer_id: u64, partner_steam_id: Option<String>) -> Result<String, Self::Error> {
472 self.accept_trade_offer(trade_offer_id, partner_steam_id).await.with_action(ApiAction::AcceptTradeOffer)
473 }
474 async fn decline_trade_offer(&self, trade_offer_id: u64) -> Result<(), Self::Error> {
475 self.decline_trade_offer(trade_offer_id).await.with_action(ApiAction::DeclineTradeOffer)
476 }
477 async fn send_trade_offer(&self, trade_url: &str, my_assets: Vec<TradeOfferAsset>, their_assets: Vec<TradeOfferAsset>, message: &str) -> Result<TradeOfferResult, Self::Error> {
478 self.send_trade_offer(trade_url, my_assets, their_assets, message).await.with_action(ApiAction::SendTradeOffer)
479 }
480
481 async fn get_steam_guard_status(&self) -> Result<SteamGuardStatus, Self::Error> {
486 self.get_steam_guard_status().await.with_action(ApiAction::GetSteamGuardStatus)
487 }
488 async fn enable_two_factor(&self) -> Result<TwoFactorResponse, Self::Error> {
489 self.enable_two_factor().await.with_action(ApiAction::EnableTwoFactor)
490 }
491 async fn finalize_two_factor(&self, shared_secret: &str, activation_code: &str) -> Result<(), Self::Error> {
492 self.finalize_two_factor(shared_secret, activation_code).await.with_action(ApiAction::FinalizeTwoFactor)
493 }
494 async fn disable_two_factor(&self, revocation_code: &str) -> Result<(), Self::Error> {
495 self.disable_two_factor(revocation_code).await.with_action(ApiAction::DisableTwoFactor)
496 }
497 async fn deauthorize_devices(&self) -> Result<(), Self::Error> {
498 self.deauthorize_devices().await.with_action(ApiAction::DeauthorizeDevices)
499 }
500 async fn add_authenticator(&self) -> Result<TwoFactorResponse, Self::Error> {
501 self.add_authenticator().await.with_action(ApiAction::AddAuthenticator)
502 }
503 async fn finalize_authenticator(&self, activation_code: &str) -> Result<(), Self::Error> {
504 self.finalize_authenticator(activation_code).await.with_action(ApiAction::FinalizeAuthenticator)
505 }
506 async fn remove_authenticator(&self, revocation_code: &str) -> Result<(), Self::Error> {
507 self.remove_authenticator(revocation_code).await.with_action(ApiAction::RemoveAuthenticator)
508 }
509 async fn enable_steam_guard_email(&self) -> Result<bool, Self::Error> {
510 self.enable_steam_guard_email().await.with_action(ApiAction::EnableSteamGuardEmail)
511 }
512 async fn disable_steam_guard_email(&self) -> Result<bool, Self::Error> {
513 self.disable_steam_guard_email().await.with_action(ApiAction::DisableSteamGuardEmail)
514 }
515
516 async fn get_player_reports(&self) -> Result<Vec<PlayerReport>, Self::Error> {
521 self.get_player_reports().await.with_action(ApiAction::GetPlayerReports)
522 }
523 async fn add_free_license(&self, package_id: u32) -> Result<bool, Self::Error> {
524 self.add_free_license(package_id).await.with_action(ApiAction::AddFreeLicense)
525 }
526 async fn add_sub_free_license(&self, sub_id: u32) -> Result<bool, Self::Error> {
527 self.add_sub_free_license(sub_id).await.with_action(ApiAction::AddSubFreeLicense)
528 }
529 async fn redeem_points(&self, definition_id: u32) -> Result<steam_protos::messages::loyalty_rewards::CLoyaltyRewardsRedeemPointsResponse, Self::Error> {
530 self.redeem_points(definition_id).await.with_action(ApiAction::RedeemPoints)
531 }
532 async fn get_help_requests(&self) -> Result<Vec<HelpRequest>, Self::Error> {
533 self.get_help_requests().await.with_action(ApiAction::GetHelpRequests)
534 }
535 async fn get_help_request_detail(&self, id: &str) -> Result<String, Self::Error> {
536 self.get_help_request_detail(id).await.with_action(ApiAction::GetHelpRequestDetail)
537 }
538 async fn get_match_history(&self, match_type: &str, token: Option<&str>) -> Result<MatchHistoryResponse, Self::Error> {
539 let mt: crate::types::MatchHistoryType = match_type.parse().map_err(|_| SteamUserError::Other(format!("Invalid match type: {}", match_type)))?;
540 self.get_match_history(mt, token).await.with_action(ApiAction::GetMatchHistory)
541 }
542
543 async fn logged_in(&self) -> Result<LoggedInResult, Self::Error> {
548 let (logged_in, family_view) = self.logged_in().await.with_action(ApiAction::LoggedIn)?;
549 Ok(LoggedInResult { logged_in, family_view })
550 }
551 async fn get_notifications(&self) -> Result<Notifications, Self::Error> {
552 self.get_notifications().await.with_action(ApiAction::GetNotifications)
553 }
554 async fn get_web_api_key(&self, _domain: &str) -> Result<String, Self::Error> {
555 Err(SteamUserError::Other("get_web_api_key uses scraper (!Send) \u{2014} call the inherent method directly".into()))
556 }
557 async fn resolve_vanity_url(&self, api_key: &str, vanity_name: &str) -> Result<SteamID, Self::Error> {
558 self.resolve_vanity_url(api_key, vanity_name).await.with_action(ApiAction::ResolveVanityUrl)
559 }
560 async fn revoke_web_api_key(&self) -> Result<(), Self::Error> {
561 self.revoke_web_api_key().await.with_action(ApiAction::RevokeWebApiKey)
562 }
563}