From 3d56d7c722ef92a62057f61ebc39ed767fe05b3e Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 4 Jun 2020 22:39:51 -0700 Subject: [PATCH] Add meta module with ENDPOINT_PATH_METHODID map --- Cargo.toml | 2 +- src/lib.rs | 2 ++ src/meta.rs | 70 +++++++++++++++++++++++++++++++++++++++++++++++ srcgen/meta.rs.dt | 33 ++++++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 src/meta.rs create mode 100644 srcgen/meta.rs.dt diff --git a/Cargo.toml b/Cargo.toml index 9279894..055c373 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ features = [ "nightly" ] nightly = [ "parking_lot/nightly" ] [dependencies] +lazy_static = "1.4" log = "0.4" num_enum = "0.4" parking_lot = "0.10" @@ -39,5 +40,4 @@ url = "2.1" colored = "1.8" env_logger = "0.7" fake_instant = "0.4" -lazy_static = "1.4" tokio = "0.2" diff --git a/src/lib.rs b/src/lib.rs index c692254..8b822da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,8 @@ pub mod endpoints; mod error; pub use error::*; +pub mod meta; + pub mod models; mod req; diff --git a/src/meta.rs b/src/meta.rs new file mode 100644 index 0000000..0ecb898 --- /dev/null +++ b/src/meta.rs @@ -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 + }; +} diff --git a/srcgen/meta.rs.dt b/srcgen/meta.rs.dt new file mode 100644 index 0000000..0c28fb0 --- /dev/null +++ b/srcgen/meta.rs.dt @@ -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 + }; +}