diff --git a/src/consts/champion.rs b/src/consts/champion.rs index f13c436..b91d8fb 100644 --- a/src/consts/champion.rs +++ b/src/consts/champion.rs @@ -1,7 +1,7 @@  // This file is automatically generated. // Do not directly edit. -// Generated on 2019-10-22T06:59:44.522Z +// Generated on 2019-10-22T21:22:55.963Z use std::fmt; use num_derive; diff --git a/src/endpoints.rs b/src/endpoints.rs index a3de876..35b7e72 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -1,11 +1,14 @@ // This file is automatically generated. // Do not directly edit. -// Generated on 2019-10-22T06:59:44.598Z +// Generated on 2019-10-22T21:22:55.948Z // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version 0c74167e0eaaeb6de1c7e8219fecaabcf8386d1f +mod dto; +pub use dto::*; + use std::future::Future; use std::vec::Vec; @@ -109,10 +112,10 @@ impl<'a> ChampionMasteryV4<'a> { /// * `region` - Region to query. /// * `encryptedSummonerId` - Summoner ID associated with the player pub fn get_all_champion_masteries(&self, region: Region, encrypted_summoner_id: &str) - -> impl Future>, reqwest::Error>> + 'a + -> impl Future>, reqwest::Error>> + 'a { let path_string = format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}", encrypted_summoner_id); - self.base.get::>("champion-mastery-v4.getAllChampionMasteries", region, path_string, None) + self.base.get::>("champion-mastery-v4.getAllChampionMasteries", region, path_string, None) } /// Get a champion mastery by player ID and champion ID. @@ -123,10 +126,10 @@ impl<'a> ChampionMasteryV4<'a> { /// * `championId` - Champion ID to retrieve Champion Mastery for /// * `encryptedSummonerId` - Summoner ID associated with the player pub fn get_champion_mastery(&self, region: Region, encrypted_summoner_id: &str, champion_id: i64) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}/by-champion/{}", encrypted_summoner_id, champion_id); - self.base.get::("champion-mastery-v4.getChampionMastery", region, path_string, None) + self.base.get::("champion-mastery-v4.getChampionMastery", region, path_string, None) } /// Get a player's total champion mastery score, which is the sum of individual champion mastery levels. @@ -157,10 +160,10 @@ impl<'a> ChampionV3<'a> { /// # Parameters /// * `region` - Region to query. pub fn get_champion_info(&self, region: Region) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = "/lol/platform/v3/champion-rotations".to_owned(); - self.base.get::("champion-v3.getChampionInfo", region, path_string, None) + self.base.get::("champion-v3.getChampionInfo", region, path_string, None) } } @@ -182,13 +185,13 @@ impl<'a> LeagueExpV4<'a> { /// * `division` /// * `page` (optional) - Starts with page 1. pub fn get_league_entries(&self, region: Region, division: &str, tier: &str, queue: &str, page: Option) - -> impl Future>, reqwest::Error>> + 'a + -> impl Future>, reqwest::Error>> + 'a { let mut query_params = Serializer::new(String::new()); if let Some(page) = page { query_params.append_pair("page", &*page.to_string()); }; let query_string = query_params.finish(); let path_string = format!("/lol/league-exp/v4/entries/{}/{}/{}", division, tier, queue); - self.base.get::>("league-exp-v4.getLeagueEntries", region, path_string, Some(query_string)) + self.base.get::>("league-exp-v4.getLeagueEntries", region, path_string, Some(query_string)) } } @@ -207,10 +210,10 @@ impl<'a> LeagueV4<'a> { /// * `region` - Region to query. /// * `queue` pub fn get_challenger_league(&self, region: Region, queue: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/league/v4/challengerleagues/by-queue/{}", queue); - self.base.get::("league-v4.getChallengerLeague", region, path_string, None) + self.base.get::("league-v4.getChallengerLeague", region, path_string, None) } /// Get league entries in all queues for a given summoner ID. @@ -220,10 +223,10 @@ impl<'a> LeagueV4<'a> { /// * `region` - Region to query. /// * `encryptedSummonerId` pub fn get_league_entries_for_summoner(&self, region: Region, encrypted_summoner_id: &str) - -> impl Future>, reqwest::Error>> + 'a + -> impl Future>, reqwest::Error>> + 'a { let path_string = format!("/lol/league/v4/entries/by-summoner/{}", encrypted_summoner_id); - self.base.get::>("league-v4.getLeagueEntriesForSummoner", region, path_string, None) + self.base.get::>("league-v4.getLeagueEntriesForSummoner", region, path_string, None) } /// Get all the league entries. @@ -236,13 +239,13 @@ impl<'a> LeagueV4<'a> { /// * `queue` - Note that the queue value must be a valid ranked queue. /// * `page` (optional) - Starts with page 1. pub fn get_league_entries(&self, region: Region, queue: &str, tier: &str, division: &str, page: Option) - -> impl Future>, reqwest::Error>> + 'a + -> impl Future>, reqwest::Error>> + 'a { let mut query_params = Serializer::new(String::new()); if let Some(page) = page { query_params.append_pair("page", &*page.to_string()); }; let query_string = query_params.finish(); let path_string = format!("/lol/league/v4/entries/{}/{}/{}", queue, tier, division); - self.base.get::>("league-v4.getLeagueEntries", region, path_string, Some(query_string)) + self.base.get::>("league-v4.getLeagueEntries", region, path_string, Some(query_string)) } /// Get the grandmaster league of a specific queue. @@ -252,10 +255,10 @@ impl<'a> LeagueV4<'a> { /// * `region` - Region to query. /// * `queue` pub fn get_grandmaster_league(&self, region: Region, queue: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/league/v4/grandmasterleagues/by-queue/{}", queue); - self.base.get::("league-v4.getGrandmasterLeague", region, path_string, None) + self.base.get::("league-v4.getGrandmasterLeague", region, path_string, None) } /// Get league with given ID, including inactive entries. @@ -265,10 +268,10 @@ impl<'a> LeagueV4<'a> { /// * `region` - Region to query. /// * `leagueId` - The UUID of the league. pub fn get_league_by_id(&self, region: Region, league_id: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/league/v4/leagues/{}", league_id); - self.base.get::("league-v4.getLeagueById", region, path_string, None) + self.base.get::("league-v4.getLeagueById", region, path_string, None) } /// Get the master league for given queue. @@ -278,10 +281,10 @@ impl<'a> LeagueV4<'a> { /// * `region` - Region to query. /// * `queue` pub fn get_master_league(&self, region: Region, queue: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/league/v4/masterleagues/by-queue/{}", queue); - self.base.get::("league-v4.getMasterLeague", region, path_string, None) + self.base.get::("league-v4.getMasterLeague", region, path_string, None) } } @@ -301,10 +304,10 @@ impl<'a> LolStatusV3<'a> { /// # Parameters /// * `region` - Region to query. pub fn get_shard_data(&self, region: Region) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = "/lol/status/v3/shard-data".to_owned(); - self.base.get::("lol-status-v3.getShardData", region, path_string, None) + self.base.get::("lol-status-v3.getShardData", region, path_string, None) } } @@ -336,10 +339,10 @@ impl<'a> MatchV4<'a> { /// * `region` - Region to query. /// * `matchId` - The match ID. pub fn get_match(&self, region: Region, match_id: i64) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/match/v4/matches/{}", match_id); - self.base.get::("match-v4.getMatch", region, path_string, None) + self.base.get::("match-v4.getMatch", region, path_string, None) } /// Get match by match ID and tournament code. @@ -350,10 +353,10 @@ impl<'a> MatchV4<'a> { /// * `tournamentCode` - The tournament code. /// * `matchId` - The match ID. pub fn get_match_by_tournament_code(&self, region: Region, match_id: i64, tournament_code: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/match/v4/matches/{}/by-tournament-code/{}", match_id, tournament_code); - self.base.get::("match-v4.getMatchByTournamentCode", region, path_string, None) + self.base.get::("match-v4.getMatchByTournamentCode", region, path_string, None) } /// Get matchlist for games played on given account ID and platform ID and filtered using given filter parameters, if any. @@ -376,7 +379,7 @@ impl<'a> MatchV4<'a> { /// * `endIndex` (optional) - The end index to use for filtering matchlist. If beginIndex is specified, but not endIndex, then endIndex defaults to beginIndex+100. If endIndex is specified, but not beginIndex, then beginIndex defaults to 0. If both are specified, then endIndex must be greater than beginIndex. The maximum range allowed is 100, otherwise a 400 error code is returned. /// * `beginIndex` (optional) - The begin index to use for filtering matchlist. If beginIndex is specified, but not endIndex, then endIndex defaults to beginIndex+100. If endIndex is specified, but not beginIndex, then beginIndex defaults to 0. If both are specified, then endIndex must be greater than beginIndex. The maximum range allowed is 100, otherwise a 400 error code is returned. pub fn get_matchlist(&self, region: Region, encrypted_account_id: &str, champion: Option>, queue: Option>, season: Option>, end_time: Option, begin_time: Option, end_index: Option, begin_index: Option) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let mut query_params = Serializer::new(String::new()); if let Some(champion) = champion { query_params.extend_pairs(champion.iter().map(|w| ("champion", w.to_string()))); }; @@ -388,7 +391,7 @@ impl<'a> MatchV4<'a> { if let Some(begin_index) = begin_index { query_params.append_pair("beginIndex", &*begin_index.to_string()); }; let query_string = query_params.finish(); let path_string = format!("/lol/match/v4/matchlists/by-account/{}", encrypted_account_id); - self.base.get::("match-v4.getMatchlist", region, path_string, Some(query_string)) + self.base.get::("match-v4.getMatchlist", region, path_string, Some(query_string)) } /// Get match timeline by match ID. @@ -400,10 +403,10 @@ impl<'a> MatchV4<'a> { /// * `region` - Region to query. /// * `matchId` - The match ID. pub fn get_match_timeline(&self, region: Region, match_id: i64) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/match/v4/timelines/by-match/{}", match_id); - self.base.get::("match-v4.getMatchTimeline", region, path_string, None) + self.base.get::("match-v4.getMatchTimeline", region, path_string, None) } } @@ -422,10 +425,10 @@ impl<'a> SpectatorV4<'a> { /// * `region` - Region to query. /// * `encryptedSummonerId` - The ID of the summoner. pub fn get_current_game_info_by_summoner(&self, region: Region, encrypted_summoner_id: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/spectator/v4/active-games/by-summoner/{}", encrypted_summoner_id); - self.base.get::("spectator-v4.getCurrentGameInfoBySummoner", region, path_string, None) + self.base.get::("spectator-v4.getCurrentGameInfoBySummoner", region, path_string, None) } /// Get list of featured games. @@ -434,10 +437,10 @@ impl<'a> SpectatorV4<'a> { /// # Parameters /// * `region` - Region to query. pub fn get_featured_games(&self, region: Region) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = "/lol/spectator/v4/featured-games".to_owned(); - self.base.get::("spectator-v4.getFeaturedGames", region, path_string, None) + self.base.get::("spectator-v4.getFeaturedGames", region, path_string, None) } } @@ -456,10 +459,10 @@ impl<'a> SummonerV4<'a> { /// * `region` - Region to query. /// * `encryptedAccountId` pub fn get_by_account_id(&self, region: Region, encrypted_account_id: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/summoner/v4/summoners/by-account/{}", encrypted_account_id); - self.base.get::("summoner-v4.getByAccountId", region, path_string, None) + self.base.get::("summoner-v4.getByAccountId", region, path_string, None) } /// Get a summoner by summoner name. @@ -469,10 +472,10 @@ impl<'a> SummonerV4<'a> { /// * `region` - Region to query. /// * `summonerName` - Summoner Name pub fn get_by_summoner_name(&self, region: Region, summoner_name: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/summoner/v4/summoners/by-name/{}", summoner_name); - self.base.get::("summoner-v4.getBySummonerName", region, path_string, None) + self.base.get::("summoner-v4.getBySummonerName", region, path_string, None) } /// Get a summoner by PUUID. @@ -482,10 +485,10 @@ impl<'a> SummonerV4<'a> { /// * `region` - Region to query. /// * `encryptedPUUID` - Summoner ID pub fn get_by_puuid(&self, region: Region, encrypted_puuid: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/summoner/v4/summoners/by-puuid/{}", encrypted_puuid); - self.base.get::("summoner-v4.getByPUUID", region, path_string, None) + self.base.get::("summoner-v4.getByPUUID", region, path_string, None) } /// Get a summoner by summoner ID. @@ -495,10 +498,10 @@ impl<'a> SummonerV4<'a> { /// * `region` - Region to query. /// * `encryptedSummonerId` - Summoner ID pub fn get_by_summoner_id(&self, region: Region, encrypted_summoner_id: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/summoner/v4/summoners/{}", encrypted_summoner_id); - self.base.get::("summoner-v4.getBySummonerId", region, path_string, None) + self.base.get::("summoner-v4.getBySummonerId", region, path_string, None) } } @@ -539,10 +542,10 @@ impl<'a> TournamentStubV4<'a> { /// * `region` - Region to query. /// * `tournamentCode` - The short code to look up lobby events for pub fn get_lobby_events_by_code(&self, region: Region, tournament_code: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/tournament-stub/v4/lobby-events/by-code/{}", tournament_code); - self.base.get::("tournament-stub-v4.getLobbyEventsByCode", region, path_string, None) + self.base.get::("tournament-stub-v4.getLobbyEventsByCode", region, path_string, None) } } @@ -561,10 +564,10 @@ impl<'a> TournamentV4<'a> { /// * `region` - Region to query. /// * `tournamentCode` - The tournament code string. pub fn get_tournament_code(&self, region: Region, tournament_code: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/tournament/v4/codes/{}", tournament_code); - self.base.get::("tournament-v4.getTournamentCode", region, path_string, None) + self.base.get::("tournament-v4.getTournamentCode", region, path_string, None) } /// Gets a list of lobby events by tournament code. @@ -574,10 +577,10 @@ impl<'a> TournamentV4<'a> { /// * `region` - Region to query. /// * `tournamentCode` - The short code to look up lobby events for pub fn get_lobby_events_by_code(&self, region: Region, tournament_code: &str) - -> impl Future, reqwest::Error>> + 'a + -> impl Future, reqwest::Error>> + 'a { let path_string = format!("/lol/tournament/v4/lobby-events/by-code/{}", tournament_code); - self.base.get::("tournament-v4.getLobbyEventsByCode", region, path_string, None) + self.base.get::("tournament-v4.getLobbyEventsByCode", region, path_string, None) } } diff --git a/src/dto.rs b/src/endpoints/dto.rs similarity index 97% rename from src/dto.rs rename to src/endpoints/dto.rs index 7e037eb..b7ab291 100644 --- a/src/dto.rs +++ b/src/endpoints/dto.rs @@ -1,7 +1,7 @@ // This file is automatically generated. // Do not directly edit. -// Generated on 2019-10-22T06:59:44.590Z +// Generated on 2019-10-22T21:22:55.955Z // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version 0c74167e0eaaeb6de1c7e8219fecaabcf8386d1f diff --git a/src/lib.rs b/src/lib.rs index bb21b70..0bdff24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,6 @@ -mod dto; -pub use dto::*; - pub mod consts; -mod endpoints; -pub use endpoints::*; +pub mod endpoints; mod riot_api_config; pub use riot_api_config::*; diff --git a/srcgen/dotUtils.js b/srcgen/dotUtils.js index 1f019b0..264bba9 100644 --- a/srcgen/dotUtils.js +++ b/srcgen/dotUtils.js @@ -51,7 +51,7 @@ function stringifyType(prop, endpoint = null, optional = false, fullpath = true, let refType = prop['$ref']; if (refType) { - return (!endpoint ? '' : 'crate::' + changeCase.snakeCase(endpoint) + '::') + + return (!endpoint ? '' : changeCase.snakeCase(endpoint) + '::') + normalizeSchemaName(refType.slice(refType.indexOf('.') + 1)); } if (optional) { diff --git a/srcgen/endpoints.rs.dt b/srcgen/endpoints.rs.dt index 835bcf5..bfa569c 100644 --- a/srcgen/endpoints.rs.dt +++ b/srcgen/endpoints.rs.dt @@ -9,6 +9,9 @@ // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version {{= spec.info.version }} +mod dto; +pub use dto::*; + use std::future::Future; use std::vec::Vec; diff --git a/srcgen/dto.rs.dt b/srcgen/endpoints/dto.rs.dt similarity index 100% rename from srcgen/dto.rs.dt rename to srcgen/endpoints/dto.rs.dt