mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-23 01:54:22 +00:00
Add create_globalindexes_from_dd_latest_en_us
This commit is contained in:
parent
ef93f04140
commit
ee1778284d
1 changed files with 13 additions and 0 deletions
|
@ -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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
macro_rules! test_fetch {
|
macro_rules! test_fetch {
|
||||||
|
|
Loading…
Reference in a new issue