From bf51ba0a835f110bf2965c90751ad1db397c8b5f Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Fri, 16 Jun 2023 12:05:19 -0700 Subject: [PATCH] Regenerate for new `champion-mastery-v4` PUUID methods, new `match-v5.ParticipantDto` fields New `champion-mastery-v4` endpoints: * `getAllChampionMasteriesByPUUID` * `getChampionMasteryByPUUID` * `getTopChampionMasteriesByPUUID` * `getChampionMasteryScoreByPUUID` New fields: `match-v5.ParticipantDto.playerAugment[1234],playerSubteamId,subteamPlacement` --- riven/src/endpoints.rs | 81 +++++++++++++++++++++++++++++++++++- riven/src/meta.rs | 8 +++- riven/src/models.rs | 20 ++++++++- riven/tests/tests_asia_jp.rs | 3 ++ 4 files changed, 108 insertions(+), 4 deletions(-) diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index 022d9b2..f3b7c87 100644 --- a/riven/src/endpoints.rs +++ b/riven/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 330285a83d1e8c4a3a619734dc2204446fb16cff +// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba //! 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: &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. @@ -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. diff --git a/riven/src/meta.rs b/riven/src/meta.rs index 1465420..ce8ded6 100644 --- a/riven/src/meta.rs +++ b/riven/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 330285a83d1e8c4a3a619734dc2204446fb16cff +// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba //! Metadata about the Riot API and Riven. //! @@ -15,14 +15,18 @@ /// 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"), diff --git a/riven/src/models.rs b/riven/src/models.rs index 4a70fee..b089663 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 330285a83d1e8c4a3a619734dc2204446fb16cff +// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba #![allow(missing_docs)] @@ -1299,6 +1299,24 @@ pub mod match_v5 { #[serde(rename = "totalEnemyJungleMinionsKilled")] #[serde(skip_serializing_if = "Option::is_none")] pub total_enemy_jungle_minions_killed: Option, + #[serde(rename = "playerAugment1")] + #[serde(skip_serializing_if = "Option::is_none")] + pub player_augment1: Option, + #[serde(rename = "playerAugment2")] + #[serde(skip_serializing_if = "Option::is_none")] + pub player_augment2: Option, + #[serde(rename = "playerAugment3")] + #[serde(skip_serializing_if = "Option::is_none")] + pub player_augment3: Option, + #[serde(rename = "playerAugment4")] + #[serde(skip_serializing_if = "Option::is_none")] + pub player_augment4: Option, + #[serde(rename = "playerSubteamId")] + #[serde(skip_serializing_if = "Option::is_none")] + pub player_subteam_id: Option, + #[serde(rename = "subteamPlacement")] + #[serde(skip_serializing_if = "Option::is_none")] + pub subteam_placement: Option, } /// Perks data object. #[derive(Clone, Debug)] diff --git a/riven/tests/tests_asia_jp.rs b/riven/tests/tests_asia_jp.rs index cf0b377..750e0a1 100644 --- a/riven/tests/tests_asia_jp.rs +++ b/riven/tests/tests_asia_jp.rs @@ -34,6 +34,9 @@ static MATCHES: &[&str] = &[ "JP1_391732436", // New field `ParticipantChallenges` `twoWardsOneSweeperCount` "JP1_397348569", + // New fields: + // `match-v5.ParticipantDto.playerAugment[1234],playerSubteamId,subteamPlacement` + "JP1_400700181", ]; async_tests! {