steam-user 0.1.0

Steam User web client for Rust - HTTP-based Steam Community interactions
Documentation
//! Declarative macro to generate passthrough `SteamUserApi` implementations.
//!
//! Used by `gas/trait_impl.rs` and `remote/trait_impl.rs` to eliminate
//! boilerplate.  Every method simply delegates to the inherent method
//! of the same name on the implementing struct.

/// Internal macro that takes a compact method list and expands each
/// into a passthrough `async fn` that delegates to `self.method(args).await`.
macro_rules! passthrough_methods {
    ($struct:ty, $error:ty, $( $method:ident( $($arg:ident : $argty:ty),* ) -> $ret:ty; )*) => {
        #[async_trait::async_trait]
        impl $crate::SteamUserApi for $struct {
            type Error = $error;

            $(
                async fn $method(&self $(, $arg: $argty)*) -> Result<$ret, Self::Error> {
                    self.$method($($arg),*).await
                }
            )*
        }
    };
}

/// Generate a passthrough `impl SteamUserApi for $struct`.
///
/// # Usage
///
/// ```ignore
/// impl_passthrough_steam_user_api!(RemoteSteamUser, RemoteSteamUserError);
/// ```
macro_rules! impl_passthrough_steam_user_api {
    ($struct:ty, $error:ty) => {
        passthrough_methods!($struct, $error,
            // Account
            get_account_details() -> crate::types::AccountDetails;
            get_steam_wallet_balance() -> crate::types::WalletBalance;
            get_amount_spent_on_steam() -> String;
            get_purchase_history() -> Vec<crate::types::PurchaseHistoryItem>;
            redeem_wallet_code(code: &str) -> crate::types::RedeemWalletCodeResponse;
            parental_unlock(pin: &str) -> ();

            // Activity
            get_friend_activity(start: Option<u64>) -> crate::types::FriendActivityResponse;
            get_friend_activity_full() -> Vec<crate::types::FriendActivity>;
            comment_user_received_new_game(steam_id: steamid::SteamID, thread_id: u64, comment: &str) -> crate::types::ActivityCommentResponse;
            rate_up_user_received_new_game(steam_id: steamid::SteamID, thread_id: u64) -> crate::types::ActivityCommentResponse;
            delete_comment_user_received_new_game(steam_id: steamid::SteamID, thread_id: u64, comment_id: &str) -> crate::types::ActivityCommentResponse;

            // Apps
            get_owned_apps() -> Vec<crate::types::OwnedApp>;
            get_owned_apps_id() -> Vec<u32>;
            get_owned_apps_detail() -> Vec<crate::types::OwnedAppDetail>;
            get_app_detail(app_ids: &[u32]) -> std::collections::HashMap<u32, crate::types::AppDetail>;
            fetch_csgo_account_stats() -> crate::types::CsgoAccountStats;
            get_app_list() -> crate::types::SimpleSteamAppList;
            suggest_app_list(term: &str) -> Vec<crate::types::AppListItem>;
            query_app_list(term: &str) -> Vec<crate::types::AppListItem>;
            get_steam_app_version_info(app_id: u32) -> crate::types::SteamAppVersionInfo;
            get_dynamic_store_user_data() -> crate::types::DynamicStoreUserData;
            fetch_batched_loyalty_reward_items(app_ids: &[u32]) -> Vec<steam_protos::messages::CLoyaltyRewardsBatchedQueryRewardItemsResponseResponse>;

            // Comments
            get_my_comments() -> Vec<crate::types::UserComment>;
            get_user_comments(steam_id: steamid::SteamID) -> Vec<crate::types::UserComment>;
            post_comment(steam_id: steamid::SteamID, message: &str) -> Option<crate::types::UserComment>;
            delete_comment(steam_id: steamid::SteamID, gidcomment: &str) -> ();

            // Confirmations
            get_confirmations(identity_secret: &str, tag: Option<&str>) -> Vec<crate::types::Confirmation>;
            accept_confirmation_for_object(identity_secret: &str, object_id: u64) -> ();
            deny_confirmation_for_object(identity_secret: &str, object_id: u64) -> ();

            // Email
            get_account_email() -> String;
            get_current_steam_login() -> String;

            // Friends
            add_friend(steam_id: steamid::SteamID) -> ();
            remove_friend(steam_id: steamid::SteamID) -> ();
            accept_friend_request(steam_id: steamid::SteamID) -> ();
            ignore_friend_request(steam_id: steamid::SteamID) -> ();
            block_user(steam_id: steamid::SteamID) -> ();
            unblock_user(steam_id: steamid::SteamID) -> ();
            get_friends_list() -> std::collections::HashMap<steamid::SteamID, i32>;
            get_friends_details() -> crate::types::FriendListPage;
            get_friends_details_of_user(steam_id: steamid::SteamID) -> crate::types::FriendListPage;
            search_users(query: &str, page: u32) -> crate::types::CommunitySearchResult;
            create_instant_invite() -> String;
            follow_user(steam_id: steamid::SteamID) -> ();
            unfollow_user(steam_id: steamid::SteamID) -> ();
            get_following_list() -> crate::types::FriendListPage;
            get_following_list_of_user(steam_id: steamid::SteamID) -> crate::types::FriendListPage;
            get_my_friends_id_list() -> Vec<steamid::SteamID>;
            get_pending_friend_list() -> crate::types::PendingFriendList;
            remove_friends(steam_ids: &[steamid::SteamID]) -> ();
            unfollow_users(steam_ids: &[steamid::SteamID]) -> ();
            cancel_friend_request(steam_id: steamid::SteamID) -> ();
            get_friends_in_common(steam_id: steamid::SteamID) -> Vec<crate::types::FriendDetails>;

            // Groups
            join_group(group_id: steamid::SteamID) -> ();
            leave_group(group_id: steamid::SteamID) -> ();
            get_group_members(group_id: steamid::SteamID) -> Vec<steamid::SteamID>;
            post_group_announcement(group_id: steamid::SteamID, headline: &str, content: &str) -> ();
            kick_group_member(group_id: steamid::SteamID, member_id: steamid::SteamID) -> ();
            invite_user_to_group(user_id: steamid::SteamID, group_id: steamid::SteamID) -> ();
            invite_users_to_group(user_ids: &[steamid::SteamID], group_id: steamid::SteamID) -> ();
            accept_group_invite(group_id: steamid::SteamID) -> ();
            ignore_group_invite(group_id: steamid::SteamID) -> ();
            get_group_overview(gid: Option<steamid::SteamID>, group_url: Option<&str>, page: Option<i32>, search_key: Option<&str>) -> crate::types::GroupOverview;
            get_group_steam_id_from_vanity_url(vanity_url: &str) -> String;
            get_group_info_xml(gid: Option<steamid::SteamID>, group_url: Option<&str>, page: Option<u32>) -> crate::types::GroupInfoXml;
            get_group_info_xml_full(gid: Option<steamid::SteamID>, group_url: Option<&str>) -> crate::types::GroupInfoXml;
            get_invitable_groups(user_steam_id: steamid::SteamID) -> Vec<crate::types::InvitableGroup>;
            invite_all_friends_to_group(group_id: steamid::SteamID) -> ();

            // Inventory
            get_inventory(appid: crate::types::AppId, context_id: crate::types::ContextId) -> Vec<crate::types::EconItem>;
            get_user_inventory_contents(steam_id: steamid::SteamID, appid: crate::types::AppId, context_id: crate::types::ContextId) -> Vec<crate::types::EconItem>;
            get_inventory_history() -> crate::types::InventoryHistoryResult;
            get_price_overview(appid: crate::types::AppId, market_hash_name: &str) -> crate::types::PriceOverview;
            get_active_inventories() -> Vec<crate::types::ActiveInventory>;
            get_inventory_trading(appid: crate::types::AppId, context_id: crate::types::ContextId) -> serde_json::Value;
            get_inventory_trading_partner(appid: crate::types::AppId, partner: steamid::SteamID, context_id: crate::types::ContextId) -> serde_json::Value;
            get_full_inventory_history() -> Vec<crate::types::InventoryHistoryItem>;

            // Market
            get_my_listings() -> crate::types::MyListingsResult;
            get_market_history(start: u32, count: u32) -> crate::types::MarketHistoryResponse;
            sell_item(appid: crate::types::AppId, contextid: crate::types::ContextId, assetid: crate::types::AssetId, amount: crate::types::Amount, price: crate::types::PriceCents) -> crate::types::SellItemResult;
            remove_listing(listing_id: &str) -> bool;
            get_gem_value(appid: crate::types::AppId, assetid: crate::types::AssetId) -> crate::types::GemValue;
            turn_item_into_gems(appid: crate::types::AppId, assetid: crate::types::AssetId, expected_value: u32) -> crate::types::GemResult;
            get_booster_pack_catalog() -> Vec<crate::types::BoosterPackEntry>;
            create_booster_pack(appid: crate::types::AppId, use_untradable_gems: bool) -> crate::types::BoosterResult;
            open_booster_pack(appid: crate::types::AppId, assetid: crate::types::AssetId) -> Vec<crate::types::EconItem>;
            get_market_restrictions() -> (crate::types::MarketRestrictions, Option<crate::types::WalletBalance>);
            get_market_apps() -> std::collections::HashMap<u32, String>;
            get_item_nameid(app_id: crate::types::AppId, market_hash_name: &str) -> crate::types::ItemNameId;
            get_item_orders_histogram(item_nameid: crate::types::ItemNameId, country: &str, currency: u32) -> crate::types::ItemOrdersHistogramResponse;

            // Phone
            get_phone_number_status() -> Option<String>;
            add_phone_number(phone: &str) -> crate::types::AddPhoneNumberResponse;
            confirm_phone_code_for_add(code: &str) -> crate::types::ConfirmPhoneCodeResponse;
            resend_phone_verification_code() -> serde_json::Value;
            get_remove_phone_number_type() -> Option<crate::types::RemovePhoneResult>;
            send_account_recovery_code(wizard_param: serde_json::Value, method: i32) -> serde_json::Value;
            confirm_remove_phone_number_code(wizard_param: serde_json::Value, code: &str) -> serde_json::Value;
            send_confirmation_2_steam_mobile_app(wizard_param: serde_json::Value) -> serde_json::Value;
            send_confirmation_2_steam_mobile_app_final(wizard_param: serde_json::Value) -> serde_json::Value;

            // Privacy
            get_privacy_settings() -> crate::types::PrivacySettings;
            set_privacy_settings(settings: crate::types::PrivacySettings) -> crate::types::PrivacySettings;
            set_all_privacy(level: &str) -> crate::types::PrivacySettings;

            // Profile
            get_profile(steam_id: Option<steamid::SteamID>) -> crate::types::SteamProfile;
            edit_profile(settings: serde_json::Value) -> ();
            set_persona_name(name: &str) -> ();
            get_alias_history(steam_id: steamid::SteamID) -> Vec<crate::types::AliasEntry>;
            clear_previous_aliases() -> ();
            set_nickname(steam_id: steamid::SteamID, nickname: &str) -> ();
            remove_nickname(steam_id: steamid::SteamID) -> ();
            post_profile_status(text: &str, app_id: Option<u32>) -> u64;
            select_previous_avatar(avatar_hash: &str) -> ();
            setup_profile() -> bool;
            get_user_summary_from_xml(steam_id: steamid::SteamID) -> crate::types::UserSummaryXml;
            get_user_summary_from_profile(steam_id: Option<steamid::SteamID>) -> crate::types::UserSummaryProfile;
            fetch_full_profile(steam_id: steamid::SteamID) -> crate::types::SteamProfile;
            resolve_user(steam_id: steamid::SteamID) -> Option<crate::types::SteamUserProfile>;
            get_avatar_history() -> Vec<crate::types::AvatarHistoryEntry>;
            upload_avatar_from_url(url: &str) -> crate::types::AvatarUploadResponse;

            // Tokens
            enumerate_tokens() -> steam_protos::CAuthenticationRefreshTokenEnumerateResponse;
            check_token_exists(token_id: &str) -> bool;
            revoke_tokens(token_ids: &[&str], shared_secret: Option<&str>) -> crate::services::tokens::RevokeTokensResult;

            // Trade
            get_trade_url() -> Option<String>;
            get_trade_offer() -> crate::types::TradeOffersResponse;
            accept_trade_offer(trade_offer_id: u64, partner_steam_id: Option<String>) -> String;
            decline_trade_offer(trade_offer_id: u64) -> ();
            send_trade_offer(trade_url: &str, my_assets: Vec<crate::types::TradeOfferAsset>, their_assets: Vec<crate::types::TradeOfferAsset>, message: &str) -> crate::types::TradeOfferResult;

            // Two-Factor Authentication
            get_steam_guard_status() -> crate::types::SteamGuardStatus;
            enable_two_factor() -> crate::types::TwoFactorResponse;
            finalize_two_factor(shared_secret: &str, activation_code: &str) -> ();
            disable_two_factor(revocation_code: &str) -> ();
            deauthorize_devices() -> ();
            add_authenticator() -> crate::types::TwoFactorResponse;
            finalize_authenticator(activation_code: &str) -> ();
            remove_authenticator(revocation_code: &str) -> ();
            enable_steam_guard_email() -> bool;
            disable_steam_guard_email() -> bool;

            // Extra
            get_player_reports() -> Vec<crate::types::PlayerReport>;
            add_free_license(package_id: u32) -> bool;
            add_sub_free_license(sub_id: u32) -> bool;
            redeem_points(definition_id: u32) -> steam_protos::messages::loyalty_rewards::CLoyaltyRewardsRedeemPointsResponse;
            get_help_requests() -> Vec<crate::types::HelpRequest>;
            get_help_request_detail(id: &str) -> String;
            get_match_history(match_type: &str, token: Option<&str>) -> crate::types::MatchHistoryResponse;

            // Misc
            logged_in() -> crate::types::LoggedInResult;
            get_notifications() -> crate::types::Notifications;
            get_web_api_key(domain: &str) -> String;
            resolve_vanity_url(api_key: &str, vanity_name: &str) -> steamid::SteamID;
            revoke_web_api_key() -> ();
        );
    };
}