From 1ec4c18ae4e2b6af794f5d1bde09c7c5841bbea7 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Tue, 5 Sep 2023 00:38:32 -0700 Subject: [PATCH] Regen for Briar, new `champion-mastery-v4.getChampionMasteryByPUUID` endpoint --- riven/src/consts/champion.rs | 6 +++ riven/src/endpoints.rs | 87 ++++++++++++++++++++++++++++++++++-- riven/src/meta.rs | 10 +++-- riven/src/models.rs | 2 +- 4 files changed, 97 insertions(+), 8 deletions(-) diff --git a/riven/src/consts/champion.rs b/riven/src/consts/champion.rs index e5eb375..232b232 100644 --- a/riven/src/consts/champion.rs +++ b/riven/src/consts/champion.rs @@ -33,6 +33,7 @@ newtype_enum! { /// `BLITZCRANK` | "Blitzcrank" | "Blitzcrank" | 53 /// `BRAND` | "Brand" | "Brand" | 63 /// `BRAUM` | "Braum" | "Braum" | 201 + /// `BRIAR` | "Briar" | "Briar" | 233 /// `CAITLYN` | "Caitlyn" | "Caitlyn" | 51 /// `CAMILLE` | "Camille" | "Camille" | 164 /// `CASSIOPEIA` | "Cassiopeia" | "Cassiopeia" | 69 @@ -218,6 +219,8 @@ newtype_enum! { BRAND = 63, /// `201`. BRAUM = 201, + /// `233`. + BRIAR = 233, /// `51`. CAITLYN = 51, /// `164`. @@ -536,6 +539,7 @@ impl Champion { Self::BLITZCRANK => Some("Blitzcrank"), Self::BRAND => Some("Brand"), Self::BRAUM => Some("Braum"), + Self::BRIAR => Some("Briar"), Self::CAITLYN => Some("Caitlyn"), Self::CAMILLE => Some("Camille"), Self::CASSIOPEIA => Some("Cassiopeia"), @@ -724,6 +728,7 @@ impl Champion { Self::BLITZCRANK => Some("Blitzcrank"), Self::BRAND => Some("Brand"), Self::BRAUM => Some("Braum"), + Self::BRIAR => Some("Briar"), Self::CAITLYN => Some("Caitlyn"), Self::CAMILLE => Some("Camille"), Self::CASSIOPEIA => Some("Cassiopeia"), @@ -943,6 +948,7 @@ impl std::str::FromStr for Champion { /* BLIT */ [ 'B', 'L', 'I', 'T'] => Ok(Champion::BLITZCRANK), /* BRAN */ [ 'B', 'R', 'A', 'N'] => Ok(Champion::BRAND), /* BRAU */ [ 'B', 'R', 'A', 'U'] => Ok(Champion::BRAUM), + /* BRIA */ [ 'B', 'R', 'I', 'A'] => Ok(Champion::BRIAR), /* CAIT */ [ 'C', 'A', 'I', 'T'] => Ok(Champion::CAITLYN), /* CAMI */ [ 'C', 'A', 'M', 'I'] => Ok(Champion::CAMILLE), /* CASS */ [ 'C', 'A', 'S', 'S'] => Ok(Champion::CASSIOPEIA), diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index 4b83abf..0368026 100644 --- a/riven/src/endpoints.rs +++ b/riven/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 55e76c61b6feb1298719d6f55d89f2229e88e4eb +// Version 560d6708a4e0e652fc4b2ada788de0bd6eb546ad //! Automatically generated endpoint handles. #![allow(clippy::let_and_return, clippy::too_many_arguments)] @@ -372,6 +372,66 @@ 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: crate::consts::Champion) + -> 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 request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request }; + 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. @@ -432,6 +492,25 @@ 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. @@ -498,16 +577,16 @@ impl<'a> ClashV1<'a> { /// This endpoint returns a list of active Clash players for a given PUUID. If a summoner registers for multiple tournaments at the same time (e.g., Saturday and Sunday) then both registrations would appear in this list. /// # Parameters /// * `route` - Route to query. - /// * `encrypted_puuid` (required, in path) + /// * `puuid` (required, in path) /// # Riot Developer API Reference /// `clash-v1.getPlayersByPUUID` /// /// Note: this method is automatically generated. - pub fn get_players_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str) + pub fn get_players_by_puuid(&self, route: PlatformRoute, puuid: &str) -> impl Future>> + 'a { let route_str = route.into(); - let request = self.base.request(Method::GET, route_str, &format!("/lol/clash/v1/players/by-puuid/{}", encrypted_puuid)); + let request = self.base.request(Method::GET, route_str, &format!("/lol/clash/v1/players/by-puuid/{}", puuid)); let future = self.base.execute_val::>("clash-v1.getPlayersByPUUID", route_str, request); #[cfg(feature = "tracing")] let future = future.instrument(tracing::info_span!("clash-v1.getPlayersByPUUID")); diff --git a/riven/src/meta.rs b/riven/src/meta.rs index 033bdeb..4038cfd 100644 --- a/riven/src/meta.rs +++ b/riven/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 55e76c61b6feb1298719d6f55d89f2229e88e4eb +// Version 560d6708a4e0e652fc4b2ada788de0bd6eb546ad //! Metadata about the Riot API and Riven. //! @@ -15,17 +15,21 @@ /// 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); 79] = [ +pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 83] = [ (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"), + (reqwest::Method::GET, "/lol/clash/v1/players/by-puuid/{puuid}", "clash-v1.getPlayersByPUUID"), (reqwest::Method::GET, "/lol/clash/v1/players/by-summoner/{summonerId}", "clash-v1.getPlayersBySummoner"), (reqwest::Method::GET, "/lol/clash/v1/teams/{teamId}", "clash-v1.getTeamById"), (reqwest::Method::GET, "/lol/clash/v1/tournaments", "clash-v1.getTournaments"), diff --git a/riven/src/models.rs b/riven/src/models.rs index 046c594..46eba70 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 55e76c61b6feb1298719d6f55d89f2229e88e4eb +// Version 560d6708a4e0e652fc4b2ada788de0bd6eb546ad #![allow(missing_docs)]