diff --git a/riven/src/consts/champion.rs b/riven/src/consts/champion.rs index 80a0038..05efb27 100644 --- a/riven/src/consts/champion.rs +++ b/riven/src/consts/champion.rs @@ -28,6 +28,7 @@ newtype_enum! { /// `AURELION_SOL` | "Aurelion Sol" | "AurelionSol" | 136 /// `AZIR` | "Azir" | "Azir" | 268 /// `BARD` | "Bard" | "Bard" | 432 + /// `BEL_VETH` | "Bel'Veth" | "Belveth" | 200 /// `BLITZCRANK` | "Blitzcrank" | "Blitzcrank" | 53 /// `BRAND` | "Brand" | "Brand" | 63 /// `BRAUM` | "Braum" | "Braum" | 201 @@ -203,6 +204,8 @@ newtype_enum! { AZIR = 268, /// `432`. BARD = 432, + /// `200`. + BEL_VETH = 200, /// `53`. BLITZCRANK = 53, /// `63`. @@ -515,6 +518,7 @@ impl Champion { Self::AURELION_SOL => Some("Aurelion Sol"), Self::AZIR => Some("Azir"), Self::BARD => Some("Bard"), + Self::BEL_VETH => Some("Bel'Veth"), Self::BLITZCRANK => Some("Blitzcrank"), Self::BRAND => Some("Brand"), Self::BRAUM => Some("Braum"), @@ -673,6 +677,7 @@ impl Champion { /// /// Field | Name | Identifier | Id /// ---|---|---|--- + /// `BEL_VETH` | "Bel'Veth" | "Belveth" | 200 /// `CHO_GATH` | "Cho'Gath" | "Chogath" | 31 /// `FIDDLESTICKS` | "Fiddlesticks" | "FiddleSticks" | 9 /// `KAI_SA` | "Kai'Sa" | "Kaisa" | 145 @@ -697,6 +702,7 @@ impl Champion { Self::AURELION_SOL => Some("AurelionSol"), Self::AZIR => Some("Azir"), Self::BARD => Some("Bard"), + Self::BEL_VETH => Some("Belveth"), Self::BLITZCRANK => Some("Blitzcrank"), Self::BRAND => Some("Brand"), Self::BRAUM => Some("Braum"), @@ -910,6 +916,8 @@ impl std::str::FromStr for Champion { /* AURE */ [ 'A', 'U', 'R', 'E'] => Ok(Champion::AURELION_SOL), /* AZIR */ [ 'A', 'Z', 'I', 'R'] => Ok(Champion::AZIR), /* BARD */ [ 'B', 'A', 'R', 'D'] => Ok(Champion::BARD), + /* BELV */ [ 'B', 'E', 'L', 'V'] => Ok(Champion::BEL_VETH), + /* BEL */ [ 'B', 'E', 'L', '\0'] => Ok(Champion::BEL_VETH), /* BLIT */ [ 'B', 'L', 'I', 'T'] => Ok(Champion::BLITZCRANK), /* BRAN */ [ 'B', 'R', 'A', 'N'] => Ok(Champion::BRAND), /* BRAU */ [ 'B', 'R', 'A', 'U'] => Ok(Champion::BRAUM), diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index 49a7969..af2b9b9 100644 --- a/riven/src/endpoints.rs +++ b/riven/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c +// Version 8afe7b8e927da46a6f41108e6dc7e1a8c71d89b9 //! Automatically generated endpoint handles. #![allow(clippy::let_and_return, clippy::too_many_arguments)] @@ -801,7 +801,7 @@ impl<'a> LolChallengesV1<'a> { /// `lol-challenges-v1.getChallengeLeaderboards` /// /// Note: this method is automatically generated. - pub fn get_challenge_leaderboards(&self, route: PlatformRoute, challenge_id: i64, level: &str, limit: Option) + pub fn get_challenge_leaderboards(&self, route: PlatformRoute, challenge_id: i64, level: crate::consts::Tier, limit: Option) -> impl Future>>> + 'a { let route_str = route.into(); diff --git a/riven/src/meta.rs b/riven/src/meta.rs index 7d716ca..c819c26 100644 --- a/riven/src/meta.rs +++ b/riven/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c +// Version 8afe7b8e927da46a6f41108e6dc7e1a8c71d89b9 //! Metadata about the Riot API and Riven. //! diff --git a/riven/src/models.rs b/riven/src/models.rs index e1ec9b5..bc27535 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c +// Version 8afe7b8e927da46a6f41108e6dc7e1a8c71d89b9 #![allow(missing_docs)] @@ -468,34 +468,56 @@ pub mod lol_challenges_v1 { pub category_points: std::collections::HashMap, } /// ChallengeInfo data object. - /// # Description - /// UNKNOWN TYPE. - /// - /// Note: This struct is automatically generated #[derive(Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct ChallengeInfo { + #[serde(rename = "challengeId")] + pub challenge_id: i64, + #[serde(rename = "percentile")] + pub percentile: f64, + #[serde(rename = "level")] + pub level: crate::consts::Tier, + #[serde(rename = "value")] + pub value: f64, + #[serde(rename = "achievedTime")] + pub achieved_time: i64, + #[serde(rename = "position")] + #[serde(skip_serializing_if = "Option::is_none")] + pub position: Option, + #[serde(rename = "playersInLevel")] + #[serde(skip_serializing_if = "Option::is_none")] + pub players_in_level: Option, } /// PlayerClientPreferences data object. - /// # Description - /// UNKNOWN TYPE. - /// - /// Note: This struct is automatically generated #[derive(Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct PlayerClientPreferences { + #[serde(rename = "bannerAccent")] + #[serde(skip_serializing_if = "Option::is_none")] + pub banner_accent: Option, + #[serde(rename = "title")] + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(rename = "challengeIds")] + #[serde(skip_serializing_if = "Option::is_none")] + pub challenge_ids: Option>, } /// ChallengePoints data object. - /// # Description - /// UNKNOWN TYPE. - /// - /// Note: This struct is automatically generated #[derive(Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct ChallengePoints { + #[serde(rename = "level")] + pub level: crate::consts::Tier, + #[serde(rename = "current")] + pub current: i64, + #[serde(rename = "max")] + pub max: i64, + #[serde(rename = "percentile")] + #[serde(skip_serializing_if = "Option::is_none")] + pub percentile: Option, } } diff --git a/riven/tests/tests_la1.rs b/riven/tests/tests_la1.rs index fabca7f..349a62f 100644 --- a/riven/tests/tests_la1.rs +++ b/riven/tests/tests_la1.rs @@ -11,8 +11,44 @@ use riven::consts::*; const ROUTE: PlatformRoute = PlatformRoute::LA1; +/// en_US description: "As a laner, get kills before 10 minutes outside your lane (anyone but your lane opponent)" +const CHALLENGE_ID__ARAM_1K_DPM: i64 = 101101; + async_tests! { my_runner { + // /lol/challenges/v1/challenges/{challengeId}/leaderboards/by-level/{level} + // /lol/challenges/v1/player-data/{puuid} + lol_challenges_v1_leaderboards_playerdata: async { + let challenge_id = CHALLENGE_ID__ARAM_1K_DPM; + let leaderboard = RIOT_API.lol_challenges_v1() + .get_challenge_leaderboards(ROUTE, challenge_id, Tier::GRANDMASTER, None) + .await.map_err(|e| e.to_string())? + .ok_or_else(|| format!("Challenge leaderboard with id {} returned 404", challenge_id))?; + + { + rassert!(!leaderboard.is_empty()); + let start = leaderboard[0].position; + // Commented out: leaderboard is not monotonic for some reason. + // let mut val = leaderboard[0].value; + for (n, entry) in leaderboard.iter().enumerate() { + rassert_eq!(start + (n as i32), entry.position); + // rassert!(entry.val <= val); + // val = etnry.val; + } + } + + // Spot check 10% for `player-data`. + for entry in leaderboard.iter().step_by(10) + { + let player_data = RIOT_API.lol_challenges_v1().get_player_data(ROUTE, &*entry.puuid) + .await.map_err(|e| format!("Failed to get player data PUUID {}: {}", entry.puuid, e))?; + } + + Ok(()) + }, + + // /lol/challenges/v1/challenges/config + // /lol/challenges/v1/challenges/{challengeId}/config lol_challenges_v1_check_configs: async { let challenges = RIOT_API.lol_challenges_v1().get_all_challenge_configs(ROUTE) .await.map_err(|e| e.to_string())?; @@ -32,6 +68,9 @@ async_tests! { Ok(()) }, + + // /lol/challenges/v1/challenges/percentiles + // /lol/challenges/v1/challenges/{challengeId}/percentiles lol_challenges_v1_check_percentiles: async { // Check all percentiles. let percentiles = RIOT_API.lol_challenges_v1().get_all_challenge_percentiles(ROUTE)