use std::collections::HashMap;
use super::super::{GasError, GasSteamUser};
use crate::types::{AppDetail, AppListItem, CsgoAccountStats, DynamicStoreUserData, OwnedApp, OwnedAppDetail, SimpleSteamAppList, SteamAppVersionInfo};
impl GasSteamUser {
pub async fn get_owned_apps(&self) -> Result<Vec<OwnedApp>, GasError> {
self.call("get_owned_apps", &[]).await
}
pub async fn get_owned_apps_id(&self) -> Result<Vec<u32>, GasError> {
self.call("get_owned_apps_ids", &[]).await
}
pub async fn get_owned_apps_detail(&self) -> Result<Vec<OwnedAppDetail>, GasError> {
self.call("get_owned_apps_detail", &[]).await
}
pub async fn get_app_detail(&self, app_ids: &[u32]) -> Result<HashMap<u32, AppDetail>, GasError> {
let json = serde_json::to_string(app_ids).map_err(GasError::Json)?;
self.call("get_app_detail", &[("appIds", &json)]).await
}
pub async fn fetch_csgo_account_stats(&self) -> Result<CsgoAccountStats, GasError> {
self.call("fetch_csgo_account_stats", &[]).await
}
pub async fn get_app_list(&self) -> Result<SimpleSteamAppList, GasError> {
self.call("get_app_list", &[]).await
}
pub async fn suggest_app_list(&self, term: &str) -> Result<Vec<AppListItem>, GasError> {
self.call("suggest_app_list", &[("term", term)]).await
}
pub async fn query_app_list(&self, term: &str) -> Result<Vec<AppListItem>, GasError> {
self.call("query_app_list", &[("term", term)]).await
}
pub async fn get_steam_app_version_info(&self, app_id: u32) -> Result<SteamAppVersionInfo, GasError> {
let app = app_id.to_string();
self.call("get_steam_app_version_info", &[("appId", &app)]).await
}
pub async fn get_dynamic_store_user_data(&self) -> Result<DynamicStoreUserData, GasError> {
self.call("get_dynamic_store_user_data", &[]).await
}
pub async fn fetch_batched_loyalty_reward_items(&self, app_ids: &[u32]) -> Result<Vec<steam_protos::messages::CLoyaltyRewardsBatchedQueryRewardItemsResponseResponse>, GasError> {
let json = serde_json::to_string(app_ids).map_err(GasError::Json)?;
self.call("fetch_batched_loyalty_reward_items", &[("appIds", &json)]).await
}
}