Riven/riven/src/consts/route.rs

275 lines
7.3 KiB
Rust
Raw Normal View History

2023-01-08 04:07:35 +00:00
///////////////////////////////////////////////
// //
// ! //
// This file is automatically generated! //
// Do not directly edit! //
// //
///////////////////////////////////////////////
2021-05-22 04:07:31 +00:00
use num_enum::{ IntoPrimitive, TryFromPrimitive };
use strum_macros::{ EnumString, EnumIter, Display, IntoStaticStr };
/// Regional routes, used in tournament services, Legends of Runterra, and other endpoints.
#[derive(Debug)]
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
#[derive(Clone, Copy)]
#[repr(u8)]
#[non_exhaustive]
pub enum RegionalRoute {
2023-01-08 04:07:35 +00:00
/// North and South America.
///
/// `1` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
AMERICAS = 1,
2023-01-08 04:07:35 +00:00
/// Asia, used for LoL matches (`match-v5`) and TFT matches (`tft-match-v1`).
///
/// `2` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
ASIA = 2,
/// Europe.
2023-01-08 04:07:35 +00:00
///
/// `3` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
EUROPE = 3,
2023-01-08 04:07:35 +00:00
/// South East Asia, used for LoR, LoL matches (`match-v5`), and TFT matches (`tft-match-v1`).
///
/// `4` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
SEA = 4,
2023-01-08 04:07:35 +00:00
/// Asia-Pacific, deprecated, for some old matches in `lor-match-v1`.
///
/// `10` (riotapi-schema ID/repr)
#[deprecated]
APAC = 10,
/// Special esports platform for `account-v1`. Do not confuse with the `esports` Valorant platform route.
///
/// `11` (riotapi-schema ID/repr)
ESPORTS = 11,
2021-05-22 04:07:31 +00:00
}
2023-01-08 04:07:35 +00:00
/// Platform routes for League of Legends (LoL), Teamfight Tactics (TFT), and Legends of Runeterra (LoR).
2021-05-22 04:07:31 +00:00
#[derive(Debug)]
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
#[derive(Clone, Copy)]
#[repr(u8)]
#[non_exhaustive]
2022-02-09 04:27:58 +00:00
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
2021-05-22 04:07:31 +00:00
pub enum PlatformRoute {
/// Brazil.
2023-01-08 04:07:35 +00:00
///
/// `16` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="BR1", serialize="BR")]
BR1 = 16,
2023-01-08 04:07:35 +00:00
/// Europe, Northeast.
///
/// `17` (riotapi-schema ID/repr)
#[strum(to_string="EUN1", serialize="EUNE")]
2021-05-22 04:07:31 +00:00
EUN1 = 17,
2023-01-08 04:07:35 +00:00
/// Europe, West.
///
/// `18` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="EUW1", serialize="EUW")]
EUW1 = 18,
/// Japan.
2023-01-08 04:07:35 +00:00
///
/// `19` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="JP1", serialize="JP")]
JP1 = 19,
/// Korea.
2023-01-08 04:07:35 +00:00
///
/// `20` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
KR = 20,
2023-01-08 04:07:35 +00:00
/// Latin America, North.
///
/// `21` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="LA1", serialize="LAN")]
LA1 = 21,
2023-01-08 04:07:35 +00:00
/// Latin America, South.
///
/// `22` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="LA2", serialize="LAS")]
LA2 = 22,
/// North America.
2023-01-08 04:07:35 +00:00
///
/// `23` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="NA1", serialize="NA")]
NA1 = 23,
2023-01-08 04:07:35 +00:00
/// Oceana.
///
/// `24` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="OC1", serialize="OCE")]
OC1 = 24,
2023-01-08 04:07:35 +00:00
/// Philippines
///
/// `32` (riotapi-schema ID/repr)
PH2 = 32,
/// Russia
///
/// `25` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
RU = 25,
2023-01-08 04:07:35 +00:00
/// Singapore
///
/// `33` (riotapi-schema ID/repr)
SG2 = 33,
/// Thailand
///
/// `34` (riotapi-schema ID/repr)
TH2 = 34,
/// Turkey
///
/// `26` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="TR1", serialize="TR")]
TR1 = 26,
2023-01-08 04:07:35 +00:00
/// Taiwan
///
/// `35` (riotapi-schema ID/repr)
TW2 = 35,
/// Vietnam
///
/// `36` (riotapi-schema ID/repr)
VN2 = 36,
2021-05-22 04:07:31 +00:00
2023-01-08 04:07:35 +00:00
/// Public Beta Environment, special beta testing platform. Located in North America.
///
/// `31` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
#[strum(to_string="PBE1", serialize="PBE")]
PBE1 = 31,
2023-01-08 04:07:35 +00:00
2021-05-22 04:07:31 +00:00
}
impl PlatformRoute {
/// Converts this [`PlatformRoute`] into its corresponding
2023-01-08 04:07:35 +00:00
/// [`RegionalRoute`] for LoL and TFT match endpoints.
/// For example, [`match-v5`](crate::endpoints::MatchV5).
2021-05-22 04:07:31 +00:00
pub fn to_regional(self) -> RegionalRoute {
match self {
2023-01-08 04:07:35 +00:00
Self::BR1 => RegionalRoute::AMERICAS,
Self::EUN1 => RegionalRoute::EUROPE,
Self::EUW1 => RegionalRoute::EUROPE,
Self::JP1 => RegionalRoute::ASIA,
Self::KR => RegionalRoute::ASIA,
Self::LA1 => RegionalRoute::AMERICAS,
Self::LA2 => RegionalRoute::AMERICAS,
Self::NA1 => RegionalRoute::AMERICAS,
Self::OC1 => RegionalRoute::SEA,
Self::PH2 => RegionalRoute::SEA,
Self::RU => RegionalRoute::EUROPE,
Self::SG2 => RegionalRoute::SEA,
Self::TH2 => RegionalRoute::SEA,
Self::TR1 => RegionalRoute::EUROPE,
Self::TW2 => RegionalRoute::SEA,
Self::VN2 => RegionalRoute::SEA,
2021-05-22 04:07:31 +00:00
Self::PBE1 => RegionalRoute::AMERICAS,
2023-01-08 04:07:35 +00:00
}
}
2021-05-22 04:07:31 +00:00
2023-01-08 04:07:35 +00:00
/// Converts this [`PlatformRoute`] into its corresponding
/// [`RegionalRoute`] for LoR endpoints.
/// For example, [`lor-match-v1`](crate::endpoints::LorMatchV1).
pub fn to_regional_lor(self) -> RegionalRoute {
match self {
Self::BR1 => RegionalRoute::AMERICAS,
2021-05-22 04:07:31 +00:00
Self::EUN1 => RegionalRoute::EUROPE,
Self::EUW1 => RegionalRoute::EUROPE,
2023-01-08 04:07:35 +00:00
Self::JP1 => RegionalRoute::ASIA,
Self::KR => RegionalRoute::ASIA,
Self::LA1 => RegionalRoute::AMERICAS,
Self::LA2 => RegionalRoute::AMERICAS,
Self::NA1 => RegionalRoute::AMERICAS,
Self::OC1 => RegionalRoute::SEA,
Self::PH2 => RegionalRoute::SEA,
Self::RU => RegionalRoute::SEA,
Self::SG2 => RegionalRoute::SEA,
Self::TH2 => RegionalRoute::SEA,
Self::TR1 => RegionalRoute::SEA,
Self::TW2 => RegionalRoute::SEA,
Self::VN2 => RegionalRoute::SEA,
Self::PBE1 => RegionalRoute::AMERICAS,
2021-05-22 04:07:31 +00:00
}
}
2023-01-08 04:07:35 +00:00
/// Used in LoL Tournament API.
pub fn as_region_str(self) -> &'static str {
match self {
2023-01-08 04:07:35 +00:00
Self::BR1 => "BR",
Self::EUN1 => "EUNE",
Self::EUW1 => "EUW",
2023-01-08 04:07:35 +00:00
Self::JP1 => "JP",
Self::LA1 => "LAN",
Self::LA2 => "LAS",
Self::NA1 => "NA",
Self::OC1 => "OCE",
Self::TR1 => "TR",
Self::PBE1 => "PBE",
2023-01-08 04:07:35 +00:00
other => other.into()
}
}
2021-05-22 04:07:31 +00:00
}
/// Platform routes for Valorant.
#[derive(Debug)]
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
#[derive(Clone, Copy)]
#[repr(u8)]
#[non_exhaustive]
pub enum ValPlatformRoute {
2023-01-08 04:07:35 +00:00
/// Asia-Pacific.
///
/// `64` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
AP = 64,
2023-01-08 04:07:35 +00:00
/// Brazil.
///
/// `65` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
BR = 65,
2023-01-08 04:07:35 +00:00
/// Europe.
///
/// `66` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
EU = 66,
2023-01-08 04:07:35 +00:00
/// Korea.
///
/// `70` (riotapi-schema ID/repr)
KR = 70,
/// Latin America.
///
/// `68` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
LATAM = 68,
2023-01-08 04:07:35 +00:00
/// North America.
///
/// `69` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
NA = 69,
2023-01-08 04:07:35 +00:00
/// Special esports platform.
///
/// `95` (riotapi-schema ID/repr)
2021-05-22 04:07:31 +00:00
ESPORTS = 95,
}