forked from mirror/Riven
Regen, update for `TournamentRegion` enum, more `PlatformRoute` `altName`s
parent
d2a213c287
commit
d7330fcd84
|
@ -220,8 +220,11 @@ newtype_enum! {
|
||||||
/// Dark Star: Singularity games on Cosmic Ruins
|
/// Dark Star: Singularity games on Cosmic Ruins
|
||||||
COSMIC_RUINS_DARK_STAR_SINGULARITY = 610,
|
COSMIC_RUINS_DARK_STAR_SINGULARITY = 610,
|
||||||
/// `700`.
|
/// `700`.
|
||||||
/// Clash games on Summoner's Rift
|
/// Summoner's Rift Clash games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_CLASH = 700,
|
SUMMONERS_RIFT_CLASH = 700,
|
||||||
|
/// `720`.
|
||||||
|
/// ARAM Clash games on Howling Abyss
|
||||||
|
HOWLING_ABYSS_ARAM_CLASH = 720,
|
||||||
/// `800`.
|
/// `800`.
|
||||||
/// Co-op vs. AI Intermediate Bot games on Twisted Treeline
|
/// Co-op vs. AI Intermediate Bot games on Twisted Treeline
|
||||||
/// Deprecated in patch 9.23
|
/// Deprecated in patch 9.23
|
||||||
|
@ -325,10 +328,10 @@ newtype_enum! {
|
||||||
/// Nexus Blitz games on Nexus Blitz
|
/// Nexus Blitz games on Nexus Blitz
|
||||||
/// Deprecated in patch 9.2 in favor of queueId 1300
|
/// Deprecated in patch 9.2 in favor of queueId 1300
|
||||||
#[deprecated(note="Deprecated in patch 9.2 in favor of queueId 1300")]
|
#[deprecated(note="Deprecated in patch 9.2 in favor of queueId 1300")]
|
||||||
NEXUS_BLITZ_NEXUS_BLITZ_DEPRECATED_1200 = 1200,
|
NEXUS_BLITZ_DEPRECATED_1200 = 1200,
|
||||||
/// `1300`.
|
/// `1300`.
|
||||||
/// Nexus Blitz games on Nexus Blitz
|
/// Nexus Blitz games on Nexus Blitz
|
||||||
NEXUS_BLITZ_NEXUS_BLITZ = 1300,
|
NEXUS_BLITZ = 1300,
|
||||||
/// `1400`.
|
/// `1400`.
|
||||||
/// Ultimate Spellbook games on Summoner's Rift
|
/// Ultimate Spellbook games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_ULTIMATE_SPELLBOOK = 1400,
|
SUMMONERS_RIFT_ULTIMATE_SPELLBOOK = 1400,
|
||||||
|
|
|
@ -117,6 +117,7 @@ pub enum PlatformRoute {
|
||||||
/// Philippines
|
/// Philippines
|
||||||
///
|
///
|
||||||
/// `32` (riotapi-schema ID/repr)
|
/// `32` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="PH2", serialize="PH")]
|
||||||
PH2 = 32,
|
PH2 = 32,
|
||||||
|
|
||||||
/// Russia
|
/// Russia
|
||||||
|
@ -127,11 +128,13 @@ pub enum PlatformRoute {
|
||||||
/// Singapore
|
/// Singapore
|
||||||
///
|
///
|
||||||
/// `33` (riotapi-schema ID/repr)
|
/// `33` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="SG2", serialize="SG")]
|
||||||
SG2 = 33,
|
SG2 = 33,
|
||||||
|
|
||||||
/// Thailand
|
/// Thailand
|
||||||
///
|
///
|
||||||
/// `34` (riotapi-schema ID/repr)
|
/// `34` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="TH2", serialize="TH")]
|
||||||
TH2 = 34,
|
TH2 = 34,
|
||||||
|
|
||||||
/// Turkey
|
/// Turkey
|
||||||
|
@ -143,11 +146,13 @@ pub enum PlatformRoute {
|
||||||
/// Taiwan
|
/// Taiwan
|
||||||
///
|
///
|
||||||
/// `35` (riotapi-schema ID/repr)
|
/// `35` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="TW2", serialize="TW")]
|
||||||
TW2 = 35,
|
TW2 = 35,
|
||||||
|
|
||||||
/// Vietnam
|
/// Vietnam
|
||||||
///
|
///
|
||||||
/// `36` (riotapi-schema ID/repr)
|
/// `36` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="VN2", serialize="VN")]
|
||||||
VN2 = 36,
|
VN2 = 36,
|
||||||
|
|
||||||
/// Public Beta Environment, special beta testing platform. Located in North America.
|
/// Public Beta Environment, special beta testing platform. Located in North America.
|
||||||
|
@ -209,7 +214,32 @@ impl PlatformRoute {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used in LoL Tournament API.
|
/// Used in the LoL Tournament API. Specifically
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
pub fn to_tournament_region(self) -> Option<TournamentRegion> {
|
||||||
|
match self {
|
||||||
|
Self::BR1 => Some(TournamentRegion::BR),
|
||||||
|
Self::EUN1 => Some(TournamentRegion::EUNE),
|
||||||
|
Self::EUW1 => Some(TournamentRegion::EUW),
|
||||||
|
Self::JP1 => Some(TournamentRegion::JP),
|
||||||
|
Self::LA1 => Some(TournamentRegion::LAN),
|
||||||
|
Self::LA2 => Some(TournamentRegion::LAS),
|
||||||
|
Self::NA1 => Some(TournamentRegion::NA),
|
||||||
|
Self::OC1 => Some(TournamentRegion::OCE),
|
||||||
|
Self::TR1 => Some(TournamentRegion::TR),
|
||||||
|
Self::PBE1 => Some(TournamentRegion::PBE),
|
||||||
|
_other => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the slightly more human-friendly alternate name for this `PlatformRoute`. Specifically
|
||||||
|
/// excludes any trailing numbers and appends extra N(orth), S(outh), E(ast), and/or W(est)
|
||||||
|
/// suffixes to some names. Some of these are old region names which are often still used as
|
||||||
|
/// user-facing names, e.g. on op.gg.
|
||||||
|
///
|
||||||
|
/// Note these strings *are* handled by the `FromStr` implementation, if you wish to parse them
|
||||||
|
/// back into `PlatformRoute`s.
|
||||||
pub fn as_region_str(self) -> &'static str {
|
pub fn as_region_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::BR1 => "BR",
|
Self::BR1 => "BR",
|
||||||
|
@ -220,9 +250,14 @@ impl PlatformRoute {
|
||||||
Self::LA2 => "LAS",
|
Self::LA2 => "LAS",
|
||||||
Self::NA1 => "NA",
|
Self::NA1 => "NA",
|
||||||
Self::OC1 => "OCE",
|
Self::OC1 => "OCE",
|
||||||
|
Self::PH2 => "PH",
|
||||||
|
Self::SG2 => "SG",
|
||||||
|
Self::TH2 => "TH",
|
||||||
Self::TR1 => "TR",
|
Self::TR1 => "TR",
|
||||||
|
Self::TW2 => "TW",
|
||||||
|
Self::VN2 => "VN",
|
||||||
Self::PBE1 => "PBE",
|
Self::PBE1 => "PBE",
|
||||||
other => other.into()
|
other => other.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,3 +307,38 @@ pub enum ValPlatformRoute {
|
||||||
ESPORTS = 95,
|
ESPORTS = 95,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tournament regions for League of Legends (LoL) used in
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
||||||
|
pub enum TournamentRegion {
|
||||||
|
/// Brazil.
|
||||||
|
BR = 16,
|
||||||
|
/// Europe, Northeast.
|
||||||
|
EUNE = 17,
|
||||||
|
/// Europe, West.
|
||||||
|
EUW = 18,
|
||||||
|
/// Japan.
|
||||||
|
JP = 19,
|
||||||
|
/// Latin America, North.
|
||||||
|
LAN = 21,
|
||||||
|
/// Latin America, South.
|
||||||
|
LAS = 22,
|
||||||
|
/// North America.
|
||||||
|
NA = 23,
|
||||||
|
/// Oceana.
|
||||||
|
OCE = 24,
|
||||||
|
/// Turkey
|
||||||
|
TR = 26,
|
||||||
|
/// Public Beta Environment, special beta testing platform. Located in North America.
|
||||||
|
PBE = 31,
|
||||||
|
}
|
||||||
|
|
|
@ -181,4 +181,12 @@ mod tests {
|
||||||
assert_eq!(Ok(ValPlatformRoute::ESPORTS), "ESPORTS".parse());
|
assert_eq!(Ok(ValPlatformRoute::ESPORTS), "ESPORTS".parse());
|
||||||
assert!("SEA".parse::<ValPlatformRoute>().is_err());
|
assert!("SEA".parse::<ValPlatformRoute>().is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tournament_region_serde() {
|
||||||
|
use crate::consts::TournamentRegion;
|
||||||
|
let json = serde_json::to_string(&TournamentRegion::EUNE);
|
||||||
|
assert!(json.is_ok());
|
||||||
|
assert_eq!("\"EUNE\"", &*json.unwrap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version a9b6936baced1f181b550b7fb921ab72b216076c
|
// Version d9133c31439c2d38263002fad5fa824f2ea0cb8b
|
||||||
|
|
||||||
//! Automatically generated endpoint handles.
|
//! Automatically generated endpoint handles.
|
||||||
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version a9b6936baced1f181b550b7fb921ab72b216076c
|
// Version d9133c31439c2d38263002fad5fa824f2ea0cb8b
|
||||||
|
|
||||||
//! Metadata about the Riot API and Riven.
|
//! Metadata about the Riot API and Riven.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version a9b6936baced1f181b550b7fb921ab72b216076c
|
// Version d9133c31439c2d38263002fad5fa824f2ea0cb8b
|
||||||
|
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
|
@ -2819,7 +2819,7 @@ pub mod tournament_stub_v4 {
|
||||||
/// The region in which the provider will be running tournaments.<br>
|
/// The region in which the provider will be running tournaments.<br>
|
||||||
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
|
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
|
||||||
#[serde(rename = "region")]
|
#[serde(rename = "region")]
|
||||||
pub region: String,
|
pub region: crate::consts::TournamentRegion,
|
||||||
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
|
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
|
||||||
#[serde(rename = "url")]
|
#[serde(rename = "url")]
|
||||||
pub url: String,
|
pub url: String,
|
||||||
|
@ -2972,7 +2972,7 @@ pub mod tournament_v4 {
|
||||||
/// The region in which the provider will be running tournaments.<br>
|
/// The region in which the provider will be running tournaments.<br>
|
||||||
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
|
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
|
||||||
#[serde(rename = "region")]
|
#[serde(rename = "region")]
|
||||||
pub region: String,
|
pub region: crate::consts::TournamentRegion,
|
||||||
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
|
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
|
||||||
#[serde(rename = "url")]
|
#[serde(rename = "url")]
|
||||||
pub url: String,
|
pub url: String,
|
||||||
|
|
|
@ -97,7 +97,30 @@ impl PlatformRoute {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used in LoL Tournament API.
|
/// Used in the LoL Tournament API. Specifically
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
pub fn to_tournament_region(self) -> Option<TournamentRegion> {
|
||||||
|
match self {
|
||||||
|
{{
|
||||||
|
for (const [ name, { tournamentRegion } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
if (!tournamentRegion) continue;
|
||||||
|
}}
|
||||||
|
Self::{{= name.toUpperCase() }} => Some(TournamentRegion::{{= tournamentRegion }}),
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
_other => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the slightly more human-friendly alternate name for this `PlatformRoute`. Specifically
|
||||||
|
/// excludes any trailing numbers and appends extra N(orth), S(outh), E(ast), and/or W(est)
|
||||||
|
/// suffixes to some names. Some of these are old region names which are often still used as
|
||||||
|
/// user-facing names, e.g. on op.gg.
|
||||||
|
///
|
||||||
|
/// Note these strings *are* handled by the `FromStr` implementation, if you wish to parse them
|
||||||
|
/// back into `PlatformRoute`s.
|
||||||
pub fn as_region_str(self) -> &'static str {
|
pub fn as_region_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
{{
|
{{
|
||||||
|
@ -108,7 +131,7 @@ impl PlatformRoute {
|
||||||
{{
|
{{
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
other => other.into()
|
other => other.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,3 +163,34 @@ pub enum ValPlatformRoute {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tournament regions for League of Legends (LoL) used in
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
||||||
|
pub enum TournamentRegion {
|
||||||
|
{{
|
||||||
|
for (const [ name, { id, description, tournamentRegion, deprecated } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
if (tournamentRegion) {
|
||||||
|
const desc = description.split('\n');
|
||||||
|
}}
|
||||||
|
{{~ desc :line }}
|
||||||
|
/// {{= line }}
|
||||||
|
{{~}}
|
||||||
|
{{? deprecated }}
|
||||||
|
#[deprecated]
|
||||||
|
{{?}}
|
||||||
|
{{= tournamentRegion }} = {{= id }},
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue