riven 2.78.0

Riot Games API Library
Documentation
#![cfg_attr(any(), rustfmt::skip)]
///////////////////////////////////////////////
//                                           //
//                     !                     //
//   This file is automatically generated!   //
//           Do not directly edit!           //
//                                           //
///////////////////////////////////////////////
#![allow(clippy::upper_case_acronyms)]

use num_enum::{ IntoPrimitive, TryFromPrimitive };
use strum_macros::{ EnumString, EnumIter, Display, IntoStaticStr };

/// Regional routes, used in tournament services, Legends of Runeterra (LoR), and other some 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 {
    /// North and South America.
    ///
    /// `1` (riotapi-schema ID/repr)
    AMERICAS = 1,

    /// Asia, used for LoL matches (`match-v5`) and TFT matches (`tft-match-v1`).
    ///
    /// `2` (riotapi-schema ID/repr)
    ASIA = 2,

    /// Europe.
    ///
    /// `3` (riotapi-schema ID/repr)
    EUROPE = 3,

    /// South East Asia, used for LoR, LoL matches (`match-v5`), and TFT matches (`tft-match-v1`).
    ///
    /// `4` (riotapi-schema ID/repr)
    SEA = 4,

    /// 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,

    /// Special Europe esports platform for `account-v1`. Do not confuse with the `esports` Valorant platform route.
    ///
    /// `12` (riotapi-schema ID/repr)
    ESPORTSEU = 12,

}

/// Platform routes for League of Legends (LoL), Teamfight Tactics (TFT), and Legends of Runeterra (LoR).
#[derive(Debug)]
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
#[derive(Clone, Copy)]
#[repr(u8)]
#[non_exhaustive]
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
pub enum PlatformRoute {
    /// Brazil.
    ///
    /// `16` (riotapi-schema ID/repr)
    #[strum(to_string="BR1", serialize="BR")]
    BR1 = 16,

    /// Europe, Northeast.
    ///
    /// `17` (riotapi-schema ID/repr)
    #[strum(to_string="EUN1", serialize="EUNE")]
    EUN1 = 17,

    /// Europe, West.
    ///
    /// `18` (riotapi-schema ID/repr)
    #[strum(to_string="EUW1", serialize="EUW")]
    EUW1 = 18,

    /// Japan.
    ///
    /// `19` (riotapi-schema ID/repr)
    #[strum(to_string="JP1", serialize="JP")]
    JP1 = 19,

    /// Korea.
    ///
    /// `20` (riotapi-schema ID/repr)
    KR = 20,

    /// Latin America, North.
    ///
    /// `21` (riotapi-schema ID/repr)
    #[strum(to_string="LA1", serialize="LAN")]
    LA1 = 21,

    /// Latin America, South.
    ///
    /// `22` (riotapi-schema ID/repr)
    #[strum(to_string="LA2", serialize="LAS")]
    LA2 = 22,

    /// Middle East and North Africa.
    ///
    /// `37` (riotapi-schema ID/repr)
    #[strum(to_string="ME1", serialize="MENA")]
    ME1 = 37,

    /// North America.
    ///
    /// `23` (riotapi-schema ID/repr)
    #[strum(to_string="NA1", serialize="NA")]
    NA1 = 23,

    /// Oceania.
    ///
    /// `24` (riotapi-schema ID/repr)
    #[strum(to_string="OC1", serialize="OCE")]
    OC1 = 24,

    /// Philippines, moved into `sg2` on 2025-01-08.
    ///
    /// `32` (riotapi-schema ID/repr)
    #[deprecated]
    #[strum(to_string="PH2", serialize="PH")]
    PH2 = 32,

    /// Russia
    ///
    /// `25` (riotapi-schema ID/repr)
    RU = 25,

    /// Singapore, Thailand, Philippines
    ///
    /// `33` (riotapi-schema ID/repr)
    #[strum(to_string="SG2", serialize="SG")]
    SG2 = 33,

    /// Thailand, moved into `sg2` on 2025-01-08.
    ///
    /// `34` (riotapi-schema ID/repr)
    #[deprecated]
    #[strum(to_string="TH2", serialize="TH")]
    TH2 = 34,

    /// Turkey
    ///
    /// `26` (riotapi-schema ID/repr)
    #[strum(to_string="TR1", serialize="TR")]
    TR1 = 26,

    /// Taiwan
    ///
    /// `35` (riotapi-schema ID/repr)
    #[strum(to_string="TW2", serialize="TW")]
    TW2 = 35,

    /// Vietnam
    ///
    /// `36` (riotapi-schema ID/repr)
    #[strum(to_string="VN2", serialize="VN")]
    VN2 = 36,

    /// Public Beta Environment, special beta testing platform. Located in North America.
    ///
    /// `31` (riotapi-schema ID/repr)
    #[strum(to_string="PBE1", serialize="PBE")]
    PBE1 = 31,

}

impl PlatformRoute {
    /// Converts this [`PlatformRoute`] into its corresponding
    /// [`RegionalRoute`] for LoL and TFT match endpoints.
    /// For example, [`match-v5`](crate::endpoints::MatchV5).
    pub const fn to_regional(self) -> RegionalRoute {
        match self {
            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::ME1 => RegionalRoute::EUROPE,
            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,
            Self::PBE1 => RegionalRoute::AMERICAS,
        }
    }

    /// Converts this [`PlatformRoute`] into its corresponding
    /// [`RegionalRoute`] for LoR endpoints.
    /// For example, [`lor-match-v1`](crate::endpoints::LorMatchV1).
    pub const fn to_regional_lor(self) -> RegionalRoute {
        match self {
            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::ME1 => RegionalRoute::EUROPE,
            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,
        }
    }

    /// Used in the LoL Tournament API. Specifically
    /// [`TournamentStubV5`](crate::endpoints::TournamentStubV5)/[`TournamentV5`](crate::endpoints::TournamentV5).
    pub const 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 {
        match self {
            Self::BR1 => "BR",
            Self::EUN1 => "EUNE",
            Self::EUW1 => "EUW",
            Self::JP1 => "JP",
            Self::LA1 => "LAN",
            Self::LA2 => "LAS",
            Self::ME1 => "MENA",
            Self::NA1 => "NA",
            Self::OC1 => "OCE",
            Self::PH2 => "PH",
            Self::SG2 => "SG",
            Self::TH2 => "TH",
            Self::TR1 => "TR",
            Self::TW2 => "TW",
            Self::VN2 => "VN",
            Self::PBE1 => "PBE",
            other => other.into(),
        }
    }
}

/// 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 {
    /// Asia-Pacific.
    ///
    /// `64` (riotapi-schema ID/repr)
    AP = 64,

    /// Brazil.
    ///
    /// `65` (riotapi-schema ID/repr)
    BR = 65,

    /// Europe.
    ///
    /// `66` (riotapi-schema ID/repr)
    EU = 66,

    /// Korea.
    ///
    /// `70` (riotapi-schema ID/repr)
    KR = 70,

    /// Latin America.
    ///
    /// `68` (riotapi-schema ID/repr)
    LATAM = 68,

    /// North America.
    ///
    /// `69` (riotapi-schema ID/repr)
    NA = 69,

    /// Special esports platform.
    ///
    /// `95` (riotapi-schema ID/repr)
    ESPORTS = 95,

}

/// Tournament regions for League of Legends (LoL) used in
/// [`TournamentStubV5`](crate::endpoints::TournamentStubV5)/[`TournamentV5`](crate::endpoints::TournamentV5).
#[derive(Debug)]
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
#[derive(serde::Serialize, crate::de::Deserialize)]
#[derive(Clone, Copy)]
#[repr(u8)]
#[non_exhaustive]
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
pub enum TournamentRegion {
    /// Brazil.
    #[strum(to_string="BR", serialize="BR1")]
    #[serde(alias = "BR1")]
    BR = 16,
    /// Europe, Northeast.
    #[strum(to_string="EUNE", serialize="EUN1")]
    #[serde(alias = "EUN1")]
    EUNE = 17,
    /// Europe, West.
    #[strum(to_string="EUW", serialize="EUW1")]
    #[serde(alias = "EUW1")]
    EUW = 18,
    /// Japan.
    #[strum(to_string="JP", serialize="JP1")]
    #[serde(alias = "JP1")]
    JP = 19,
    /// Latin America, North.
    #[strum(to_string="LAN", serialize="LA1")]
    #[serde(alias = "LA1")]
    LAN = 21,
    /// Latin America, South.
    #[strum(to_string="LAS", serialize="LA2")]
    #[serde(alias = "LA2")]
    LAS = 22,
    /// North America.
    #[strum(to_string="NA", serialize="NA1")]
    #[serde(alias = "NA1")]
    NA = 23,
    /// Oceania.
    #[strum(to_string="OCE", serialize="OC1")]
    #[serde(alias = "OC1")]
    OCE = 24,
    /// Turkey
    #[strum(to_string="TR", serialize="TR1")]
    #[serde(alias = "TR1")]
    TR = 26,
    /// Public Beta Environment, special beta testing platform. Located in North America.
    #[strum(to_string="PBE", serialize="PBE1")]
    #[serde(alias = "PBE1")]
    PBE = 31,
}