pub async fn get_matchs_info(
client: &Client,
match_id: &str,
riot_api_key: &str,
) -> Result<Value, Box<dyn Error + Send + Sync>>Expand description
⚙️ Function: Fetches detailed information about a specific match using the match ID.
This function sends a request to the Riot API to retrieve detailed information about a match, such as participants, game duration, result (win/loss), and other match-related statistics. The match data is returned as a JSON object.
§Parameters:
client: An instance of thereqwest::Clientused to send HTTP requests.match_id: The unique ID of the match to retrieve. Each match is assigned a unique identifier in the Riot API.riot_api_key: The API key used to authenticate the request with the Riot API.
§Returns:
Result<Value, Error>: A JSON object containing detailed match data if the request is successful, or an error if the request fails.
§⚠️ Notes:
- The match data includes detailed statistics for each participant, including champion played, kills, deaths, assists, and more.
- The
match_idmust be valid for the request to succeed; otherwise, the function returns an error.
§Example:
let match_info = get_matchs_info(&client, "EUW1_1234567890", riot_api_key).await?;The resulting match_info will contain detailed match data like:
{
"metadata": {
"dataVersion": "2",
"matchId": "EUW1_1234567890"
},
"info": {
"gameCreation": 1625000000000,
"gameDuration": 1800,
"participants": [
{
"summonerName": "Faker",
"championName": "Yasuo",
"kills": 10,
"deaths": 2,
"assists": 8,
...
}
]
}
}