Add meta module with ENDPOINT_PATH_METHODID map

pull/16/head
Mingwei Samuel 2020-06-04 22:39:51 -07:00
parent b15672baaa
commit 3d56d7c722
4 changed files with 106 additions and 1 deletions

View File

@ -23,6 +23,7 @@ features = [ "nightly" ]
nightly = [ "parking_lot/nightly" ] nightly = [ "parking_lot/nightly" ]
[dependencies] [dependencies]
lazy_static = "1.4"
log = "0.4" log = "0.4"
num_enum = "0.4" num_enum = "0.4"
parking_lot = "0.10" parking_lot = "0.10"
@ -39,5 +40,4 @@ url = "2.1"
colored = "1.8" colored = "1.8"
env_logger = "0.7" env_logger = "0.7"
fake_instant = "0.4" fake_instant = "0.4"
lazy_static = "1.4"
tokio = "0.2" tokio = "0.2"

View File

@ -20,6 +20,8 @@ pub mod endpoints;
mod error; mod error;
pub use error::*; pub use error::*;
pub mod meta;
pub mod models; pub mod models;
mod req; mod req;

70
src/meta.rs Normal file
View File

@ -0,0 +1,70 @@
///////////////////////////////////////////////
// //
// ! //
// This file is automatically generated! //
// Do not directly edit! //
// //
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 909460d67267a0122544094d93120b50f8d0f5de
//! Metadata about the Riot API and Riven.
//!
//! Note: this modules is automatically generated.
use std::collections::HashMap;
use lazy_static::lazy_static;
lazy_static! {
pub static ref ENDPOINT_PATH_METHODID: HashMap<&'static str, &'static str> = {
let mut map = HashMap::new();
map.insert("/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getAllChampionMasteries");
map.insert("/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/by-champion/{championId}", "champion-mastery-v4.getChampionMastery");
map.insert("/lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getChampionMasteryScore");
map.insert("/lol/platform/v3/champion-rotations", "champion-v3.getChampionInfo");
map.insert("/lol/clash/v1/players/by-summoner/{summonerId}", "clash-v1.getPlayersBySummoner");
map.insert("/lol/clash/v1/teams/{teamId}", "clash-v1.getTeamById");
map.insert("/lol/clash/v1/tournaments", "clash-v1.getTournaments");
map.insert("/lol/clash/v1/tournaments/by-team/{teamId}", "clash-v1.getTournamentByTeam");
map.insert("/lol/clash/v1/tournaments/{tournamentId}", "clash-v1.getTournamentById");
map.insert("/lol/league-exp/v4/entries/{queue}/{tier}/{division}", "league-exp-v4.getLeagueEntries");
map.insert("/lol/league/v4/challengerleagues/by-queue/{queue}", "league-v4.getChallengerLeague");
map.insert("/lol/league/v4/entries/by-summoner/{encryptedSummonerId}", "league-v4.getLeagueEntriesForSummoner");
map.insert("/lol/league/v4/entries/{queue}/{tier}/{division}", "league-v4.getLeagueEntries");
map.insert("/lol/league/v4/grandmasterleagues/by-queue/{queue}", "league-v4.getGrandmasterLeague");
map.insert("/lol/league/v4/leagues/{leagueId}", "league-v4.getLeagueById");
map.insert("/lol/league/v4/masterleagues/by-queue/{queue}", "league-v4.getMasterLeague");
map.insert("/lol/status/v3/shard-data", "lol-status-v3.getShardData");
map.insert("/lor/ranked/v1/leaderboards", "lor-ranked-v1.getLeaderboards");
map.insert("/lol/match/v4/matches/by-tournament-code/{tournamentCode}/ids", "match-v4.getMatchIdsByTournamentCode");
map.insert("/lol/match/v4/matches/{matchId}", "match-v4.getMatch");
map.insert("/lol/match/v4/matches/{matchId}/by-tournament-code/{tournamentCode}", "match-v4.getMatchByTournamentCode");
map.insert("/lol/match/v4/matchlists/by-account/{encryptedAccountId}", "match-v4.getMatchlist");
map.insert("/lol/match/v4/timelines/by-match/{matchId}", "match-v4.getMatchTimeline");
map.insert("/lol/spectator/v4/active-games/by-summoner/{encryptedSummonerId}", "spectator-v4.getCurrentGameInfoBySummoner");
map.insert("/lol/spectator/v4/featured-games", "spectator-v4.getFeaturedGames");
map.insert("/lol/summoner/v4/summoners/by-account/{encryptedAccountId}", "summoner-v4.getByAccountId");
map.insert("/lol/summoner/v4/summoners/by-name/{summonerName}", "summoner-v4.getBySummonerName");
map.insert("/lol/summoner/v4/summoners/by-puuid/{encryptedPUUID}", "summoner-v4.getByPUUID");
map.insert("/lol/summoner/v4/summoners/{encryptedSummonerId}", "summoner-v4.getBySummonerId");
map.insert("/tft/league/v1/challenger", "tft-league-v1.getChallengerLeague");
map.insert("/tft/league/v1/entries/by-summoner/{encryptedSummonerId}", "tft-league-v1.getLeagueEntriesForSummoner");
map.insert("/tft/league/v1/entries/{tier}/{division}", "tft-league-v1.getLeagueEntries");
map.insert("/tft/league/v1/grandmaster", "tft-league-v1.getGrandmasterLeague");
map.insert("/tft/league/v1/leagues/{leagueId}", "tft-league-v1.getLeagueById");
map.insert("/tft/league/v1/master", "tft-league-v1.getMasterLeague");
map.insert("/tft/match/v1/matches/by-puuid/{puuid}/ids", "tft-match-v1.getMatchIdsByPUUID");
map.insert("/tft/match/v1/matches/{matchId}", "tft-match-v1.getMatch");
map.insert("/tft/summoner/v1/summoners/by-account/{encryptedAccountId}", "tft-summoner-v1.getByAccountId");
map.insert("/tft/summoner/v1/summoners/by-name/{summonerName}", "tft-summoner-v1.getBySummonerName");
map.insert("/tft/summoner/v1/summoners/by-puuid/{encryptedPUUID}", "tft-summoner-v1.getByPUUID");
map.insert("/tft/summoner/v1/summoners/{encryptedSummonerId}", "tft-summoner-v1.getBySummonerId");
map.insert("/lol/platform/v4/third-party-code/by-summoner/{encryptedSummonerId}", "third-party-code-v4.getThirdPartyCodeBySummonerId");
map.insert("/lol/tournament-stub/v4/lobby-events/by-code/{tournamentCode}", "tournament-stub-v4.getLobbyEventsByCode");
map.insert("/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.getTournamentCode");
map.insert("/lol/tournament/v4/lobby-events/by-code/{tournamentCode}", "tournament-v4.getLobbyEventsByCode");
map
};
}

33
srcgen/meta.rs.dt Normal file
View File

@ -0,0 +1,33 @@
{{
const spec = require('./.spec.json');
const dotUtils = require('./dotUtils.js');
}}{{= dotUtils.preamble() }}
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version {{= spec.info.version }}
//! Metadata about the Riot API and Riven.
//!
//! Note: this modules is automatically generated.
use std::collections::HashMap;
use lazy_static::lazy_static;
lazy_static! {
pub static ref ENDPOINT_PATH_METHODID: HashMap<&'static str, &'static str> = {
let mut map = HashMap::new();
{{
for (const [ route, path ] of Object.entries(spec.paths)) {
const get = path.get;
if (!get)
continue;
const operationId = get.operationId;
}}
map.insert("{{= route }}", "{{= operationId }}");
{{
}
}}
map
};
}