diff --git a/riven/src/consts/champion.rs b/riven/src/consts/champion.rs index 6f33df7..e5eb375 100644 --- a/riven/src/consts/champion.rs +++ b/riven/src/consts/champion.rs @@ -97,6 +97,7 @@ newtype_enum! { /// `MISS_FORTUNE` | "Miss Fortune" | "MissFortune" | 21 /// `MORDEKAISER` | "Mordekaiser" | "Mordekaiser" | 82 /// `MORGANA` | "Morgana" | "Morgana" | 25 + /// `NAAFIRI` | "Naafiri" | "Naafiri" | 950 /// `NAMI` | "Nami" | "Nami" | 267 /// `NASUS` | "Nasus" | "Nasus" | 75 /// `NAUTILUS` | "Nautilus" | "Nautilus" | 111 @@ -345,6 +346,8 @@ newtype_enum! { MORDEKAISER = 82, /// `25`. MORGANA = 25, + /// `950`. + NAAFIRI = 950, /// `267`. NAMI = 267, /// `75`. @@ -597,6 +600,7 @@ impl Champion { Self::MISS_FORTUNE => Some("Miss Fortune"), Self::MORDEKAISER => Some("Mordekaiser"), Self::MORGANA => Some("Morgana"), + Self::NAAFIRI => Some("Naafiri"), Self::NAMI => Some("Nami"), Self::NASUS => Some("Nasus"), Self::NAUTILUS => Some("Nautilus"), @@ -784,6 +788,7 @@ impl Champion { Self::MISS_FORTUNE => Some("MissFortune"), Self::MORDEKAISER => Some("Mordekaiser"), Self::MORGANA => Some("Morgana"), + Self::NAAFIRI => Some("Naafiri"), Self::NAMI => Some("Nami"), Self::NASUS => Some("Nasus"), Self::NAUTILUS => Some("Nautilus"), @@ -1009,6 +1014,7 @@ impl std::str::FromStr for Champion { /* MISS */ [ 'M', 'I', 'S', 'S'] => Ok(Champion::MISS_FORTUNE), /* MORD */ [ 'M', 'O', 'R', 'D'] => Ok(Champion::MORDEKAISER), /* MORG */ [ 'M', 'O', 'R', 'G'] => Ok(Champion::MORGANA), + /* NAAF */ [ 'N', 'A', 'A', 'F'] => Ok(Champion::NAAFIRI), /* NAMI */ [ 'N', 'A', 'M', 'I'] => Ok(Champion::NAMI), /* NASU */ [ 'N', 'A', 'S', 'U'] => Ok(Champion::NASUS), /* NAUT */ [ 'N', 'A', 'U', 'T'] => Ok(Champion::NAUTILUS), diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index f3b7c87..0510c60 100644 --- a/riven/src/endpoints.rs +++ b/riven/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba +// Version 7d71fe40a50ce14ad12ed6db791a4d0bae0f810e //! Automatically generated endpoint handles. #![allow(clippy::let_and_return, clippy::too_many_arguments)] @@ -372,66 +372,6 @@ pub struct ChampionMasteryV4<'a> { base: &'a RiotApi, } impl<'a> ChampionMasteryV4<'a> { - /// Get all champion mastery entries sorted by number of champion points descending. - /// # Parameters - /// * `route` - Route to query. - /// * `encrypted_puuid` (required, in path) - /// # Riot Developer API Reference - /// `champion-mastery-v4.getAllChampionMasteriesByPUUID` - /// - /// Note: this method is automatically generated. - pub fn get_all_champion_masteries_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str) - -> impl Future>> + 'a - { - let route_str = route.into(); - let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}", encrypted_puuid)); - let future = self.base.execute_val::>("champion-mastery-v4.getAllChampionMasteriesByPUUID", route_str, request); - #[cfg(feature = "tracing")] - let future = future.instrument(tracing::info_span!("champion-mastery-v4.getAllChampionMasteriesByPUUID")); - future - } - - /// Get a champion mastery by puuid and champion ID. - /// # Parameters - /// * `route` - Route to query. - /// * `encrypted_puuid` (required, in path) - /// * `champion_id` (required, in path) - Champion ID to retrieve Champion Mastery. - /// # Riot Developer API Reference - /// `champion-mastery-v4.getChampionMasteryByPUUID` - /// - /// Note: this method is automatically generated. - pub fn get_champion_mastery_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str, champion_id: &str) - -> impl Future> + 'a - { - let route_str = route.into(); - let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}/by-champion/{}", encrypted_puuid, champion_id)); - let future = self.base.execute_val::("champion-mastery-v4.getChampionMasteryByPUUID", route_str, request); - #[cfg(feature = "tracing")] - let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryByPUUID")); - future - } - - /// Get specified number of top champion mastery entries sorted by number of champion points descending. - /// # Parameters - /// * `route` - Route to query. - /// * `encrypted_puuid` (required, in path) - /// * `count` (optional, in query) - Number of entries to retrieve, defaults to 3. - /// # Riot Developer API Reference - /// `champion-mastery-v4.getTopChampionMasteriesByPUUID` - /// - /// Note: this method is automatically generated. - pub fn get_top_champion_masteries_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str, count: Option) - -> impl Future>> + 'a - { - let route_str = route.into(); - let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}/top", encrypted_puuid)); - let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); } - let future = self.base.execute_val::>("champion-mastery-v4.getTopChampionMasteriesByPUUID", route_str, request); - #[cfg(feature = "tracing")] - let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteriesByPUUID")); - future - } - /// Get all champion mastery entries sorted by number of champion points descending, /// # Parameters /// * `route` - Route to query. @@ -492,25 +432,6 @@ impl<'a> ChampionMasteryV4<'a> { future } - /// Get a player's total champion mastery score, which is the sum of individual champion mastery levels. - /// # Parameters - /// * `route` - Route to query. - /// * `encrypted_puuid` (required, in path) - /// # Riot Developer API Reference - /// `champion-mastery-v4.getChampionMasteryScoreByPUUID` - /// - /// Note: this method is automatically generated. - pub fn get_champion_mastery_score_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str) - -> impl Future> + 'a - { - let route_str = route.into(); - let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/scores/by-puuid/{}", encrypted_puuid)); - let future = self.base.execute_val::("champion-mastery-v4.getChampionMasteryScoreByPUUID", route_str, request); - #[cfg(feature = "tracing")] - let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryScoreByPUUID")); - future - } - /// Get a player's total champion mastery score, which is the sum of individual champion mastery levels. /// # Parameters /// * `route` - Route to query. diff --git a/riven/src/meta.rs b/riven/src/meta.rs index ce8ded6..e02f32c 100644 --- a/riven/src/meta.rs +++ b/riven/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba +// Version 7d71fe40a50ce14ad12ed6db791a4d0bae0f810e //! Metadata about the Riot API and Riven. //! @@ -15,18 +15,14 @@ /// Metadata for endpoints. Each tuple corresponds to one endpoint and contains /// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID. -pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 83] = [ +pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 79] = [ (reqwest::Method::GET, "/riot/account/v1/accounts/by-puuid/{puuid}", "account-v1.getByPuuid"), (reqwest::Method::GET, "/riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine}", "account-v1.getByRiotId"), (reqwest::Method::GET, "/riot/account/v1/accounts/me", "account-v1.getByAccessToken"), (reqwest::Method::GET, "/riot/account/v1/active-shards/by-game/{game}/by-puuid/{puuid}", "account-v1.getActiveShard"), - (reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}", "champion-mastery-v4.getAllChampionMasteriesByPUUID"), - (reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}/by-champion/{championId}", "champion-mastery-v4.getChampionMasteryByPUUID"), - (reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}/top", "champion-mastery-v4.getTopChampionMasteriesByPUUID"), (reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getAllChampionMasteries"), (reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/by-champion/{championId}", "champion-mastery-v4.getChampionMastery"), (reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/top", "champion-mastery-v4.getTopChampionMasteries"), - (reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-puuid/{encryptedPUUID}", "champion-mastery-v4.getChampionMasteryScoreByPUUID"), (reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getChampionMasteryScore"), (reqwest::Method::GET, "/lol/platform/v3/champion-rotations", "champion-v3.getChampionInfo"), (reqwest::Method::GET, "/lol/clash/v1/players/by-puuid/{encryptedPUUID}", "clash-v1.getPlayersByPUUID"), diff --git a/riven/src/models.rs b/riven/src/models.rs index b089663..97c94ae 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba +// Version 7d71fe40a50ce14ad12ed6db791a4d0bae0f810e #![allow(missing_docs)] @@ -269,15 +269,18 @@ pub mod league_v4 { #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct LeagueList { #[serde(rename = "leagueId")] - pub league_id: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub league_id: Option, #[serde(rename = "entries")] pub entries: std::vec::Vec, #[serde(rename = "tier")] pub tier: crate::consts::Tier, #[serde(rename = "name")] - pub name: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, #[serde(rename = "queue")] - pub queue: crate::consts::QueueType, + #[serde(skip_serializing_if = "Option::is_none")] + pub queue: Option, } /// LeagueItem data object. #[derive(Clone, Debug)] @@ -403,9 +406,9 @@ pub mod lol_challenges_v1 { } /// State data object. /// # Description - /// DISABLED - not visible and not calculated,
- /// HIDDEN - not visible, but calculated,
- /// ENABLED - visible and calculated,
+ /// DISABLED - not visible and not calculated,
+ /// HIDDEN - not visible, but calculated,
+ /// ENABLED - visible and calculated,
/// ARCHIVED - visible, but not calculated /// /// Note: This struct is automatically generated @@ -416,7 +419,7 @@ pub mod lol_challenges_v1 { } /// Tracking data object. /// # Description - /// LIFETIME - stats are incremented without reset,
+ /// LIFETIME - stats are incremented without reset,
/// SEASON - stats are accumulated by season and reset at the beginning of new season /// /// Note: This struct is automatically generated @@ -439,15 +442,15 @@ pub mod lol_challenges_v1 { } /// Level data object. /// # Description - /// 0 NONE,
- /// 1 IRON,
- /// 2 BRONZE,
- /// 3 SILVER,
- /// 4 GOLD,
- /// 5 PLATINUM,
- /// 6 DIAMOND,
- /// 7 MASTER,
- /// 8 GRANDMASTER,
+ /// 0 NONE,
+ /// 1 IRON,
+ /// 2 BRONZE,
+ /// 3 SILVER,
+ /// 4 GOLD,
+ /// 5 PLATINUM,
+ /// 6 DIAMOND,
+ /// 7 MASTER,
+ /// 8 GRANDMASTER,
/// 9 CHALLENGER /// /// Note: This struct is automatically generated @@ -1840,7 +1843,7 @@ pub mod match_v5 { pub real_timestamp: Option, #[serde(rename = "timestamp")] pub timestamp: i32, - /// Timeline event type.
+ /// Timeline event type.
/// (Known legal values: ASCENDED_EVENT, BUILDING_KILL, CAPTURE_POINT, CHAMPION_KILL, CHAMPION_SPECIAL_KILL, CHAMPION_TRANSFORM, DRAGON_SOUL_GIVEN, ELITE_MONSTER_KILL, GAME_END, ITEM_DESTROYED, ITEM_PURCHASED, ITEM_SOLD, ITEM_UNDO, LEVEL_UP, PAUSE_END, PAUSE_START, SKILL_LEVEL_UP, TURRET_PLATE_DESTROYED, WARD_KILL, WARD_PLACED) #[serde(rename = "type")] pub r#type: String, @@ -2313,7 +2316,7 @@ pub mod spectator_v4 { #[derive(serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct FeaturedGameInfo { - /// The game mode
+ /// The game mode
/// (Legal values: CLASSIC, ODIN, ARAM, TUTORIAL, ONEFORALL, ASCENSION, FIRSTBLOOD, KINGPORO) #[serde(rename = "gameMode")] pub game_mode: crate::consts::GameMode, @@ -2323,7 +2326,7 @@ pub mod spectator_v4 { /// The ID of the map #[serde(rename = "mapId")] pub map_id: crate::consts::Map, - /// The game type
+ /// The game type
/// (Legal values: CUSTOM_GAME, MATCHED_GAME, TUTORIAL_GAME) #[serde(rename = "gameType")] pub game_type: crate::consts::GameType, @@ -2502,7 +2505,7 @@ pub mod tft_league_v1 { pub summoner_name: String, #[serde(rename = "queueType")] pub queue_type: crate::consts::QueueType, - /// Only included for the RANKED_TFT_TURBO queueType.
+ /// Only included for the RANKED_TFT_TURBO queueType.
/// (Legal values: ORANGE, PURPLE, BLUE, GREEN, GRAY) #[serde(rename = "ratedTier")] #[serde(skip_serializing_if = "Option::is_none")] @@ -2890,15 +2893,15 @@ pub mod tournament_stub_v4 { /// The team size of the game. Valid values are 1-5. #[serde(rename = "teamSize")] pub team_size: i32, - /// The pick type of the game.
+ /// The pick type of the game.
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT) #[serde(rename = "pickType")] pub pick_type: String, - /// The map type of the game.
+ /// The map type of the game.
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS) #[serde(rename = "mapType")] pub map_type: String, - /// The spectator type of the game.
+ /// The spectator type of the game.
/// (Legal values: NONE, LOBBYONLY, ALL) #[serde(rename = "spectatorType")] pub spectator_type: String, @@ -2931,7 +2934,7 @@ pub mod tournament_stub_v4 { #[derive(serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct ProviderRegistrationParameters { - /// The region in which the provider will be running tournaments.
+ /// The region in which the provider will be running tournaments.
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR) #[serde(rename = "region")] pub region: crate::consts::TournamentRegion, @@ -2975,15 +2978,15 @@ pub mod tournament_v4 { /// The team size of the game. Valid values are 1-5. #[serde(rename = "teamSize")] pub team_size: i32, - /// The pick type of the game.
+ /// The pick type of the game.
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT) #[serde(rename = "pickType")] pub pick_type: String, - /// The map type of the game.
+ /// The map type of the game.
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS) #[serde(rename = "mapType")] pub map_type: String, - /// The spectator type of the game.
+ /// The spectator type of the game.
/// (Legal values: NONE, LOBBYONLY, ALL) #[serde(rename = "spectatorType")] pub spectator_type: String, @@ -3023,7 +3026,7 @@ pub mod tournament_v4 { /// The tournament code's ID. #[serde(rename = "id")] pub id: i32, - /// The tournament code's region.
+ /// The tournament code's region.
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR) #[serde(rename = "region")] pub region: String, @@ -3043,15 +3046,15 @@ pub mod tournament_v4 { #[serde(rename = "allowedSummonerIds")] #[serde(skip_serializing_if = "Option::is_none")] pub allowed_summoner_ids: Option>, - /// The pick type
+ /// The pick type
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT) #[serde(rename = "pickType")] pub pick_type: String, - /// The map type
+ /// The map type
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS) #[serde(rename = "mapType")] pub map_type: String, - /// The spectator type
+ /// The spectator type
/// (Legal values: NONE, LOBBYONLY, ALL) #[serde(rename = "spectatorType")] pub spectator_type: String, @@ -3084,7 +3087,7 @@ pub mod tournament_v4 { #[derive(serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] pub struct ProviderRegistrationParameters { - /// The region in which the provider will be running tournaments.
+ /// The region in which the provider will be running tournaments.
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR) #[serde(rename = "region")] pub region: crate::consts::TournamentRegion, diff --git a/riven/tests/tests_na.rs b/riven/tests/tests_na.rs index 03728b6..9c1f68f 100644 --- a/riven/tests/tests_na.rs +++ b/riven/tests/tests_na.rs @@ -49,7 +49,9 @@ async_tests! { leagueexp_get: async { let p = RIOT_API.league_exp_v4().get_league_entries(ROUTE, QueueType::RANKED_SOLO_5x5, Tier::CHALLENGER, Division::I, None); let d = p.await.map_err(|e| e.to_string())?; - rassert!(!d.is_empty(), "Challenger shouldn't be empty."); + if d.is_empty() { + eprintln!("Off-season, challenger league is empty."); + } Ok(()) }, champion_mastery_v4: async { diff --git a/riven/tests/testutils.rs b/riven/tests/testutils.rs index e29de82..d1e9dd9 100644 --- a/riven/tests/testutils.rs +++ b/riven/tests/testutils.rs @@ -25,8 +25,14 @@ pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(), .await .map_err(|e| format!("Failed to get challenger league: {}", e))?; - if QueueType::RANKED_SOLO_5x5 != challenger_league.queue { - return Err(format!("Unexpected `queue`: {}", challenger_league.queue)); + let Some(queue) = challenger_league.queue else { + assert!(challenger_league.entries.is_empty()); + eprintln!("Off-season, challenger league is empty."); + return Ok(()); + }; + + if QueueType::RANKED_SOLO_5x5 != queue { + return Err(format!("Unexpected `queue`: {:?}", queue)); } if challenger_league.entries.is_empty() { return Err("Challenger league is unexpectedly empty!".to_owned());