From 21579835c06c732957d9f5136415266c9bb23c12 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Sat, 2 May 2020 12:55:37 -0700 Subject: [PATCH] Regen, fix issues with tft optional responses/fields --- src/endpoints.rs | 16 +++++++++------- src/models.rs | 20 ++++++++++---------- tests/tests_euw.rs | 7 ++++++- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/endpoints.rs b/src/endpoints.rs index f1f420a..2814d67 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 71bb788ab92c0b03d5dd284402d9514b625fe2a4 +// Version e558dafc98b78c830aadeca509f18285e4d11a7a //! Automatically generated endpoint handles. @@ -261,6 +261,8 @@ pub struct ClashV1<'a> { } impl<'a> ClashV1<'a> { /// Get players by summoner ID. + /// ## Implementation Notes + /// This endpoint returns a list of active Clash players for a given summoner ID. 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 /// * `region` - Region to query. /// * `summonerId` @@ -830,10 +832,10 @@ impl<'a> TftLeagueV1<'a> { /// /// Note: this method is automatically generated. pub fn get_league_by_id(&self, region: Region, league_id: &str) - -> impl Future> + 'a + -> impl Future>> + 'a { let path_string = format!("/tft/league/v1/leagues/{}", league_id); - self.base.get::("tft-league-v1.getLeagueById", region.into(), path_string, None) + self.base.get_optional::("tft-league-v1.getLeagueById", region.into(), path_string, None) } /// Get the master league. @@ -889,10 +891,10 @@ impl<'a> TftMatchV1<'a> { /// /// Note: this method is automatically generated. pub fn get_match(&self, region: Region, match_id: &str) - -> impl Future> + 'a + -> impl Future>> + 'a { let path_string = format!("/tft/match/v1/matches/{}", match_id); - self.base.get::("tft-match-v1.getMatch", region.into(), path_string, None) + self.base.get_optional::("tft-match-v1.getMatch", region.into(), path_string, None) } } @@ -930,10 +932,10 @@ impl<'a> TftSummonerV1<'a> { /// /// Note: this method is automatically generated. pub fn get_by_summoner_name(&self, region: Region, summoner_name: &str) - -> impl Future> + 'a + -> impl Future>> + 'a { let path_string = format!("/tft/summoner/v1/summoners/by-name/{}", summoner_name); - self.base.get::("tft-summoner-v1.getBySummonerName", region.into(), path_string, None) + self.base.get_optional::("tft-summoner-v1.getBySummonerName", region.into(), path_string, None) } /// Get a summoner by PUUID. diff --git a/src/models.rs b/src/models.rs index 1c7cf78..8c37250 100644 --- a/src/models.rs +++ b/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 71bb788ab92c0b03d5dd284402d9514b625fe2a4 +// Version e558dafc98b78c830aadeca509f18285e4d11a7a //! Data transfer structs. //! @@ -466,7 +466,7 @@ pub mod match_v4 { pub struct ParticipantIdentity { #[serde(rename = "participantId")] pub participant_id: i32, - /// Player information. + /// Player information not included in the response for custom matches. Custom matches are considered private unless a tournament code was used to create the match. #[serde(rename = "player")] pub player: Player, } @@ -1485,7 +1485,7 @@ pub mod tft_match_v1 { pub tier_current: i32, /// Total tiers for the trait. #[serde(rename = "tier_total")] - pub tier_total: i32, + pub tier_total: Option, } /// Unit data object. #[derive(Debug)] @@ -1535,25 +1535,25 @@ pub mod tft_summoner_v1 { pub struct Summoner { /// ID of the summoner icon associated with the summoner. #[serde(rename = "profileIconId")] - pub profile_icon_id: Option, + pub profile_icon_id: i32, /// Summoner name. #[serde(rename = "name")] - pub name: Option, + pub name: String, /// Encrypted PUUID. Exact length of 78 characters. #[serde(rename = "puuid")] - pub puuid: Option, + pub puuid: String, /// Summoner level associated with the summoner. #[serde(rename = "summonerLevel")] - pub summoner_level: Option, + pub summoner_level: i64, /// Date summoner was last modified specified as epoch milliseconds. The following events will update this timestamp: profile icon change, playing the tutorial or advanced tutorial, finishing a game, summoner name change #[serde(rename = "revisionDate")] - pub revision_date: Option, + pub revision_date: i64, /// Encrypted summoner ID. Max length 63 characters. #[serde(rename = "id")] - pub id: Option, + pub id: String, /// Encrypted account ID. Max length 56 characters. #[serde(rename = "accountId")] - pub account_id: Option, + pub account_id: String, } } diff --git a/tests/tests_euw.rs b/tests/tests_euw.rs index e7c58e9..dbcae21 100644 --- a/tests/tests_euw.rs +++ b/tests/tests_euw.rs @@ -57,7 +57,7 @@ async_tests!{ // Ok(()) // }, // tftmatchv1_getmatch: async { - // let p = RIOT_API.tft_match_v1().get_match(Region::AMERICAS, "PBE1_4328907912"); + // let p = RIOT_API.tft_match_v1().get_match(Region::EUROPE, "EUW1_4568680990"); // let _m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT match.".to_owned())?; // Ok(()) // }, @@ -66,5 +66,10 @@ async_tests!{ // let _s = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT summoner.".to_owned())?; // Ok(()) // }, + // tftsummonerv1_getbyname_none: async { + // let p = RIOT_API.tft_summoner_v1().get_by_summoner_name(Region::EUW, "this summoner does not exist"); + // rassert!(p.await.map_err(|e| e.to_string())?.is_none()); + // Ok(()) + // }, } }