From 998eb4ec469293e2960f1e4b7790ef3b31c96c11 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Wed, 21 Sep 2022 01:42:39 -0700 Subject: [PATCH] Regen for new endpoints, nullable `lol-status-v4` fields --- riven/src/endpoints.rs | 62 ++++++++++++++++++++++++++- riven/src/meta.rs | 6 ++- riven/src/models.rs | 95 ++++++++++++++++++++++++++++++++++++++--- riven/tests/tests_na.rs | 7 +++ 4 files changed, 162 insertions(+), 8 deletions(-) diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index e8b2630..485a040 100644 --- a/riven/src/endpoints.rs +++ b/riven/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 648c5b93c3144e7094749547bb91481778c8dc08 +// Version dae26e2703c82eb19447d1b27f1209801cb83beb //! Automatically generated endpoint handles. #![allow(clippy::let_and_return, clippy::too_many_arguments)] @@ -197,6 +197,15 @@ impl RiotApi { pub fn tft_match_v1(&self) -> TftMatchV1 { TftMatchV1 { base: self } } + /// Returns a handle for accessing [TftStatusV1](crate::endpoints::TftStatusV1) endpoints. + /// # Riot Developer API Reference + /// `tft-status-v1` + /// + /// Note: this method is automatically generated. + #[inline] + pub fn tft_status_v1(&self) -> TftStatusV1 { + TftStatusV1 { base: self } + } /// Returns a handle for accessing [TftSummonerV1](crate::endpoints::TftSummonerV1) endpoints. /// # Riot Developer API Reference /// `tft-summoner-v1` @@ -402,6 +411,27 @@ impl<'a> ChampionMasteryV4<'a> { future } + /// Get specified number of top champion mastery entries sorted by number of champion points descending. + /// # Parameters + /// * `route` - Route to query. + /// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player + /// * `count` (optional, in query) - Number of entries to retrieve, defaults to 3 + /// # Riot Developer API Reference + /// `champion-mastery-v4.getTopChampionMasteries` + /// + /// Note: this method is automatically generated. + pub fn get_top_champion_masteries(&self, route: PlatformRoute, encrypted_summoner_id: &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-summoner/{}/top", encrypted_summoner_id)); + let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); } + let future = self.base.execute_val::>("champion-mastery-v4.getTopChampionMasteries", route_str, request); + #[cfg(feature = "tracing")] + let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteries")); + future + } + /// Get a player's total champion mastery score, which is the sum of individual champion mastery levels. /// # Parameters /// * `route` - Route to query. @@ -1551,6 +1581,36 @@ impl<'a> TftMatchV1<'a> { } +/// TftStatusV1 endpoints handle, accessed by calling [`tft_status_v1()`](crate::RiotApi::tft_status_v1) on a [`RiotApi`](crate::RiotApi) instance. +/// # Riot Developer API Reference +/// `tft-status-v1` +/// +/// Note: this struct is automatically generated. +#[repr(transparent)] +pub struct TftStatusV1<'a> { + base: &'a RiotApi, +} +impl<'a> TftStatusV1<'a> { + /// Get Teamfight Tactics status for the given platform. + /// # Parameters + /// * `route` - Route to query. + /// # Riot Developer API Reference + /// `tft-status-v1.getPlatformData` + /// + /// Note: this method is automatically generated. + pub fn get_platform_data(&self, route: PlatformRoute) + -> impl Future> + 'a + { + let route_str = route.into(); + let request = self.base.request(Method::GET, route_str, "/tft/status/v1/platform-data"); + let future = self.base.execute_val::("tft-status-v1.getPlatformData", route_str, request); + #[cfg(feature = "tracing")] + let future = future.instrument(tracing::info_span!("tft-status-v1.getPlatformData")); + future + } + +} + /// TftSummonerV1 endpoints handle, accessed by calling [`tft_summoner_v1()`](crate::RiotApi::tft_summoner_v1) on a [`RiotApi`](crate::RiotApi) instance. /// # Riot Developer API Reference /// `tft-summoner-v1` diff --git a/riven/src/meta.rs b/riven/src/meta.rs index 4d44ce3..b3cfb62 100644 --- a/riven/src/meta.rs +++ b/riven/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 648c5b93c3144e7094749547bb91481778c8dc08 +// Version dae26e2703c82eb19447d1b27f1209801cb83beb //! Metadata about the Riot API and Riven. //! @@ -15,13 +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); 75] = [ +pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 77] = [ (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-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-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-summoner/{summonerId}", "clash-v1.getPlayersBySummoner"), @@ -70,6 +71,7 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 75] = [ (reqwest::Method::GET, "/tft/league/v1/rated-ladders/{queue}/top", "tft-league-v1.getTopRatedLadder"), (reqwest::Method::GET, "/tft/match/v1/matches/by-puuid/{puuid}/ids", "tft-match-v1.getMatchIdsByPUUID"), (reqwest::Method::GET, "/tft/match/v1/matches/{matchId}", "tft-match-v1.getMatch"), + (reqwest::Method::GET, "/tft/status/v1/platform-data", "tft-status-v1.getPlatformData"), (reqwest::Method::GET, "/tft/summoner/v1/summoners/by-account/{encryptedAccountId}", "tft-summoner-v1.getByAccountId"), (reqwest::Method::GET, "/tft/summoner/v1/summoners/by-name/{summonerName}", "tft-summoner-v1.getBySummonerName"), (reqwest::Method::GET, "/tft/summoner/v1/summoners/by-puuid/{encryptedPUUID}", "tft-summoner-v1.getByPUUID"), diff --git a/riven/src/models.rs b/riven/src/models.rs index 5c5ba39..e4424e2 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 648c5b93c3144e7094749547bb91481778c8dc08 +// Version dae26e2703c82eb19447d1b27f1209801cb83beb #![allow(missing_docs)] @@ -639,10 +639,12 @@ pub mod lol_status_v4 { pub id: i32, /// (Legal values: scheduled, in_progress, complete) #[serde(rename = "maintenance_status")] - pub maintenance_status: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub maintenance_status: Option, /// (Legal values: info, warning, critical) #[serde(rename = "incident_severity")] - pub incident_severity: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub incident_severity: Option, #[serde(rename = "titles")] pub titles: std::vec::Vec, #[serde(rename = "updates")] @@ -650,9 +652,11 @@ pub mod lol_status_v4 { #[serde(rename = "created_at")] pub created_at: String, #[serde(rename = "archive_at")] - pub archive_at: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub archive_at: Option, #[serde(rename = "updated_at")] - pub updated_at: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub updated_at: Option, /// (Legal values: windows, macos, android, ios, ps4, xbone, switch) #[serde(rename = "platforms")] pub platforms: std::vec::Vec, @@ -2631,6 +2635,87 @@ pub mod tft_match_v1 { } } +/// Data structs used by [`TftStatusV1`](crate::endpoints::TftStatusV1). +/// +/// Note: this module is automatically generated. +#[allow(dead_code)] +pub mod tft_status_v1 { + /// PlatformData data object. + #[derive(Clone, Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] + pub struct PlatformData { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "locales")] + pub locales: std::vec::Vec, + #[serde(rename = "maintenances")] + pub maintenances: std::vec::Vec, + #[serde(rename = "incidents")] + pub incidents: std::vec::Vec, + } + /// Status data object. + #[derive(Clone, Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] + pub struct Status { + #[serde(rename = "id")] + pub id: i32, + /// (Legal values: scheduled, in_progress, complete) + #[serde(rename = "maintenance_status")] + pub maintenance_status: String, + /// (Legal values: info, warning, critical) + #[serde(rename = "incident_severity")] + pub incident_severity: String, + #[serde(rename = "titles")] + pub titles: std::vec::Vec, + #[serde(rename = "updates")] + pub updates: std::vec::Vec, + #[serde(rename = "created_at")] + pub created_at: String, + #[serde(rename = "archive_at")] + pub archive_at: String, + #[serde(rename = "updated_at")] + pub updated_at: String, + /// (Legal values: windows, macos, android, ios, ps4, xbone, switch) + #[serde(rename = "platforms")] + pub platforms: std::vec::Vec, + } + /// Content data object. + #[derive(Clone, Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] + pub struct Content { + #[serde(rename = "locale")] + pub locale: String, + #[serde(rename = "content")] + pub content: String, + } + /// Update data object. + #[derive(Clone, Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + #[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))] + pub struct Update { + #[serde(rename = "id")] + pub id: i32, + #[serde(rename = "author")] + pub author: String, + #[serde(rename = "publish")] + pub publish: bool, + /// (Legal values: riotclient, riotstatus, game) + #[serde(rename = "publish_locations")] + pub publish_locations: std::vec::Vec, + #[serde(rename = "translations")] + pub translations: std::vec::Vec, + #[serde(rename = "created_at")] + pub created_at: String, + #[serde(rename = "updated_at")] + pub updated_at: String, + } +} + /// Data structs used by [`TftSummonerV1`](crate::endpoints::TftSummonerV1). /// /// Note: this module is automatically generated. diff --git a/riven/tests/tests_na.rs b/riven/tests/tests_na.rs index 1b792f1..8048ee4 100644 --- a/riven/tests/tests_na.rs +++ b/riven/tests/tests_na.rs @@ -164,5 +164,12 @@ async_tests!{ assert!(team.is_none()); Ok(()) }, + + status: async { + let p = RIOT_API.lol_status_v4().get_platform_data(PlatformRoute::NA1); + let status = p.await.map_err(|e| e.to_string())?; + println!("{:?}", status); + Ok(()) + }, } }