Adding iters to enums, updating a bunch of documentation

This commit is contained in:
Mingwei Samuel 2020-02-01 13:35:37 -08:00
parent 338fc4e8b5
commit b8b3ec83f0
11 changed files with 647 additions and 259 deletions

View file

@ -8,17 +8,19 @@
use num_enum::{ IntoPrimitive, TryFromPrimitive };
use serde_repr::{ Serialize_repr, Deserialize_repr };
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
use strum_macros::{ EnumString, EnumIter, Display, AsRefStr, IntoStaticStr };
/// League of Legend's champions.
///
/// The documentation of each variant specifies:<br>
/// NAME (`IDENTIFIER`, ID).
///
/// Implements [IntoEnumIterator](super::IntoEnumIterator).
#[cfg_attr(feature = "nightly", non_exhaustive)]
#[derive(Debug, Copy, Clone)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(Serialize_repr, Deserialize_repr)]
#[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
#[derive(EnumString, EnumIter, Display, AsRefStr, IntoStaticStr)]
#[repr(i16)]
pub enum Champion {
/// A champion that doesn't exist. Used in TeamBans when no champion was banned.

View file

@ -1,13 +1,16 @@
use std::cmp::Ordering;
use strum::IntoEnumIterator;
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
use num_enum::{ IntoPrimitive, TryFromPrimitive };
/// LoL and TFT rank divisions, I, II, III, IV, and (deprecated) V.
///
/// Sorts in reverse numeric order, from low to high rank.
/// Ordered such that "higher" divisions are greater than "lower" ones: `Division::I > Division::IV`.
///
/// Repr'd as equivalent numeric values, (1, 2, 3, 4, 5).
///
/// Implements [IntoEnumIterator](super::IntoEnumIterator). Iterator excludes deprecated `Division::V`.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash)]
#[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
@ -24,6 +27,16 @@ pub enum Division {
serde_string!(Division);
/// Returns a DoubleEndedIterator of I, II, III, IV.
/// Ordered from high rank (I) to low (IV).
/// Excludes V, which is deprecated.
impl IntoEnumIterator for Division {
type Iterator = std::slice::Iter<'static, Self>;
fn iter() -> Self::Iterator {
[ Self::I, Self::II, Self::III, Self::IV ].iter()
}
}
impl Ord for Division {
fn cmp(&self, other: &Self) -> Ordering {
u8::from(*self).cmp(&u8::from(*other)).reverse()

View file

@ -1,4 +1,4 @@
//! Constant data and Enums relevant to the Riot Games API.
//! Constant data and Enums used with the Riot Games API.
//!
//! This module uses SCREAMING_SNAKE_CASE for enum variants, as enums in this
//! crate should be considered collections of constants.
@ -29,12 +29,20 @@ pub use queue_type::*;
mod queue;
pub use queue::*;
pub mod ranks;
mod region;
pub use region::*;
mod season;
pub use season::*;
/// Trait allowing iteration of enum types, implemented by several enums in this module.
/// Re-exported from strum.
///
///
pub use strum::IntoEnumIterator;
mod team;
pub use team::*;

100
src/consts/ranks.rs Normal file
View file

@ -0,0 +1,100 @@
//! Utilities for working with ranks, represented as `(Tier, Division)` tuples.
use std::iter::Peekable;
use strum::IntoEnumIterator;
use super::{ Tier, Division };
/// Iterator for iterating `(Tier, Division)` rank tuples.
pub struct Iter {
tier_iter: Peekable<<Tier as IntoEnumIterator>::Iterator>,
div_iter: <Division as IntoEnumIterator>::Iterator,
}
impl Iterator for Iter {
type Item = (Tier, Division);
fn next(&mut self) -> Option<Self::Item> {
// First find the tier (innermost loop).
// If none found, we go to next tier (in unwrap_or_else case).
let div = *self.div_iter.next()
.unwrap_or_else(|| {
// If no divisions available, go to next tier, reset the divisions, and return I.
self.tier_iter.next();
self.div_iter = Division::iter();
self.div_iter.next().unwrap()
});
// Then find the tier.
let tier = *self.tier_iter.peek()?;
// If its an apex tier go to next tier and reset the divisions.
if tier.is_apex() {
self.tier_iter.next();
self.div_iter = Division::iter();
}
Some((tier, div))
}
}
/// Returns an iterator over all `(Tier, Division)` pairs, ordered from highest rank to lowest rank.
///
/// Apex tiers are all division I, for example: `(Tier::CHALLENGER, Division::I)`.
/// This matches how they are represented by Riot. There is no "Challenger II", etc.
pub fn iter() -> Iter {
Iter {
tier_iter: Tier::iter().peekable(),
div_iter: Division::iter(),
}
}
/// Returns an iterator over all `(Tier, Division)` pairs, excluding apex (Master+) tiers,
/// ordered from highest (Diamond I) to lowest (Iron IV).
pub fn non_apex_iter() -> Iter {
let mut tier_iter = Tier::iter().peekable();
while tier_iter.peek().unwrap().is_apex() {
tier_iter.next();
}
Iter {
tier_iter: tier_iter,
div_iter: Division::iter(),
}
}
#[cfg(test)]
mod tests {
use super::{ Tier, Division };
#[test]
fn iter() {
let mut it = super::iter();
assert_eq!(Some((Tier::CHALLENGER, Division::I)), it.next());
assert_eq!(Some((Tier::GRANDMASTER, Division::I)), it.next());
assert_eq!(Some((Tier::MASTER, Division::I)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::I)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next());
let mut last = None;
for next in &mut it {
last = Some(next);
}
assert_eq!(Some((Tier::IRON, Division::IV)), last);
assert_eq!(None, it.next());
}
#[test]
fn non_apex_iter() {
let mut it = super::non_apex_iter();
assert_eq!(Some((Tier::DIAMOND, Division::I)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::III)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::IV)), it.next());
assert_eq!(Some((Tier::PLATINUM, Division::I)), it.next());
let mut last = None;
for next in &mut it {
last = Some(next);
}
assert_eq!(Some((Tier::IRON, Division::IV)), last);
assert_eq!(None, it.next());
}
}

View file

@ -1,43 +1,49 @@
use num_enum::{ IntoPrimitive, TryFromPrimitive };
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
use strum_macros::{ EnumString, EnumIter, Display, AsRefStr, IntoStaticStr };
/// LoL and TFT ranked tiers, such as gold, diamond, challenger, etc.
///
/// Sorts from lowest rank to highest rank.
///
/// Repr'd as arbitrary u8 values.
/// Repr'd as arbitrary `u8` values.
///
/// Implements [IntoEnumIterator](super::IntoEnumIterator).
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash, PartialOrd, Ord)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
#[derive(EnumString, EnumIter, Display, AsRefStr, IntoStaticStr)]
#[repr(u8)]
pub enum Tier {
IRON = 40,
BRONZE = 60,
SILVER = 80,
GOLD = 100,
PLATINUM = 120,
DIAMOND = 140,
MASTER = 180,
GRANDMASTER = 200,
/// Challenger, the highest tier, an apex tier. Repr: `220_u8`.
CHALLENGER = 220,
/// Grand Master, an apex tier. Repr: `200_u8`.
GRANDMASTER = 200,
/// Master, an apex tier. Repr: `180_u8`.
MASTER = 180,
/// Diamond, the higest non-apex tier. Repr: `140_u8`.
DIAMOND = 140,
/// Platinum. Repr: `120_u8`.
PLATINUM = 120,
/// Gold. Repr: `100_u8`.
GOLD = 100,
/// Silver. Repr: `80_u8`.
SILVER = 80,
/// Bronze. Repr: `60_u8`.
BRONZE = 60,
/// Iron, the lowest tier. Repr: `40_u8`.
IRON = 40,
}
serde_string!(Tier);
impl Tier {
/// If this tier is "standard".
/// Standard means non-apex (not master+), and not unranked.
/// If this tier is an apex tier: master and above.
///
/// Only these tiers are queryable by LeagueV4Endpoints::get_league_entries(...).
pub fn is_standard_tier(self) -> bool {
self < Self::MASTER
}
/// If this tier is an apex tier.
/// Master and above.
pub fn is_apex_tier(self) -> bool {
Self::MASTER <= self
/// Inverse of is_standard().
///
/// These tiers are NOT queryable by LeagueV4Endpoints::get_league_entries(...).
pub const fn is_apex(self) -> bool {
(Self::MASTER as u8) <= (self as u8)
}
}
@ -50,6 +56,12 @@ mod tests {
assert!(Tier::GOLD < Tier::DIAMOND);
}
#[test]
fn apex_check() {
assert!( Tier::GRANDMASTER.is_apex());
assert!(!Tier::DIAMOND.is_apex());
}
#[test]
fn to_string() {
assert_eq!("GRANDMASTER", Tier::GRANDMASTER.as_ref());
@ -60,4 +72,20 @@ mod tests {
fn from_string() {
assert_eq!(Ok(Tier::GRANDMASTER), "GRANDMASTER".parse());
}
#[test]
fn iter() {
use strum::IntoEnumIterator;
let mut iter = Tier::iter();
assert_eq!(Some(Tier::CHALLENGER), iter.next());
iter.next();
iter.next();
assert_eq!(Some(Tier::DIAMOND), iter.next());
iter.next();
iter.next();
iter.next();
iter.next();
assert_eq!(Some(Tier::IRON), iter.next());
assert_eq!(None, iter.next());
}
}

View file

@ -23,126 +23,160 @@ use crate::consts::Region;
use crate::riot_api::RiotApi;
impl RiotApi {
/// Handle for ChampionMasteryV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [ChampionMasteryV4](crate::endpoints::ChampionMasteryV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#champion-mastery-v4" target="_blank">`champion-mastery-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn champion_mastery_v4(&self) -> ChampionMasteryV4 {
ChampionMasteryV4 { base: self }
}
/// Handle for ChampionV3 endpoints. This method is automatically generated.
/// Returns a handle for accessing [ChampionV3](crate::endpoints::ChampionV3) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#champion-v3" target="_blank">`champion-v3`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-v3">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn champion_v3(&self) -> ChampionV3 {
ChampionV3 { base: self }
}
/// Handle for LeagueExpV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [LeagueExpV4](crate::endpoints::LeagueExpV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#league-exp-v4" target="_blank">`league-exp-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#league-exp-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn league_exp_v4(&self) -> LeagueExpV4 {
LeagueExpV4 { base: self }
}
/// Handle for LeagueV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [LeagueV4](crate::endpoints::LeagueV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#league-v4" target="_blank">`league-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn league_v4(&self) -> LeagueV4 {
LeagueV4 { base: self }
}
/// Handle for LolStatusV3 endpoints. This method is automatically generated.
/// Returns a handle for accessing [LolStatusV3](crate::endpoints::LolStatusV3) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#lol-status-v3" target="_blank">`lol-status-v3`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#lol-status-v3">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn lol_status_v3(&self) -> LolStatusV3 {
LolStatusV3 { base: self }
}
/// Handle for LorRankedV1 endpoints. This method is automatically generated.
/// Returns a handle for accessing [LorRankedV1](crate::endpoints::LorRankedV1) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#lor-ranked-v1" target="_blank">`lor-ranked-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn lor_ranked_v1(&self) -> LorRankedV1 {
LorRankedV1 { base: self }
}
/// Handle for MatchV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [MatchV4](crate::endpoints::MatchV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#match-v4" target="_blank">`match-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn match_v4(&self) -> MatchV4 {
MatchV4 { base: self }
}
/// Handle for SpectatorV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [SpectatorV4](crate::endpoints::SpectatorV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#spectator-v4" target="_blank">`spectator-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn spectator_v4(&self) -> SpectatorV4 {
SpectatorV4 { base: self }
}
/// Handle for SummonerV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [SummonerV4](crate::endpoints::SummonerV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#summoner-v4" target="_blank">`summoner-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn summoner_v4(&self) -> SummonerV4 {
SummonerV4 { base: self }
}
/// Handle for TftLeagueV1 endpoints. This method is automatically generated.
/// Returns a handle for accessing [TftLeagueV1](crate::endpoints::TftLeagueV1) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-league-v1" target="_blank">`tft-league-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn tft_league_v1(&self) -> TftLeagueV1 {
TftLeagueV1 { base: self }
}
/// Handle for TftMatchV1 endpoints. This method is automatically generated.
/// Returns a handle for accessing [TftMatchV1](crate::endpoints::TftMatchV1) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-match-v1" target="_blank">`tft-match-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-match-v1">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn tft_match_v1(&self) -> TftMatchV1 {
TftMatchV1 { base: self }
}
/// Handle for TftSummonerV1 endpoints. This method is automatically generated.
/// Returns a handle for accessing [TftSummonerV1](crate::endpoints::TftSummonerV1) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn tft_summoner_v1(&self) -> TftSummonerV1 {
TftSummonerV1 { base: self }
}
/// Handle for ThirdPartyCodeV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [ThirdPartyCodeV4](crate::endpoints::ThirdPartyCodeV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#third-party-code-v4" target="_blank">`third-party-code-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#third-party-code-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn third_party_code_v4(&self) -> ThirdPartyCodeV4 {
ThirdPartyCodeV4 { base: self }
}
/// Handle for TournamentStubV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [TournamentStubV4](crate::endpoints::TournamentStubV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn tournament_stub_v4(&self) -> TournamentStubV4 {
TournamentStubV4 { base: self }
}
/// Handle for TournamentV4 endpoints. This method is automatically generated.
/// Returns a handle for accessing [TournamentV4](crate::endpoints::TournamentV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn tournament_v4(&self) -> TournamentV4 {
TournamentV4 { base: self }
}
}
/// ChampionMasteryV4 endpoints. This struct is automatically generated.
/// ChampionMasteryV4 endpoints handle, accessed by calling [`champion_mastery_v4()`](crate::RiotApi::champion_mastery_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#champion-mastery-v4" target="_blank">`champion-mastery-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct ChampionMasteryV4<'a> {
base: &'a RiotApi,
}
impl<'a> ChampionMasteryV4<'a> {
/// Get all champion mastery entries sorted by number of champion points descending,
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteries">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId` - Summoner ID associated with the player
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteries" target="_blank">`champion-mastery-v4.getAllChampionMasteries`</a>
///
/// Note: this method is automatically generated.
pub fn get_all_champion_masteries(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
{
@ -151,12 +185,14 @@ impl<'a> ChampionMasteryV4<'a> {
}
/// Get a champion mastery by player ID and champion ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMastery">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `championId` - Champion ID to retrieve Champion Mastery for
/// * `encryptedSummonerId` - Summoner ID associated with the player
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMastery" target="_blank">`champion-mastery-v4.getChampionMastery`</a>
///
/// Note: this method is automatically generated.
pub fn get_champion_mastery(&self, region: Region, encrypted_summoner_id: &str, champion_id: crate::consts::Champion)
-> impl Future<Output = Result<Option<champion_mastery_v4::ChampionMastery>>> + 'a
{
@ -165,11 +201,13 @@ impl<'a> ChampionMasteryV4<'a> {
}
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScore">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId` - Summoner ID associated with the player
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScore" target="_blank">`champion-mastery-v4.getChampionMasteryScore`</a>
///
/// Note: this method is automatically generated.
pub fn get_champion_mastery_score(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<i32>> + 'a
{
@ -179,18 +217,22 @@ impl<'a> ChampionMasteryV4<'a> {
}
/// ChampionV3 endpoints. This struct is automatically generated.
/// ChampionV3 endpoints handle, accessed by calling [`champion_v3()`](crate::RiotApi::champion_v3) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#champion-v3" target="_blank">`champion-v3`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-v3">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct ChampionV3<'a> {
base: &'a RiotApi,
}
impl<'a> ChampionV3<'a> {
/// Returns champion rotations, including free-to-play and low-level free-to-play rotations (REST)
///
/// <a href="https://developer.riotgames.com/api-methods/#champion-v3/GET_getChampionInfo">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-v3/GET_getChampionInfo" target="_blank">`champion-v3.getChampionInfo`</a>
///
/// Note: this method is automatically generated.
pub fn get_champion_info(&self, region: Region)
-> impl Future<Output = Result<champion_v3::ChampionInfo>> + 'a
{
@ -200,22 +242,26 @@ impl<'a> ChampionV3<'a> {
}
/// LeagueExpV4 endpoints. This struct is automatically generated.
/// LeagueExpV4 endpoints handle, accessed by calling [`league_exp_v4()`](crate::RiotApi::league_exp_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#league-exp-v4" target="_blank">`league-exp-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#league-exp-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct LeagueExpV4<'a> {
base: &'a RiotApi,
}
impl<'a> LeagueExpV4<'a> {
/// Get all the league entries.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-exp-v4/GET_getLeagueEntries">Official API Reference</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.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-exp-v4/GET_getLeagueEntries" target="_blank">`league-exp-v4.getLeagueEntries`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_entries(&self, region: Region, queue: crate::consts::QueueType, tier: crate::consts::Tier, division: crate::consts::Division, page: Option<i32>)
-> impl Future<Output = Result<Vec<league_exp_v4::LeagueEntry>>> + 'a
{
@ -228,19 +274,23 @@ impl<'a> LeagueExpV4<'a> {
}
/// LeagueV4 endpoints. This struct is automatically generated.
/// LeagueV4 endpoints handle, accessed by calling [`league_v4()`](crate::RiotApi::league_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#league-v4" target="_blank">`league-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct LeagueV4<'a> {
base: &'a RiotApi,
}
impl<'a> LeagueV4<'a> {
/// Get the challenger league for given queue.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getChallengerLeague">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `queue`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getChallengerLeague" target="_blank">`league-v4.getChallengerLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_challenger_league(&self, region: Region, queue: crate::consts::QueueType)
-> impl Future<Output = Result<league_v4::LeagueList>> + 'a
{
@ -249,11 +299,13 @@ impl<'a> LeagueV4<'a> {
}
/// Get league entries in all queues for a given summoner ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntriesForSummoner">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntriesForSummoner" target="_blank">`league-v4.getLeagueEntriesForSummoner`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_entries_for_summoner(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<Vec<league_v4::LeagueEntry>>> + 'a
{
@ -262,14 +314,16 @@ impl<'a> LeagueV4<'a> {
}
/// Get all the league entries.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntries">Official API Reference</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.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueEntries" target="_blank">`league-v4.getLeagueEntries`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_entries(&self, region: Region, queue: crate::consts::QueueType, tier: crate::consts::Tier, division: crate::consts::Division, page: Option<i32>)
-> impl Future<Output = Result<Vec<league_v4::LeagueEntry>>> + 'a
{
@ -281,11 +335,13 @@ impl<'a> LeagueV4<'a> {
}
/// Get the grandmaster league of a specific queue.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getGrandmasterLeague">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `queue`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getGrandmasterLeague" target="_blank">`league-v4.getGrandmasterLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_grandmaster_league(&self, region: Region, queue: crate::consts::QueueType)
-> impl Future<Output = Result<league_v4::LeagueList>> + 'a
{
@ -294,11 +350,13 @@ impl<'a> LeagueV4<'a> {
}
/// Get league with given ID, including inactive entries.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueById">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `leagueId` - The UUID of the league.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getLeagueById" target="_blank">`league-v4.getLeagueById`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_by_id(&self, region: Region, league_id: &str)
-> impl Future<Output = Result<Option<league_v4::LeagueList>>> + 'a
{
@ -307,11 +365,13 @@ impl<'a> LeagueV4<'a> {
}
/// Get the master league for given queue.
///
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getMasterLeague">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `queue`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#league-v4/GET_getMasterLeague" target="_blank">`league-v4.getMasterLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_master_league(&self, region: Region, queue: crate::consts::QueueType)
-> impl Future<Output = Result<league_v4::LeagueList>> + 'a
{
@ -321,9 +381,11 @@ impl<'a> LeagueV4<'a> {
}
/// LolStatusV3 endpoints. This struct is automatically generated.
/// LolStatusV3 endpoints handle, accessed by calling [`lol_status_v3()`](crate::RiotApi::lol_status_v3) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#lol-status-v3" target="_blank">`lol-status-v3`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#lol-status-v3">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct LolStatusV3<'a> {
base: &'a RiotApi,
}
@ -331,10 +393,12 @@ impl<'a> LolStatusV3<'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.
///
/// <a href="https://developer.riotgames.com/api-methods/#lol-status-v3/GET_getShardData">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#lol-status-v3/GET_getShardData" target="_blank">`lol-status-v3.getShardData`</a>
///
/// Note: this method is automatically generated.
pub fn get_shard_data(&self, region: Region)
-> impl Future<Output = Result<lol_status_v3::ShardStatus>> + 'a
{
@ -344,18 +408,22 @@ impl<'a> LolStatusV3<'a> {
}
/// LorRankedV1 endpoints. This struct is automatically generated.
/// LorRankedV1 endpoints handle, accessed by calling [`lor_ranked_v1()`](crate::RiotApi::lor_ranked_v1) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#lor-ranked-v1" target="_blank">`lor-ranked-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct LorRankedV1<'a> {
base: &'a RiotApi,
}
impl<'a> LorRankedV1<'a> {
/// Get the players in Master tier.
///
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1/GET_getLeaderboards">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1/GET_getLeaderboards" target="_blank">`lor-ranked-v1.getLeaderboards`</a>
///
/// Note: this method is automatically generated.
pub fn get_leaderboards(&self, region: Region)
-> impl Future<Output = Result<lor_ranked_v1::Leaderboard>> + 'a
{
@ -365,19 +433,23 @@ impl<'a> LorRankedV1<'a> {
}
/// MatchV4 endpoints. This struct is automatically generated.
/// MatchV4 endpoints handle, accessed by calling [`match_v4()`](crate::RiotApi::match_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#match-v4" target="_blank">`match-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct MatchV4<'a> {
base: &'a RiotApi,
}
impl<'a> MatchV4<'a> {
/// Get match IDs by tournament code.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchIdsByTournamentCode">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `tournamentCode` - The tournament code.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchIdsByTournamentCode" target="_blank">`match-v4.getMatchIdsByTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_match_ids_by_tournament_code(&self, region: Region, tournament_code: &str)
-> impl Future<Output = Result<Vec<i64>>> + 'a
{
@ -386,11 +458,13 @@ impl<'a> MatchV4<'a> {
}
/// Get match by match ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatch">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `matchId` - The match ID.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatch" target="_blank">`match-v4.getMatch`</a>
///
/// Note: this method is automatically generated.
pub fn get_match(&self, region: Region, match_id: i64)
-> impl Future<Output = Result<Option<match_v4::Match>>> + 'a
{
@ -399,12 +473,14 @@ impl<'a> MatchV4<'a> {
}
/// Get match by match ID and tournament code.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchByTournamentCode">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `tournamentCode` - The tournament code.
/// * `matchId` - The match ID.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchByTournamentCode" target="_blank">`match-v4.getMatchByTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_match_by_tournament_code(&self, region: Region, match_id: i64, tournament_code: &str)
-> impl Future<Output = Result<match_v4::Match>> + 'a
{
@ -419,8 +495,6 @@ impl<'a> MatchV4<'a> {
/// 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.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchlist">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedAccountId` - The account ID.
@ -431,6 +505,10 @@ impl<'a> MatchV4<'a> {
/// * `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.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchlist" target="_blank">`match-v4.getMatchlist`</a>
///
/// Note: this method is automatically generated.
pub fn get_matchlist(&self, region: Region, encrypted_account_id: &str, begin_time: Option<i64>, begin_index: Option<i32>, champion: Option<std::vec::Vec<crate::consts::Champion>>, end_time: Option<i64>, end_index: Option<i32>, queue: Option<std::vec::Vec<crate::consts::Queue>>, season: Option<std::vec::Vec<crate::consts::Season>>)
-> impl Future<Output = Result<Option<match_v4::Matchlist>>> + 'a
{
@ -450,11 +528,13 @@ impl<'a> MatchV4<'a> {
/// Get match timeline by match ID.
/// ## Implementation Notes
/// Not all matches have timeline data.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchTimeline">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `matchId` - The match ID.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#match-v4/GET_getMatchTimeline" target="_blank">`match-v4.getMatchTimeline`</a>
///
/// Note: this method is automatically generated.
pub fn get_match_timeline(&self, region: Region, match_id: i64)
-> impl Future<Output = Result<Option<match_v4::MatchTimeline>>> + 'a
{
@ -464,19 +544,23 @@ impl<'a> MatchV4<'a> {
}
/// SpectatorV4 endpoints. This struct is automatically generated.
/// SpectatorV4 endpoints handle, accessed by calling [`spectator_v4()`](crate::RiotApi::spectator_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#spectator-v4" target="_blank">`spectator-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct SpectatorV4<'a> {
base: &'a RiotApi,
}
impl<'a> SpectatorV4<'a> {
/// Get current game information for the given summoner ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4/GET_getCurrentGameInfoBySummoner">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId` - The ID of the summoner.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4/GET_getCurrentGameInfoBySummoner" target="_blank">`spectator-v4.getCurrentGameInfoBySummoner`</a>
///
/// Note: this method is automatically generated.
pub fn get_current_game_info_by_summoner(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<Option<spectator_v4::CurrentGameInfo>>> + 'a
{
@ -485,10 +569,12 @@ impl<'a> SpectatorV4<'a> {
}
/// Get list of featured games.
///
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4/GET_getFeaturedGames">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v4/GET_getFeaturedGames" target="_blank">`spectator-v4.getFeaturedGames`</a>
///
/// Note: this method is automatically generated.
pub fn get_featured_games(&self, region: Region)
-> impl Future<Output = Result<spectator_v4::FeaturedGames>> + 'a
{
@ -498,19 +584,23 @@ impl<'a> SpectatorV4<'a> {
}
/// SummonerV4 endpoints. This struct is automatically generated.
/// SummonerV4 endpoints handle, accessed by calling [`summoner_v4()`](crate::RiotApi::summoner_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#summoner-v4" target="_blank">`summoner-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct SummonerV4<'a> {
base: &'a RiotApi,
}
impl<'a> SummonerV4<'a> {
/// Get a summoner by account ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByAccountId">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedAccountId`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByAccountId" target="_blank">`summoner-v4.getByAccountId`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_account_id(&self, region: Region, encrypted_account_id: &str)
-> impl Future<Output = Result<summoner_v4::Summoner>> + 'a
{
@ -519,11 +609,13 @@ impl<'a> SummonerV4<'a> {
}
/// Get a summoner by summoner name.
///
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerName">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `summonerName` - Summoner Name
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerName" target="_blank">`summoner-v4.getBySummonerName`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_summoner_name(&self, region: Region, summoner_name: &str)
-> impl Future<Output = Result<Option<summoner_v4::Summoner>>> + 'a
{
@ -532,11 +624,13 @@ impl<'a> SummonerV4<'a> {
}
/// Get a summoner by PUUID.
///
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByPUUID">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedPUUID` - Summoner ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByPUUID" target="_blank">`summoner-v4.getByPUUID`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_puuid(&self, region: Region, encrypted_puuid: &str)
-> impl Future<Output = Result<summoner_v4::Summoner>> + 'a
{
@ -545,11 +639,13 @@ impl<'a> SummonerV4<'a> {
}
/// Get a summoner by summoner ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerId">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId` - Summoner ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getBySummonerId" target="_blank">`summoner-v4.getBySummonerId`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_summoner_id(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<summoner_v4::Summoner>> + 'a
{
@ -559,18 +655,22 @@ impl<'a> SummonerV4<'a> {
}
/// TftLeagueV1 endpoints. This struct is automatically generated.
/// TftLeagueV1 endpoints handle, accessed by calling [`tft_league_v1()`](crate::RiotApi::tft_league_v1) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-league-v1" target="_blank">`tft-league-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct TftLeagueV1<'a> {
base: &'a RiotApi,
}
impl<'a> TftLeagueV1<'a> {
/// Get the challenger league.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getChallengerLeague">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getChallengerLeague" target="_blank">`tft-league-v1.getChallengerLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_challenger_league(&self, region: Region)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
@ -579,11 +679,13 @@ impl<'a> TftLeagueV1<'a> {
}
/// Get league entries for a given summoner ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueEntriesForSummoner">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueEntriesForSummoner" target="_blank">`tft-league-v1.getLeagueEntriesForSummoner`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_entries_for_summoner(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<Vec<tft_league_v1::LeagueEntry>>> + 'a
{
@ -592,13 +694,15 @@ impl<'a> TftLeagueV1<'a> {
}
/// Get all the league entries.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueEntries">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `tier`
/// * `division`
/// * `page` (optional) - Starts with page 1.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueEntries" target="_blank">`tft-league-v1.getLeagueEntries`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_entries(&self, region: Region, tier: &str, division: &str, page: Option<i32>)
-> impl Future<Output = Result<Vec<tft_league_v1::LeagueEntry>>> + 'a
{
@ -610,10 +714,12 @@ impl<'a> TftLeagueV1<'a> {
}
/// Get the grandmaster league.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getGrandmasterLeague">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getGrandmasterLeague" target="_blank">`tft-league-v1.getGrandmasterLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_grandmaster_league(&self, region: Region)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
@ -622,11 +728,13 @@ impl<'a> TftLeagueV1<'a> {
}
/// Get league with given ID, including inactive entries.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueById">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `leagueId` - The UUID of the league.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueById" target="_blank">`tft-league-v1.getLeagueById`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_by_id(&self, region: Region, league_id: &str)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
@ -635,10 +743,12 @@ impl<'a> TftLeagueV1<'a> {
}
/// Get the master league.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getMasterLeague">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getMasterLeague" target="_blank">`tft-league-v1.getMasterLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_master_league(&self, region: Region)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
@ -648,20 +758,24 @@ impl<'a> TftLeagueV1<'a> {
}
/// TftMatchV1 endpoints. This struct is automatically generated.
/// TftMatchV1 endpoints handle, accessed by calling [`tft_match_v1()`](crate::RiotApi::tft_match_v1) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-match-v1" target="_blank">`tft-match-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-match-v1">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct TftMatchV1<'a> {
base: &'a RiotApi,
}
impl<'a> TftMatchV1<'a> {
/// Get a list of match ids by PUUID.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-match-v1/GET_getMatchIdsByPUUID">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `puuid` (optional)
/// * `count` (optional)
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-match-v1/GET_getMatchIdsByPUUID" target="_blank">`tft-match-v1.getMatchIdsByPUUID`</a>
///
/// Note: this method is automatically generated.
pub fn get_match_ids_by_puuid(&self, region: Region, puuid: &str, count: Option<i32>)
-> impl Future<Output = Result<Vec<String>>> + 'a
{
@ -673,11 +787,13 @@ impl<'a> TftMatchV1<'a> {
}
/// Get a match by match id.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-match-v1/GET_getMatch">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `matchId`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-match-v1/GET_getMatch" target="_blank">`tft-match-v1.getMatch`</a>
///
/// Note: this method is automatically generated.
pub fn get_match(&self, region: Region, match_id: &str)
-> impl Future<Output = Result<tft_match_v1::Match>> + 'a
{
@ -687,19 +803,23 @@ impl<'a> TftMatchV1<'a> {
}
/// TftSummonerV1 endpoints. This struct is automatically generated.
/// TftSummonerV1 endpoints handle, accessed by calling [`tft_summoner_v1()`](crate::RiotApi::tft_summoner_v1) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct TftSummonerV1<'a> {
base: &'a RiotApi,
}
impl<'a> TftSummonerV1<'a> {
/// Get a summoner by account ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getByAccountId">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedAccountId`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getByAccountId" target="_blank">`tft-summoner-v1.getByAccountId`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_account_id(&self, region: Region, encrypted_account_id: &str)
-> impl Future<Output = Result<tft_summoner_v1::Summoner>> + 'a
{
@ -708,11 +828,13 @@ impl<'a> TftSummonerV1<'a> {
}
/// Get a summoner by summoner name.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getBySummonerName">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `summonerName` - Summoner Name
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getBySummonerName" target="_blank">`tft-summoner-v1.getBySummonerName`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_summoner_name(&self, region: Region, summoner_name: &str)
-> impl Future<Output = Result<tft_summoner_v1::Summoner>> + 'a
{
@ -721,11 +843,13 @@ impl<'a> TftSummonerV1<'a> {
}
/// Get a summoner by PUUID.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getByPUUID">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedPUUID` - Summoner ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getByPUUID" target="_blank">`tft-summoner-v1.getByPUUID`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_puuid(&self, region: Region, encrypted_puuid: &str)
-> impl Future<Output = Result<tft_summoner_v1::Summoner>> + 'a
{
@ -734,11 +858,13 @@ impl<'a> TftSummonerV1<'a> {
}
/// Get a summoner by summoner ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getBySummonerId">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId` - Summoner ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-summoner-v1/GET_getBySummonerId" target="_blank">`tft-summoner-v1.getBySummonerId`</a>
///
/// Note: this method is automatically generated.
pub fn get_by_summoner_id(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<tft_summoner_v1::Summoner>> + 'a
{
@ -748,19 +874,23 @@ impl<'a> TftSummonerV1<'a> {
}
/// ThirdPartyCodeV4 endpoints. This struct is automatically generated.
/// ThirdPartyCodeV4 endpoints handle, accessed by calling [`third_party_code_v4()`](crate::RiotApi::third_party_code_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#third-party-code-v4" target="_blank">`third-party-code-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#third-party-code-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct ThirdPartyCodeV4<'a> {
base: &'a RiotApi,
}
impl<'a> ThirdPartyCodeV4<'a> {
/// Get third party code for a given summoner ID.
///
/// <a href="https://developer.riotgames.com/api-methods/#third-party-code-v4/GET_getThirdPartyCodeBySummonerId">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `encryptedSummonerId`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#third-party-code-v4/GET_getThirdPartyCodeBySummonerId" target="_blank">`third-party-code-v4.getThirdPartyCodeBySummonerId`</a>
///
/// Note: this method is automatically generated.
pub fn get_third_party_code_by_summoner_id(&self, region: Region, encrypted_summoner_id: &str)
-> impl Future<Output = Result<String>> + 'a
{
@ -770,19 +900,23 @@ impl<'a> ThirdPartyCodeV4<'a> {
}
/// TournamentStubV4 endpoints. This struct is automatically generated.
/// TournamentStubV4 endpoints handle, accessed by calling [`tournament_stub_v4()`](crate::RiotApi::tournament_stub_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct TournamentStubV4<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentStubV4<'a> {
/// Gets a mock list of lobby events by tournament code.
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/GET_getLobbyEventsByCode">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `tournamentCode` - The short code to look up lobby events for
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/GET_getLobbyEventsByCode" target="_blank">`tournament-stub-v4.getLobbyEventsByCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_lobby_events_by_code(&self, region: Region, tournament_code: &str)
-> impl Future<Output = Result<tournament_stub_v4::LobbyEventWrapper>> + 'a
{
@ -792,19 +926,23 @@ impl<'a> TournamentStubV4<'a> {
}
/// TournamentV4 endpoints. This struct is automatically generated.
/// TournamentV4 endpoints handle, accessed by calling [`tournament_v4()`](crate::RiotApi::tournament_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct TournamentV4<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentV4<'a> {
/// Returns the tournament code DTO associated with a tournament code string.
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getTournamentCode">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `tournamentCode` - The tournament code string.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getTournamentCode" target="_blank">`tournament-v4.getTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_tournament_code(&self, region: Region, tournament_code: &str)
-> impl Future<Output = Result<tournament_v4::TournamentCode>> + 'a
{
@ -813,11 +951,13 @@ impl<'a> TournamentV4<'a> {
}
/// Gets a list of lobby events by tournament code.
///
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getLobbyEventsByCode">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
/// * `tournamentCode` - The short code to look up lobby events for
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getLobbyEventsByCode" target="_blank">`tournament-v4.getLobbyEventsByCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_lobby_events_by_code(&self, region: Region, tournament_code: &str)
-> impl Future<Output = Result<tournament_v4::LobbyEventWrapper>> + 'a
{

View file

@ -9,14 +9,23 @@
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e22fa894666bc6e13ce9daac7c0c9272c1ff3aaa
//! Automatically generated data transfer structs.
//! Data transfer structs.
//!
//! Separated into separate modules for each endpoint.
//! Several modules contain structs with the same name, so be sure to use the right ones.
//!
//! Note: these modules are automatically generated.
/// ChampionMasteryV4 data objects. This module is automatically generated.
/// Data structs used by [`ChampionMasteryV4`](crate::endpoints::ChampionMasteryV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod champion_mastery_v4 {
/// ChampionMastery data object. This struct is automatically generated.
/// ChampionMastery data object.
/// # Description
/// This object contains single Champion Mastery information for player and champion combination.
///
/// Note: This struct is automatically generated
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ChampionMastery {
@ -50,10 +59,12 @@ pub mod champion_mastery_v4 {
}
}
/// ChampionV3 data objects. This module is automatically generated.
/// Data structs used by [`ChampionV3`](crate::endpoints::ChampionV3).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod champion_v3 {
/// ChampionInfo data object. This struct is automatically generated.
/// ChampionInfo data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ChampionInfo {
@ -66,10 +77,12 @@ pub mod champion_v3 {
}
}
/// LeagueExpV4 data objects. This module is automatically generated.
/// Data structs used by [`LeagueExpV4`](crate::endpoints::LeagueExpV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod league_exp_v4 {
/// LeagueEntry data object. This struct is automatically generated.
/// LeagueEntry data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueEntry {
@ -105,7 +118,7 @@ pub mod league_exp_v4 {
#[serde(rename = "leaguePoints")]
pub league_points: i32,
}
/// MiniSeries data object. This struct is automatically generated.
/// MiniSeries data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MiniSeries {
@ -120,10 +133,12 @@ pub mod league_exp_v4 {
}
}
/// LeagueV4 data objects. This module is automatically generated.
/// Data structs used by [`LeagueV4`](crate::endpoints::LeagueV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod league_v4 {
/// LeagueList data object. This struct is automatically generated.
/// LeagueList data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueList {
@ -138,7 +153,7 @@ pub mod league_v4 {
#[serde(rename = "name")]
pub name: String,
}
/// LeagueItem data object. This struct is automatically generated.
/// LeagueItem data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueItem {
@ -168,7 +183,7 @@ pub mod league_v4 {
#[serde(rename = "leaguePoints")]
pub league_points: i32,
}
/// MiniSeries data object. This struct is automatically generated.
/// MiniSeries data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MiniSeries {
@ -181,7 +196,7 @@ pub mod league_v4 {
#[serde(rename = "wins")]
pub wins: i32,
}
/// LeagueEntry data object. This struct is automatically generated.
/// LeagueEntry data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueEntry {
@ -219,10 +234,12 @@ pub mod league_v4 {
}
}
/// LolStatusV3 data objects. This module is automatically generated.
/// Data structs used by [`LolStatusV3`](crate::endpoints::LolStatusV3).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod lol_status_v3 {
/// ShardStatus data object. This struct is automatically generated.
/// ShardStatus data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ShardStatus {
@ -239,7 +256,7 @@ pub mod lol_status_v3 {
#[serde(rename = "locales")]
pub locales: std::vec::Vec<String>,
}
/// Service data object. This struct is automatically generated.
/// Service data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Service {
@ -252,7 +269,7 @@ pub mod lol_status_v3 {
#[serde(rename = "slug")]
pub slug: String,
}
/// Incident data object. This struct is automatically generated.
/// Incident data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Incident {
@ -265,7 +282,7 @@ pub mod lol_status_v3 {
#[serde(rename = "updates")]
pub updates: std::vec::Vec<Message>,
}
/// Message data object. This struct is automatically generated.
/// Message data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Message {
@ -284,7 +301,7 @@ pub mod lol_status_v3 {
#[serde(rename = "id")]
pub id: String,
}
/// Translation data object. This struct is automatically generated.
/// Translation data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Translation {
@ -297,10 +314,12 @@ pub mod lol_status_v3 {
}
}
/// LorRankedV1 data objects. This module is automatically generated.
/// Data structs used by [`LorRankedV1`](crate::endpoints::LorRankedV1).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod lor_ranked_v1 {
/// Leaderboard data object. This struct is automatically generated.
/// Leaderboard data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Leaderboard {
@ -308,7 +327,7 @@ pub mod lor_ranked_v1 {
#[serde(rename = "players")]
pub players: std::vec::Vec<Player>,
}
/// Player data object. This struct is automatically generated.
/// Player data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Player {
@ -319,10 +338,12 @@ pub mod lor_ranked_v1 {
}
}
/// MatchV4 data objects. This module is automatically generated.
/// Data structs used by [`MatchV4`](crate::endpoints::MatchV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod match_v4 {
/// Match data object. This struct is automatically generated.
/// Match data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Match {
@ -365,7 +386,7 @@ pub mod match_v4 {
#[serde(rename = "gameCreation")]
pub game_creation: i64,
}
/// ParticipantIdentity data object. This struct is automatically generated.
/// ParticipantIdentity data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ParticipantIdentity {
@ -375,7 +396,7 @@ pub mod match_v4 {
#[serde(rename = "participantId")]
pub participant_id: i32,
}
/// Player data object. This struct is automatically generated.
/// Player data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Player {
@ -400,7 +421,7 @@ pub mod match_v4 {
#[serde(rename = "accountId")]
pub account_id: String,
}
/// TeamStats data object. This struct is automatically generated.
/// TeamStats data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TeamStats {
@ -454,7 +475,7 @@ pub mod match_v4 {
#[serde(rename = "dragonKills")]
pub dragon_kills: i32,
}
/// TeamBans data object. This struct is automatically generated.
/// TeamBans data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TeamBans {
@ -465,7 +486,7 @@ pub mod match_v4 {
#[serde(rename = "championId")]
pub champion_id: crate::consts::Champion,
}
/// Participant data object. This struct is automatically generated.
/// Participant data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Participant {
@ -499,7 +520,7 @@ pub mod match_v4 {
#[serde(rename = "championId")]
pub champion_id: crate::consts::Champion,
}
/// ParticipantStats data object. This struct is automatically generated.
/// ParticipantStats data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ParticipantStats {
@ -746,7 +767,7 @@ pub mod match_v4 {
#[serde(rename = "timeCCingOthers")]
pub time_c_cing_others: i64,
}
/// Rune data object. This struct is automatically generated.
/// Rune data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Rune {
@ -755,7 +776,7 @@ pub mod match_v4 {
#[serde(rename = "rank")]
pub rank: i32,
}
/// ParticipantTimeline data object. This struct is automatically generated.
/// ParticipantTimeline data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ParticipantTimeline {
@ -791,7 +812,7 @@ pub mod match_v4 {
#[serde(rename = "damageTakenPerMinDeltas")]
pub damage_taken_per_min_deltas: Option<std::collections::HashMap<String, f64>>,
}
/// Mastery data object. This struct is automatically generated.
/// Mastery data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Mastery {
@ -800,7 +821,7 @@ pub mod match_v4 {
#[serde(rename = "rank")]
pub rank: i32,
}
/// Matchlist data object. This struct is automatically generated.
/// Matchlist data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Matchlist {
@ -813,7 +834,7 @@ pub mod match_v4 {
#[serde(rename = "endIndex")]
pub end_index: i32,
}
/// MatchReference data object. This struct is automatically generated.
/// MatchReference data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MatchReference {
@ -834,7 +855,7 @@ pub mod match_v4 {
#[serde(rename = "timestamp")]
pub timestamp: i64,
}
/// MatchTimeline data object. This struct is automatically generated.
/// MatchTimeline data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MatchTimeline {
@ -843,7 +864,7 @@ pub mod match_v4 {
#[serde(rename = "frameInterval")]
pub frame_interval: i64,
}
/// MatchFrame data object. This struct is automatically generated.
/// MatchFrame data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MatchFrame {
@ -854,7 +875,7 @@ pub mod match_v4 {
#[serde(rename = "events")]
pub events: std::vec::Vec<MatchEvent>,
}
/// MatchParticipantFrame data object. This struct is automatically generated.
/// MatchParticipantFrame data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MatchParticipantFrame {
@ -879,7 +900,7 @@ pub mod match_v4 {
#[serde(rename = "jungleMinionsKilled")]
pub jungle_minions_killed: i32,
}
/// MatchPosition data object. This struct is automatically generated.
/// MatchPosition data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MatchPosition {
@ -888,7 +909,7 @@ pub mod match_v4 {
#[serde(rename = "x")]
pub x: i32,
}
/// MatchEvent data object. This struct is automatically generated.
/// MatchEvent data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MatchEvent {
@ -942,10 +963,12 @@ pub mod match_v4 {
}
}
/// SpectatorV4 data objects. This module is automatically generated.
/// Data structs used by [`SpectatorV4`](crate::endpoints::SpectatorV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod spectator_v4 {
/// CurrentGameInfo data object. This struct is automatically generated.
/// CurrentGameInfo data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct CurrentGameInfo {
@ -983,7 +1006,7 @@ pub mod spectator_v4 {
#[serde(rename = "gameQueueConfigId")]
pub game_queue_config_id: Option<crate::consts::Queue>,
}
/// BannedChampion data object. This struct is automatically generated.
/// BannedChampion data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct BannedChampion {
@ -997,7 +1020,7 @@ pub mod spectator_v4 {
#[serde(rename = "teamId")]
pub team_id: crate::consts::Team,
}
/// Observer data object. This struct is automatically generated.
/// Observer data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Observer {
@ -1005,7 +1028,7 @@ pub mod spectator_v4 {
#[serde(rename = "encryptionKey")]
pub encryption_key: String,
}
/// CurrentGameParticipant data object. This struct is automatically generated.
/// CurrentGameParticipant data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct CurrentGameParticipant {
@ -1040,7 +1063,7 @@ pub mod spectator_v4 {
#[serde(rename = "summonerId")]
pub summoner_id: String,
}
/// GameCustomizationObject data object. This struct is automatically generated.
/// GameCustomizationObject data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct GameCustomizationObject {
@ -1051,7 +1074,7 @@ pub mod spectator_v4 {
#[serde(rename = "content")]
pub content: String,
}
/// Perks data object. This struct is automatically generated.
/// Perks data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Perks {
@ -1065,7 +1088,7 @@ pub mod spectator_v4 {
#[serde(rename = "perkSubStyle")]
pub perk_sub_style: i64,
}
/// FeaturedGames data object. This struct is automatically generated.
/// FeaturedGames data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct FeaturedGames {
@ -1076,7 +1099,7 @@ pub mod spectator_v4 {
#[serde(rename = "gameList")]
pub game_list: std::vec::Vec<FeaturedGameInfo>,
}
/// FeaturedGameInfo data object. This struct is automatically generated.
/// FeaturedGameInfo data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct FeaturedGameInfo {
@ -1116,7 +1139,7 @@ pub mod spectator_v4 {
#[serde(rename = "gameQueueConfigId")]
pub game_queue_config_id: crate::consts::Queue,
}
/// Participant data object. This struct is automatically generated.
/// Participant data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Participant {
@ -1144,12 +1167,16 @@ pub mod spectator_v4 {
}
}
/// SummonerV4 data objects. This module is automatically generated.
/// Data structs used by [`SummonerV4`](crate::endpoints::SummonerV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod summoner_v4 {
/// Summoner data object. This struct is automatically generated.
/// Summoner data object.
/// # Description
/// represents a summoner
///
/// Note: This struct is automatically generated
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Summoner {
@ -1177,10 +1204,12 @@ pub mod summoner_v4 {
}
}
/// TftLeagueV1 data objects. This module is automatically generated.
/// Data structs used by [`TftLeagueV1`](crate::endpoints::TftLeagueV1).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tft_league_v1 {
/// LeagueList data object. This struct is automatically generated.
/// LeagueList data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueList {
@ -1195,7 +1224,7 @@ pub mod tft_league_v1 {
#[serde(rename = "name")]
pub name: String,
}
/// LeagueItem data object. This struct is automatically generated.
/// LeagueItem data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueItem {
@ -1225,7 +1254,7 @@ pub mod tft_league_v1 {
#[serde(rename = "leaguePoints")]
pub league_points: i32,
}
/// MiniSeries data object. This struct is automatically generated.
/// MiniSeries data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MiniSeries {
@ -1238,7 +1267,7 @@ pub mod tft_league_v1 {
#[serde(rename = "wins")]
pub wins: i32,
}
/// LeagueEntry data object. This struct is automatically generated.
/// LeagueEntry data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LeagueEntry {
@ -1276,10 +1305,12 @@ pub mod tft_league_v1 {
}
}
/// TftMatchV1 data objects. This module is automatically generated.
/// Data structs used by [`TftMatchV1`](crate::endpoints::TftMatchV1).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tft_match_v1 {
/// Match data object. This struct is automatically generated.
/// Match data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Match {
@ -1290,7 +1321,7 @@ pub mod tft_match_v1 {
#[serde(rename = "metadata")]
pub metadata: Metadata,
}
/// Info data object. This struct is automatically generated.
/// Info data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Info {
@ -1313,7 +1344,7 @@ pub mod tft_match_v1 {
#[serde(rename = "game_version")]
pub game_version: String,
}
/// Participant data object. This struct is automatically generated.
/// Participant data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Participant {
@ -1351,7 +1382,7 @@ pub mod tft_match_v1 {
#[serde(rename = "gold_left")]
pub gold_left: i32,
}
/// Trait data object. This struct is automatically generated.
/// Trait data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Trait {
@ -1368,7 +1399,7 @@ pub mod tft_match_v1 {
#[serde(rename = "num_units")]
pub num_units: i32,
}
/// Unit data object. This struct is automatically generated.
/// Unit data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Unit {
@ -1388,7 +1419,7 @@ pub mod tft_match_v1 {
#[serde(rename = "rarity")]
pub rarity: i32,
}
/// Metadata data object. This struct is automatically generated.
/// Metadata data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Metadata {
@ -1402,7 +1433,7 @@ pub mod tft_match_v1 {
#[serde(rename = "match_id")]
pub match_id: String,
}
/// Companion data object. This struct is automatically generated.
/// Companion data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Companion {
@ -1415,12 +1446,16 @@ pub mod tft_match_v1 {
}
}
/// TftSummonerV1 data objects. This module is automatically generated.
/// Data structs used by [`TftSummonerV1`](crate::endpoints::TftSummonerV1).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tft_summoner_v1 {
/// Summoner data object. This struct is automatically generated.
/// Summoner data object.
/// # Description
/// represents a summoner
///
/// Note: This struct is automatically generated
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Summoner {
@ -1448,10 +1483,12 @@ pub mod tft_summoner_v1 {
}
}
/// TournamentStubV4 data objects. This module is automatically generated.
/// Data structs used by [`TournamentStubV4`](crate::endpoints::TournamentStubV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_stub_v4 {
/// TournamentCodeParameters data object. This struct is automatically generated.
/// TournamentCodeParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TournamentCodeParameters {
@ -1477,14 +1514,14 @@ pub mod tournament_stub_v4 {
#[serde(rename = "metadata")]
pub metadata: Option<String>,
}
/// LobbyEventWrapper data object. This struct is automatically generated.
/// LobbyEventWrapper data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LobbyEventWrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEvent>,
}
/// LobbyEvent data object. This struct is automatically generated.
/// LobbyEvent data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LobbyEvent {
@ -1498,7 +1535,7 @@ pub mod tournament_stub_v4 {
#[serde(rename = "timestamp")]
pub timestamp: String,
}
/// ProviderRegistrationParameters data object. This struct is automatically generated.
/// ProviderRegistrationParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ProviderRegistrationParameters {
@ -1510,7 +1547,7 @@ pub mod tournament_stub_v4 {
#[serde(rename = "region")]
pub region: String,
}
/// TournamentRegistrationParameters data object. This struct is automatically generated.
/// TournamentRegistrationParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TournamentRegistrationParameters {
@ -1523,10 +1560,12 @@ pub mod tournament_stub_v4 {
}
}
/// TournamentV4 data objects. This module is automatically generated.
/// Data structs used by [`TournamentV4`](crate::endpoints::TournamentV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_v4 {
/// TournamentCodeParameters data object. This struct is automatically generated.
/// TournamentCodeParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TournamentCodeParameters {
@ -1552,7 +1591,7 @@ pub mod tournament_v4 {
#[serde(rename = "metadata")]
pub metadata: Option<String>,
}
/// TournamentCode data object. This struct is automatically generated.
/// TournamentCode data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TournamentCode {
@ -1597,7 +1636,7 @@ pub mod tournament_v4 {
#[serde(rename = "metaData")]
pub meta_data: String,
}
/// TournamentCodeUpdateParameters data object. This struct is automatically generated.
/// TournamentCodeUpdateParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TournamentCodeUpdateParameters {
@ -1617,14 +1656,14 @@ pub mod tournament_v4 {
#[serde(rename = "mapType")]
pub map_type: String,
}
/// LobbyEventWrapper data object. This struct is automatically generated.
/// LobbyEventWrapper data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LobbyEventWrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEvent>,
}
/// LobbyEvent data object. This struct is automatically generated.
/// LobbyEvent data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct LobbyEvent {
@ -1638,7 +1677,7 @@ pub mod tournament_v4 {
#[serde(rename = "eventType")]
pub event_type: String,
}
/// ProviderRegistrationParameters data object. This struct is automatically generated.
/// ProviderRegistrationParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ProviderRegistrationParameters {
@ -1650,7 +1689,7 @@ pub mod tournament_v4 {
#[serde(rename = "region")]
pub region: String,
}
/// TournamentRegistrationParameters data object. This struct is automatically generated.
/// TournamentRegistrationParameters data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TournamentRegistrationParameters {

View file

@ -11,15 +11,29 @@ use crate::util::InsertOnlyCHashMap;
/// For retrieving data from the Riot Games API.
///
/// # Usage
///
/// Construct an instance using [`with_key(api_key)`](RiotApi::with_key) or
/// [`with_config(config)`](RiotApi::with_config).
///
/// An instance provides access to "endpoint handles" which in turn provide access
/// to individual API method calls. For example, getting a summoner by name:
/// ```ignore
/// riot_api.summoner_v4().get_by_summoner_name(Region::NA, "LugnutsK")
/// ```
///
/// # Rate Limiting
///
/// The Riot Game API enforces _dynamic_ rate limiting, meaning that rate limits are
/// specified in response headers and (hypothetically) could change at any time.
/// specified in response headers and (theoretically) could change at any time.
/// Riven keeps track of changing rate limits seamlessly, preventing you from
/// getting blacklisted.
///
/// Riven's rate limiting is highly efficient, meaning that it can reach the limits
/// of your rate limit without going over.
///
/// To adjust rate limiting, see [RiotApiConfig](crate::RiotApiConfig) and use
/// [`with_config(config)`](RiotApi::with_config) to construct an instance.
pub struct RiotApi {
/// Configuration settings.
config: RiotApiConfig,
@ -31,6 +45,7 @@ pub struct RiotApi {
}
impl RiotApi {
/// Constructs a new instance from the given [RiotApiConfig](crate::RiotApiConfig), consuming it.
pub fn with_config(mut config: RiotApiConfig) -> Self {
let client_builder = config.client_builder.take()
.expect("!NONE CLIENT_BUILDER IN CONFIG.");
@ -41,10 +56,24 @@ impl RiotApi {
}
}
/// Constructs a new instance from the given API key, using default configuration.
///
/// `api_key` should be a Riot Games API key from
/// [https://developer.riotgames.com/](https://developer.riotgames.com/),
/// and should look like `"RGAPI-01234567-89ab-cdef-0123-456789abcdef"`.
pub fn with_key<T: Into<String>>(api_key: T) -> Self {
Self::with_config(RiotApiConfig::with_key(api_key))
}
/// This method is not meant to be used directly.
///
/// This sends a GET request based on the given parameters and returns an optional parsed result.
///
/// # Parameters
/// * `method_id` - A unique string id representing the endpoint method for per-method rate limiting.
/// * `region_platform` - The stringified platform, prepended to `.api.riotgames.com` to create the hostname.
/// * `path` - The path relative to the hostname.
/// * `query` - An optional query string.
pub fn get_optional<'a, T: serde::de::DeserializeOwned + 'a>(&'a self,
method_id: &'static str, region_platform: &'static str, path: String, query: Option<String>)
-> impl Future<Output = Result<Option<T>>> + 'a
@ -53,6 +82,15 @@ impl RiotApi {
.get_optional(&self.config, &self.client, method_id, region_platform, path, query)
}
/// This method is not meant to be used directly.
///
/// This sends a GET request based on the given parameters and returns a parsed result.
///
/// # Parameters
/// * `method_id` - A unique string id representing the endpoint method for per-method rate limiting.
/// * `region_platform` - The stringified platform, prepended to `.api.riotgames.com` to create the hostname.
/// * `path` - The path relative to the hostname.
/// * `query` - An optional query string.
pub fn get<'a, T: serde::de::DeserializeOwned + 'a>(&'a self,
method_id: &'static str, region_platform: &'static str, path: String, query: Option<String>)
-> impl Future<Output = Result<T>> + 'a
@ -61,6 +99,7 @@ impl RiotApi {
.get(&self.config, &self.client, method_id, region_platform, path, query)
}
/// Get or create the RegionalRequester for the given region.
fn regional_requester(&self, region_platform: &'static str) -> Arc<RegionalRequester> {
self.regional_requesters.get_or_insert_with(region_platform, || {
log::debug!("Creating requester for region platform {}.", region_platform);

View file

@ -16,17 +16,19 @@
use num_enum::{ IntoPrimitive, TryFromPrimitive };
use serde_repr::{ Serialize_repr, Deserialize_repr };
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
use strum_macros::{ EnumString, EnumIter, Display, AsRefStr, IntoStaticStr };
/// League of Legend's champions.
///
/// The documentation of each variant specifies:<br>
/// NAME (`IDENTIFIER`, ID).
///
/// Implements [IntoEnumIterator](super::IntoEnumIterator).
#[cfg_attr(feature = "nightly", non_exhaustive)]
#[derive(Debug, Copy, Clone)]
#[derive(IntoPrimitive, TryFromPrimitive)]
#[derive(Serialize_repr, Deserialize_repr)]
#[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
#[derive(EnumString, EnumIter, Display, AsRefStr, IntoStaticStr)]
#[repr(i16)]
pub enum Champion {
/// A champion that doesn't exist. Used in TeamBans when no champion was banned.

View file

@ -33,9 +33,11 @@ impl RiotApi {
const method = dotUtils.changeCase.snakeCase(endpointName);
const type = dotUtils.changeCase.pascalCase(endpointName);
}}
/// Handle for {{= type }} endpoints. This method is automatically generated.
/// Returns a handle for accessing [{{= type }}](crate::endpoints::{{= type }}) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#{{= endpointName }}" target="_blank">`{{= endpointName }}`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#{{= endpointName }}">Official API Reference</a>
/// Note: this method is automatically generated.
#[inline]
pub fn {{= method }}(&self) -> {{= type }} {
{{= type }} { base: self }
@ -47,11 +49,14 @@ impl RiotApi {
{{
for (let [ endpointName, endpointMethods ] of Object.entries(endpointGroups)) {
let endpoint = dotUtils.changeCase.pascalCase(endpointName);
const endpoint_snake_case = dotUtils.changeCase.snakeCase(endpointName);
}}
/// {{= endpoint }} endpoints. This struct is automatically generated.
/// {{= endpoint }} endpoints handle, accessed by calling [`{{= endpoint_snake_case }}()`](crate::RiotApi::{{= endpoint_snake_case }}) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#{{= endpointName }}" target="_blank">`{{= endpointName }}`</a>
///
/// <a href="https://developer.riotgames.com/api-methods/#{{= endpointName }}">Official API Reference</a>
/// Note: this struct is automatically generated.
pub struct {{= endpoint }}<'a> {
base: &'a RiotApi,
}
@ -118,8 +123,6 @@ impl<'a> {{= endpoint }}<'a> {
{{
}
}}
///
/// <a href="{{= get.externalDocs.url }}">{{= get.externalDocs.description }}</a>
/// # Parameters
/// * `region` - Region to query.
{{
@ -133,6 +136,10 @@ impl<'a> {{= endpoint }}<'a> {
}
}
}}
/// # Riot Developer API Reference
/// <a href="{{= get.externalDocs.url }}" target="_blank">`{{= operationId }}`</a>
///
/// Note: this method is automatically generated.
pub fn {{= method }}(&self, region: Region{{= argBuilder.join('') }})
-> impl Future<Output = Result<{{= returnType }}>> + 'a
{

View file

@ -6,7 +6,12 @@
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version {{= spec.info.version }}
//! Automatically generated data transfer structs.
//! Data transfer structs.
//!
//! Separated into separate modules for each endpoint.
//! Several modules contain structs with the same name, so be sure to use the right ones.
//!
//! Note: these modules are automatically generated.
{{
let schemas = spec.components.schemas;
@ -15,8 +20,11 @@
.groupBy(schemaKey => schemaKey.split('.')[0]);
for (let [endpoint, schemaKeyGroup] of schemaKeyByEndpoint) {
const endpoint_pascal_case = dotUtils.changeCase.pascalCase(endpoint);
}}
/// {{= dotUtils.changeCase.pascalCase(endpoint) }} data objects. This module is automatically generated.
/// Data structs used by [`{{= endpoint_pascal_case }}`](crate::endpoints::{{= endpoint_pascal_case }}).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod {{= dotUtils.changeCase.snakeCase(endpoint) }} {
{{
@ -27,10 +35,12 @@ pub mod {{= dotUtils.changeCase.snakeCase(endpoint) }} {
const props = schema.properties;
const requiredSet = new Set(schema.required);
}}
/// {{= schemaName }} data object. This struct is automatically generated.
/// {{= schemaName }} data object.
{{? schema.description }}
/// # Description
/// {{= schema.description }}
///
/// Note: This struct is automatically generated
{{?}}
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]