1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-22 17:44:22 +00:00

Add create_globalindexes_from_dd_latest_en_us

This commit is contained in:
Steffo 2023-03-21 15:39:00 +01:00
parent ef93f04140
commit ee1778284d
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -77,6 +77,19 @@ pub fn create_globalindexes_from_wd() -> globals::LocalizedGlobalsIndexes {
}
/// Create [`globals::LocalizedGlobalsIndexes`] from the latest english data in Data Dragon.
///
/// This function tries to load data from `https://dd.b.pvp.net/latest`.
pub async fn create_globalindexes_from_dd_latest_en_us() -> globals::LocalizedGlobalsIndexes {
let client = reqwest::Client::new();
let core = CoreBundle::fetch(&client, "https://dd.b.pvp.net/latest", "en_us").await
.expect("to be able to fetch `core-en_us` bundle");
globals::LocalizedGlobalsIndexes::from(core.globals)
}
#[cfg(test)]
mod tests {
macro_rules! test_fetch {