mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2024-12-26 19:06:32 +00:00
code generation working
This commit is contained in:
parent
de2c27be4c
commit
346e12656b
16 changed files with 2882 additions and 67 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "riven"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
authors = ["Mingwei Samuel <mingwei.samuel@gmail.com>"]
|
||||
description = "Riot API Library (WIP)"
|
||||
license = "LGPL-3.0"
|
||||
|
@ -19,7 +19,8 @@ num-derive = "0.3"
|
|||
parking_lot = { version = "0.9", features = [ "nightly" ] }
|
||||
reqwest = { version = "0.10.0-alpha.1", features = [ "gzip", "json" ] }
|
||||
scan_fmt = "0.2"
|
||||
serde = "^1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
url = "2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.7"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct Region<'a> {
|
||||
pub key: &'a str,
|
||||
pub platform: &'a str,
|
||||
#[derive(Debug)]
|
||||
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Region {
|
||||
pub key: &'static str,
|
||||
pub platform: &'static str,
|
||||
}
|
||||
|
||||
macro_rules! regions {
|
||||
|
@ -11,7 +13,7 @@ macro_rules! regions {
|
|||
)*
|
||||
) => {
|
||||
$(
|
||||
pub const $key: &'static Region<'static> = &Region {
|
||||
pub const $key: Region = Region {
|
||||
key: stringify!($key),
|
||||
platform: $plat,
|
||||
};
|
||||
|
@ -23,7 +25,7 @@ macro_rules! regions {
|
|||
#[doc="# Returns"]
|
||||
#[doc="`Some(&Region)` if match found, `None` if no match found."]
|
||||
#[allow(unreachable_patterns)]
|
||||
pub fn get(name: &str) -> Option<&Region> {
|
||||
pub fn get(name: &str) -> Option<Region> {
|
||||
match &*name.to_ascii_uppercase() {
|
||||
$(
|
||||
stringify!($key) | $plat => Some(Self::$key),
|
||||
|
@ -34,7 +36,7 @@ macro_rules! regions {
|
|||
}
|
||||
}
|
||||
|
||||
impl Region<'_> {
|
||||
impl Region {
|
||||
// Is this stupid?
|
||||
regions! {
|
||||
BR => "BR1";
|
||||
|
|
15
src/lib.rs
15
src/lib.rs
|
@ -1,5 +1,7 @@
|
|||
include!("../srcgen/mod.rs");
|
||||
|
||||
pub use dto::*;
|
||||
|
||||
pub mod consts;
|
||||
|
||||
mod riot_api_config;
|
||||
|
@ -11,11 +13,24 @@ pub use riot_api::*;
|
|||
mod req;
|
||||
mod util;
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tokio::runtime::Runtime;
|
||||
use super::*;
|
||||
|
||||
|
||||
use url::form_urlencoded::Serializer;
|
||||
#[test]
|
||||
fn checkme() {
|
||||
let mut query = Serializer::new(String::new());
|
||||
query.append_pair("hello", "false");
|
||||
query.append_pair("hello", "world");
|
||||
let result = query.finish();
|
||||
println!("{}", result);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
env_logger::init();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use async_std::task;
|
||||
use reqwest::{ Client, StatusCode };
|
||||
use reqwest::{ Client, StatusCode, Url };
|
||||
|
||||
use crate::riot_api_config::RiotApiConfig;
|
||||
use crate::consts::Region;
|
||||
|
@ -40,8 +40,8 @@ impl<'a> RegionalRequester<'a> {
|
|||
}
|
||||
|
||||
pub async fn get<T: serde::de::DeserializeOwned>(
|
||||
&self, method_id: &'a str, region: &'_ Region<'_>, relative_url: &'_ str,
|
||||
query: &[(&'_ str, &'_ str)]) -> Result<Option<T>, reqwest::Error>
|
||||
&self, method_id: &'a str, region: Region, path: &str,
|
||||
query: Option<&str>) -> Result<Option<T>, reqwest::Error>
|
||||
{
|
||||
|
||||
let mut attempts: u8 = 0;
|
||||
|
@ -57,10 +57,14 @@ impl<'a> RegionalRequester<'a> {
|
|||
}
|
||||
|
||||
// Send request.
|
||||
let url = &*format!("https://{}.api.riotgames.com{}", region.platform, relative_url);
|
||||
let url_base = format!("https://{}.api.riotgames.com", region.platform);
|
||||
let mut url = Url::parse(&*url_base)
|
||||
.unwrap_or_else(|_| panic!("Failed to parse url_base: \"{}\".", url_base));
|
||||
url.set_path(path);
|
||||
url.set_query(query);
|
||||
|
||||
let result = self.client.get(url)
|
||||
.header(Self::RIOT_KEY_HEADER, self.riot_api_config.api_key)
|
||||
.query(query)
|
||||
.send()
|
||||
.await;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pub struct RequesterManager<'a> {
|
|||
client: Client,
|
||||
|
||||
/// Per-region requesters.
|
||||
regional_requesters: InsertOnlyCHashMap<&'a Region<'a>, RegionalRequester<'a>>,
|
||||
regional_requesters: InsertOnlyCHashMap<Region, RegionalRequester<'a>>,
|
||||
}
|
||||
|
||||
impl<'a> RequesterManager<'a> {
|
||||
|
@ -31,12 +31,12 @@ impl<'a> RequesterManager<'a> {
|
|||
}
|
||||
|
||||
pub async fn get<T: serde::de::DeserializeOwned>(
|
||||
&'a self, method_id: &'a str, region: &'a Region<'a>, relative_url: &'_ str,
|
||||
query: &[(&'_ str, &'_ str)]) -> Result<Option<T>, reqwest::Error>
|
||||
&'a self, method_id: &'a str, region: Region, path: &str,
|
||||
query: Option<&str>) -> Result<Option<T>, reqwest::Error>
|
||||
{
|
||||
// TODO: max concurrent requests? Or can configure client?
|
||||
let regional_requester = self.regional_requesters
|
||||
.get_or_insert_with(region, || RegionalRequester::new(&self.riot_api_config, &self.client));
|
||||
regional_requester.get(method_id, region, relative_url, query).await
|
||||
regional_requester.get(method_id, region, path, query).await
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
use crate::RiotApiConfig;
|
||||
use crate::*;
|
||||
use crate::consts::Region;
|
||||
use crate::req::RequesterManager;
|
||||
|
||||
pub struct RiotApi<'a> {
|
||||
requester_manager: RequesterManager<'a>,
|
||||
pub requester_manager: RequesterManager<'a>,
|
||||
_private: (),
|
||||
}
|
||||
|
||||
impl<'a> RiotApi<'a> {
|
||||
pub fn with_config(config: RiotApiConfig<'a>) -> Self {
|
||||
let req_man = RequesterManager::new(config);
|
||||
Self {
|
||||
requester_manager: RequesterManager::new(config),
|
||||
requester_manager: req_man,
|
||||
_private: (),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +21,9 @@ impl<'a> RiotApi<'a> {
|
|||
}
|
||||
|
||||
pub async fn get<T: serde::de::DeserializeOwned>(
|
||||
&'a self, method_id: &'a str, region: &'a Region<'a>, relative_url: &'_ str,
|
||||
query: &[(&'_ str, &'_ str)]) -> Result<Option<T>, reqwest::Error>
|
||||
&'a self, method_id: &'a str, region: Region, path: &str,
|
||||
query: Option<&str>) -> Result<Option<T>, reqwest::Error>
|
||||
{
|
||||
self.requester_manager.get(method_id, region, relative_url, query).await
|
||||
self.requester_manager.get(method_id, region, path, query).await
|
||||
}
|
||||
}
|
||||
|
|
2
srcgen/.gitignore
vendored
2
srcgen/.gitignore
vendored
|
@ -1,4 +1,2 @@
|
|||
node_modules/
|
||||
*.rs
|
||||
!mod.rs
|
||||
.*.json
|
||||
|
|
636
srcgen/champion.rs
Normal file
636
srcgen/champion.rs
Normal file
|
@ -0,0 +1,636 @@
|
|||
|
||||
// This file is automatically generated.
|
||||
// Do not directly edit.
|
||||
// Generated on 2019-10-20T06:19:43.696Z
|
||||
|
||||
use std::fmt;
|
||||
use num_derive;
|
||||
|
||||
#[derive(fmt::Debug, Copy, Clone)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||
pub enum Champion {
|
||||
Aatrox = 266,
|
||||
Ahri = 103,
|
||||
Akali = 84,
|
||||
Alistar = 12,
|
||||
Amumu = 32,
|
||||
Anivia = 34,
|
||||
Annie = 1,
|
||||
Ashe = 22,
|
||||
AurelionSol = 136,
|
||||
Azir = 268,
|
||||
Bard = 432,
|
||||
Blitzcrank = 53,
|
||||
Brand = 63,
|
||||
Braum = 201,
|
||||
Caitlyn = 51,
|
||||
Camille = 164,
|
||||
Cassiopeia = 69,
|
||||
ChoGath = 31,
|
||||
Corki = 42,
|
||||
Darius = 122,
|
||||
Diana = 131,
|
||||
DrMundo = 36,
|
||||
Draven = 119,
|
||||
Ekko = 245,
|
||||
Elise = 60,
|
||||
Evelynn = 28,
|
||||
Ezreal = 81,
|
||||
Fiddlesticks = 9,
|
||||
Fiora = 114,
|
||||
Fizz = 105,
|
||||
Galio = 3,
|
||||
Gangplank = 41,
|
||||
Garen = 86,
|
||||
Gnar = 150,
|
||||
Gragas = 79,
|
||||
Graves = 104,
|
||||
Hecarim = 120,
|
||||
Heimerdinger = 74,
|
||||
Illaoi = 420,
|
||||
Irelia = 39,
|
||||
Ivern = 427,
|
||||
Janna = 40,
|
||||
JarvanIV = 59,
|
||||
Jax = 24,
|
||||
Jayce = 126,
|
||||
Jhin = 202,
|
||||
Jinx = 222,
|
||||
KaiSa = 145,
|
||||
Kalista = 429,
|
||||
Karma = 43,
|
||||
Karthus = 30,
|
||||
Kassadin = 38,
|
||||
Katarina = 55,
|
||||
Kayle = 10,
|
||||
Kayn = 141,
|
||||
Kennen = 85,
|
||||
KhaZix = 121,
|
||||
Kindred = 203,
|
||||
Kled = 240,
|
||||
KogMaw = 96,
|
||||
LeBlanc = 7,
|
||||
LeeSin = 64,
|
||||
Leona = 89,
|
||||
Lissandra = 127,
|
||||
Lucian = 236,
|
||||
Lulu = 117,
|
||||
Lux = 99,
|
||||
Malphite = 54,
|
||||
Malzahar = 90,
|
||||
Maokai = 57,
|
||||
MasterYi = 11,
|
||||
MissFortune = 21,
|
||||
Mordekaiser = 82,
|
||||
Morgana = 25,
|
||||
Nami = 267,
|
||||
Nasus = 75,
|
||||
Nautilus = 111,
|
||||
Neeko = 518,
|
||||
Nidalee = 76,
|
||||
Nocturne = 56,
|
||||
NunuWillump = 20,
|
||||
Olaf = 2,
|
||||
Orianna = 61,
|
||||
Ornn = 516,
|
||||
Pantheon = 80,
|
||||
Poppy = 78,
|
||||
Pyke = 555,
|
||||
Qiyana = 246,
|
||||
Quinn = 133,
|
||||
Rakan = 497,
|
||||
Rammus = 33,
|
||||
RekSai = 421,
|
||||
Renekton = 58,
|
||||
Rengar = 107,
|
||||
Riven = 92,
|
||||
Rumble = 68,
|
||||
Ryze = 13,
|
||||
Sejuani = 113,
|
||||
Shaco = 35,
|
||||
Shen = 98,
|
||||
Shyvana = 102,
|
||||
Singed = 27,
|
||||
Sion = 14,
|
||||
Sivir = 15,
|
||||
Skarner = 72,
|
||||
Sona = 37,
|
||||
Soraka = 16,
|
||||
Swain = 50,
|
||||
Sylas = 517,
|
||||
Syndra = 134,
|
||||
TahmKench = 223,
|
||||
Taliyah = 163,
|
||||
Talon = 91,
|
||||
Taric = 44,
|
||||
Teemo = 17,
|
||||
Thresh = 412,
|
||||
Tristana = 18,
|
||||
Trundle = 48,
|
||||
Tryndamere = 23,
|
||||
TwistedFate = 4,
|
||||
Twitch = 29,
|
||||
Udyr = 77,
|
||||
Urgot = 6,
|
||||
Varus = 110,
|
||||
Vayne = 67,
|
||||
Veigar = 45,
|
||||
VelKoz = 161,
|
||||
Vi = 254,
|
||||
Viktor = 112,
|
||||
Vladimir = 8,
|
||||
Volibear = 106,
|
||||
Warwick = 19,
|
||||
Wukong = 62,
|
||||
Xayah = 498,
|
||||
Xerath = 101,
|
||||
XinZhao = 5,
|
||||
Yasuo = 157,
|
||||
Yorick = 83,
|
||||
Yuumi = 350,
|
||||
Zac = 154,
|
||||
Zed = 238,
|
||||
Ziggs = 115,
|
||||
Zilean = 26,
|
||||
Zoe = 142,
|
||||
Zyra = 143,
|
||||
}
|
||||
|
||||
impl Champion {
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
Self::Aatrox => "Aatrox",
|
||||
Self::Ahri => "Ahri",
|
||||
Self::Akali => "Akali",
|
||||
Self::Alistar => "Alistar",
|
||||
Self::Amumu => "Amumu",
|
||||
Self::Anivia => "Anivia",
|
||||
Self::Annie => "Annie",
|
||||
Self::Ashe => "Ashe",
|
||||
Self::AurelionSol => "Aurelion Sol",
|
||||
Self::Azir => "Azir",
|
||||
Self::Bard => "Bard",
|
||||
Self::Blitzcrank => "Blitzcrank",
|
||||
Self::Brand => "Brand",
|
||||
Self::Braum => "Braum",
|
||||
Self::Caitlyn => "Caitlyn",
|
||||
Self::Camille => "Camille",
|
||||
Self::Cassiopeia => "Cassiopeia",
|
||||
Self::ChoGath => "Cho'Gath",
|
||||
Self::Corki => "Corki",
|
||||
Self::Darius => "Darius",
|
||||
Self::Diana => "Diana",
|
||||
Self::DrMundo => "Dr. Mundo",
|
||||
Self::Draven => "Draven",
|
||||
Self::Ekko => "Ekko",
|
||||
Self::Elise => "Elise",
|
||||
Self::Evelynn => "Evelynn",
|
||||
Self::Ezreal => "Ezreal",
|
||||
Self::Fiddlesticks => "Fiddlesticks",
|
||||
Self::Fiora => "Fiora",
|
||||
Self::Fizz => "Fizz",
|
||||
Self::Galio => "Galio",
|
||||
Self::Gangplank => "Gangplank",
|
||||
Self::Garen => "Garen",
|
||||
Self::Gnar => "Gnar",
|
||||
Self::Gragas => "Gragas",
|
||||
Self::Graves => "Graves",
|
||||
Self::Hecarim => "Hecarim",
|
||||
Self::Heimerdinger => "Heimerdinger",
|
||||
Self::Illaoi => "Illaoi",
|
||||
Self::Irelia => "Irelia",
|
||||
Self::Ivern => "Ivern",
|
||||
Self::Janna => "Janna",
|
||||
Self::JarvanIV => "Jarvan IV",
|
||||
Self::Jax => "Jax",
|
||||
Self::Jayce => "Jayce",
|
||||
Self::Jhin => "Jhin",
|
||||
Self::Jinx => "Jinx",
|
||||
Self::KaiSa => "Kai'Sa",
|
||||
Self::Kalista => "Kalista",
|
||||
Self::Karma => "Karma",
|
||||
Self::Karthus => "Karthus",
|
||||
Self::Kassadin => "Kassadin",
|
||||
Self::Katarina => "Katarina",
|
||||
Self::Kayle => "Kayle",
|
||||
Self::Kayn => "Kayn",
|
||||
Self::Kennen => "Kennen",
|
||||
Self::KhaZix => "Kha'Zix",
|
||||
Self::Kindred => "Kindred",
|
||||
Self::Kled => "Kled",
|
||||
Self::KogMaw => "Kog'Maw",
|
||||
Self::LeBlanc => "LeBlanc",
|
||||
Self::LeeSin => "Lee Sin",
|
||||
Self::Leona => "Leona",
|
||||
Self::Lissandra => "Lissandra",
|
||||
Self::Lucian => "Lucian",
|
||||
Self::Lulu => "Lulu",
|
||||
Self::Lux => "Lux",
|
||||
Self::Malphite => "Malphite",
|
||||
Self::Malzahar => "Malzahar",
|
||||
Self::Maokai => "Maokai",
|
||||
Self::MasterYi => "Master Yi",
|
||||
Self::MissFortune => "Miss Fortune",
|
||||
Self::Mordekaiser => "Mordekaiser",
|
||||
Self::Morgana => "Morgana",
|
||||
Self::Nami => "Nami",
|
||||
Self::Nasus => "Nasus",
|
||||
Self::Nautilus => "Nautilus",
|
||||
Self::Neeko => "Neeko",
|
||||
Self::Nidalee => "Nidalee",
|
||||
Self::Nocturne => "Nocturne",
|
||||
Self::NunuWillump => "Nunu & Willump",
|
||||
Self::Olaf => "Olaf",
|
||||
Self::Orianna => "Orianna",
|
||||
Self::Ornn => "Ornn",
|
||||
Self::Pantheon => "Pantheon",
|
||||
Self::Poppy => "Poppy",
|
||||
Self::Pyke => "Pyke",
|
||||
Self::Qiyana => "Qiyana",
|
||||
Self::Quinn => "Quinn",
|
||||
Self::Rakan => "Rakan",
|
||||
Self::Rammus => "Rammus",
|
||||
Self::RekSai => "Rek'Sai",
|
||||
Self::Renekton => "Renekton",
|
||||
Self::Rengar => "Rengar",
|
||||
Self::Riven => "Riven",
|
||||
Self::Rumble => "Rumble",
|
||||
Self::Ryze => "Ryze",
|
||||
Self::Sejuani => "Sejuani",
|
||||
Self::Shaco => "Shaco",
|
||||
Self::Shen => "Shen",
|
||||
Self::Shyvana => "Shyvana",
|
||||
Self::Singed => "Singed",
|
||||
Self::Sion => "Sion",
|
||||
Self::Sivir => "Sivir",
|
||||
Self::Skarner => "Skarner",
|
||||
Self::Sona => "Sona",
|
||||
Self::Soraka => "Soraka",
|
||||
Self::Swain => "Swain",
|
||||
Self::Sylas => "Sylas",
|
||||
Self::Syndra => "Syndra",
|
||||
Self::TahmKench => "Tahm Kench",
|
||||
Self::Taliyah => "Taliyah",
|
||||
Self::Talon => "Talon",
|
||||
Self::Taric => "Taric",
|
||||
Self::Teemo => "Teemo",
|
||||
Self::Thresh => "Thresh",
|
||||
Self::Tristana => "Tristana",
|
||||
Self::Trundle => "Trundle",
|
||||
Self::Tryndamere => "Tryndamere",
|
||||
Self::TwistedFate => "Twisted Fate",
|
||||
Self::Twitch => "Twitch",
|
||||
Self::Udyr => "Udyr",
|
||||
Self::Urgot => "Urgot",
|
||||
Self::Varus => "Varus",
|
||||
Self::Vayne => "Vayne",
|
||||
Self::Veigar => "Veigar",
|
||||
Self::VelKoz => "Vel'Koz",
|
||||
Self::Vi => "Vi",
|
||||
Self::Viktor => "Viktor",
|
||||
Self::Vladimir => "Vladimir",
|
||||
Self::Volibear => "Volibear",
|
||||
Self::Warwick => "Warwick",
|
||||
Self::Wukong => "Wukong",
|
||||
Self::Xayah => "Xayah",
|
||||
Self::Xerath => "Xerath",
|
||||
Self::XinZhao => "Xin Zhao",
|
||||
Self::Yasuo => "Yasuo",
|
||||
Self::Yorick => "Yorick",
|
||||
Self::Yuumi => "Yuumi",
|
||||
Self::Zac => "Zac",
|
||||
Self::Zed => "Zed",
|
||||
Self::Ziggs => "Ziggs",
|
||||
Self::Zilean => "Zilean",
|
||||
Self::Zoe => "Zoe",
|
||||
Self::Zyra => "Zyra",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn identifier(self) -> &'static str {
|
||||
match self {
|
||||
Self::Aatrox => "Aatrox",
|
||||
Self::Ahri => "Ahri",
|
||||
Self::Akali => "Akali",
|
||||
Self::Alistar => "Alistar",
|
||||
Self::Amumu => "Amumu",
|
||||
Self::Anivia => "Anivia",
|
||||
Self::Annie => "Annie",
|
||||
Self::Ashe => "Ashe",
|
||||
Self::AurelionSol => "AurelionSol",
|
||||
Self::Azir => "Azir",
|
||||
Self::Bard => "Bard",
|
||||
Self::Blitzcrank => "Blitzcrank",
|
||||
Self::Brand => "Brand",
|
||||
Self::Braum => "Braum",
|
||||
Self::Caitlyn => "Caitlyn",
|
||||
Self::Camille => "Camille",
|
||||
Self::Cassiopeia => "Cassiopeia",
|
||||
Self::ChoGath => "Chogath",
|
||||
Self::Corki => "Corki",
|
||||
Self::Darius => "Darius",
|
||||
Self::Diana => "Diana",
|
||||
Self::DrMundo => "DrMundo",
|
||||
Self::Draven => "Draven",
|
||||
Self::Ekko => "Ekko",
|
||||
Self::Elise => "Elise",
|
||||
Self::Evelynn => "Evelynn",
|
||||
Self::Ezreal => "Ezreal",
|
||||
Self::Fiddlesticks => "FiddleSticks",
|
||||
Self::Fiora => "Fiora",
|
||||
Self::Fizz => "Fizz",
|
||||
Self::Galio => "Galio",
|
||||
Self::Gangplank => "Gangplank",
|
||||
Self::Garen => "Garen",
|
||||
Self::Gnar => "Gnar",
|
||||
Self::Gragas => "Gragas",
|
||||
Self::Graves => "Graves",
|
||||
Self::Hecarim => "Hecarim",
|
||||
Self::Heimerdinger => "Heimerdinger",
|
||||
Self::Illaoi => "Illaoi",
|
||||
Self::Irelia => "Irelia",
|
||||
Self::Ivern => "Ivern",
|
||||
Self::Janna => "Janna",
|
||||
Self::JarvanIV => "JarvanIV",
|
||||
Self::Jax => "Jax",
|
||||
Self::Jayce => "Jayce",
|
||||
Self::Jhin => "Jhin",
|
||||
Self::Jinx => "Jinx",
|
||||
Self::KaiSa => "Kaisa",
|
||||
Self::Kalista => "Kalista",
|
||||
Self::Karma => "Karma",
|
||||
Self::Karthus => "Karthus",
|
||||
Self::Kassadin => "Kassadin",
|
||||
Self::Katarina => "Katarina",
|
||||
Self::Kayle => "Kayle",
|
||||
Self::Kayn => "Kayn",
|
||||
Self::Kennen => "Kennen",
|
||||
Self::KhaZix => "Khazix",
|
||||
Self::Kindred => "Kindred",
|
||||
Self::Kled => "Kled",
|
||||
Self::KogMaw => "KogMaw",
|
||||
Self::LeBlanc => "Leblanc",
|
||||
Self::LeeSin => "LeeSin",
|
||||
Self::Leona => "Leona",
|
||||
Self::Lissandra => "Lissandra",
|
||||
Self::Lucian => "Lucian",
|
||||
Self::Lulu => "Lulu",
|
||||
Self::Lux => "Lux",
|
||||
Self::Malphite => "Malphite",
|
||||
Self::Malzahar => "Malzahar",
|
||||
Self::Maokai => "Maokai",
|
||||
Self::MasterYi => "MasterYi",
|
||||
Self::MissFortune => "MissFortune",
|
||||
Self::Mordekaiser => "Mordekaiser",
|
||||
Self::Morgana => "Morgana",
|
||||
Self::Nami => "Nami",
|
||||
Self::Nasus => "Nasus",
|
||||
Self::Nautilus => "Nautilus",
|
||||
Self::Neeko => "Neeko",
|
||||
Self::Nidalee => "Nidalee",
|
||||
Self::Nocturne => "Nocturne",
|
||||
Self::NunuWillump => "Nunu",
|
||||
Self::Olaf => "Olaf",
|
||||
Self::Orianna => "Orianna",
|
||||
Self::Ornn => "Ornn",
|
||||
Self::Pantheon => "Pantheon",
|
||||
Self::Poppy => "Poppy",
|
||||
Self::Pyke => "Pyke",
|
||||
Self::Qiyana => "Qiyana",
|
||||
Self::Quinn => "Quinn",
|
||||
Self::Rakan => "Rakan",
|
||||
Self::Rammus => "Rammus",
|
||||
Self::RekSai => "RekSai",
|
||||
Self::Renekton => "Renekton",
|
||||
Self::Rengar => "Rengar",
|
||||
Self::Riven => "Riven",
|
||||
Self::Rumble => "Rumble",
|
||||
Self::Ryze => "Ryze",
|
||||
Self::Sejuani => "Sejuani",
|
||||
Self::Shaco => "Shaco",
|
||||
Self::Shen => "Shen",
|
||||
Self::Shyvana => "Shyvana",
|
||||
Self::Singed => "Singed",
|
||||
Self::Sion => "Sion",
|
||||
Self::Sivir => "Sivir",
|
||||
Self::Skarner => "Skarner",
|
||||
Self::Sona => "Sona",
|
||||
Self::Soraka => "Soraka",
|
||||
Self::Swain => "Swain",
|
||||
Self::Sylas => "Sylas",
|
||||
Self::Syndra => "Syndra",
|
||||
Self::TahmKench => "TahmKench",
|
||||
Self::Taliyah => "Taliyah",
|
||||
Self::Talon => "Talon",
|
||||
Self::Taric => "Taric",
|
||||
Self::Teemo => "Teemo",
|
||||
Self::Thresh => "Thresh",
|
||||
Self::Tristana => "Tristana",
|
||||
Self::Trundle => "Trundle",
|
||||
Self::Tryndamere => "Tryndamere",
|
||||
Self::TwistedFate => "TwistedFate",
|
||||
Self::Twitch => "Twitch",
|
||||
Self::Udyr => "Udyr",
|
||||
Self::Urgot => "Urgot",
|
||||
Self::Varus => "Varus",
|
||||
Self::Vayne => "Vayne",
|
||||
Self::Veigar => "Veigar",
|
||||
Self::VelKoz => "Velkoz",
|
||||
Self::Vi => "Vi",
|
||||
Self::Viktor => "Viktor",
|
||||
Self::Vladimir => "Vladimir",
|
||||
Self::Volibear => "Volibear",
|
||||
Self::Warwick => "Warwick",
|
||||
Self::Wukong => "MonkeyKing",
|
||||
Self::Xayah => "Xayah",
|
||||
Self::Xerath => "Xerath",
|
||||
Self::XinZhao => "XinZhao",
|
||||
Self::Yasuo => "Yasuo",
|
||||
Self::Yorick => "Yorick",
|
||||
Self::Yuumi => "Yuumi",
|
||||
Self::Zac => "Zac",
|
||||
Self::Zed => "Zed",
|
||||
Self::Ziggs => "Ziggs",
|
||||
Self::Zilean => "Zilean",
|
||||
Self::Zoe => "Zoe",
|
||||
Self::Zyra => "Zyra",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for Champion {
|
||||
type Err = ();
|
||||
|
||||
fn from_str(val: &str) -> Result<Self, Self::Err> {
|
||||
// 4 characters encoded as an int.
|
||||
match val.chars()
|
||||
.filter(|c| c.is_ascii_alphabetic())
|
||||
.take(4)
|
||||
.map(|c| c.to_ascii_uppercase() as u32)
|
||||
.fold(0u32, |hash, next| hash * 256 + next)
|
||||
{
|
||||
1094800466 /* AATR */ => Ok(Self::Aatrox),
|
||||
1095258697 /* AHRI */ => Ok(Self::Ahri),
|
||||
1095450956 /* AKAL */ => Ok(Self::Akali),
|
||||
1095518547 /* ALIS */ => Ok(Self::Alistar),
|
||||
1095587149 /* AMUM */ => Ok(Self::Amumu),
|
||||
1095649622 /* ANIV */ => Ok(Self::Anivia),
|
||||
1095650889 /* ANNI */ => Ok(Self::Annie),
|
||||
1095977029 /* ASHE */ => Ok(Self::Ashe),
|
||||
1096110661 /* AURE */ => Ok(Self::AurelionSol),
|
||||
1096436050 /* AZIR */ => Ok(Self::Azir),
|
||||
1111577156 /* BARD */ => Ok(Self::Bard),
|
||||
1112295764 /* BLIT */ => Ok(Self::Blitzcrank),
|
||||
1112686926 /* BRAN */ => Ok(Self::Brand),
|
||||
1112686933 /* BRAU */ => Ok(Self::Braum),
|
||||
1128352084 /* CAIT */ => Ok(Self::Caitlyn),
|
||||
1128353097 /* CAMI */ => Ok(Self::Camille),
|
||||
1128354643 /* CASS */ => Ok(Self::Cassiopeia),
|
||||
1128812359 /* CHOG */ => Ok(Self::ChoGath),
|
||||
4409423 /* CHO */ => Ok(Self::ChoGath),
|
||||
1129271883 /* CORK */ => Ok(Self::Corki),
|
||||
1145131593 /* DARI */ => Ok(Self::Darius),
|
||||
1145651534 /* DIAN */ => Ok(Self::Diana),
|
||||
1146244437 /* DRMU */ => Ok(Self::DrMundo),
|
||||
17490 /* DR */ => Ok(Self::DrMundo),
|
||||
1146241366 /* DRAV */ => Ok(Self::Draven),
|
||||
1162562383 /* EKKO */ => Ok(Self::Ekko),
|
||||
1162627411 /* ELIS */ => Ok(Self::Elise),
|
||||
1163281740 /* EVEL */ => Ok(Self::Evelynn),
|
||||
1163547205 /* EZRE */ => Ok(Self::Ezreal),
|
||||
1179206724 /* FIDD */ => Ok(Self::Fiddlesticks),
|
||||
1179209554 /* FIOR */ => Ok(Self::Fiora),
|
||||
1179212378 /* FIZZ */ => Ok(Self::Fizz),
|
||||
1195461705 /* GALI */ => Ok(Self::Galio),
|
||||
1195462215 /* GANG */ => Ok(Self::Gangplank),
|
||||
1195463237 /* GARE */ => Ok(Self::Garen),
|
||||
1196310866 /* GNAR */ => Ok(Self::Gnar),
|
||||
1196572999 /* GRAG */ => Ok(Self::Gragas),
|
||||
1196573014 /* GRAV */ => Ok(Self::Graves),
|
||||
1212498753 /* HECA */ => Ok(Self::Hecarim),
|
||||
1212500301 /* HEIM */ => Ok(Self::Heimerdinger),
|
||||
1229737025 /* ILLA */ => Ok(Self::Illaoi),
|
||||
1230128460 /* IREL */ => Ok(Self::Irelia),
|
||||
1230390610 /* IVER */ => Ok(Self::Ivern),
|
||||
1245793870 /* JANN */ => Ok(Self::Janna),
|
||||
1245794902 /* JARV */ => Ok(Self::JarvanIV),
|
||||
4866392 /* JAX */ => Ok(Self::Jax),
|
||||
1245796675 /* JAYC */ => Ok(Self::Jayce),
|
||||
1246251342 /* JHIN */ => Ok(Self::Jhin),
|
||||
1246318168 /* JINX */ => Ok(Self::Jinx),
|
||||
1262569811 /* KAIS */ => Ok(Self::KaiSa),
|
||||
4931913 /* KAI */ => Ok(Self::KaiSa),
|
||||
1262570569 /* KALI */ => Ok(Self::Kalista),
|
||||
1262572109 /* KARM */ => Ok(Self::Karma),
|
||||
1262572116 /* KART */ => Ok(Self::Karthus),
|
||||
1262572371 /* KASS */ => Ok(Self::Kassadin),
|
||||
1262572609 /* KATA */ => Ok(Self::Katarina),
|
||||
1262573900 /* KAYL */ => Ok(Self::Kayle),
|
||||
1262573902 /* KAYN */ => Ok(Self::Kayn),
|
||||
1262833230 /* KENN */ => Ok(Self::Kennen),
|
||||
1263026522 /* KHAZ */ => Ok(Self::KhaZix),
|
||||
4933697 /* KHA */ => Ok(Self::KhaZix),
|
||||
1263095364 /* KIND */ => Ok(Self::Kindred),
|
||||
1263289668 /* KLED */ => Ok(Self::Kled),
|
||||
1263486797 /* KOGM */ => Ok(Self::KogMaw),
|
||||
4935495 /* KOG */ => Ok(Self::KogMaw),
|
||||
1279607372 /* LEBL */ => Ok(Self::LeBlanc),
|
||||
1279608147 /* LEES */ => Ok(Self::LeeSin),
|
||||
4998469 /* LEE */ => Ok(Self::LeeSin),
|
||||
1279610702 /* LEON */ => Ok(Self::Leona),
|
||||
1279873875 /* LISS */ => Ok(Self::Lissandra),
|
||||
1280656201 /* LUCI */ => Ok(Self::Lucian),
|
||||
1280658517 /* LULU */ => Ok(Self::Lulu),
|
||||
5002584 /* LUX */ => Ok(Self::Lux),
|
||||
1296125008 /* MALP */ => Ok(Self::Malphite),
|
||||
1296125018 /* MALZ */ => Ok(Self::Malzahar),
|
||||
1296125771 /* MAOK */ => Ok(Self::Maokai),
|
||||
1296126804 /* MAST */ => Ok(Self::MasterYi),
|
||||
1296651091 /* MISS */ => Ok(Self::MissFortune),
|
||||
1297044036 /* MORD */ => Ok(Self::Mordekaiser),
|
||||
1297044039 /* MORG */ => Ok(Self::Morgana),
|
||||
1312902473 /* NAMI */ => Ok(Self::Nami),
|
||||
1312904021 /* NASU */ => Ok(Self::Nasus),
|
||||
1312904532 /* NAUT */ => Ok(Self::Nautilus),
|
||||
1313162571 /* NEEK */ => Ok(Self::Neeko),
|
||||
1313424449 /* NIDA */ => Ok(Self::Nidalee),
|
||||
1313817428 /* NOCT */ => Ok(Self::Nocturne),
|
||||
1314213461 /* NUNU */ => Ok(Self::NunuWillump),
|
||||
1330397510 /* OLAF */ => Ok(Self::Olaf),
|
||||
1330792769 /* ORIA */ => Ok(Self::Orianna),
|
||||
1330794062 /* ORNN */ => Ok(Self::Ornn),
|
||||
1346457172 /* PANT */ => Ok(Self::Pantheon),
|
||||
1347375184 /* POPP */ => Ok(Self::Poppy),
|
||||
1348029253 /* PYKE */ => Ok(Self::Pyke),
|
||||
1363761473 /* QIYA */ => Ok(Self::Qiyana),
|
||||
1364543822 /* QUIN */ => Ok(Self::Quinn),
|
||||
1380010817 /* RAKA */ => Ok(Self::Rakan),
|
||||
1380011341 /* RAMM */ => Ok(Self::Rammus),
|
||||
1380272979 /* REKS */ => Ok(Self::RekSai),
|
||||
5391691 /* REK */ => Ok(Self::RekSai),
|
||||
1380273733 /* RENE */ => Ok(Self::Renekton),
|
||||
1380273735 /* RENG */ => Ok(Self::Rengar),
|
||||
1380537925 /* RIVE */ => Ok(Self::Riven),
|
||||
1381322050 /* RUMB */ => Ok(Self::Rumble),
|
||||
1381587525 /* RYZE */ => Ok(Self::Ryze),
|
||||
1397049941 /* SEJU */ => Ok(Self::Sejuani),
|
||||
1397244227 /* SHAC */ => Ok(Self::Shaco),
|
||||
1397245262 /* SHEN */ => Ok(Self::Shen),
|
||||
1397250390 /* SHYV */ => Ok(Self::Shyvana),
|
||||
1397313095 /* SING */ => Ok(Self::Singed),
|
||||
1397313358 /* SION */ => Ok(Self::Sion),
|
||||
1397315145 /* SIVI */ => Ok(Self::Sivir),
|
||||
1397440850 /* SKAR */ => Ok(Self::Skarner),
|
||||
1397706305 /* SONA */ => Ok(Self::Sona),
|
||||
1397707329 /* SORA */ => Ok(Self::Soraka),
|
||||
1398227273 /* SWAI */ => Ok(Self::Swain),
|
||||
1398361153 /* SYLA */ => Ok(Self::Sylas),
|
||||
1398361668 /* SYND */ => Ok(Self::Syndra),
|
||||
1413564493 /* TAHM */ => Ok(Self::TahmKench),
|
||||
1413565513 /* TALI */ => Ok(Self::Taliyah),
|
||||
1413565519 /* TALO */ => Ok(Self::Talon),
|
||||
1413567049 /* TARI */ => Ok(Self::Taric),
|
||||
1413825869 /* TEEM */ => Ok(Self::Teemo),
|
||||
1414025797 /* THRE */ => Ok(Self::Thresh),
|
||||
1414678867 /* TRIS */ => Ok(Self::Tristana),
|
||||
1414681934 /* TRUN */ => Ok(Self::Trundle),
|
||||
1414682958 /* TRYN */ => Ok(Self::Tryndamere),
|
||||
1415006547 /* TWIS */ => Ok(Self::TwistedFate),
|
||||
1415006548 /* TWIT */ => Ok(Self::Twitch),
|
||||
1430542674 /* UDYR */ => Ok(Self::Udyr),
|
||||
1431455567 /* URGO */ => Ok(Self::Urgot),
|
||||
1447121493 /* VARU */ => Ok(Self::Varus),
|
||||
1447123278 /* VAYN */ => Ok(Self::Vayne),
|
||||
1447381319 /* VEIG */ => Ok(Self::Veigar),
|
||||
1447382091 /* VELK */ => Ok(Self::VelKoz),
|
||||
5653836 /* VEL */ => Ok(Self::VelKoz),
|
||||
22089 /* VI */ => Ok(Self::Vi),
|
||||
1447643988 /* VIKT */ => Ok(Self::Viktor),
|
||||
1447838020 /* VLAD */ => Ok(Self::Vladimir),
|
||||
1448037449 /* VOLI */ => Ok(Self::Volibear),
|
||||
1463898711 /* WARW */ => Ok(Self::Warwick),
|
||||
1465207631 /* WUKO */ => Ok(Self::Wukong),
|
||||
1297043019 /* MONK */ => Ok(Self::Wukong),
|
||||
1480677697 /* XAYA */ => Ok(Self::Xayah),
|
||||
1480938049 /* XERA */ => Ok(Self::Xerath),
|
||||
1481199194 /* XINZ */ => Ok(Self::XinZhao),
|
||||
5785934 /* XIN */ => Ok(Self::XinZhao),
|
||||
1497453397 /* YASU */ => Ok(Self::Yasuo),
|
||||
1498370633 /* YORI */ => Ok(Self::Yorick),
|
||||
1498764621 /* YUUM */ => Ok(Self::Yuumi),
|
||||
5914947 /* ZAC */ => Ok(Self::Zac),
|
||||
5915972 /* ZED */ => Ok(Self::Zed),
|
||||
1514751815 /* ZIGG */ => Ok(Self::Ziggs),
|
||||
1514753093 /* ZILE */ => Ok(Self::Zilean),
|
||||
5918533 /* ZOE */ => Ok(Self::Zoe),
|
||||
1515803201 /* ZYRA */ => Ok(Self::Zyra),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Champion {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
const changeCase = require('change-case');
|
||||
|
||||
// flatMap: https://gist.github.com/samgiles/762ee337dff48623e729
|
||||
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
|
||||
Array.prototype.flatMap = function(lambda) {
|
||||
|
@ -19,87 +21,104 @@ function decapitalize(input) {
|
|||
return input[0].toLowerCase() + input.slice(1);
|
||||
}
|
||||
|
||||
function normalizeEndpointName(name) {
|
||||
return name.split('-')
|
||||
.join('_');
|
||||
}
|
||||
|
||||
function normalizeSchemaName(name) {
|
||||
return name.replace(/DTO/ig, '');
|
||||
}
|
||||
|
||||
function normalizeArgName(name) {
|
||||
var tokens = name.split('_');
|
||||
var argName = decapitalize(tokens.map(capitalize).join(''));
|
||||
const tokens = name.split('_');
|
||||
const argName = decapitalize(tokens.map(capitalize).join(''));
|
||||
return 'base' === argName ? 'Base' : argName;
|
||||
}
|
||||
|
||||
function normalizePropName(propName, schemaName, value) {
|
||||
var tokens = propName.split('_');
|
||||
var name = tokens.map(capitalize).join('');
|
||||
if (name === schemaName)
|
||||
name += stringifyType(value);
|
||||
return name;
|
||||
const out = changeCase.snakeCase(propName);
|
||||
if ('type' === out)
|
||||
return 'r#' + out;
|
||||
return out;
|
||||
// return propName;
|
||||
// var tokens = propName.split('_');
|
||||
// var name = tokens.map(capitalize).join('');
|
||||
// if (name === schemaName)
|
||||
// name += stringifyType(value);
|
||||
// return name;
|
||||
}
|
||||
|
||||
function stringifyType(prop, endpoint = null, nullable = false) {
|
||||
function stringifyType(prop, endpoint = null, optional = false, fullpath = true, owned = true) {
|
||||
if (prop.anyOf) {
|
||||
prop = prop.anyOf[0];
|
||||
}
|
||||
|
||||
let refType = prop['$ref'];
|
||||
if (refType) {
|
||||
return (!endpoint ? '' : endpoint + '.') +
|
||||
return (!endpoint ? '' : 'crate::' + changeCase.snakeCase(endpoint) + '::') +
|
||||
normalizeSchemaName(refType.slice(refType.indexOf('.') + 1));
|
||||
}
|
||||
var qm = nullable ? '?' : '';
|
||||
if (optional) {
|
||||
return `Option<${stringifyType(prop, endpoint, false, fullpath)}>`;
|
||||
}
|
||||
switch (prop.type) {
|
||||
case 'boolean': return 'bool' + qm;
|
||||
case 'integer': return ('int32' === prop.format ? 'int' : 'long') + qm;
|
||||
case 'number': return prop.format + qm;
|
||||
case 'array': return stringifyType(prop.items, endpoint) + '[]' + qm;
|
||||
case 'boolean': return 'bool';
|
||||
case 'integer': return ('int32' === prop.format ? 'i32' : 'i64');
|
||||
case 'number': return ('float' === prop.format ? 'f32' : 'f64');
|
||||
case 'array':
|
||||
const subprop = stringifyType(prop.items, endpoint, optional, fullpath, owned);
|
||||
return (owned ? (fullpath ? 'std::vec::' : '') + `Vec<${subprop}>` : `&[${subprop}]`);
|
||||
case 'string': return (owned ? 'String' : '&str');
|
||||
case 'object':
|
||||
return 'IDictionary<' + stringifyType(prop['x-key'], endpoint) + ', ' +
|
||||
stringifyType(prop.additionalProperties, endpoint) + '>' + qm;
|
||||
default: return prop.type + qm;
|
||||
return 'std::collections::HashMap<' + stringifyType(prop['x-key'], endpoint, optional, fullpath, owned) + ', ' +
|
||||
stringifyType(prop.additionalProperties, endpoint, optional, fullpath, owned) + '>';
|
||||
default: return prop.type;
|
||||
}
|
||||
}
|
||||
|
||||
function formatJsonProperty(name) {
|
||||
return `[JsonProperty(\"${name}\")]`;
|
||||
return `#[serde(rename = "${name}")]`;
|
||||
}
|
||||
|
||||
function formatQueryParamStringify(prop) {
|
||||
function formatQueryParamStringify(name, prop, ownedOk = false) {
|
||||
switch (prop.type) {
|
||||
case 'boolean': return '.ToString().ToLowerInvariant()';
|
||||
case 'string': return '';
|
||||
default: return '.ToString()';
|
||||
case 'boolean': return `${name} ? "true" : "false"`;
|
||||
case 'string': return name;
|
||||
default: return (ownedOk ? '' : '&*') + `${name}.to_string()`;
|
||||
}
|
||||
}
|
||||
|
||||
function formatAddQueryParam(param) {
|
||||
let k = `nameof(${param.name})`;
|
||||
let nc = param.required ? '' : `if (null != ${param.name}) `;
|
||||
let k = `"${param.name}"`;
|
||||
let name = changeCase.snakeCase(param.name);
|
||||
let nc = param.required ? '' : `if let Some(${name}) = ${name} `;
|
||||
let prop = param.schema;
|
||||
switch (prop.type) {
|
||||
case 'array': return `${nc}queryParams.AddRange(${param.name}.Select(`
|
||||
+ `w => new KeyValuePair<string, string>(${k}, w${formatQueryParamStringify(prop.items)})))`;
|
||||
case 'array': return `${nc}{ query_params.extend_pairs(${name}.iter()`
|
||||
+ `.map(|w| (${k}, ${formatQueryParamStringify("w", prop, true)}))); }`;
|
||||
case 'object': throw 'unsupported';
|
||||
default:
|
||||
let vnc = param.required ? '' : '.Value';
|
||||
return `${nc}queryParams.Add(new KeyValuePair<string, string>(${k}, `
|
||||
+ `${param.name}${vnc}${formatQueryParamStringify(prop.type)}))`;
|
||||
return `${nc}{ query_params.append_pair(${k}, ${formatQueryParamStringify(name, prop)}); }`;
|
||||
}
|
||||
}
|
||||
|
||||
function formatRouteArgument(route, pathParams = []) {
|
||||
if (!pathParams.length)
|
||||
return `"${route}"`;
|
||||
|
||||
route = route.replace(/\{\S+?\}/g, '{}');
|
||||
const args = pathParams
|
||||
.map(({name}) => name)
|
||||
.map(changeCase.snakeCase)
|
||||
.join(', ');
|
||||
return `format!("${route}", ${args})`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
changeCase,
|
||||
capitalize,
|
||||
decapitalize,
|
||||
normalizeEndpointName,
|
||||
normalizeSchemaName,
|
||||
normalizeArgName,
|
||||
normalizePropName,
|
||||
stringifyType,
|
||||
formatJsonProperty,
|
||||
formatAddQueryParam
|
||||
formatAddQueryParam,
|
||||
formatRouteArgument,
|
||||
};
|
1366
srcgen/dto.rs
Normal file
1366
srcgen/dto.rs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,7 @@
|
|||
}}
|
||||
// {{= endpoint }}
|
||||
#[allow(dead_code)]
|
||||
pub mod {{= dotUtils.normalizeEndpointName(endpoint) }} {
|
||||
pub mod {{= dotUtils.changeCase.snakeCase(endpoint) }} {
|
||||
{{
|
||||
for (let schemaKey of schemaKeyGroup) {
|
||||
let [endpoint, rawSchemaName] = schemaKey.split('.');
|
||||
|
@ -32,8 +32,22 @@ pub mod {{= dotUtils.normalizeEndpointName(endpoint) }} {
|
|||
/// # Description
|
||||
/// {{= schema.description }}
|
||||
{{?}}
|
||||
#[derive(Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
pub struct {{= schemaName }} {
|
||||
// TODO.
|
||||
{{
|
||||
for (let [ propKey, prop ] of Object.entries(props))
|
||||
{
|
||||
let name = dotUtils.normalizePropName(propKey, schemaName, prop);
|
||||
}}
|
||||
{{? prop.description }}
|
||||
/// {{= prop.description.split('\n').map(x => x.trim()).join(' \r\n /// ') }}
|
||||
{{?}}
|
||||
{{= dotUtils.formatJsonProperty(propKey) }}
|
||||
pub {{= name }}: {{= dotUtils.stringifyType(prop) }},
|
||||
{{
|
||||
}
|
||||
}}
|
||||
}
|
||||
{{
|
||||
}
|
||||
|
|
448
srcgen/endpoints.rs
Normal file
448
srcgen/endpoints.rs
Normal file
|
@ -0,0 +1,448 @@
|
|||
|
||||
// This file is automatically generated.
|
||||
// Do not directly edit.
|
||||
// Generated on 2019-10-20T06:19:43.832Z
|
||||
|
||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||
// Version 0c74167e0eaaeb6de1c7e8219fecaabcf8386d1f
|
||||
|
||||
use std::vec::Vec;
|
||||
|
||||
use reqwest;
|
||||
use url::form_urlencoded::Serializer;
|
||||
|
||||
use crate::consts::Region;
|
||||
use crate::riot_api::RiotApi;
|
||||
|
||||
|
||||
// ChampionMasteryV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get all champion mastery entries sorted by number of champion points descending,
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteries">https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteries</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedSummonerId` - Summoner ID associated with the player
|
||||
pub async fn champion_mastery_v4_get_all_champion_masteries(&'a self, region: Region, encrypted_summoner_id: &str) -> Result<Option<Vec<crate::champion_mastery_v4::ChampionMastery>>, reqwest::Error> {
|
||||
let path_string = format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}", encrypted_summoner_id);
|
||||
return self.requester_manager.get::<Vec<crate::champion_mastery_v4::ChampionMastery>>(
|
||||
"champion-mastery-v4.getAllChampionMasteries", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get a champion mastery by player ID and champion ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMastery">https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMastery</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `championId` - Champion ID to retrieve Champion Mastery for
|
||||
/// * `encryptedSummonerId` - Summoner ID associated with the player
|
||||
pub async fn champion_mastery_v4_get_champion_mastery(&'a self, region: Region, encrypted_summoner_id: &str, champion_id: i64) -> Result<Option<crate::champion_mastery_v4::ChampionMastery>, reqwest::Error> {
|
||||
let path_string = format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}/by-champion/{}", encrypted_summoner_id, champion_id);
|
||||
return self.requester_manager.get::<crate::champion_mastery_v4::ChampionMastery>(
|
||||
"champion-mastery-v4.getChampionMastery", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScore">https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScore</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedSummonerId` - Summoner ID associated with the player
|
||||
pub async fn champion_mastery_v4_get_champion_mastery_score(&'a self, region: Region, encrypted_summoner_id: &str) -> Result<Option<i32>, reqwest::Error> {
|
||||
let path_string = format!("/lol/champion-mastery/v4/scores/by-summoner/{}", encrypted_summoner_id);
|
||||
return self.requester_manager.get::<i32>(
|
||||
"champion-mastery-v4.getChampionMasteryScore", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ChampionV3
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Returns champion rotations, including free-to-play and low-level free-to-play rotations (REST)
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-v3/GET_getChampionInfo">https://developer.riotgames.com/api-methods/#champion-v3/GET_getChampionInfo</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
pub async fn champion_v3_get_champion_info(&'a self, region: Region) -> Result<Option<crate::champion_v3::ChampionInfo>, reqwest::Error> {
|
||||
let path_string = "/lol/platform/v3/champion-rotations";
|
||||
return self.requester_manager.get::<crate::champion_v3::ChampionInfo>(
|
||||
"champion-v3.getChampionInfo", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// LeagueExpV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get all the league entries.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-exp-v4/GET_getLeagueEntries">https://developer.riotgames.com/api-methods/#league-exp-v4/GET_getLeagueEntries</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `queue` - Note that the queue value must be a valid ranked queue.
|
||||
/// * `tier`
|
||||
/// * `division`
|
||||
/// * `page` (optional) - Starts with page 1.
|
||||
pub async fn league_exp_v4_get_league_entries(&'a self, region: Region, division: &str, tier: &str, queue: &str, page: Option<i32>) -> Result<Option<Vec<crate::league_exp_v4::LeagueEntry>>, reqwest::Error> {
|
||||
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);
|
||||
return self.requester_manager.get::<Vec<crate::league_exp_v4::LeagueEntry>>(
|
||||
"league-exp-v4.getLeagueEntries", region, &*path_string,
|
||||
Some(&*query_string)).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// LeagueV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get the challenger league for given queue.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getChallengerLeague">https://developer.riotgames.com/api-methods/#league-v4/GET_getChallengerLeague</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `queue`
|
||||
pub async fn league_v4_get_challenger_league(&'a self, region: Region, queue: &str) -> Result<Option<crate::league_v4::LeagueList>, reqwest::Error> {
|
||||
let path_string = format!("/lol/league/v4/challengerleagues/by-queue/{}", queue);
|
||||
return self.requester_manager.get::<crate::league_v4::LeagueList>(
|
||||
"league-v4.getChallengerLeague", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get league entries in all queues for a given summoner ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntriesForSummoner">https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntriesForSummoner</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedSummonerId`
|
||||
pub async fn league_v4_get_league_entries_for_summoner(&'a self, region: Region, encrypted_summoner_id: &str) -> Result<Option<Vec<crate::league_v4::LeagueEntry>>, reqwest::Error> {
|
||||
let path_string = format!("/lol/league/v4/entries/by-summoner/{}", encrypted_summoner_id);
|
||||
return self.requester_manager.get::<Vec<crate::league_v4::LeagueEntry>>(
|
||||
"league-v4.getLeagueEntriesForSummoner", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get all the league entries.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntries">https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntries</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `division`
|
||||
/// * `tier`
|
||||
/// * `queue` - Note that the queue value must be a valid ranked queue.
|
||||
/// * `page` (optional) - Starts with page 1.
|
||||
pub async fn league_v4_get_league_entries(&'a self, region: Region, queue: &str, tier: &str, division: &str, page: Option<i32>) -> Result<Option<Vec<crate::league_v4::LeagueEntry>>, reqwest::Error> {
|
||||
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);
|
||||
return self.requester_manager.get::<Vec<crate::league_v4::LeagueEntry>>(
|
||||
"league-v4.getLeagueEntries", region, &*path_string,
|
||||
Some(&*query_string)).await; // false);
|
||||
}
|
||||
|
||||
/// Get the grandmaster league of a specific queue.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getGrandmasterLeague">https://developer.riotgames.com/api-methods/#league-v4/GET_getGrandmasterLeague</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `queue`
|
||||
pub async fn league_v4_get_grandmaster_league(&'a self, region: Region, queue: &str) -> Result<Option<crate::league_v4::LeagueList>, reqwest::Error> {
|
||||
let path_string = format!("/lol/league/v4/grandmasterleagues/by-queue/{}", queue);
|
||||
return self.requester_manager.get::<crate::league_v4::LeagueList>(
|
||||
"league-v4.getGrandmasterLeague", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get league with given ID, including inactive entries.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueById">https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueById</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `leagueId` - The UUID of the league.
|
||||
pub async fn league_v4_get_league_by_id(&'a self, region: Region, league_id: &str) -> Result<Option<crate::league_v4::LeagueList>, reqwest::Error> {
|
||||
let path_string = format!("/lol/league/v4/leagues/{}", league_id);
|
||||
return self.requester_manager.get::<crate::league_v4::LeagueList>(
|
||||
"league-v4.getLeagueById", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get the master league for given queue.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getMasterLeague">https://developer.riotgames.com/api-methods/#league-v4/GET_getMasterLeague</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `queue`
|
||||
pub async fn league_v4_get_master_league(&'a self, region: Region, queue: &str) -> Result<Option<crate::league_v4::LeagueList>, reqwest::Error> {
|
||||
let path_string = format!("/lol/league/v4/masterleagues/by-queue/{}", queue);
|
||||
return self.requester_manager.get::<crate::league_v4::LeagueList>(
|
||||
"league-v4.getMasterLeague", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// LolStatusV3
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get League of Legends status for the given shard.
|
||||
/// ## Rate Limit Notes
|
||||
/// Requests to this API are not counted against the application Rate Limits.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#lol-status-v3/GET_getShardData">https://developer.riotgames.com/api-methods/#lol-status-v3/GET_getShardData</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
pub async fn lol_status_v3_get_shard_data(&'a self, region: Region) -> Result<Option<crate::lol_status_v3::ShardStatus>, reqwest::Error> {
|
||||
let path_string = "/lol/status/v3/shard-data";
|
||||
return self.requester_manager.get::<crate::lol_status_v3::ShardStatus>(
|
||||
"lol-status-v3.getShardData", region, &*path_string,
|
||||
None).await; // true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MatchV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get match IDs by tournament code.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchIdsByTournamentCode">https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchIdsByTournamentCode</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `tournamentCode` - The tournament code.
|
||||
pub async fn match_v4_get_match_ids_by_tournament_code(&'a self, region: Region, tournament_code: &str) -> Result<Option<Vec<i64>>, reqwest::Error> {
|
||||
let path_string = format!("/lol/match/v4/matches/by-tournament-code/{}/ids", tournament_code);
|
||||
return self.requester_manager.get::<Vec<i64>>(
|
||||
"match-v4.getMatchIdsByTournamentCode", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get match by match ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatch">https://developer.riotgames.com/api-methods/#match-v4/GET_getMatch</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `matchId` - The match ID.
|
||||
pub async fn match_v4_get_match(&'a self, region: Region, match_id: i64) -> Result<Option<crate::match_v4::Match>, reqwest::Error> {
|
||||
let path_string = format!("/lol/match/v4/matches/{}", match_id);
|
||||
return self.requester_manager.get::<crate::match_v4::Match>(
|
||||
"match-v4.getMatch", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get match by match ID and tournament code.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchByTournamentCode">https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchByTournamentCode</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `tournamentCode` - The tournament code.
|
||||
/// * `matchId` - The match ID.
|
||||
pub async fn match_v4_get_match_by_tournament_code(&'a self, region: Region, match_id: i64, tournament_code: &str) -> Result<Option<crate::match_v4::Match>, reqwest::Error> {
|
||||
let path_string = format!("/lol/match/v4/matches/{}/by-tournament-code/{}", match_id, tournament_code);
|
||||
return self.requester_manager.get::<crate::match_v4::Match>(
|
||||
"match-v4.getMatchByTournamentCode", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get matchlist for games played on given account ID and platform ID and filtered using given filter parameters, if any.
|
||||
/// ## Implementation Notes
|
||||
/// A number of optional parameters are provided for filtering. It is up to the caller to ensure that the combination of filter parameters provided is valid for the requested account, otherwise, no matches may be returned.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// If beginTime is specified, but not endTime, then endTime defaults to the the current unix timestamp in milliseconds (the maximum time range limitation is not observed in this specific case). If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history returning a 400 due to the maximum time range limitation. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchlist">https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchlist</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedAccountId` - The account ID.
|
||||
/// * `champion` (optional) - Set of champion IDs for filtering the matchlist.
|
||||
/// * `queue` (optional) - Set of queue IDs for filtering the matchlist.
|
||||
/// * `season` (optional) - Set of season IDs for filtering the matchlist.
|
||||
/// * `endTime` (optional) - The end time to use for filtering matchlist specified as epoch milliseconds. If beginTime is specified, but not endTime, then endTime defaults to the the current unix timestamp in milliseconds (the maximum time range limitation is not observed in this specific case). If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history returning a 400 due to the maximum time range limitation. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
|
||||
/// * `beginTime` (optional) - The begin time to use for filtering matchlist specified as epoch milliseconds. If beginTime is specified, but not endTime, then endTime defaults to the the current unix timestamp in milliseconds (the maximum time range limitation is not observed in this specific case). If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history returning a 400 due to the maximum time range limitation. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
|
||||
/// * `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 async fn match_v4_get_matchlist(&'a self, region: Region, encrypted_account_id: &str, champion: Option<std::vec::Vec<i32>>, queue: Option<std::vec::Vec<i32>>, season: Option<std::vec::Vec<i32>>, end_time: Option<i64>, begin_time: Option<i64>, end_index: Option<i32>, begin_index: Option<i32>) -> Result<Option<crate::match_v4::Matchlist>, reqwest::Error> {
|
||||
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()))); };
|
||||
if let Some(queue) = queue { query_params.extend_pairs(queue.iter().map(|w| ("queue", w.to_string()))); };
|
||||
if let Some(season) = season { query_params.extend_pairs(season.iter().map(|w| ("season", w.to_string()))); };
|
||||
if let Some(end_time) = end_time { query_params.append_pair("endTime", &*end_time.to_string()); };
|
||||
if let Some(begin_time) = begin_time { query_params.append_pair("beginTime", &*begin_time.to_string()); };
|
||||
if let Some(end_index) = end_index { query_params.append_pair("endIndex", &*end_index.to_string()); };
|
||||
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);
|
||||
return self.requester_manager.get::<crate::match_v4::Matchlist>(
|
||||
"match-v4.getMatchlist", region, &*path_string,
|
||||
Some(&*query_string)).await; // false);
|
||||
}
|
||||
|
||||
/// Get match timeline by match ID.
|
||||
/// ## Implementation Notes
|
||||
/// Not all matches have timeline data.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchTimeline">https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchTimeline</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `matchId` - The match ID.
|
||||
pub async fn match_v4_get_match_timeline(&'a self, region: Region, match_id: i64) -> Result<Option<crate::match_v4::MatchTimeline>, reqwest::Error> {
|
||||
let path_string = format!("/lol/match/v4/timelines/by-match/{}", match_id);
|
||||
return self.requester_manager.get::<crate::match_v4::MatchTimeline>(
|
||||
"match-v4.getMatchTimeline", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// SpectatorV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get current game information for the given summoner ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4/GET_getCurrentGameInfoBySummoner">https://developer.riotgames.com/api-methods/#spectator-v4/GET_getCurrentGameInfoBySummoner</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedSummonerId` - The ID of the summoner.
|
||||
pub async fn spectator_v4_get_current_game_info_by_summoner(&'a self, region: Region, encrypted_summoner_id: &str) -> Result<Option<crate::spectator_v4::CurrentGameInfo>, reqwest::Error> {
|
||||
let path_string = format!("/lol/spectator/v4/active-games/by-summoner/{}", encrypted_summoner_id);
|
||||
return self.requester_manager.get::<crate::spectator_v4::CurrentGameInfo>(
|
||||
"spectator-v4.getCurrentGameInfoBySummoner", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get list of featured games.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4/GET_getFeaturedGames">https://developer.riotgames.com/api-methods/#spectator-v4/GET_getFeaturedGames</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
pub async fn spectator_v4_get_featured_games(&'a self, region: Region) -> Result<Option<crate::spectator_v4::FeaturedGames>, reqwest::Error> {
|
||||
let path_string = "/lol/spectator/v4/featured-games";
|
||||
return self.requester_manager.get::<crate::spectator_v4::FeaturedGames>(
|
||||
"spectator-v4.getFeaturedGames", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// SummonerV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get a summoner by account ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByAccountId">https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByAccountId</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedAccountId`
|
||||
pub async fn summoner_v4_get_by_account_id(&'a self, region: Region, encrypted_account_id: &str) -> Result<Option<crate::summoner_v4::Summoner>, reqwest::Error> {
|
||||
let path_string = format!("/lol/summoner/v4/summoners/by-account/{}", encrypted_account_id);
|
||||
return self.requester_manager.get::<crate::summoner_v4::Summoner>(
|
||||
"summoner-v4.getByAccountId", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get a summoner by summoner name.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerName">https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerName</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `summonerName` - Summoner Name
|
||||
pub async fn summoner_v4_get_by_summoner_name(&'a self, region: Region, summoner_name: &str) -> Result<Option<crate::summoner_v4::Summoner>, reqwest::Error> {
|
||||
let path_string = format!("/lol/summoner/v4/summoners/by-name/{}", summoner_name);
|
||||
return self.requester_manager.get::<crate::summoner_v4::Summoner>(
|
||||
"summoner-v4.getBySummonerName", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get a summoner by PUUID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByPUUID">https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByPUUID</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedPUUID` - Summoner ID
|
||||
pub async fn summoner_v4_get_by_puuid(&'a self, region: Region, encrypted_puuid: &str) -> Result<Option<crate::summoner_v4::Summoner>, reqwest::Error> {
|
||||
let path_string = format!("/lol/summoner/v4/summoners/by-puuid/{}", encrypted_puuid);
|
||||
return self.requester_manager.get::<crate::summoner_v4::Summoner>(
|
||||
"summoner-v4.getByPUUID", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Get a summoner by summoner ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerId">https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerId</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedSummonerId` - Summoner ID
|
||||
pub async fn summoner_v4_get_by_summoner_id(&'a self, region: Region, encrypted_summoner_id: &str) -> Result<Option<crate::summoner_v4::Summoner>, reqwest::Error> {
|
||||
let path_string = format!("/lol/summoner/v4/summoners/{}", encrypted_summoner_id);
|
||||
return self.requester_manager.get::<crate::summoner_v4::Summoner>(
|
||||
"summoner-v4.getBySummonerId", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ThirdPartyCodeV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Get third party code for a given summoner ID.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#third-party-code-v4/GET_getThirdPartyCodeBySummonerId">https://developer.riotgames.com/api-methods/#third-party-code-v4/GET_getThirdPartyCodeBySummonerId</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `encryptedSummonerId`
|
||||
pub async fn third_party_code_v4_get_third_party_code_by_summoner_id(&'a self, region: Region, encrypted_summoner_id: &str) -> Result<Option<String>, reqwest::Error> {
|
||||
let path_string = format!("/lol/platform/v4/third-party-code/by-summoner/{}", encrypted_summoner_id);
|
||||
return self.requester_manager.get::<String>(
|
||||
"third-party-code-v4.getThirdPartyCodeBySummonerId", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TournamentStubV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Gets a mock list of lobby events by tournament code.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/GET_getLobbyEventsByCode">https://developer.riotgames.com/api-methods/#tournament-stub-v4/GET_getLobbyEventsByCode</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `tournamentCode` - The short code to look up lobby events for
|
||||
pub async fn tournament_stub_v4_get_lobby_events_by_code(&'a self, region: Region, tournament_code: &str) -> Result<Option<crate::tournament_stub_v4::LobbyEventWrapper>, reqwest::Error> {
|
||||
let path_string = format!("/lol/tournament-stub/v4/lobby-events/by-code/{}", tournament_code);
|
||||
return self.requester_manager.get::<crate::tournament_stub_v4::LobbyEventWrapper>(
|
||||
"tournament-stub-v4.getLobbyEventsByCode", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TournamentV4
|
||||
impl<'a> RiotApi<'a> {
|
||||
/// Returns the tournament code DTO associated with a tournament code string.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getTournamentCode">https://developer.riotgames.com/api-methods/#tournament-v4/GET_getTournamentCode</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `tournamentCode` - The tournament code string.
|
||||
pub async fn tournament_v4_get_tournament_code(&'a self, region: Region, tournament_code: &str) -> Result<Option<crate::tournament_v4::TournamentCode>, reqwest::Error> {
|
||||
let path_string = format!("/lol/tournament/v4/codes/{}", tournament_code);
|
||||
return self.requester_manager.get::<crate::tournament_v4::TournamentCode>(
|
||||
"tournament-v4.getTournamentCode", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
/// Gets a list of lobby events by tournament code.
|
||||
/// # Official API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getLobbyEventsByCode">https://developer.riotgames.com/api-methods/#tournament-v4/GET_getLobbyEventsByCode</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
/// * `tournamentCode` - The short code to look up lobby events for
|
||||
pub async fn tournament_v4_get_lobby_events_by_code(&'a self, region: Region, tournament_code: &str) -> Result<Option<crate::tournament_v4::LobbyEventWrapper>, reqwest::Error> {
|
||||
let path_string = format!("/lol/tournament/v4/lobby-events/by-code/{}", tournament_code);
|
||||
return self.requester_manager.get::<crate::tournament_v4::LobbyEventWrapper>(
|
||||
"tournament-v4.getLobbyEventsByCode", region, &*path_string,
|
||||
None).await; // false);
|
||||
}
|
||||
|
||||
}
|
133
srcgen/endpoints.rs.dt
Normal file
133
srcgen/endpoints.rs.dt
Normal file
|
@ -0,0 +1,133 @@
|
|||
{{
|
||||
const spec = require('./.spec.json');
|
||||
const dotUtils = require('./dotUtils.js');
|
||||
}}
|
||||
// This file is automatically generated.
|
||||
// Do not directly edit.
|
||||
// Generated on {{= (new Date).toISOString() }}
|
||||
|
||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||
// Version {{= spec.info.version }}
|
||||
|
||||
use std::vec::Vec;
|
||||
|
||||
use reqwest;
|
||||
use url::form_urlencoded::Serializer;
|
||||
|
||||
use crate::consts::Region;
|
||||
use crate::riot_api::RiotApi;
|
||||
|
||||
{{
|
||||
const endpointGroups = {};
|
||||
for (let path of Object.entries(spec.paths)) {
|
||||
let ep = path[1]['x-endpoint'];
|
||||
endpointGroups[ep] = endpointGroups[ep] || [];
|
||||
endpointGroups[ep].push(path);
|
||||
}
|
||||
|
||||
for (let [ endpointName, endpointMethods ] of Object.entries(endpointGroups)) {
|
||||
let endpoint = dotUtils.changeCase.pascalCase(endpointName);
|
||||
}}
|
||||
|
||||
// {{= endpoint }}
|
||||
impl<'a> RiotApi<'a> {
|
||||
{{
|
||||
for (let [ route, path ] of endpointMethods)
|
||||
{
|
||||
let get = path.get;
|
||||
if (!get)
|
||||
continue;
|
||||
let operationId = get.operationId;
|
||||
let method = dotUtils.changeCase.snakeCase(operationId.slice(operationId.indexOf('.') + 1));
|
||||
|
||||
let jsonInfo = get.responses['200'].content['application/json'];
|
||||
let returnType = dotUtils.stringifyType(jsonInfo.schema, endpoint, false, false);
|
||||
|
||||
/* Cases if not rate limited. */
|
||||
let rateLimitExcluded = get['x-app-rate-limit-excluded'] ? true : false;
|
||||
|
||||
/* Description processing. */
|
||||
let desc = get.description;
|
||||
let descArr = desc
|
||||
.replace(/(#+)\s*([^\\]+)\\n(.*?)([\\n$])/g,
|
||||
(m, g1, g2, g3, g4) => `<h${g1.length}>${g2}</h${g1.length}>\\n${g3}${g4}`)
|
||||
.split('\n');
|
||||
|
||||
/* Build argument comment & string. */
|
||||
let argBuilder = [];
|
||||
let makeParamCode = '';
|
||||
let allParams = get.parameters;
|
||||
let queryParams = [];
|
||||
let routeArgument = dotUtils.formatRouteArgument(route);
|
||||
if (allParams && allParams.length)
|
||||
{
|
||||
let pathParams = allParams.filter(p => 'path' === p.in)
|
||||
.sort(p => route.indexOf(p.name));
|
||||
let reqParams = allParams.filter(p => 'path' !== p.in && p.required);
|
||||
let optParams = allParams.filter(p => 'path' !== p.in && !p.required)
|
||||
.sort(p => {
|
||||
let match = /(^[a-z]+|[A-Z]+(?![a-z])|[A-Z][a-z]+)/.exec(p.name);
|
||||
return match.slice(1).reverse().join('');
|
||||
});
|
||||
queryParams = reqParams.concat(optParams);
|
||||
|
||||
for (let paramList of [ pathParams, reqParams, optParams ])
|
||||
{
|
||||
let required = paramList === pathParams;
|
||||
for (let param of paramList)
|
||||
{
|
||||
argBuilder.push(', ', dotUtils.changeCase.snakeCase(param.name), ': ',
|
||||
dotUtils.stringifyType(param.schema, endpoint, !required, true, false));
|
||||
}
|
||||
}
|
||||
|
||||
routeArgument = dotUtils.formatRouteArgument(route, pathParams);
|
||||
}
|
||||
for (var descLine of descArr)
|
||||
{
|
||||
}}
|
||||
///{{= descLine ? ' ' + descLine : '' }}
|
||||
{{
|
||||
}
|
||||
}}
|
||||
/// # {{= get.externalDocs.description }}
|
||||
/// <a href="{{= get.externalDocs.url }}">{{= get.externalDocs.url }}</a>
|
||||
/// # Parameters
|
||||
/// * `region` - Region to query.
|
||||
{{
|
||||
if (allParams)
|
||||
{
|
||||
for (let param of allParams)
|
||||
{
|
||||
}}
|
||||
/// * `{{= param.name }}`{{= param.required ? '' : ' (optional)' }}{{= param.description ? ' - ' + param.description : ''}}
|
||||
{{
|
||||
}
|
||||
}
|
||||
}}
|
||||
pub async fn {{= dotUtils.changeCase.snakeCase(endpoint) }}_{{= method }}(&'a self, region: Region{{= argBuilder.join('') }}) -> Result<Option<{{= returnType }}>, reqwest::Error> {
|
||||
{{? queryParams.length }}
|
||||
let mut query_params = Serializer::new(String::new());
|
||||
{{
|
||||
for (let queryParam of queryParams)
|
||||
{
|
||||
}}
|
||||
{{= dotUtils.formatAddQueryParam(queryParam) }};
|
||||
{{
|
||||
}
|
||||
}}
|
||||
let query_string = query_params.finish();
|
||||
{{?}}
|
||||
let path_string = {{= routeArgument }};
|
||||
return self.requester_manager.get::<{{= returnType }}>(
|
||||
"{{= operationId }}", region, &*path_string,
|
||||
{{= queryParams.length ? 'Some(&*query_string)' : 'None' }}).await; // {{= rateLimitExcluded }});
|
||||
}
|
||||
|
||||
{{
|
||||
}
|
||||
}}
|
||||
}
|
||||
{{
|
||||
}
|
||||
}}
|
|
@ -1,2 +1,7 @@
|
|||
mod champion;
|
||||
|
||||
mod dto;
|
||||
pub use dto::*;
|
||||
|
||||
mod endpoints;
|
||||
pub use endpoints::*;
|
||||
|
|
170
srcgen/package-lock.json
generated
170
srcgen/package-lock.json
generated
|
@ -90,11 +90,45 @@
|
|||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"camel-case": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz",
|
||||
"integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0",
|
||||
"upper-case": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||
},
|
||||
"change-case": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/change-case/-/change-case-3.1.0.tgz",
|
||||
"integrity": "sha512-2AZp7uJZbYEzRPsFoa+ijKdvp9zsrnnt6+yFokfwEpeJm0xuJDVoxiRCAaTzyJND8GJkofo2IcKWaUZ/OECVzw==",
|
||||
"requires": {
|
||||
"camel-case": "^3.0.0",
|
||||
"constant-case": "^2.0.0",
|
||||
"dot-case": "^2.1.0",
|
||||
"header-case": "^1.0.0",
|
||||
"is-lower-case": "^1.1.0",
|
||||
"is-upper-case": "^1.1.0",
|
||||
"lower-case": "^1.1.1",
|
||||
"lower-case-first": "^1.0.0",
|
||||
"no-case": "^2.3.2",
|
||||
"param-case": "^2.1.0",
|
||||
"pascal-case": "^2.0.0",
|
||||
"path-case": "^2.1.0",
|
||||
"sentence-case": "^2.1.0",
|
||||
"snake-case": "^2.1.0",
|
||||
"swap-case": "^1.1.0",
|
||||
"title-case": "^2.1.0",
|
||||
"upper-case": "^1.1.1",
|
||||
"upper-case-first": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
|
@ -108,6 +142,15 @@
|
|||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"constant-case": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/constant-case/-/constant-case-2.0.0.tgz",
|
||||
"integrity": "sha1-QXV2TTidP6nI7NKRhu1gBSQ7akY=",
|
||||
"requires": {
|
||||
"snake-case": "^2.1.0",
|
||||
"upper-case": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
|
@ -131,6 +174,14 @@
|
|||
"resolved": "https://registry.npmjs.org/dot/-/dot-1.1.2.tgz",
|
||||
"integrity": "sha1-xzdwGfxOVQeYkosrmv62ar+h8vk="
|
||||
},
|
||||
"dot-case": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/dot-case/-/dot-case-2.1.1.tgz",
|
||||
"integrity": "sha1-NNzzf1Co6TwrO8qLt/uRVcfaO+4=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
|
@ -223,6 +274,15 @@
|
|||
"har-schema": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"header-case": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/header-case/-/header-case-1.0.1.tgz",
|
||||
"integrity": "sha1-lTWXMZfBRLCWE81l0xfvGZY70C0=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0",
|
||||
"upper-case": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
|
@ -247,11 +307,27 @@
|
|||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"is-lower-case": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz",
|
||||
"integrity": "sha1-fhR75HaNxGbbO/shzGCzHmrWk5M=",
|
||||
"requires": {
|
||||
"lower-case": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
|
||||
},
|
||||
"is-upper-case": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz",
|
||||
"integrity": "sha1-jQsfp+eTOh5YSDYA7H2WYcuvdW8=",
|
||||
"requires": {
|
||||
"upper-case": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
|
@ -293,6 +369,19 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
||||
},
|
||||
"lower-case": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz",
|
||||
"integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw="
|
||||
},
|
||||
"lower-case-first": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/lower-case-first/-/lower-case-first-1.0.2.tgz",
|
||||
"integrity": "sha1-5dp8JvKacHO+AtUrrJmA5ZIq36E=",
|
||||
"requires": {
|
||||
"lower-case": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.40.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
|
||||
|
@ -314,6 +403,14 @@
|
|||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"no-case": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz",
|
||||
"integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==",
|
||||
"requires": {
|
||||
"lower-case": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
||||
|
@ -327,6 +424,31 @@
|
|||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"param-case": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz",
|
||||
"integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"pascal-case": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-2.0.1.tgz",
|
||||
"integrity": "sha1-LVeNNFX2YNpl7KGO+VtODekSdh4=",
|
||||
"requires": {
|
||||
"camel-case": "^3.0.0",
|
||||
"upper-case-first": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"path-case": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-case/-/path-case-2.1.1.tgz",
|
||||
"integrity": "sha1-lLgDfDctP+KQbkZbtF4l0ibo7qU=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
|
@ -407,6 +529,23 @@
|
|||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sentence-case": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-2.1.1.tgz",
|
||||
"integrity": "sha1-H24t2jnBaL+S0T+G1KkYkz9mftQ=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0",
|
||||
"upper-case-first": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"snake-case": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz",
|
||||
"integrity": "sha1-Qb2xtz8w7GagTU4srRt2OH1NbZ8=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||
|
@ -428,6 +567,24 @@
|
|||
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
|
||||
},
|
||||
"swap-case": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz",
|
||||
"integrity": "sha1-w5IDpFhzhfrTyFCgvRvK+ggZdOM=",
|
||||
"requires": {
|
||||
"lower-case": "^1.1.1",
|
||||
"upper-case": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"title-case": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/title-case/-/title-case-2.1.1.tgz",
|
||||
"integrity": "sha1-PhJyFtpY0rxb7PE3q5Ha46fNj6o=",
|
||||
"requires": {
|
||||
"no-case": "^2.2.0",
|
||||
"upper-case": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
||||
|
@ -457,6 +614,19 @@
|
|||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
|
||||
},
|
||||
"upper-case": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz",
|
||||
"integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg="
|
||||
},
|
||||
"upper-case-first": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz",
|
||||
"integrity": "sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU=",
|
||||
"requires": {
|
||||
"upper-case": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"request": "^2.88.0",
|
||||
"request-promise-native": "^1.0.7",
|
||||
"change-case": "^3.1.0",
|
||||
"dot": "^1.1.2",
|
||||
"glob": "^7.1.2",
|
||||
"glob-promise": "^3.3.0"
|
||||
"glob-promise": "^3.3.0",
|
||||
"request": "^2.88.0",
|
||||
"request-promise-native": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue