use steamid::SteamID;
use super::super::{GasError, GasSteamUser};
use crate::types::{ActiveInventory, AppId, ContextId, EconItem, InventoryHistoryItem, InventoryHistoryResult, PriceOverview};
impl GasSteamUser {
pub async fn get_inventory(&self, appid: AppId, context_id: ContextId) -> Result<Vec<EconItem>, GasError> {
let app = appid.to_string();
let ctx = context_id.to_string();
self.call("get_inventory", &[("appId", &app), ("contextId", &ctx)]).await
}
pub async fn get_user_inventory_contents(&self, steam_id: SteamID, appid: AppId, context_id: ContextId) -> Result<Vec<EconItem>, GasError> {
let id = steam_id.steam_id64().to_string();
let app = appid.to_string();
let ctx = context_id.to_string();
self.call("get_user_inventory_contents", &[("steamId64", &id), ("appId", &app), ("contextId", &ctx)]).await
}
pub async fn get_active_inventories(&self) -> Result<Vec<ActiveInventory>, GasError> {
self.call("get_active_inventories", &[]).await
}
pub async fn get_inventory_history(&self) -> Result<InventoryHistoryResult, GasError> {
self.call("get_inventory_history", &[]).await
}
pub async fn get_full_inventory_history(&self) -> Result<Vec<InventoryHistoryItem>, GasError> {
self.call("get_full_inventory_history", &[]).await
}
pub async fn get_inventory_trading(&self, appid: AppId, context_id: ContextId) -> Result<serde_json::Value, GasError> {
let app = appid.to_string();
let ctx = context_id.to_string();
self.call_raw("get_inventory_trading", &[("appId", &app), ("contextId", &ctx)]).await
}
pub async fn get_inventory_trading_partner(&self, appid: AppId, partner: SteamID, context_id: ContextId) -> Result<serde_json::Value, GasError> {
let app = appid.to_string();
let p = partner.steam_id64().to_string();
let ctx = context_id.to_string();
self.call_raw("get_inventory_trading_partner", &[("appId", &app), ("partnerSteamId64", &p), ("contextId", &ctx)]).await
}
pub async fn get_price_overview(&self, appid: AppId, market_hash_name: &str) -> Result<PriceOverview, GasError> {
let app = appid.to_string();
self.call("get_price_overview", &[("appId", &app), ("marketHashName", market_hash_name)]).await
}
}