From fee229c1a9e90746cddbf258cee653f76e77edb0 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Wed, 23 Oct 2019 00:49:02 -0700 Subject: [PATCH] adding season enum --- src/consts/champion.rs | 7 +++---- src/consts/mod.rs | 7 +++++-- src/consts/season.rs | 21 +++++++++++++++++++++ src/endpoints.rs | 7 +++---- src/endpoints/dto.rs | 7 +++---- srcgen/consts/champion.rs.dt | 5 +---- srcgen/consts/season.rs.dt | 17 +++++++++++++++++ srcgen/endpoints.rs.dt | 5 +---- srcgen/endpoints/dto.rs.dt | 5 +---- 9 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 src/consts/season.rs create mode 100644 srcgen/consts/season.rs.dt diff --git a/src/consts/champion.rs b/src/consts/champion.rs index 8091da2..531b97d 100644 --- a/src/consts/champion.rs +++ b/src/consts/champion.rs @@ -1,7 +1,6 @@ - -// This file is automatically generated. -// Do not directly edit. -// Generated on 2019-10-23T07:19:13.049Z +// This file is automatically generated. +// Do not directly edit. +// Generated on 2019-10-23T07:48:57.279Z. use std::fmt; use num_derive; diff --git a/src/consts/mod.rs b/src/consts/mod.rs index aeb57eb..342b361 100644 --- a/src/consts/mod.rs +++ b/src/consts/mod.rs @@ -1,7 +1,10 @@ //! Constant data and Enums relevant to the Riot Games API. mod region; -mod champion; - pub use region::*; + +mod champion; pub use champion::*; + +mod season; +pub use season::*; \ No newline at end of file diff --git a/src/consts/season.rs b/src/consts/season.rs new file mode 100644 index 0000000..aa74156 --- /dev/null +++ b/src/consts/season.rs @@ -0,0 +1,21 @@ +// This file is automatically generated. +// Do not directly edit. +// Generated on 2019-10-23T07:48:57.301Z. + +/// League of Legends matchmaking seasons. +pub enum Season { + Preseason3 = 0, + Season3 = 1, + Preseason2014 = 2, + Season2014 = 3, + Preseason2015 = 4, + Season2015 = 5, + Preseason2106 = 6, + Season2016 = 7, + Preseason2017 = 8, + Season2017 = 9, + Preseason2018 = 10, + Season2018 = 11, + Preseason2019 = 12, + Season2019 = 13, +} \ No newline at end of file diff --git a/src/endpoints.rs b/src/endpoints.rs index 840cd80..eb4ad7a 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -1,7 +1,6 @@ - -// This file is automatically generated. -// Do not directly edit. -// Generated on 2019-10-23T07:19:13.042Z +// This file is automatically generated. +// Do not directly edit. +// Generated on 2019-10-23T07:48:57.296Z. // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version 0c74167e0eaaeb6de1c7e8219fecaabcf8386d1f diff --git a/src/endpoints/dto.rs b/src/endpoints/dto.rs index 6d7ec33..152a2ab 100644 --- a/src/endpoints/dto.rs +++ b/src/endpoints/dto.rs @@ -1,7 +1,6 @@ - -// This file is automatically generated. -// Do not directly edit. -// Generated on 2019-10-23T07:19:13.050Z +// This file is automatically generated. +// Do not directly edit. +// Generated on 2019-10-23T07:48:57.302Z. // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version 0c74167e0eaaeb6de1c7e8219fecaabcf8386d1f diff --git a/srcgen/consts/champion.rs.dt b/srcgen/consts/champion.rs.dt index c74ae3a..72e8cf0 100644 --- a/srcgen/consts/champion.rs.dt +++ b/srcgen/consts/champion.rs.dt @@ -11,10 +11,7 @@ return h; }; const padId = function(id) { return ('' + id).padEnd(3); }; -}} -// This file is automatically generated. -// Do not directly edit. -// Generated on {{= (new Date).toISOString() }} +}}{{= require('./dotUtils.js').preamble() }} use std::fmt; use num_derive; diff --git a/srcgen/consts/season.rs.dt b/srcgen/consts/season.rs.dt new file mode 100644 index 0000000..57bf9b8 --- /dev/null +++ b/srcgen/consts/season.rs.dt @@ -0,0 +1,17 @@ +{{ + const dotUtils = require('./dotUtils.js'); + const seasons = require('./.seasons.json'); +}}{{= dotUtils.preamble() }} + +/// League of Legends matchmaking seasons. +pub enum Season { +{{ + for (const { id, season } of seasons) { + let name = season.replace(' ', ''); + name = dotUtils.changeCase.pascalCase(name).padEnd(13); +}} + {{= name }} = {{= id }}, +{{ + } +}} +} \ No newline at end of file diff --git a/srcgen/endpoints.rs.dt b/srcgen/endpoints.rs.dt index e075daa..55e6bd3 100644 --- a/srcgen/endpoints.rs.dt +++ b/srcgen/endpoints.rs.dt @@ -1,10 +1,7 @@ {{ const spec = require('./.spec.json'); const dotUtils = require('./dotUtils.js'); -}} -// This file is automatically generated. -// Do not directly edit. -// Generated on {{= (new Date).toISOString() }} +}}{{= dotUtils.preamble() }} // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version {{= spec.info.version }} diff --git a/srcgen/endpoints/dto.rs.dt b/srcgen/endpoints/dto.rs.dt index 1be89e5..f9b393a 100644 --- a/srcgen/endpoints/dto.rs.dt +++ b/srcgen/endpoints/dto.rs.dt @@ -1,10 +1,7 @@ {{ const spec = require('./.spec.json'); const dotUtils = require('./dotUtils.js'); -}} -// This file is automatically generated. -// Do not directly edit. -// Generated on {{= (new Date).toISOString() }} +}}{{= dotUtils.preamble() }} // http://www.mingweisamuel.com/riotapi-schema/tool/ // Version {{= spec.info.version }}