pub async fn get_matchs_id(
client: &Client,
puuid: &str,
riot_api_key: &str,
nb_match: u32,
) -> Result<Vec<String>, Box<dyn Error + Send + Sync>>Expand description
⚙️ Function: Retrieves recent match IDs for a given player using their PUUID.
This function sends a request to the Riot API to fetch the IDs of the player’s recent matches based on their PUUID. The match IDs are used to fetch detailed match data in subsequent API requests.
§Parameters:
client: An instance of thereqwest::Clientused to send HTTP requests.puuid: The player’s unique PUUID (Player Unique Identifier), used to identify them across Riot’s services.riot_api_key: The API key used to authenticate the request with the Riot API.nb_match: The number of recent matches to retrieve.
§Returns:
Result<Vec<String>, Error>: A vector containing the IDs of the player’s recent matches, or an error if the request fails.
§⚠️ Notes:
- The function retrieves the most recent 5 matches by default. This can be adjusted in the API URL if necessary.
- Each match ID is a unique string that can be used to query detailed match information.
- The
puuidmust be valid for the request to return match IDs successfully.
§Example:
let match_ids = get_matchs_id(&client, "abcd1234-efgh5678-ijkl91011-mnop1213", riot_api_key, 5).await?;The resulting match_ids will be a vector of strings, such as:
["EUW1_1234567890", "EUW1_0987654321", "EUW1_2345678901"]