steam-user 0.1.0

Steam User web client for Rust - HTTP-based Steam Community interactions
Documentation
use super::super::{GasError, GasSteamUser};
use crate::{
    services::tokens::RevokeTokensResult,
    types::{HelpRequest, MatchHistoryResponse, PlayerReport},
};

impl GasSteamUser {
    pub async fn get_player_reports(&self) -> Result<Vec<PlayerReport>, GasError> {
        self.call("get_player_reports", &[]).await
    }
    pub async fn add_free_license(&self, package_id: u32) -> Result<bool, GasError> {
        let pkg = package_id.to_string();
        self.call("add_free_license", &[("packageId", &pkg)]).await
    }
    pub async fn add_sub_free_license(&self, sub_id: u32) -> Result<bool, GasError> {
        let sub = sub_id.to_string();
        self.call("add_sub_free_license", &[("subId", &sub)]).await
    }
    pub async fn get_help_requests(&self) -> Result<Vec<HelpRequest>, GasError> {
        self.call("get_help_requests", &[]).await
    }
    pub async fn get_help_request_detail(&self, id: &str) -> Result<String, GasError> {
        self.call("get_help_request_detail", &[("id", id)]).await
    }
    pub async fn get_match_history(&self, match_type: &str, token: Option<&str>) -> Result<MatchHistoryResponse, GasError> {
        let mut params: Vec<(&str, &str)> = vec![("matchType", match_type)];
        if let Some(t) = token {
            params.push(("token", t));
        }
        self.call("get_match_history", &params).await
    }
    // Tokens (no separate module for GAS)
    pub async fn enumerate_tokens(&self) -> Result<steam_protos::CAuthenticationRefreshTokenEnumerateResponse, GasError> {
        self.call("enumerate_tokens", &[]).await
    }
    pub async fn check_token_exists(&self, token_id: &str) -> Result<bool, GasError> {
        self.call("check_token_exists", &[("tokenId", token_id)]).await
    }
    pub async fn revoke_tokens(&self, token_ids: &[&str], shared_secret: Option<&str>) -> Result<RevokeTokensResult, GasError> {
        let json = serde_json::to_string(token_ids).map_err(GasError::Json)?;
        let mut params: Vec<(&str, &str)> = vec![("tokenIds", &json)];
        if let Some(secret) = shared_secret {
            params.push(("sharedSecret", secret));
        }
        self.call("revoke_tokens", &params).await
    }
}