Function get_puuid

Source
pub async fn get_puuid(
    client: &Client,
    game_name_space: &str,
    tag_line: &str,
    riot_api_key: &str,
) -> Result<String, Box<dyn Error + Send + Sync>>
Expand description

⚙️ Function: Fetches the player’s PUUID (Player Unique Identifier) from the Riot API.

This function sends a request to the Riot API to retrieve the PUUID of a player based on their in-game name and tag line. The PUUID is a globally unique identifier used across Riot’s systems to identify players.

§Parameters:

  • client: An instance of the reqwest::Client used to send HTTP requests.
  • game_name_space: The player’s in-game name (spaces should be replaced with %20).
  • tag_line: The player’s tag line, typically a four-digit number associated with their Riot account.
  • riot_api_key: The API key used to authenticate the request with the Riot API.

§Returns:

  • Result<String, Error>: The PUUID as a string if the request is successful, or an error if the player does not exist or the request fails.

§⚠️ Notes:

  • If the player does not exist or the information provided is incorrect, the function will return an error message.
  • The PUUID is a critical identifier that is used in subsequent requests to fetch match and player data.

§Example:

let puuid = get_puuid(&client, "Faker", "1234", riot_api_key).await?;

The resulting puuid will be a unique string identifier, such as:

"abcd1234-efgh5678-ijkl91011-mnop1213"