Function open_dd_json

Source
pub async fn open_dd_json() -> Result<Value, Box<dyn Error + Send + Sync>>
Expand description

⚙️ Function: Fetches the latest champion data from Data Dragon (Riot’s official static data service).

This function sends a request to Data Dragon to retrieve the latest static data about League of Legends champions, such as champion names, IDs, and related information. The data is returned as a JSON object and can be used to map champion IDs to their names and other static details.

§Returns:

  • Result<Value, Error>: A JSON object containing champion data if the request is successful, or an error if the request fails.

§⚠️ Notes:

  • The request fetches champion data in French (fr_FR), but the language can be changed by modifying the URL.
  • Data Dragon provides static, versioned data, which means this data may not always be up to date with the latest game patches unless the URL version is updated.

§Example:

let dd_json = open_dd_json().await?;

The resulting dd_json will contain champion data like:

{
  "type": "champion",
  "format": "standAloneComplex",
  "data": {
    "Aatrox": {
      "id": "Aatrox",
      "key": "266",
      "name": "Aatrox",
      ...
    },
    ...
  }
}