steam-user 0.1.0

Steam User web client for Rust - HTTP-based Steam Community interactions
Documentation
use std::collections::HashMap;

use super::super::{RemoteSteamUser, RemoteSteamUserError};
use crate::types::{Amount, AppId, AssetId, BoosterPackEntry, BoosterResult, ContextId, EconItem, GemResult, GemValue, ItemNameId, ItemOrdersHistogramResponse, MarketHistoryResponse, MarketRestrictions, MyListingsResult, PriceCents, SellItemResult};

impl RemoteSteamUser {
    pub async fn get_my_listings(&self) -> Result<MyListingsResult, RemoteSteamUserError> {
        self.call_typed("/api/market/listings", serde_json::json!({})).await
    }
    pub async fn get_market_history(&self, start: u32, count: u32) -> Result<MarketHistoryResponse, RemoteSteamUserError> {
        self.call_typed("/api/market/history", serde_json::json!({"start": start, "count": count})).await
    }
    pub async fn sell_item(&self, appid: AppId, contextid: ContextId, assetid: AssetId, amount: Amount, price: PriceCents) -> Result<SellItemResult, RemoteSteamUserError> {
        self.call_typed("/api/market/sell", serde_json::json!({"appid": appid.get(), "contextid": contextid.get(), "assetid": assetid.get(), "amount": amount.get(), "price": price.get()})).await
    }
    pub async fn remove_listing(&self, listing_id: &str) -> Result<bool, RemoteSteamUserError> {
        self.call_typed("/api/market/remove_listing", serde_json::json!({"listing_id": listing_id})).await
    }
    pub async fn get_gem_value(&self, appid: AppId, assetid: AssetId) -> Result<GemValue, RemoteSteamUserError> {
        self.call_typed("/api/market/gem_value", serde_json::json!({"appid": appid.get(), "assetid": assetid.get()})).await
    }
    pub async fn turn_item_into_gems(&self, appid: AppId, assetid: AssetId, expected_value: u32) -> Result<GemResult, RemoteSteamUserError> {
        self.call_typed("/api/market/turn_into_gems", serde_json::json!({"appid": appid.get(), "assetid": assetid.get(), "expected_value": expected_value})).await
    }
    pub async fn get_booster_pack_catalog(&self) -> Result<Vec<BoosterPackEntry>, RemoteSteamUserError> {
        self.call_typed("/api/market/booster_catalog", serde_json::json!({})).await
    }
    pub async fn create_booster_pack(&self, appid: AppId, use_untradable_gems: bool) -> Result<BoosterResult, RemoteSteamUserError> {
        self.call_typed("/api/market/create_booster", serde_json::json!({"appid": appid.get(), "use_untradable_gems": use_untradable_gems})).await
    }
    pub async fn open_booster_pack(&self, appid: AppId, assetid: AssetId) -> Result<Vec<EconItem>, RemoteSteamUserError> {
        self.call_typed("/api/market/open_booster", serde_json::json!({"appid": appid.get(), "assetid": assetid.get()})).await
    }
    pub async fn get_market_restrictions(&self) -> Result<(MarketRestrictions, Option<crate::types::WalletBalance>), RemoteSteamUserError> {
        let restrictions = self.call_typed("/api/market/restrictions", serde_json::json!({})).await?;
        Ok((restrictions, None))
    }
    pub async fn get_market_apps(&self) -> Result<HashMap<u32, String>, RemoteSteamUserError> {
        self.call_typed("/api/market/apps", serde_json::json!({})).await
    }
    pub async fn get_item_nameid(&self, app_id: AppId, market_hash_name: &str) -> Result<ItemNameId, RemoteSteamUserError> {
        self.call_typed("/api/market/item_nameid", serde_json::json!({"app_id": app_id.get(), "market_hash_name": market_hash_name})).await
    }
    pub async fn get_item_orders_histogram(&self, item_nameid: ItemNameId, country: &str, currency: u32) -> Result<ItemOrdersHistogramResponse, RemoteSteamUserError> {
        self.call_typed("/api/market/orders_histogram", serde_json::json!({"item_nameid": item_nameid.get(), "country": country, "currency": currency})).await
    }
}