forked from mirror/Riven
1
0
Fork 0

Compare commits

..

1 Commits

Author SHA1 Message Date
Mingwei Samuel c4a19bd781 add test 2023-07-24 11:33:33 -07:00
50 changed files with 513 additions and 861 deletions

View File

@ -84,7 +84,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast --features nightly,deny-unknown
args: --features nightly,deny-unknown
env:
RUST_BACKTRACE: 1
RUSTLOG: riven=trace

11
.vscode/settings.json vendored
View File

@ -1,11 +0,0 @@
{
"rust-analyzer.runnableEnv": [
{
// Set output levels for `tracing` logging.
"env": {
"RUST_BACKTRACE": "1",
"RUST_LOG": "riven=debug"
}
}
]
}

View File

@ -1,4 +1,5 @@
[workspace]
members = [
"riven",
"example/proxy",
]

View File

@ -45,7 +45,7 @@ rt.block_on(async {
// Get champion mastery data.
let masteries = riot_api.champion_mastery_v4()
.get_all_champion_masteries_by_puuid(PlatformRoute::NA1, &summoner.puuid).await
.get_all_champion_masteries(PlatformRoute::NA1, &summoner.id).await
.expect("Get champion masteries failed.");
// Print champion masteries.
@ -72,7 +72,7 @@ Output:
```
The [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html)
contains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests)
and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/examples/proxy)
and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/example/proxy)
provide more example usage.
## Feature Flags

14
example/proxy/Cargo.toml Normal file
View File

@ -0,0 +1,14 @@
[package]
publish = false
name = "riven_example_proxy"
version = "0.0.0"
authors = [ "Mingwei Samuel <mingwei.samuel@gmail.com>" ]
edition = "2018"
[dependencies]
hyper = { version = "0.14", features = [ "server" ] }
lazy_static = "1.4"
riven = { path = "../../riven" }
tokio = { version = "1.0", features = [ "full" ] }
tracing = "0.1"
tracing-subscriber = "0.2"

View File

@ -14,7 +14,7 @@ when Riven is at the rate limit.
Set `RGAPI_KEY` env var then run:
```bash
export RGAPI_KEY=RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
cargo run --example proxy
cargo run
```
Test in your browser or using `curl`. The first path segment specifies the region:
@ -25,8 +25,8 @@ $ curl http://localhost:3000/na1/lol/summoner/v4/summoners/by-name/LugnutsK
$ curl http://localhost:3000/eu/val/status/v1/platform-data
{"id": "EU", "name": "Europe", "locales": ["..."], "maintenances": [], "incidents": []}
$ curl http://localhost:3000/americas/lol/tournament-stub/v5/providers -H "Content-Type: application/json" -d '{"region":"JP","url":"https://github.com/MingweiSamuel/Riven"}'
1
$ curl http://localhost:3000/americas/lol/tournament-stub/v4/providers -H "Content-Type: application/json" -d '{"region":"JP","url":"https://github.com/MingweiSamuel/Riven"}'
764
$ curl http://localhost:3000/na1/unknown/endpoint
{"error":"Riot API endpoint method not found."}

View File

@ -4,12 +4,14 @@ use std::convert::Infallible;
use http::{Method, Request, Response, StatusCode};
use hyper::header::HeaderValue;
use hyper::http;
use hyper::service::{make_service_fn, service_fn};
use hyper::{http, Body, Server};
use hyper::{Body, Server};
use lazy_static::lazy_static;
use tracing as log;
use riven::consts::Route;
use riven::{RiotApi, RiotApiConfig};
use tracing as log;
lazy_static! {
/// Create lazy static RiotApi instance.

View File

@ -1,6 +1,6 @@
[package]
name = "riven"
version = "2.32.0"
version = "2.23.0"
authors = ["Mingwei Samuel <mingwei.samuel@gmail.com>"]
repository = "https://github.com/MingweiSamuel/Riven"
description = "Riot Games API Library"
@ -58,7 +58,4 @@ colored = "2"
env_logger = "0.10.0"
fake_instant = "0.5.0"
futures = "0.3"
hyper = { version = "0.14", features = [ "server" ] }
tokio = { version = "1", features = [ "full" ] }
tracing = "0.1"
tracing-subscriber = "0.2"
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread" ] }

View File

@ -5,6 +5,8 @@ use reqwest::header::{HeaderMap, HeaderValue};
use reqwest::ClientBuilder;
/// Configuration for instantiating RiotApi.
///
///
#[derive(Debug)]
pub struct RiotApiConfig {
pub(crate) base_url: String,

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -34,7 +33,6 @@ newtype_enum! {
/// `BLITZCRANK` | "Blitzcrank" | "Blitzcrank" | 53
/// `BRAND` | "Brand" | "Brand" | 63
/// `BRAUM` | "Braum" | "Braum" | 201
/// `BRIAR` | "Briar" | "Briar" | 233
/// `CAITLYN` | "Caitlyn" | "Caitlyn" | 51
/// `CAMILLE` | "Camille" | "Camille" | 164
/// `CASSIOPEIA` | "Cassiopeia" | "Cassiopeia" | 69
@ -60,7 +58,6 @@ newtype_enum! {
/// `GWEN` | "Gwen" | "Gwen" | 887
/// `HECARIM` | "Hecarim" | "Hecarim" | 120
/// `HEIMERDINGER` | "Heimerdinger" | "Heimerdinger" | 74
/// `HWEI` | "Hwei" | "Hwei" | 910
/// `ILLAOI` | "Illaoi" | "Illaoi" | 420
/// `IRELIA` | "Irelia" | "Irelia" | 39
/// `IVERN` | "Ivern" | "Ivern" | 427
@ -139,7 +136,6 @@ newtype_enum! {
/// `SION` | "Sion" | "Sion" | 14
/// `SIVIR` | "Sivir" | "Sivir" | 15
/// `SKARNER` | "Skarner" | "Skarner" | 72
/// `SMOLDER` | "Smolder" | "Smolder" | 901
/// `SONA` | "Sona" | "Sona" | 37
/// `SORAKA` | "Soraka" | "Soraka" | 16
/// `SWAIN` | "Swain" | "Swain" | 50
@ -222,8 +218,6 @@ newtype_enum! {
BRAND = 63,
/// `201`.
BRAUM = 201,
/// `233`.
BRIAR = 233,
/// `51`.
CAITLYN = 51,
/// `164`.
@ -274,8 +268,6 @@ newtype_enum! {
HECARIM = 120,
/// `74`.
HEIMERDINGER = 74,
/// `910`.
HWEI = 910,
/// `420`.
ILLAOI = 420,
/// `39`.
@ -432,8 +424,6 @@ newtype_enum! {
SIVIR = 15,
/// `72`.
SKARNER = 72,
/// `901`.
SMOLDER = 901,
/// `37`.
SONA = 37,
/// `16`.
@ -546,7 +536,6 @@ impl Champion {
Self::BLITZCRANK => Some("Blitzcrank"),
Self::BRAND => Some("Brand"),
Self::BRAUM => Some("Braum"),
Self::BRIAR => Some("Briar"),
Self::CAITLYN => Some("Caitlyn"),
Self::CAMILLE => Some("Camille"),
Self::CASSIOPEIA => Some("Cassiopeia"),
@ -572,7 +561,6 @@ impl Champion {
Self::GWEN => Some("Gwen"),
Self::HECARIM => Some("Hecarim"),
Self::HEIMERDINGER => Some("Heimerdinger"),
Self::HWEI => Some("Hwei"),
Self::ILLAOI => Some("Illaoi"),
Self::IRELIA => Some("Irelia"),
Self::IVERN => Some("Ivern"),
@ -651,7 +639,6 @@ impl Champion {
Self::SION => Some("Sion"),
Self::SIVIR => Some("Sivir"),
Self::SKARNER => Some("Skarner"),
Self::SMOLDER => Some("Smolder"),
Self::SONA => Some("Sona"),
Self::SORAKA => Some("Soraka"),
Self::SWAIN => Some("Swain"),
@ -737,7 +724,6 @@ impl Champion {
Self::BLITZCRANK => Some("Blitzcrank"),
Self::BRAND => Some("Brand"),
Self::BRAUM => Some("Braum"),
Self::BRIAR => Some("Briar"),
Self::CAITLYN => Some("Caitlyn"),
Self::CAMILLE => Some("Camille"),
Self::CASSIOPEIA => Some("Cassiopeia"),
@ -763,7 +749,6 @@ impl Champion {
Self::GWEN => Some("Gwen"),
Self::HECARIM => Some("Hecarim"),
Self::HEIMERDINGER => Some("Heimerdinger"),
Self::HWEI => Some("Hwei"),
Self::ILLAOI => Some("Illaoi"),
Self::IRELIA => Some("Irelia"),
Self::IVERN => Some("Ivern"),
@ -842,7 +827,6 @@ impl Champion {
Self::SION => Some("Sion"),
Self::SIVIR => Some("Sivir"),
Self::SKARNER => Some("Skarner"),
Self::SMOLDER => Some("Smolder"),
Self::SONA => Some("Sona"),
Self::SORAKA => Some("Soraka"),
Self::SWAIN => Some("Swain"),
@ -959,7 +943,6 @@ impl std::str::FromStr for Champion {
/* BLIT */ [ 'B', 'L', 'I', 'T'] => Ok(Champion::BLITZCRANK),
/* BRAN */ [ 'B', 'R', 'A', 'N'] => Ok(Champion::BRAND),
/* BRAU */ [ 'B', 'R', 'A', 'U'] => Ok(Champion::BRAUM),
/* BRIA */ [ 'B', 'R', 'I', 'A'] => Ok(Champion::BRIAR),
/* CAIT */ [ 'C', 'A', 'I', 'T'] => Ok(Champion::CAITLYN),
/* CAMI */ [ 'C', 'A', 'M', 'I'] => Ok(Champion::CAMILLE),
/* CASS */ [ 'C', 'A', 'S', 'S'] => Ok(Champion::CASSIOPEIA),
@ -987,7 +970,6 @@ impl std::str::FromStr for Champion {
/* GWEN */ [ 'G', 'W', 'E', 'N'] => Ok(Champion::GWEN),
/* HECA */ [ 'H', 'E', 'C', 'A'] => Ok(Champion::HECARIM),
/* HEIM */ [ 'H', 'E', 'I', 'M'] => Ok(Champion::HEIMERDINGER),
/* HWEI */ [ 'H', 'W', 'E', 'I'] => Ok(Champion::HWEI),
/* ILLA */ [ 'I', 'L', 'L', 'A'] => Ok(Champion::ILLAOI),
/* IREL */ [ 'I', 'R', 'E', 'L'] => Ok(Champion::IRELIA),
/* IVER */ [ 'I', 'V', 'E', 'R'] => Ok(Champion::IVERN),
@ -1072,7 +1054,6 @@ impl std::str::FromStr for Champion {
/* SION */ [ 'S', 'I', 'O', 'N'] => Ok(Champion::SION),
/* SIVI */ [ 'S', 'I', 'V', 'I'] => Ok(Champion::SIVIR),
/* SKAR */ [ 'S', 'K', 'A', 'R'] => Ok(Champion::SKARNER),
/* SMOL */ [ 'S', 'M', 'O', 'L'] => Ok(Champion::SMOLDER),
/* SONA */ [ 'S', 'O', 'N', 'A'] => Ok(Champion::SONA),
/* SORA */ [ 'S', 'O', 'R', 'A'] => Ok(Champion::SORAKA),
/* SWAI */ [ 'S', 'W', 'A', 'I'] => Ok(Champion::SWAIN),

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -59,8 +58,6 @@ pub enum GameMode {
SIEGE,
/// Star Guardian Invasion games
STARGUARDIAN,
/// Teamfight Tactics, used in `spectator-v4` endpoints.
TFT,
/// Tutorial games
TUTORIAL,
/// Tutorial: Welcome to League.

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -18,18 +17,9 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
#[repr(u8)]
pub enum GameType {
/// Custom games
#[strum(to_string = "CUSTOM_GAME", serialize = "CUSTOM")]
#[serde(alias = "CUSTOM")]
CUSTOM_GAME,
/// all other games
#[strum(to_string = "MATCHED_GAME", serialize = "MATCHED")]
#[serde(alias = "MATCHED")]
MATCHED_GAME,
/// Tutorial games
#[strum(to_string = "TUTORIAL_GAME", serialize = "TUTORIAL")]
#[serde(alias = "TUTORIAL")]
TUTORIAL_GAME,
}
#[cfg(test)]
mod test;

View File

@ -1,24 +0,0 @@
use super::*;
#[test]
fn check_as_ref() {
assert_eq!("MATCHED_GAME", GameType::MATCHED_GAME.as_ref());
}
#[test]
fn check_to_string() {
assert_eq!("MATCHED_GAME", GameType::MATCHED_GAME.to_string());
}
#[test]
fn check_from_string() {
assert_eq!(Ok(GameType::MATCHED_GAME), "MATCHED_GAME".parse());
assert_eq!(Ok(GameType::MATCHED_GAME), "MATCHED".parse());
}
#[test]
fn check_serialize() {
assert_eq!(Some("\"MATCHED_GAME\""),
serde_json::to_string(&GameType::MATCHED_GAME)
.ok().as_deref());
}

View File

@ -7,7 +7,7 @@
///
/// Also implements `AsRef<str>`, `Display`, and `From<&str>`.
macro_rules! serde_strum_unknown {
($name:ident) => {
( $name:ident ) => {
impl AsRef<str> for $name {
fn as_ref(&self) -> &str {
match self {

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //

View File

@ -47,8 +47,11 @@ pub use route_ext::*;
#[rustfmt::skip]
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;

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -15,121 +14,101 @@ newtype_enum! {
CUSTOM = 0,
/// `2`.
/// 5v5 Blind Pick games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 430
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 430")]
SUMMONERS_RIFT_5V5_BLIND_PICK_DEPRECATED_2 = 2,
/// `4`.
/// 5v5 Ranked Solo games on Summoner's Rift
///
/// Deprecated in favor of queueId 420
#[deprecated(note="Deprecated in favor of queueId 420")]
SUMMONERS_RIFT_5V5_RANKED_SOLO_DEPRECATED_4 = 4,
/// `6`.
/// 5v5 Ranked Premade games on Summoner's Rift
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
SUMMONERS_RIFT_5V5_RANKED_PREMADE = 6,
/// `7`.
/// Co-op vs AI games on Summoner's Rift
///
/// Deprecated in favor of queueId 32 and 33
#[deprecated(note="Deprecated in favor of queueId 32 and 33")]
SUMMONERS_RIFT_CO_OP_VS_AI = 7,
/// `8`.
/// 3v3 Normal games on Twisted Treeline
///
/// Deprecated in patch 7.19 in favor of queueId 460
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 460")]
TWISTED_TREELINE_3V3_NORMAL = 8,
/// `9`.
/// 3v3 Ranked Flex games on Twisted Treeline
///
/// Deprecated in patch 7.19 in favor of queueId 470
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 470")]
TWISTED_TREELINE_3V3_RANKED_FLEX_DEPRECATED_9 = 9,
/// `14`.
/// 5v5 Draft Pick games on Summoner's Rift
///
/// Deprecated in favor of queueId 400
#[deprecated(note="Deprecated in favor of queueId 400")]
SUMMONERS_RIFT_5V5_DRAFT_PICK_DEPRECATED_14 = 14,
/// `16`.
/// 5v5 Dominion Blind Pick games on Crystal Scar
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
CRYSTAL_SCAR_5V5_DOMINION_BLIND_PICK = 16,
/// `17`.
/// 5v5 Dominion Draft Pick games on Crystal Scar
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
CRYSTAL_SCAR_5V5_DOMINION_DRAFT_PICK = 17,
/// `25`.
/// Dominion Co-op vs AI games on Crystal Scar
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
CRYSTAL_SCAR_DOMINION_CO_OP_VS_AI = 25,
/// `31`.
/// Co-op vs AI Intro Bot games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 830
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 830")]
SUMMONERS_RIFT_CO_OP_VS_AI_INTRO_BOT_DEPRECATED_31 = 31,
/// `32`.
/// Co-op vs AI Beginner Bot games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 840
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 840")]
SUMMONERS_RIFT_CO_OP_VS_AI_BEGINNER_BOT_DEPRECATED_32 = 32,
/// `33`.
/// Co-op vs AI Intermediate Bot games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 850
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 850")]
SUMMONERS_RIFT_CO_OP_VS_AI_INTERMEDIATE_BOT_DEPRECATED_33 = 33,
/// `41`.
/// 3v3 Ranked Team games on Twisted Treeline
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
TWISTED_TREELINE_3V3_RANKED_TEAM = 41,
/// `42`.
/// 5v5 Ranked Team games on Summoner's Rift
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
SUMMONERS_RIFT_5V5_RANKED_TEAM = 42,
/// `52`.
/// Co-op vs AI games on Twisted Treeline
///
/// Deprecated in patch 7.19 in favor of queueId 800
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 800")]
TWISTED_TREELINE_CO_OP_VS_AI = 52,
/// `61`.
/// 5v5 Team Builder games on Summoner's Rift
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
SUMMONERS_RIFT_5V5_TEAM_BUILDER = 61,
/// `65`.
/// 5v5 ARAM games on Howling Abyss
///
/// Deprecated in patch 7.19 in favor of queueId 450
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 450")]
HOWLING_ABYSS_5V5_ARAM_DEPRECATED_65 = 65,
/// `67`.
/// ARAM Co-op vs AI games on Howling Abyss
///
/// Game mode deprecated
#[deprecated(note="Game mode deprecated")]
HOWLING_ABYSS_ARAM_CO_OP_VS_AI = 67,
/// `70`.
/// One for All games on Summoner's Rift
///
/// Deprecated in patch 8.6 in favor of queueId 1020
#[deprecated(note="Deprecated in patch 8.6 in favor of queueId 1020")]
SUMMONERS_RIFT_ONE_FOR_ALL_DEPRECATED_70 = 70,
@ -153,25 +132,21 @@ newtype_enum! {
SUMMONERS_RIFT_CO_OP_VS_AI_ULTRA_RAPID_FIRE = 83,
/// `91`.
/// Doom Bots Rank 1 games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 950
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 950")]
SUMMONERS_RIFT_DOOM_BOTS_RANK_1 = 91,
/// `92`.
/// Doom Bots Rank 2 games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 950
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 950")]
SUMMONERS_RIFT_DOOM_BOTS_RANK_2 = 92,
/// `93`.
/// Doom Bots Rank 5 games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 950
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 950")]
SUMMONERS_RIFT_DOOM_BOTS_RANK_5 = 93,
/// `96`.
/// Ascension games on Crystal Scar
///
/// Deprecated in patch 7.19 in favor of queueId 910
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 910")]
CRYSTAL_SCAR_ASCENSION_DEPRECATED_96 = 96,
@ -183,7 +158,6 @@ newtype_enum! {
BUTCHERS_BRIDGE_5V5_ARAM = 100,
/// `300`.
/// Legend of the Poro King games on Howling Abyss
///
/// Deprecated in patch 7.19 in favor of queueId 920
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 920")]
HOWLING_ABYSS_LEGEND_OF_THE_PORO_KING_DEPRECATED_300 = 300,
@ -195,7 +169,6 @@ newtype_enum! {
SUMMONERS_RIFT_BLACK_MARKET_BRAWLERS = 313,
/// `315`.
/// Nexus Siege games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 940
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 940")]
SUMMONERS_RIFT_NEXUS_SIEGE_DEPRECATED_315 = 315,
@ -204,7 +177,6 @@ newtype_enum! {
CRYSTAL_SCAR_DEFINITELY_NOT_DOMINION = 317,
/// `318`.
/// ARURF games on Summoner's Rift
///
/// Deprecated in patch 7.19 in favor of queueId 900
#[deprecated(note="Deprecated in patch 7.19 in favor of queueId 900")]
SUMMONERS_RIFT_ARURF_DEPRECATED_318 = 318,
@ -216,7 +188,6 @@ newtype_enum! {
SUMMONERS_RIFT_5V5_DRAFT_PICK = 400,
/// `410`.
/// 5v5 Ranked Dynamic games on Summoner's Rift
///
/// Game mode deprecated in patch 6.22
#[deprecated(note="Game mode deprecated in patch 6.22")]
SUMMONERS_RIFT_5V5_RANKED_DYNAMIC = 410,
@ -234,21 +205,14 @@ newtype_enum! {
HOWLING_ABYSS_5V5_ARAM = 450,
/// `460`.
/// 3v3 Blind Pick games on Twisted Treeline
///
/// Deprecated in patch 9.23
#[deprecated(note="Deprecated in patch 9.23")]
TWISTED_TREELINE_3V3_BLIND_PICK = 460,
/// `470`.
/// 3v3 Ranked Flex games on Twisted Treeline
///
/// Deprecated in patch 9.23
#[deprecated(note="Deprecated in patch 9.23")]
TWISTED_TREELINE_3V3_RANKED_FLEX_DEPRECATED_470 = 470,
/// `490`.
/// Normal (Quickplay) games on Summoner's Rift
///
/// https://github.com/RiotGames/developer-relations/issues/846
SUMMONERS_RIFT_NORMAL_QUICKPLAY_ = 490,
/// `600`.
/// Blood Hunt Assassin games on Summoner's Rift
SUMMONERS_RIFT_BLOOD_HUNT_ASSASSIN = 600,
@ -263,13 +227,11 @@ newtype_enum! {
HOWLING_ABYSS_ARAM_CLASH = 720,
/// `800`.
/// Co-op vs. AI Intermediate Bot games on Twisted Treeline
///
/// Deprecated in patch 9.23
#[deprecated(note="Deprecated in patch 9.23")]
TWISTED_TREELINE_CO_OP_VS_AI_INTERMEDIATE_BOT = 800,
/// `810`.
/// Co-op vs. AI Intro Bot games on Twisted Treeline
///
/// Deprecated in patch 9.23
#[deprecated(note="Deprecated in patch 9.23")]
TWISTED_TREELINE_CO_OP_VS_AI_INTRO_BOT = 810,
@ -356,7 +318,6 @@ newtype_enum! {
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_HYPER_ROLL_ = 1130,
/// `1150`.
/// Ranked Teamfight Tactics (Double Up Workshop) games on Convergence
///
/// Deprecated in patch 12.11 in favor of queueId 1160
#[deprecated(note="Deprecated in patch 12.11 in favor of queueId 1160")]
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_DOUBLE_UP_WORKSHOP__DEPRECATED_1150 = 1150,
@ -365,7 +326,6 @@ newtype_enum! {
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_DOUBLE_UP_WORKSHOP_ = 1160,
/// `1200`.
/// Nexus Blitz games on Nexus Blitz
///
/// Deprecated in patch 9.2 in favor of queueId 1300
#[deprecated(note="Deprecated in patch 9.2 in favor of queueId 1300")]
NEXUS_BLITZ_DEPRECATED_1200 = 1200,
@ -390,8 +350,5 @@ newtype_enum! {
/// `2020`.
/// Tutorial 3 games on Summoner's Rift
SUMMONERS_RIFT_TUTORIAL_3 = 2020,
/// `6000`.
/// Teamfight Tactics Set 3.5 Revival games on Convergence
CONVERGENCE_TEAMFIGHT_TACTICS_SET_3_5_REVIVAL = 6000,
}
}

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -33,13 +32,11 @@ pub enum QueueType {
/// Ranked Teamfight Tactics (Hyper Roll) games
RANKED_TFT_TURBO,
/// Ranked Teamfight Tactics (Double Up Workshop) games
/// Deprecated in patch 12.11 in favor of queueId 1160 (`RANKED_TFT_DOUBLE_UP`)
#[deprecated(note="Deprecated in patch 12.11 in favor of queueId 1160 (`RANKED_TFT_DOUBLE_UP`)")]
/// Deprecated in patch 12.11 in favor of queueId 1160
#[deprecated(note="Deprecated in patch 12.11 in favor of queueId 1160")]
RANKED_TFT_PAIRS,
/// Ranked Teamfight Tactics (Double Up Workshop) games
RANKED_TFT_DOUBLE_UP,
/// 2v2v2v2 "Arena" games
CHERRY,
}
serde_strum_unknown!(QueueType);

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -109,7 +108,7 @@ pub enum PlatformRoute {
#[strum(to_string="NA1", serialize="NA")]
NA1 = 23,
/// Oceania.
/// Oceana.
///
/// `24` (riotapi-schema ID/repr)
#[strum(to_string="OC1", serialize="OCE")]
@ -336,7 +335,7 @@ pub enum TournamentRegion {
LAS = 22,
/// North America.
NA = 23,
/// Oceania.
/// Oceana.
OCE = 24,
/// Turkey
TR = 26,

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -8,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version d4f02b20da80dd2c869da349ba774ef6eddc22fa
// Version 55e76c61b6feb1298719d6f55d89f2229e88e4eb
//! Automatically generated endpoint handles.
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
@ -216,23 +215,23 @@ impl RiotApi {
pub fn tft_summoner_v1(&self) -> TftSummonerV1 {
TftSummonerV1 { base: self }
}
/// Returns a handle for accessing [TournamentStubV5](crate::endpoints::TournamentStubV5) endpoints.
/// Returns a handle for accessing [TournamentStubV4](crate::endpoints::TournamentStubV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v5" target="_blank">`tournament-stub-v5`</a>
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
///
/// Note: this method is automatically generated.
#[inline]
pub fn tournament_stub_v5(&self) -> TournamentStubV5 {
TournamentStubV5 { base: self }
pub fn tournament_stub_v4(&self) -> TournamentStubV4 {
TournamentStubV4 { base: self }
}
/// Returns a handle for accessing [TournamentV5](crate::endpoints::TournamentV5) endpoints.
/// Returns a handle for accessing [TournamentV4](crate::endpoints::TournamentV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v5" target="_blank">`tournament-v5`</a>
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
///
/// Note: this method is automatically generated.
#[inline]
pub fn tournament_v5(&self) -> TournamentV5 {
TournamentV5 { base: self }
pub fn tournament_v4(&self) -> TournamentV4 {
TournamentV4 { base: self }
}
/// Returns a handle for accessing [ValContentV1](crate::endpoints::ValContentV1) endpoints.
/// # Riot Developer API Reference
@ -304,8 +303,8 @@ impl<'a> AccountV1<'a> {
/// Get account by riot id
/// # Parameters
/// * `route` - Route to query.
/// * `tag_line` (required, in path) - When querying for a player by their riot id, the gameName and tagLine query params are required.
/// * `game_name` (required, in path) - When querying for a player by their riot id, the gameName and tagLine query params are required.
/// * `tag_line` (required, in path) - When querying for a player by their riot id, the gameName and tagLine query params are required. However not all accounts have a gameName and tagLine associated so these fields may not be included in the response.
/// * `game_name` (required, in path) - When querying for a player by their riot id, the gameName and tagLine query params are required. However not all accounts have a gameName and tagLine associated so these fields may not be included in the response.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#account-v1/GET_getByRiotId" target="_blank">`account-v1.getByRiotId`</a>
///
@ -373,82 +372,82 @@ pub struct ChampionMasteryV4<'a> {
base: &'a RiotApi,
}
impl<'a> ChampionMasteryV4<'a> {
/// Get all champion mastery entries sorted by number of champion points descending.
/// Get all champion mastery entries sorted by number of champion points descending,
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteriesByPUUID" target="_blank">`champion-mastery-v4.getAllChampionMasteriesByPUUID`</a>
/// <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_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
pub fn get_all_champion_masteries(&self, route: PlatformRoute, encrypted_summoner_id: &str)
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}", encrypted_puuid));
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getAllChampionMasteriesByPUUID", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}", encrypted_summoner_id));
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getAllChampionMasteries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getAllChampionMasteriesByPUUID"));
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getAllChampionMasteries"));
future
}
/// Get a champion mastery by puuid and champion ID.
/// Get a champion mastery by player ID and champion ID.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// * `champion_id` (required, in path) - Champion ID to retrieve Champion Mastery.
/// * `champion_id` (required, in path) - Champion ID to retrieve Champion Mastery for
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryByPUUID" target="_blank">`champion-mastery-v4.getChampionMasteryByPUUID`</a>
/// <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_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str, champion_id: crate::consts::Champion)
-> impl Future<Output = Result<champion_mastery_v4::ChampionMastery>> + 'a
pub fn get_champion_mastery(&self, route: PlatformRoute, encrypted_summoner_id: &str, champion_id: crate::consts::Champion)
-> impl Future<Output = Result<Option<champion_mastery_v4::ChampionMastery>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}/by-champion/{}", encrypted_puuid, champion_id));
let future = self.base.execute_val::<champion_mastery_v4::ChampionMastery>("champion-mastery-v4.getChampionMasteryByPUUID", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}/by-champion/{}", encrypted_summoner_id, champion_id));
let future = self.base.execute_opt::<champion_mastery_v4::ChampionMastery>("champion-mastery-v4.getChampionMastery", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryByPUUID"));
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMastery"));
future
}
/// Get specified number of top champion mastery entries sorted by number of champion points descending.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// * `count` (optional, in query) - Number of entries to retrieve, defaults to 3.
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
/// * `count` (optional, in query) - Number of entries to retrieve, defaults to 3
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getTopChampionMasteriesByPUUID" target="_blank">`champion-mastery-v4.getTopChampionMasteriesByPUUID`</a>
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getTopChampionMasteries" target="_blank">`champion-mastery-v4.getTopChampionMasteries`</a>
///
/// Note: this method is automatically generated.
pub fn get_top_champion_masteries_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str, count: Option<i32>)
pub fn get_top_champion_masteries(&self, route: PlatformRoute, encrypted_summoner_id: &str, count: Option<i32>)
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}/top", encrypted_puuid));
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getTopChampionMasteriesByPUUID", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}/top", encrypted_summoner_id));
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getTopChampionMasteries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteriesByPUUID"));
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteries"));
future
}
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScoreByPUUID" target="_blank">`champion-mastery-v4.getChampionMasteryScoreByPUUID`</a>
/// <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_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
pub fn get_champion_mastery_score(&self, route: PlatformRoute, encrypted_summoner_id: &str)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/scores/by-puuid/{}", encrypted_puuid));
let future = self.base.execute_val::<i32>("champion-mastery-v4.getChampionMasteryScoreByPUUID", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/scores/by-summoner/{}", encrypted_summoner_id));
let future = self.base.execute_val::<i32>("champion-mastery-v4.getChampionMasteryScore", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryScoreByPUUID"));
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryScore"));
future
}
@ -494,6 +493,27 @@ pub struct ClashV1<'a> {
base: &'a RiotApi,
}
impl<'a> ClashV1<'a> {
/// Get players by puuid
/// ## Implementation Notes
/// This endpoint returns a list of active Clash players for a given PUUID. If a summoner registers for multiple tournaments at the same time (e.g., Saturday and Sunday) then both registrations would appear in this list.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#clash-v1/GET_getPlayersByPUUID" target="_blank">`clash-v1.getPlayersByPUUID`</a>
///
/// Note: this method is automatically generated.
pub fn get_players_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
-> impl Future<Output = Result<Vec<clash_v1::Player>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/clash/v1/players/by-puuid/{}", encrypted_puuid));
let future = self.base.execute_val::<Vec<clash_v1::Player>>("clash-v1.getPlayersByPUUID", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("clash-v1.getPlayersByPUUID"));
future
}
/// Get players by summoner ID.
/// ## Implementation Notes
/// This endpoint returns a list of active Clash players for a given summoner ID. If a summoner registers for multiple tournaments at the same time (e.g., Saturday and Sunday) then both registrations would appear in this list.
@ -618,7 +638,7 @@ impl<'a> LeagueExpV4<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/league-exp/v4/entries/{}/{}/{}", queue, tier, division));
let request = if let Some(page) = page { request.query(&[ ("page", page) ]) } else { request };
let mut request = request; if let Some(page) = page { request = request.query(&[ ("page", page) ]); }
let future = self.base.execute_val::<Vec<league_exp_v4::LeagueEntry>>("league-exp-v4.getLeagueEntries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("league-exp-v4.getLeagueEntries"));
@ -691,7 +711,7 @@ impl<'a> LeagueV4<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/league/v4/entries/{}/{}/{}", queue, tier, division));
let request = if let Some(page) = page { request.query(&[ ("page", page) ]) } else { request };
let mut request = request; if let Some(page) = page { request = request.query(&[ ("page", page) ]); }
let future = self.base.execute_val::<Vec<league_v4::LeagueEntry>>("league-v4.getLeagueEntries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("league-v4.getLeagueEntries"));
@ -837,7 +857,7 @@ impl<'a> LolChallengesV1<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/challenges/v1/challenges/{}/leaderboards/by-level/{}", challenge_id, level));
let request = if let Some(limit) = limit { request.query(&[ ("limit", limit) ]) } else { request };
let mut request = request; if let Some(limit) = limit { request = request.query(&[ ("limit", limit) ]); }
let future = self.base.execute_opt::<Vec<lol_challenges_v1::ApexPlayerInfo>>("lol-challenges-v1.getChallengeLeaderboards", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("lol-challenges-v1.getChallengeLeaderboards"));
@ -1170,12 +1190,12 @@ impl<'a> MatchV5<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/match/v5/matches/by-puuid/{}/ids", puuid));
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
let request = if let Some(end_time) = end_time { request.query(&[ ("endTime", end_time) ]) } else { request };
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let request = if let Some(start_time) = start_time { request.query(&[ ("startTime", start_time) ]) } else { request };
let request = if let Some(start) = start { request.query(&[ ("start", start) ]) } else { request };
let request = if let Some(r#type) = r#type { request.query(&[ ("type", r#type) ]) } else { request };
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let mut request = request; if let Some(end_time) = end_time { request = request.query(&[ ("endTime", end_time) ]); }
let mut request = request; if let Some(queue) = queue { request = request.query(&[ ("queue", queue) ]); }
let mut request = request; if let Some(start_time) = start_time { request = request.query(&[ ("startTime", start_time) ]); }
let mut request = request; if let Some(start) = start { request = request.query(&[ ("start", start) ]); }
let mut request = request; if let Some(r#type) = r#type { request = request.query(&[ ("type", r#type) ]); }
let future = self.base.execute_val::<Vec<String>>("match-v5.getMatchIdsByPUUID", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("match-v5.getMatchIdsByPUUID"));
@ -1411,17 +1431,15 @@ impl<'a> TftLeagueV1<'a> {
/// Get the challenger league.
/// # Parameters
/// * `route` - Route to query.
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// # 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, route: PlatformRoute, queue: Option<&str>)
pub fn get_challenger_league(&self, route: PlatformRoute)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/challenger");
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getChallengerLeague", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getChallengerLeague"));
@ -1452,19 +1470,17 @@ impl<'a> TftLeagueV1<'a> {
/// * `route` - Route to query.
/// * `tier` (required, in path)
/// * `division` (required, in path)
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// * `page` (optional, in query) - Defaults to 1. 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, route: PlatformRoute, tier: crate::consts::Tier, division: &str, page: Option<i32>, queue: Option<&str>)
pub fn get_league_entries(&self, route: PlatformRoute, tier: crate::consts::Tier, division: &str, page: Option<i32>)
-> impl Future<Output = Result<Vec<tft_league_v1::LeagueEntry>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/tft/league/v1/entries/{}/{}", tier, division));
let request = if let Some(page) = page { request.query(&[ ("page", page) ]) } else { request };
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let mut request = request; if let Some(page) = page { request = request.query(&[ ("page", page) ]); }
let future = self.base.execute_val::<Vec<tft_league_v1::LeagueEntry>>("tft-league-v1.getLeagueEntries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getLeagueEntries"));
@ -1474,17 +1490,15 @@ impl<'a> TftLeagueV1<'a> {
/// Get the grandmaster league.
/// # Parameters
/// * `route` - Route to query.
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// # 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, route: PlatformRoute, queue: Option<&str>)
pub fn get_grandmaster_league(&self, route: PlatformRoute)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/grandmaster");
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getGrandmasterLeague", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getGrandmasterLeague"));
@ -1513,17 +1527,15 @@ impl<'a> TftLeagueV1<'a> {
/// Get the master league.
/// # Parameters
/// * `route` - Route to query.
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// # 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, route: PlatformRoute, queue: Option<&str>)
pub fn get_master_league(&self, route: PlatformRoute)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/master");
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getMasterLeague", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getMasterLeague"));
@ -1578,10 +1590,10 @@ impl<'a> TftMatchV1<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/tft/match/v1/matches/by-puuid/{}/ids", puuid));
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
let request = if let Some(end_time) = end_time { request.query(&[ ("endTime", end_time) ]) } else { request };
let request = if let Some(start) = start { request.query(&[ ("start", start) ]) } else { request };
let request = if let Some(start_time) = start_time { request.query(&[ ("startTime", start_time) ]) } else { request };
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let mut request = request; if let Some(end_time) = end_time { request = request.query(&[ ("endTime", end_time) ]); }
let mut request = request; if let Some(start) = start { request = request.query(&[ ("start", start) ]); }
let mut request = request; if let Some(start_time) = start_time { request = request.query(&[ ("startTime", start_time) ]); }
let future = self.base.execute_val::<Vec<String>>("tft-match-v1.getMatchIdsByPUUID", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-match-v1.getMatchIdsByPUUID"));
@ -1747,149 +1759,130 @@ impl<'a> TftSummonerV1<'a> {
}
/// TournamentStubV5 endpoints handle, accessed by calling [`tournament_stub_v5()`](crate::RiotApi::tournament_stub_v5) on a [`RiotApi`](crate::RiotApi) instance.
/// 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-v5" target="_blank">`tournament-stub-v5`</a>
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
///
/// Note: this struct is automatically generated.
#[repr(transparent)]
pub struct TournamentStubV5<'a> {
pub struct TournamentStubV4<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentStubV5<'a> {
/// Create a tournament code for the given tournament - Stub method
impl<'a> TournamentStubV4<'a> {
/// Create a mock tournament code for the given tournament.
/// # Parameters
/// * `route` - Route to query.
/// * `count` (optional, in query) - The number of codes to create (max 1000)
/// * `tournament_id` (required, in query) - The tournament ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/POST_createTournamentCode" target="_blank">`tournament-stub-v5.createTournamentCode`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_createTournamentCode" target="_blank">`tournament-stub-v4.createTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_stub_v5::TournamentCodeParametersV5, tournament_id: i64, count: Option<i32>)
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_stub_v4::TournamentCodeParameters, tournament_id: i64, count: Option<i32>)
-> impl Future<Output = Result<Vec<String>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v5/codes");
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/codes");
let request = request.query(&[ ("tournamentId", tournament_id) ]);
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<Vec<String>>("tournament-stub-v5.createTournamentCode", route_str, request);
let future = self.base.execute_val::<Vec<String>>("tournament-stub-v4.createTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v5.createTournamentCode"));
let future = future.instrument(tracing::info_span!("tournament-stub-v4.createTournamentCode"));
future
}
/// Returns the tournament code DTO associated with a tournament code string - Stub Method
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The tournament code string.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/GET_getTournamentCode" target="_blank">`tournament-stub-v5.getTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_tournament_code(&self, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_stub_v5::TournamentCodeV5>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament-stub/v5/codes/{}", tournament_code));
let future = self.base.execute_val::<tournament_stub_v5::TournamentCodeV5>("tournament-stub-v5.getTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v5.getTournamentCode"));
future
}
/// Gets a list of lobby events by tournament code - Stub method
/// Gets a mock list of lobby events by tournament code.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/GET_getLobbyEventsByCode" target="_blank">`tournament-stub-v5.getLobbyEventsByCode`</a>
/// <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, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_stub_v5::LobbyEventV5Wrapper>> + 'a
-> impl Future<Output = Result<tournament_stub_v4::LobbyEventWrapper>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament-stub/v5/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_stub_v5::LobbyEventV5Wrapper>("tournament-stub-v5.getLobbyEventsByCode", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament-stub/v4/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_stub_v4::LobbyEventWrapper>("tournament-stub-v4.getLobbyEventsByCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v5.getLobbyEventsByCode"));
let future = future.instrument(tracing::info_span!("tournament-stub-v4.getLobbyEventsByCode"));
future
}
/// Creates a tournament provider and returns its ID - Stub method
/// Creates a mock tournament provider and returns its ID.
/// ## Implementation Notes
/// Providers will need to call this endpoint first to register their callback URL and their API key with the tournament system before any other tournament provider endpoints will work.
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/POST_registerProviderData" target="_blank">`tournament-stub-v5.registerProviderData`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_registerProviderData" target="_blank">`tournament-stub-v4.registerProviderData`</a>
///
/// Note: this method is automatically generated.
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_stub_v5::ProviderRegistrationParametersV5)
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_stub_v4::ProviderRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v5/providers");
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/providers");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-stub-v5.registerProviderData", route_str, request);
let future = self.base.execute_val::<i32>("tournament-stub-v4.registerProviderData", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v5.registerProviderData"));
let future = future.instrument(tracing::info_span!("tournament-stub-v4.registerProviderData"));
future
}
/// Creates a tournament and returns its ID - Stub method
/// Creates a mock tournament and returns its ID.
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/POST_registerTournament" target="_blank">`tournament-stub-v5.registerTournament`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_registerTournament" target="_blank">`tournament-stub-v4.registerTournament`</a>
///
/// Note: this method is automatically generated.
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_stub_v5::TournamentRegistrationParametersV5)
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_stub_v4::TournamentRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v5/tournaments");
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/tournaments");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-stub-v5.registerTournament", route_str, request);
let future = self.base.execute_val::<i32>("tournament-stub-v4.registerTournament", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v5.registerTournament"));
let future = future.instrument(tracing::info_span!("tournament-stub-v4.registerTournament"));
future
}
}
/// TournamentV5 endpoints handle, accessed by calling [`tournament_v5()`](crate::RiotApi::tournament_v5) on a [`RiotApi`](crate::RiotApi) instance.
/// 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-v5" target="_blank">`tournament-v5`</a>
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
///
/// Note: this struct is automatically generated.
#[repr(transparent)]
pub struct TournamentV5<'a> {
pub struct TournamentV4<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentV5<'a> {
impl<'a> TournamentV4<'a> {
/// Create a tournament code for the given tournament.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_id` (required, in query) - The tournament ID
/// * `count` (optional, in query) - The number of codes to create (max 1000)
/// * `tournament_id` (required, in query) - The tournament ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_createTournamentCode" target="_blank">`tournament-v5.createTournamentCode`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_createTournamentCode" target="_blank">`tournament-v4.createTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_v5::TournamentCodeParametersV5, tournament_id: i64, count: Option<i32>)
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_v4::TournamentCodeParameters, tournament_id: i64, count: Option<i32>)
-> impl Future<Output = Result<Vec<String>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/codes");
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/codes");
let request = request.query(&[ ("tournamentId", tournament_id) ]);
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<Vec<String>>("tournament-v5.createTournamentCode", route_str, request);
let future = self.base.execute_val::<Vec<String>>("tournament-v4.createTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.createTournamentCode"));
let future = future.instrument(tracing::info_span!("tournament-v4.createTournamentCode"));
future
}
@ -1898,62 +1891,37 @@ impl<'a> TournamentV5<'a> {
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The tournament code string.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getTournamentCode" target="_blank">`tournament-v5.getTournamentCode`</a>
/// <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, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_v5::TournamentCodeV5>> + 'a
-> impl Future<Output = Result<tournament_v4::TournamentCode>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v5/codes/{}", tournament_code));
let future = self.base.execute_val::<tournament_v5::TournamentCodeV5>("tournament-v5.getTournamentCode", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v4/codes/{}", tournament_code));
let future = self.base.execute_val::<tournament_v4::TournamentCode>("tournament-v4.getTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.getTournamentCode"));
let future = future.instrument(tracing::info_span!("tournament-v4.getTournamentCode"));
future
}
/// Update the pick type, map, spectator type, or allowed puuids for a code.
/// Update the pick type, map, spectator type, or allowed summoners for a code.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The tournament code to update
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/PUT_updateCode" target="_blank">`tournament-v5.updateCode`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/PUT_updateCode" target="_blank">`tournament-v4.updateCode`</a>
///
/// Note: this method is automatically generated.
pub fn update_code(&self, route: RegionalRoute, body: &tournament_v5::TournamentCodeUpdateParametersV5, tournament_code: &str)
pub fn update_code(&self, route: RegionalRoute, body: &tournament_v4::TournamentCodeUpdateParameters, tournament_code: &str)
-> impl Future<Output = Result<()>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::PUT, route_str, &format!("/lol/tournament/v5/codes/{}", tournament_code));
let request = self.base.request(Method::PUT, route_str, &format!("/lol/tournament/v4/codes/{}", tournament_code));
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute("tournament-v5.updateCode", route_str, request);
let future = self.base.execute("tournament-v4.updateCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.updateCode"));
future
}
/// Get games details
/// ## Implementation Notes
/// Additional endpoint to get tournament games. From this endpoint, you are able to get participants PUUID (the callback doesn't contain this info).
///
/// You can also use it to check if the game was recorded and validate callbacks. If the endpoint returns the game, it means a callback was attempted.
///
/// This will only work for tournament codes created after November 10, 2023.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path)
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getGames" target="_blank">`tournament-v5.getGames`</a>
///
/// Note: this method is automatically generated.
pub fn get_games(&self, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<Vec<tournament_v5::TournamentGamesV5>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v5/games/by-code/{}", tournament_code));
let future = self.base.execute_val::<Vec<tournament_v5::TournamentGamesV5>>("tournament-v5.getGames", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.getGames"));
let future = future.instrument(tracing::info_span!("tournament-v4.updateCode"));
future
}
@ -1962,17 +1930,17 @@ impl<'a> TournamentV5<'a> {
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getLobbyEventsByCode" target="_blank">`tournament-v5.getLobbyEventsByCode`</a>
/// <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, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_v5::LobbyEventV5Wrapper>> + 'a
-> impl Future<Output = Result<tournament_v4::LobbyEventWrapper>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v5/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_v5::LobbyEventV5Wrapper>("tournament-v5.getLobbyEventsByCode", route_str, request);
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v4/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_v4::LobbyEventWrapper>("tournament-v4.getLobbyEventsByCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.getLobbyEventsByCode"));
let future = future.instrument(tracing::info_span!("tournament-v4.getLobbyEventsByCode"));
future
}
@ -1982,18 +1950,18 @@ impl<'a> TournamentV5<'a> {
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_registerProviderData" target="_blank">`tournament-v5.registerProviderData`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_registerProviderData" target="_blank">`tournament-v4.registerProviderData`</a>
///
/// Note: this method is automatically generated.
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_v5::ProviderRegistrationParametersV5)
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_v4::ProviderRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/providers");
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/providers");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-v5.registerProviderData", route_str, request);
let future = self.base.execute_val::<i32>("tournament-v4.registerProviderData", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.registerProviderData"));
let future = future.instrument(tracing::info_span!("tournament-v4.registerProviderData"));
future
}
@ -2001,18 +1969,18 @@ impl<'a> TournamentV5<'a> {
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_registerTournament" target="_blank">`tournament-v5.registerTournament`</a>
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_registerTournament" target="_blank">`tournament-v4.registerTournament`</a>
///
/// Note: this method is automatically generated.
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_v5::TournamentRegistrationParametersV5)
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_v4::TournamentRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/tournaments");
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/tournaments");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-v5.registerTournament", route_str, request);
let future = self.base.execute_val::<i32>("tournament-v4.registerTournament", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.registerTournament"));
let future = future.instrument(tracing::info_span!("tournament-v4.registerTournament"));
future
}
@ -2041,7 +2009,7 @@ impl<'a> ValContentV1<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/val/content/v1/contents");
let request = if let Some(locale) = locale { request.query(&[ ("locale", locale) ]) } else { request };
let mut request = request; if let Some(locale) = locale { request = request.query(&[ ("locale", locale) ]); }
let future = self.base.execute_val::<val_content_v1::Content>("val-content-v1.getContent", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("val-content-v1.getContent"));
@ -2146,8 +2114,8 @@ impl<'a> ValRankedV1<'a> {
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/val/ranked/v1/leaderboards/by-act/{}", act_id));
let request = if let Some(size) = size { request.query(&[ ("size", size) ]) } else { request };
let request = if let Some(start_index) = start_index { request.query(&[ ("startIndex", start_index) ]) } else { request };
let mut request = request; if let Some(size) = size { request = request.query(&[ ("size", size) ]); }
let mut request = request; if let Some(start_index) = start_index { request = request.query(&[ ("startIndex", start_index) ]); }
let future = self.base.execute_opt::<val_ranked_v1::Leaderboard>("val-ranked-v1.getLeaderboard", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("val-ranked-v1.getLeaderboard"));

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -57,7 +56,7 @@
//!
//! // Get champion mastery data.
//! let masteries = riot_api.champion_mastery_v4()
//! .get_all_champion_masteries_by_puuid(PlatformRoute::NA1, &summoner.puuid).await
//! .get_all_champion_masteries(PlatformRoute::NA1, &summoner.id).await
//! .expect("Get champion masteries failed.");
//!
//! // Print champion masteries.
@ -84,7 +83,7 @@
//! ```
//! The [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html)
//! contains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests)
//! and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/examples/proxy)
//! and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/example/proxy)
//! provide more example usage.
//!
//! ## Feature Flags

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -8,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version d4f02b20da80dd2c869da349ba774ef6eddc22fa
// Version 55e76c61b6feb1298719d6f55d89f2229e88e4eb
//! Metadata about the Riot API and Riven.
//!
@ -16,16 +15,17 @@
/// Metadata for endpoints. Each tuple corresponds to one endpoint and contains
/// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID.
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 80] = [
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 79] = [
(reqwest::Method::GET, "/riot/account/v1/accounts/by-puuid/{puuid}", "account-v1.getByPuuid"),
(reqwest::Method::GET, "/riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine}", "account-v1.getByRiotId"),
(reqwest::Method::GET, "/riot/account/v1/accounts/me", "account-v1.getByAccessToken"),
(reqwest::Method::GET, "/riot/account/v1/active-shards/by-game/{game}/by-puuid/{puuid}", "account-v1.getActiveShard"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}", "champion-mastery-v4.getAllChampionMasteriesByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}/by-champion/{championId}", "champion-mastery-v4.getChampionMasteryByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}/top", "champion-mastery-v4.getTopChampionMasteriesByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-puuid/{encryptedPUUID}", "champion-mastery-v4.getChampionMasteryScoreByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getAllChampionMasteries"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/by-champion/{championId}", "champion-mastery-v4.getChampionMastery"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/top", "champion-mastery-v4.getTopChampionMasteries"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getChampionMasteryScore"),
(reqwest::Method::GET, "/lol/platform/v3/champion-rotations", "champion-v3.getChampionInfo"),
(reqwest::Method::GET, "/lol/clash/v1/players/by-puuid/{encryptedPUUID}", "clash-v1.getPlayersByPUUID"),
(reqwest::Method::GET, "/lol/clash/v1/players/by-summoner/{summonerId}", "clash-v1.getPlayersBySummoner"),
(reqwest::Method::GET, "/lol/clash/v1/teams/{teamId}", "clash-v1.getTeamById"),
(reqwest::Method::GET, "/lol/clash/v1/tournaments", "clash-v1.getTournaments"),
@ -79,18 +79,16 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 80] = [
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-puuid/{encryptedPUUID}", "tft-summoner-v1.getByPUUID"),
(reqwest::Method::GET, "/tft/summoner/v1/summoners/me", "tft-summoner-v1.getByAccessToken"),
(reqwest::Method::GET, "/tft/summoner/v1/summoners/{encryptedSummonerId}", "tft-summoner-v1.getBySummonerId"),
(reqwest::Method::POST, "/lol/tournament-stub/v5/codes", "tournament-stub-v5.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament-stub/v5/codes/{tournamentCode}", "tournament-stub-v5.getTournamentCode"),
(reqwest::Method::GET, "/lol/tournament-stub/v5/lobby-events/by-code/{tournamentCode}", "tournament-stub-v5.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament-stub/v5/providers", "tournament-stub-v5.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament-stub/v5/tournaments", "tournament-stub-v5.registerTournament"),
(reqwest::Method::POST, "/lol/tournament/v5/codes", "tournament-v5.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament/v5/codes/{tournamentCode}", "tournament-v5.getTournamentCode"),
(reqwest::Method::PUT, "/lol/tournament/v5/codes/{tournamentCode}", "tournament-v5.updateCode"),
(reqwest::Method::GET, "/lol/tournament/v5/games/by-code/{tournamentCode}", "tournament-v5.getGames"),
(reqwest::Method::GET, "/lol/tournament/v5/lobby-events/by-code/{tournamentCode}", "tournament-v5.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament/v5/providers", "tournament-v5.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament/v5/tournaments", "tournament-v5.registerTournament"),
(reqwest::Method::POST, "/lol/tournament-stub/v4/codes", "tournament-stub-v4.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament-stub/v4/lobby-events/by-code/{tournamentCode}", "tournament-stub-v4.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament-stub/v4/providers", "tournament-stub-v4.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament-stub/v4/tournaments", "tournament-stub-v4.registerTournament"),
(reqwest::Method::POST, "/lol/tournament/v4/codes", "tournament-v4.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.getTournamentCode"),
(reqwest::Method::PUT, "/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.updateCode"),
(reqwest::Method::GET, "/lol/tournament/v4/lobby-events/by-code/{tournamentCode}", "tournament-v4.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament/v4/providers", "tournament-v4.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament/v4/tournaments", "tournament-v4.registerTournament"),
(reqwest::Method::GET, "/val/content/v1/contents", "val-content-v1.getContent"),
(reqwest::Method::GET, "/val/match/v1/matches/{matchId}", "val-match-v1.getMatch"),
(reqwest::Method::GET, "/val/match/v1/matchlists/by-puuid/{puuid}", "val-match-v1.getMatchlist"),

View File

@ -1,4 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -8,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version d4f02b20da80dd2c869da349ba774ef6eddc22fa
// Version 55e76c61b6feb1298719d6f55d89f2229e88e4eb
#![allow(missing_docs)]
@ -800,9 +799,6 @@ pub mod lor_match_v1 {
pub game_start_time_utc: String,
#[serde(rename = "game_version")]
pub game_version: String,
/// (Legal values: standard, eternal)
#[serde(rename = "game_format")]
pub game_format: String,
#[serde(rename = "players")]
pub players: std::vec::Vec<Player>,
/// Total turns taken by both players.
@ -1164,11 +1160,7 @@ pub mod match_v5 {
#[serde(rename = "quadraKills")]
pub quadra_kills: i32,
#[serde(rename = "riotIdName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub riot_id_name: Option<String>,
#[serde(rename = "riotIdGameName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub riot_id_game_name: Option<String>,
pub riot_id_name: String,
#[serde(rename = "riotIdTagline")]
pub riot_id_tagline: String,
#[serde(rename = "role")]
@ -1331,45 +1323,6 @@ pub mod match_v5 {
#[serde(rename = "placement")]
#[serde(skip_serializing_if = "Option::is_none")]
pub placement: Option<i32>,
#[serde(rename = "missions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub missions: Option<ParticipantMissions>,
#[serde(rename = "playerScore0")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score0: Option<i32>,
#[serde(rename = "playerScore1")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score1: Option<i32>,
#[serde(rename = "playerScore10")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score10: Option<i32>,
#[serde(rename = "playerScore11")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score11: Option<i32>,
#[serde(rename = "playerScore2")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score2: Option<i32>,
#[serde(rename = "playerScore3")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score3: Option<i32>,
#[serde(rename = "playerScore4")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score4: Option<i32>,
#[serde(rename = "playerScore5")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score5: Option<i32>,
#[serde(rename = "playerScore6")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score6: Option<i32>,
#[serde(rename = "playerScore7")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score7: Option<i32>,
#[serde(rename = "playerScore8")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score8: Option<i32>,
#[serde(rename = "playerScore9")]
#[serde(skip_serializing_if = "Option::is_none")]
pub player_score9: Option<i32>,
}
/// Perks data object.
#[derive(Clone, Debug)]
@ -1460,9 +1413,6 @@ pub mod match_v5 {
pub rift_herald: Objective,
#[serde(rename = "tower")]
pub tower: Objective,
#[serde(rename = "horde")]
#[serde(skip_serializing_if = "Option::is_none")]
pub horde: Option<Objective>,
}
/// Objective data object.
#[derive(Clone, Debug)]
@ -1885,39 +1835,6 @@ pub mod match_v5 {
#[serde(rename = "wardTakedownsBefore20M")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ward_takedowns_before20_m: Option<f64>,
#[serde(rename = "legendaryItemUsed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub legendary_item_used: Option<std::vec::Vec<i32>>,
}
/// ParticipantMissions data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct ParticipantMissions {
#[serde(rename = "playerScore0")]
pub player_score0: i32,
#[serde(rename = "playerScore1")]
pub player_score1: i32,
#[serde(rename = "playerScore10")]
pub player_score10: i32,
#[serde(rename = "playerScore11")]
pub player_score11: i32,
#[serde(rename = "playerScore2")]
pub player_score2: i32,
#[serde(rename = "playerScore3")]
pub player_score3: i32,
#[serde(rename = "playerScore4")]
pub player_score4: i32,
#[serde(rename = "playerScore5")]
pub player_score5: i32,
#[serde(rename = "playerScore6")]
pub player_score6: i32,
#[serde(rename = "playerScore7")]
pub player_score7: i32,
#[serde(rename = "playerScore8")]
pub player_score8: i32,
#[serde(rename = "playerScore9")]
pub player_score9: i32,
}
/// MatchTimelineInfoFrameEvent data object.
#[derive(Clone, Debug)]
@ -2352,10 +2269,6 @@ pub mod spectator_v4 {
/// The encrypted summoner ID of this participant
#[serde(rename = "summonerId")]
pub summoner_id: String,
/// The encrypted puuid of this participant
#[serde(rename = "puuid")]
#[serde(skip_serializing_if = "Option::is_none")]
pub puuid: Option<String>,
/// The ID of the first summoner spell used by this participant
#[serde(rename = "spell1Id")]
pub spell1_id: i64,
@ -2403,8 +2316,7 @@ pub mod spectator_v4 {
pub game_list: std::vec::Vec<FeaturedGameInfo>,
/// The suggested interval to wait before requesting FeaturedGames again
#[serde(rename = "clientRefreshInterval")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_refresh_interval: Option<i64>,
pub client_refresh_interval: i64,
}
/// FeaturedGameInfo data object.
#[derive(Clone, Debug)]
@ -2437,6 +2349,9 @@ pub mod spectator_v4 {
/// The queue type (queue types are documented on the Game Constants page)
#[serde(rename = "gameQueueConfigId")]
pub game_queue_config_id: crate::consts::Queue,
/// The game start time represented in epoch milliseconds
#[serde(rename = "gameStartTime")]
pub game_start_time: i64,
/// The participant information
#[serde(rename = "participants")]
pub participants: std::vec::Vec<Participant>,
@ -2461,14 +2376,6 @@ pub mod spectator_v4 {
/// The summoner name of this participant
#[serde(rename = "summonerName")]
pub summoner_name: String,
/// Encrypted summoner ID of this participant
#[serde(rename = "summonerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub summoner_id: Option<String>,
/// Encrypted puuid of this participant
#[serde(rename = "puuid")]
#[serde(skip_serializing_if = "Option::is_none")]
pub puuid: Option<String>,
/// The ID of the champion played by this participant
#[serde(rename = "championId")]
pub champion_id: crate::consts::Champion,
@ -2594,10 +2501,6 @@ pub mod tft_league_v1 {
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LeagueEntry {
/// Player Universal Unique Identifier. Exact length of 78 characters. (Encrypted)
#[serde(rename = "puuid")]
#[serde(skip_serializing_if = "Option::is_none")]
pub puuid: Option<String>,
/// Not included for the RANKED_TFT_TURBO queueType.
#[serde(rename = "leagueId")]
#[serde(skip_serializing_if = "Option::is_none")]
@ -2739,7 +2642,7 @@ pub mod tft_match_v1 {
pub participants: std::vec::Vec<Participant>,
/// Please refer to the League of Legends documentation.
#[serde(rename = "queue_id")]
pub queue_id: crate::consts::Queue,
pub queue_id: i32,
/// Teamfight Tactics set number.
#[serde(rename = "tft_set_number")]
pub tft_set_number: i32,
@ -2976,20 +2879,20 @@ pub mod tft_summoner_v1 {
}
}
/// Data structs used by [`TournamentStubV5`](crate::endpoints::TournamentStubV5).
/// Data structs used by [`TournamentStubV4`](crate::endpoints::TournamentStubV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_stub_v5 {
/// TournamentCodeParametersV5 data object.
pub mod tournament_stub_v4 {
/// TournamentCodeParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeParametersV5 {
/// Optional list of encrypted puuids in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedParticipants")]
pub struct TournamentCodeParameters {
/// Optional list of encrypted summonerIds in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_participants: Option<std::vec::Vec<String>>,
pub allowed_summoner_ids: Option<std::vec::Vec<String>>,
/// Optional string that may contain any data in any format, if specified at all. Used to denote any custom information about the game.
#[serde(rename = "metadata")]
#[serde(skip_serializing_if = "Option::is_none")]
@ -3002,104 +2905,55 @@ pub mod tournament_stub_v5 {
#[serde(rename = "pickType")]
pub pick_type: String,
/// The map type of the game.<br>
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
#[serde(rename = "mapType")]
pub map_type: String,
/// The spectator type of the game.<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
/// Checks if allowed participants are enough to make full teams.
#[serde(rename = "enoughPlayers")]
pub enough_players: bool,
}
/// TournamentCodeV5 data object.
/// LobbyEventWrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeV5 {
/// The tournament code.
#[serde(rename = "code")]
pub code: String,
/// The spectator mode for the tournament code game.
#[serde(rename = "spectators")]
pub spectators: String,
/// The lobby name for the tournament code game.
#[serde(rename = "lobbyName")]
pub lobby_name: String,
/// The metadata for tournament code.
#[serde(rename = "metaData")]
pub meta_data: String,
/// The password for the tournament code game.
#[serde(rename = "password")]
pub password: String,
/// The team size for the tournament code game.
#[serde(rename = "teamSize")]
pub team_size: i32,
/// The provider's ID.
#[serde(rename = "providerId")]
pub provider_id: i32,
/// The pick mode for tournament code game.
#[serde(rename = "pickType")]
pub pick_type: String,
/// The tournament's ID.
#[serde(rename = "tournamentId")]
pub tournament_id: i32,
/// The tournament code's ID.
#[serde(rename = "id")]
pub id: i32,
/// The tournament code's region.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
#[serde(rename = "region")]
pub region: String,
/// The game map for the tournament code game
#[serde(rename = "map")]
pub map: String,
/// The puuids of the participants (Encrypted)
#[serde(rename = "participants")]
pub participants: std::vec::Vec<String>,
}
/// LobbyEventV5Wrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventV5Wrapper {
pub struct LobbyEventWrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEventV5>,
pub event_list: std::vec::Vec<LobbyEvent>,
}
/// LobbyEventV5 data object.
/// LobbyEvent data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventV5 {
/// Timestamp from the event
#[serde(rename = "timestamp")]
pub timestamp: String,
pub struct LobbyEvent {
/// The summonerId that triggered the event (Encrypted)
#[serde(rename = "summonerId")]
pub summoner_id: String,
/// The type of event that was triggered
#[serde(rename = "eventType")]
pub event_type: String,
/// The puuid that triggered the event (Encrypted)
#[serde(rename = "puuid")]
pub puuid: String,
/// Timestamp from the event
#[serde(rename = "timestamp")]
pub timestamp: String,
}
/// ProviderRegistrationParametersV5 data object.
/// ProviderRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct ProviderRegistrationParametersV5 {
pub struct ProviderRegistrationParameters {
/// The region in which the provider will be running tournaments.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
#[serde(rename = "region")]
pub region: String,
pub region: crate::consts::TournamentRegion,
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
#[serde(rename = "url")]
pub url: String,
}
/// TournamentRegistrationParametersV5 data object.
/// TournamentRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentRegistrationParametersV5 {
pub struct TournamentRegistrationParameters {
/// The provider ID to specify the regional registered provider data to associate this tournament.
#[serde(rename = "providerId")]
pub provider_id: i32,
@ -3110,20 +2964,20 @@ pub mod tournament_stub_v5 {
}
}
/// Data structs used by [`TournamentV5`](crate::endpoints::TournamentV5).
/// Data structs used by [`TournamentV4`](crate::endpoints::TournamentV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_v5 {
/// TournamentCodeParametersV5 data object.
pub mod tournament_v4 {
/// TournamentCodeParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeParametersV5 {
/// Optional list of encrypted puuids in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedParticipants")]
pub struct TournamentCodeParameters {
/// Optional list of encrypted summonerIds in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_participants: Option<std::vec::Vec<String>>,
pub allowed_summoner_ids: Option<std::vec::Vec<String>>,
/// Optional string that may contain any data in any format, if specified at all. Used to denote any custom information about the game.
#[serde(rename = "metadata")]
#[serde(skip_serializing_if = "Option::is_none")]
@ -3136,22 +2990,19 @@ pub mod tournament_v5 {
#[serde(rename = "pickType")]
pub pick_type: String,
/// The map type of the game.<br>
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
#[serde(rename = "mapType")]
pub map_type: String,
/// The spectator type of the game.<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
/// Checks if allowed participants are enough to make full teams.
#[serde(rename = "enoughPlayers")]
pub enough_players: bool,
}
/// TournamentCodeV5 data object.
/// TournamentCode data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeV5 {
pub struct TournamentCode {
/// The tournament code.
#[serde(rename = "code")]
pub code: String,
@ -3183,31 +3034,31 @@ pub mod tournament_v5 {
#[serde(rename = "id")]
pub id: i32,
/// The tournament code's region.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
#[serde(rename = "region")]
pub region: String,
/// The game map for the tournament code game
#[serde(rename = "map")]
pub map: String,
/// The puuids of the participants (Encrypted)
/// The summonerIds of the participants (Encrypted)
#[serde(rename = "participants")]
pub participants: std::vec::Vec<String>,
}
/// TournamentCodeUpdateParametersV5 data object.
/// TournamentCodeUpdateParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeUpdateParametersV5 {
/// Optional list of encrypted puuids in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedParticipants")]
pub struct TournamentCodeUpdateParameters {
/// Optional list of encrypted summonerIds in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_participants: Option<std::vec::Vec<String>>,
pub allowed_summoner_ids: Option<std::vec::Vec<String>>,
/// The pick type<br>
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
#[serde(rename = "pickType")]
pub pick_type: String,
/// The map type<br>
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
#[serde(rename = "mapType")]
pub map_type: String,
/// The spectator type<br>
@ -3215,87 +3066,47 @@ pub mod tournament_v5 {
#[serde(rename = "spectatorType")]
pub spectator_type: String,
}
/// TournamentGamesV5 data object.
/// LobbyEventWrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentGamesV5 {
#[serde(rename = "winningTeam")]
pub winning_team: std::vec::Vec<TournamentTeamV5>,
#[serde(rename = "losingTeam")]
pub losing_team: std::vec::Vec<TournamentTeamV5>,
/// Tournament Code
#[serde(rename = "shortCode")]
pub short_code: String,
/// Metadata for the TournamentCode
#[serde(rename = "metaData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub meta_data: Option<String>,
#[serde(rename = "gameId")]
pub game_id: i64,
#[serde(rename = "gameName")]
pub game_name: String,
#[serde(rename = "gameType")]
pub game_type: String,
/// Game Map ID
#[serde(rename = "gameMap")]
pub game_map: i32,
#[serde(rename = "gameMode")]
pub game_mode: String,
/// Region of the game
#[serde(rename = "region")]
pub region: String,
}
/// TournamentTeamV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentTeamV5 {
/// Player Unique UUID (Encrypted)
#[serde(rename = "puuid")]
pub puuid: String,
}
/// LobbyEventV5Wrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventV5Wrapper {
pub struct LobbyEventWrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEventV5>,
pub event_list: std::vec::Vec<LobbyEvent>,
}
/// LobbyEventV5 data object.
/// LobbyEvent data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventV5 {
pub struct LobbyEvent {
/// Timestamp from the event
#[serde(rename = "timestamp")]
pub timestamp: String,
/// The type of event that was triggered
#[serde(rename = "eventType")]
pub event_type: String,
/// The puuid that triggered the event (Encrypted)
#[serde(rename = "puuid")]
pub puuid: String,
/// The summonerId that triggered the event (Encrypted)
#[serde(rename = "summonerId")]
pub summoner_id: String,
}
/// ProviderRegistrationParametersV5 data object.
/// ProviderRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct ProviderRegistrationParametersV5 {
pub struct ProviderRegistrationParameters {
/// The region in which the provider will be running tournaments.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
#[serde(rename = "region")]
pub region: String,
pub region: crate::consts::TournamentRegion,
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
#[serde(rename = "url")]
pub url: String,
}
/// TournamentRegistrationParametersV5 data object.
/// TournamentRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentRegistrationParametersV5 {
pub struct TournamentRegistrationParameters {
/// The provider ID to specify the regional registered provider data to associate this tournament.
#[serde(rename = "providerId")]
pub provider_id: i32,
@ -3349,10 +3160,6 @@ pub mod val_content_v1 {
#[serde(rename = "ceremonies")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ceremonies: Option<std::vec::Vec<ContentItem>>,
/// Unknown type, this is a placeholder subject to change.
#[serde(rename = "totems")]
#[serde(skip_serializing_if = "Option::is_none")]
pub totems: Option<std::vec::Vec<String>>,
}
/// ContentItem data object.
#[derive(Clone, Debug)]

View File

@ -4,9 +4,9 @@ mod rate_limit;
pub use rate_limit::*;
mod rate_limit_type;
use std::time::Instant;
pub use rate_limit_type::*;
pub use rate_limit_type::*; // Hack for token_bucket_test.rs.
use std::time::Instant; // Hack for token_bucket_test.rs.
mod token_bucket;
pub use token_bucket::*;

View File

@ -1,14 +1,16 @@
use std::cmp;
use std::time::{Duration, Instant};
#[cfg(feature = "tracing")]
use tracing as log;
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
use reqwest::{Response, StatusCode};
use scan_fmt::scan_fmt;
use tokio::sync::Notify;
#[cfg(feature = "tracing")]
use tracing as log;
use super::{RateLimitType, TokenBucket, VectorTokenBucket};
use super::RateLimitType;
use super::{TokenBucket, VectorTokenBucket};
use crate::RiotApiConfig;
pub struct RateLimit {

View File

@ -1,15 +1,21 @@
use std::future::Future;
use std::sync::Arc;
use reqwest::{RequestBuilder, StatusCode};
#[cfg(feature = "tracing")]
use tracing as log;
#[cfg(feature = "tracing")]
use tracing::Instrument;
use super::{RateLimit, RateLimitType};
use reqwest::{RequestBuilder, StatusCode};
use crate::util::InsertOnlyCHashMap;
use crate::{ResponseInfo, Result, RiotApiConfig, RiotApiError};
use crate::ResponseInfo;
use crate::Result;
use crate::RiotApiConfig;
use crate::RiotApiError;
use super::RateLimit;
use super::RateLimitType;
pub struct RegionalRequester {
/// The app rate limit.

View File

@ -7,9 +7,8 @@ mod token_bucket {
include!("token_bucket.rs");
mod tests {
use lazy_static::lazy_static;
use super::*;
use lazy_static::lazy_static;
lazy_static! {
pub static ref ZERO: Duration = Duration::new(0, 0);

View File

@ -1,13 +1,17 @@
use std::future::Future;
use std::sync::Arc;
use reqwest::{Client, Method, RequestBuilder};
#[cfg(feature = "tracing")]
use tracing as log;
use reqwest::{Client, Method, RequestBuilder};
use crate::req::RegionalRequester;
use crate::util::InsertOnlyCHashMap;
use crate::{ResponseInfo, Result, RiotApiConfig, RiotApiError};
use crate::ResponseInfo;
use crate::Result;
use crate::RiotApiConfig;
use crate::RiotApiError;
/// For retrieving data from the Riot Games API.
///

View File

@ -16,18 +16,12 @@ pub enum GameType {
{{
for (const e of gameTypes) {
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
const nameNoGame = e['x-name'].replace(/_GAME$/, "");
}}
{{~ desc :line }}
/// {{= line }}
{{~}}
#[strum(to_string = "{{= e['x-name'] }}", serialize = "{{= nameNoGame }}")]
#[serde(alias = "{{= nameNoGame }}")]
{{= e['x-name'] }},
{{
}
}}
}
#[cfg(test)]
mod test;

View File

@ -14,11 +14,8 @@ newtype_enum! {
{{~ desc :line }}
/// {{= line }}
{{~}}
{{? e.notes }}
///
/// {{= e.notes }}
{{?}}
{{? e['x-deprecated'] }}
/// {{= e.notes }}
#[deprecated(note="{{= e.notes }}")]
{{?}}
{{= e['x-name'] }} = {{= e['x-value'] }},

View File

@ -28,7 +28,6 @@ Array.prototype.sortBy = function(lambda) {
function preamble() {
return `\
#![cfg_attr(rustfmt, rustfmt_skip)]
///////////////////////////////////////////////
// //
// ! //
@ -104,16 +103,16 @@ function formatJsonProperty(name) {
function formatAddQueryParam(param) {
const k = `"${param.name}"`;
const name = normalizePropName(param.name);
const condStart = param.required ? '' : `if let Some(${name}) = ${name} { `;
const condEnd = param.required ? '' : ' } else { request }'
const condStart = param.required ? '' : `mut request = request; if let Some(${name}) = ${name} { `;
const condEnd = param.required ? '' : ' }'
const prop = param.schema;
switch (prop.type) {
case 'array': return `let request = ${condStart}request.query(&*${name}.iter()`
+ `.map(|w| ( ${k}, w )).collect::<Vec<_>>())${condEnd};`;
case 'array': return `let ${condStart}request = request.query(&*${name}.iter()`
+ `.map(|w| ( ${k}, w )).collect::<Vec<_>>());${condEnd}`;
case 'object':
throw 'unsupported';
default:
return `let request = ${condStart}request.query(&[ (${k}, ${name}) ])${condEnd};`;
return `let ${condStart}request = request.query(&[ (${k}, ${name}) ]);${condEnd}`;
}
}

View File

@ -1,26 +0,0 @@
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::RU;
async_tests! {
my_runner {
summoner_leagues: async {
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "d3atomiz3d");
let sum = sum.await
.map_err(|e| format!("Error getting summoner: {}", e))?
.ok_or_else(|| "Failed to find summoner".to_owned())?;
let p = RIOT_API.league_v4().get_league_entries_for_summoner(ROUTE, &sum.id);
let s = p.await.map_err(|e| format!("Error getting league entries: {}", e))?;
let _ = s;
Ok(())
},
}
}

View File

@ -1,94 +0,0 @@
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use riven::models::tournament_stub_v5::*;
use testutils::*;
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
static MATCHES: &[&str] = &[
// New games with `match-v5.ParticipantDto.challenges` field.
"NA1_4209556127",
"NA1_4212715433",
"NA1_4265913704", // `match-v5.ParticipantDto.challenges.mejaisFullStackInTime`
];
async_tests! {
my_runner {
// Account-v1
account_v1_getbyriotid_getbypuuid: async {
// Game name is case and whitespace insensitive.
// But tag cannot have spaces. (Is it case sensitive?).
let account_tag = RIOT_API.account_v1().get_by_riot_id(ROUTE, "Lug nuts K", "000")
.await
.map_err(|e| format!("Failed to get account by riot ID: {}", e))?
.ok_or("Riot account not found!".to_owned())?;
let account_puuid = RIOT_API.account_v1().get_by_puuid(ROUTE, &account_tag.puuid)
.await
.map_err(|e| format!("Failed to get account by PUUID: {}", e))?;
let _ = account_puuid;
Ok(())
},
// Tournament stub test.
tournamentstub: async {
let ts = RIOT_API.tournament_stub_v5();
let provider_id = ts.register_provider_data(ROUTE, &ProviderRegistrationParametersV5 {
region: PlatformRoute::NA1.as_region_str().to_owned(),
url: "https://github.com/MingweiSamuel/Riven".to_owned(),
})
.await
.map_err(|e| e.to_string())?;
println!("provider_id: {}", provider_id);
let tournament_id = ts.register_tournament(ROUTE, &TournamentRegistrationParametersV5 {
name: Some("Riven Tourney :)".to_owned()),
provider_id,
})
.await
.map_err(|e| e.to_string())?;
println!("tournament_id: {}", tournament_id);
let codes_result = ts.create_tournament_code(ROUTE, &TournamentCodeParametersV5 {
map_type: "SUMMONERS_RIFT".to_owned(),
metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
pick_type: "TOURNAMENT_DRAFT".to_owned(),
spectator_type: "ALL".to_owned(),
team_size: 5,
allowed_participants: None,
enough_players: false,
}, tournament_id as i64, Some(300))
.await;
match codes_result {
Ok(codes) => {
rassert_eq!(300, codes.len());
println!("codes: {}", codes.join(", "));
Ok(())
}
Err(mut e) => {
if let Some(response) = e.take_response() {
eprintln!("{:?}", response.text().await);
}
Err(e.to_string())
}
}
},
match_v5_get: async {
match_v5_get(ROUTE, MATCHES).await
},
match_v5_get_timeline: async {
match_v5_get_timeline(ROUTE, MATCHES).await
},
}
}

View File

@ -3,10 +3,13 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use riven::models::summoner_v4::*;
use testutils::*;
// use riven::models::tournament_stub_v4::*;
fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
rassert_eq!(s1.name, s2.name, "Names didn't match {}.", "");
@ -22,8 +25,74 @@ fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
const ROUTE: PlatformRoute = PlatformRoute::NA1;
static MATCHES: &[&str] = &[
"NA1_3923487226",
"NA1_4049206905",
"NA1_4052515784",
"NA1_4062578191",
"NA1_4097036960",
// New games with `match-v5.ParticipantDto.challenges` field.
"NA1_4209556127",
"NA1_4212715433",
"NA1_4265913704", // `match-v5.ParticipantDto.challenges.mejaisFullStackInTime`
];
async_tests! {
my_runner {
// TODO FAILING since 2022/11/28 https://github.com/MingweiSamuel/Riven/actions/runs/3571320200/jobs/6003088646
// // Champion Mastery tests.
// tournamentstub: async {
// let tsv4 = RIOT_API.tournament_stub_v4();
// let provider_id = tsv4.register_provider_data(ROUTE, &ProviderRegistrationParameters {
// region: PlatformRoute::NA1.as_region_str().to_owned(),
// url: "https://github.com/MingweiSamuel/Riven".to_owned(),
// })
// .await
// .map_err(|e| e.to_string())?;
// println!("provider_id: {}", provider_id);
// let tournament_id = tsv4.register_tournament(ROUTE, &TournamentRegistrationParameters {
// name: Some("Riven Tourney :)".to_owned()),
// provider_id,
// })
// .await
// .map_err(|e| e.to_string())?;
// println!("tournament_id: {}", tournament_id);
// let codes_result = tsv4.create_tournament_code(ROUTE, &TournamentCodeParameters {
// map_type: "SUMMONERS_RIFT".to_owned(),
// metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
// pick_type: "TOURNAMENT_DRAFT".to_owned(),
// spectator_type: "ALL".to_owned(),
// team_size: 5,
// allowed_summoner_ids: None,
// }, tournament_id as i64, Some(300))
// .await;
// match codes_result {
// Ok(codes) => {
// rassert_eq!(300, codes.len());
// println!("codes: {}", codes.join(", "));
// Ok(())
// }
// Err(mut e) => {
// if let Some(response) = e.take_response() {
// eprintln!("{:?}", response.text().await);
// }
// Err(e.to_string())
// }
// }
// },
match_v5_get: async {
match_v5_get(ROUTE.to_regional(), MATCHES).await
},
match_v5_get_timeline: async {
match_v5_get_timeline(ROUTE.to_regional(), MATCHES).await
},
// Summoner tests.
summoner_double: async {
let l1p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "lug nuts k");
@ -55,12 +124,27 @@ async_tests! {
champion_mastery_v4: async {
let summoner = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "LugnutsK");
let summoner = summoner.await.map_err(|e| e.to_string())?.ok_or_else(|| "'LugnutsK' not found!".to_owned())?;
let masteries = RIOT_API.champion_mastery_v4().get_all_champion_masteries_by_puuid(ROUTE, &summoner.puuid);
let masteries = RIOT_API.champion_mastery_v4().get_all_champion_masteries(ROUTE, &summoner.id);
let masteries = masteries.await.map_err(|e| e.to_string())?;
rassert!(74 <= masteries.len());
Ok(())
},
// TO TEST THIS BUG: https://github.com/RiotGames/developer-relations/issues/572.
// https://lolchess.gg/leaderboards?mode=doubleup&region=na
// summoner must have double-up rank.
league_getforsummoner_tftbug: async {
// TODO(mingwei): get summoner from leaderboard to avoid updating this all the time.
const SUMMONER_NAME: &str = "jessixa";
let summoner_fut = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, SUMMONER_NAME);
let summoner = summoner_fut.await.map_err(|e| e.to_string())?.ok_or_else(|| format!("Failed to get \"{}\"", SUMMONER_NAME))?;
let league_fut = RIOT_API.league_v4().get_league_entries_for_summoner(ROUTE, &summoner.id);
let leagues = league_fut.await.map_err(|e| e.to_string())?;
let tft_league = leagues.iter().find(|league| QueueType::RANKED_TFT_DOUBLE_UP == league.queue_type);
rassert!(tft_league.is_some());
Ok(())
},
// TODO: MATCH-V4 REMOVED.
// matchlist_get: async {
// let sp = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "haha yes");
@ -172,5 +256,35 @@ async_tests! {
println!("{:?}", status);
Ok(())
},
summoner_history: async {
let summoner = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "Bang Fangirl");
let summoner = summoner.await.map_err(|e| e.to_string())?.ok_or_else(|| "'Bang Fangirl' not found!".to_owned())?;
let ids = RIOT_API
.match_v5()
.get_match_ids_by_puuid(
ROUTE.to_regional(),
&summoner.puuid,
Some(10),
None,
None,
None,
None,
None,
)
.await
.map_err(|e| e.to_string())?;
for id in ids {
let _match_data = RIOT_API
.match_v5()
.get_match(ROUTE.to_regional(), id.as_str())
.await
.map_err(|e| e.to_string())?;
}
Ok(())
},
}
}

View File

@ -3,13 +3,33 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::JP1;
static MATCHES: &[&str] = &[
// Regular game:
"KR_5495121707",
// `teamPosition` empty:
// AFK:
"JP1_312062554",
"JP1_326464722",
"JP1_289504387",
"JP1_285434511",
"JP1_307559381",
"JP1_292569767",
"JP1_310138781",
"JP1_300507433",
"JP1_283568774",
// `individualPosition` is set but `teamPosition` is empty due to AFK slightly after beginning:
"JP1_285797147",
// Illegal big `championId`s. https://github.com/RiotGames/developer-relations/issues/553
"JP1_267647303",
"JP1_273343663",
// Only has participant IDs for blue team.
"JP1_391732436",
// New field `ParticipantChallenges` `twoWardsOneSweeperCount`
@ -21,10 +41,6 @@ static MATCHES: &[&str] = &[
"JP1_405073638",
// New ARENA 2v2v2v2 game mode, broken `subteamPlacement`
"KR_6604607115",
// New field: `match-v5.ParticipantDto.missions`
"JP1_417935351",
// New field: `match-v5.ParticipantDto.riotIdGameName`
"JP1_419115017",
];
async_tests! {
@ -58,7 +74,7 @@ async_tests! {
},
// Make sure 403 is handled as expected.
tournament_forbidden: async {
let p = RIOT_API.tournament_v5().get_tournament_code(ROUTE.to_regional(), "INVALID_CODE");
let p = RIOT_API.tournament_v4().get_tournament_code(ROUTE.to_regional(), "INVALID_CODE");
let r = p.await;
rassert!(r.is_err());
rassert_eq!(Some(reqwest::StatusCode::FORBIDDEN), r.unwrap_err().status_code());

View File

@ -3,28 +3,22 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: RegionalRoute = RegionalRoute::EUROPE;
// Archived 2023-08-17
// // Illegal big `championId`s. https://github.com/RiotGames/developer-relations/issues/553
// "EUW1_5097684633",
// "EUW1_5097963383",
// "EUW1_5102203800", // https://github.com/MingweiSamuel/Riven/issues/36
// "EUW1_5765650307", // https://gist.github.com/MingweiSamuel/d5f9dc40cc5a80a9255e488f27705c56?permalink_comment_id=4088256#gistcomment-4088256
static MATCHES: &[&str] = &[
// Illegal big `championId`s. https://github.com/RiotGames/developer-relations/issues/553
"EUW1_5097684633",
"EUW1_5097963383",
"EUW1_5102203800", // https://github.com/MingweiSamuel/Riven/issues/36
"EUW1_5765650307", // https://gist.github.com/MingweiSamuel/d5f9dc40cc5a80a9255e488f27705c56?permalink_comment_id=4088256#gistcomment-4088256
// New ARENA 2v2v2v2 game mode
"EUW1_6511808246", // https://github.com/MingweiSamuel/Camille/issues/99
// Added 2023-08-27
"EUW1_6569580003",
"EUW1_6569417645",
"EUW1_6568707352",
"EUW1_6568635198",
"EUW1_6568537080",
];
async_tests! {

View File

@ -3,73 +3,54 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::EUW1;
async_tests! {
my_runner {
// Champion Mastery tests.
// SUMMONER ID ENDPOINT BROKEN: https://github.com/RiotGames/developer-relations/issues/830
// championmastery_getscore_ma5tery: async {
// let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
// let sum = sum.await
// .map_err(|e| format!("Error getting summoner: {}", e))?
// .ok_or_else(|| "Failed to find summoner".to_owned())?;
// let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score(ROUTE, &sum.id);
// let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?;
// rassert!((969..=1000).contains(&s), "Unexpected ma5tery score: {}.", s);
// Ok(())
// },
championmastery_getscore_ma5tery: async {
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
let sum = sum.await
.map_err(|e| format!("Error getting summoner: {}", e))?
.ok_or_else(|| "Failed to find summoner".to_owned())?;
let sum = sum.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get summoner".to_owned())?;
let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score_by_puuid(ROUTE, &sum.puuid);
let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?;
let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score(ROUTE, &sum.id);
let s = p.await.map_err(|e| e.to_string())?;
rassert!((969..=1000).contains(&s), "Unexpected ma5tery score: {}.", s);
Ok(())
},
championmastery_getall_ma5tery: async {
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
let sum = sum.await
.map_err(|e| format!("Error getting summoner: {}", e))?
.ok_or_else(|| "Failed to find summoner".to_owned())?;
let sum = sum.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get summoner".to_owned())?;
let p = RIOT_API.champion_mastery_v4().get_all_champion_masteries_by_puuid(ROUTE, &sum.puuid);
let s = p.await.map_err(|e| format!("Error getting all champion masteries: {}", e))?;
let p = RIOT_API.champion_mastery_v4().get_all_champion_masteries(ROUTE, &sum.id);
let s = p.await.map_err(|e| e.to_string())?;
rassert!(s.len() >= 142, "Expected masteries: {}.", s.len());
Ok(())
},
// https://github.com/RiotGames/developer-relations/issues/602
spectator_combo: async {
let featured_p = RIOT_API.spectator_v4().get_featured_games(ROUTE);
let featured = featured_p.await.map_err(|e| e.to_string())?;
// TODO: https://github.com/RiotGames/developer-relations/issues/602
// spectator_combo: async {
// let featured_p = RIOT_API.spectator_v4().get_featured_games(ROUTE);
// let featured = featured_p.await.map_err(|e| e.to_string())?;
rassert!(!featured.game_list.is_empty());
// rassert!(!featured.game_list.is_empty());
// let summoner_name = &featured.game_list[0].participants[0].summoner_name;
// let summoner_p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, summoner_name);
// let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to find summoner".to_owned())?;
// let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get summoner".to_owned())?;
let featured_game = &featured.game_list[0];
let participant = &featured_game.participants[0];
let summoner_id = participant.summoner_id.as_ref()
.ok_or_else(|| format!("Summoner in spectator featured game missing summoner ID: {}", &participant.summoner_name))?;
let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner_id);
let livegame_o = livegame_p.await.map_err(|e| e.to_string())?;
if let Some(livegame) = livegame_o {
let participant_match = livegame.participants.iter().find(|p| p.summoner_name == participant.summoner_name);
rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", &participant.summoner_name);
}
Ok(())
},
// let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner.id);
// let livegame_o = livegame_p.await.map_err(|e| e.to_string())?;
// if let Some(livegame) = livegame_o {
// let participant_match = livegame.participants.iter().find(|p| p.summoner_name == *summoner_name);
// rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", summoner_name);
// }
// Ok(())
// },
}
}

View File

@ -3,18 +3,17 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::EUW1;
static TFT_MATCHES: &[&str] = &[
"EUW1_6307427444", // https://github.com/MingweiSamuel/Riven/issues/50
"EUW1_6307262798",
// https://github.com/MingweiSamuel/Riven/pull/62
// https://github.com/MingweiSamuel/riotapi-schema/pull/43
"EUW1_6786745342",
];
async_tests! {

View File

@ -36,7 +36,7 @@ async_tests!{
REGION, &leagueentry.summoner_id);
summonerfuture.await
.map_err(|e| e.to_string())?
.ok_or(format!("Failed to find summoner_id {}.",
.ok_or(format!("Failed to get summoner_id {}.",
leagueentry.summoner_id))
});
future::join_all(summoners).await

View File

@ -3,10 +3,12 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::RIOT_API;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::LA1;
/// en_US description: "As a laner, get kills before 10 minutes outside your lane (anyone but your lane opponent)"

View File

@ -3,10 +3,12 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::PH2;
async_tests! {

View File

@ -3,10 +3,12 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::SG2;
async_tests! {

View File

@ -3,10 +3,12 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::TH2;
async_tests! {

View File

@ -3,10 +3,12 @@
mod async_tests;
mod testutils;
use testutils::RIOT_API;
use colored::*;
use riven::consts::*;
use riven::models::summoner_v4::Summoner;
use testutils::RIOT_API;
const ROUTE: PlatformRoute = PlatformRoute::TR1;

View File

@ -3,17 +3,19 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::RIOT_API;
use colored::*;
use riven::consts::*;
const ROUTE: ValPlatformRoute = ValPlatformRoute::LATAM;
async_tests! {
my_runner {
val_content_ranked_test: async {
let p = RIOT_API.val_content_v1().get_content(ROUTE, Some("zh-CN"));
let contents = p.await.map_err(|e| format!("Failed to get content: {}", e))?;
let contents = p.await.map_err(|e| e.to_string())?;
// Find the LAST active act, via `.rev().find(...)`.
// Added filter when parent id is 0000... as there are multiple that are active, the last active seems to be episode 5

View File

@ -3,10 +3,12 @@
mod async_tests;
mod testutils;
use colored::*;
use riven::consts::*;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::VN2;
async_tests! {

View File

@ -1,8 +1,7 @@
#![allow(dead_code)]
use std::future::Future;
use lazy_static::lazy_static;
use riven::consts::{PlatformRoute, QueueType, RegionalRoute};
use riven::{RiotApi, RiotApiConfig};
@ -49,7 +48,7 @@ pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(),
.get_by_summoner_id(route, &entry.summoner_id);
let summoner_info = summoner_future
.await
.map_err(|e| format!("Failed to find summoner info: {}", e))?;
.map_err(|e| format!("Failed to get summoner info: {}", e))?;
let match_ids_future = RIOT_API.match_v5().get_match_ids_by_puuid(
route.to_regional(),
@ -63,7 +62,7 @@ pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(),
);
let match_ids = match_ids_future
.await
.map_err(|e| format!("Failed to find summoner match IDs: {}", e))?;
.map_err(|e| format!("Failed to get summoner match IDs: {}", e))?;
Ok(match_ids) as Result<_, String>
});
@ -158,7 +157,8 @@ pub async fn match_v5_get(
}
Ok(())
});
join_all_future_errs(futures).await
futures::future::try_join_all(futures).await?;
Ok(())
}
pub async fn match_v5_get_timeline(
@ -191,18 +191,6 @@ pub async fn match_v5_get_timeline(
}
Ok(())
});
join_all_future_errs(futures).await
}
/// Joins all futures and keeps ALL error messages, separated by newlines.
async fn join_all_future_errs<T>(
result_tasks: impl Iterator<Item = impl Future<Output = Result<T, String>>>,
) -> Result<(), String> {
futures::future::join_all(result_tasks)
.await
.into_iter()
.filter_map(Result::err)
.reduce(|a, b| a + "\n" + &b)
.map(Err)
.unwrap_or(Ok(()))
futures::future::try_join_all(futures).await?;
Ok(())
}

View File

@ -1,10 +0,0 @@
format_code_in_doc_comments = true
format_macro_matchers = true
group_imports = "StdExternalCrate"
hex_literal_case = "Lower"
imports_granularity = "Module"
newline_style = "Unix"
normalize_comments = true
normalize_doc_attributes = true
use_field_init_shorthand = true
use_try_shorthand = true

View File

@ -1,4 +1,4 @@
#!/bin/bash
set -euxo pipefail
RGAPI_KEY="$(cat apikey.txt)" RUST_BACKTRACE=full RUST_LOG=riven=debug cargo test --no-fail-fast --features nightly,deny-unknown -- --nocapture
RGAPI_KEY="$(cat apikey.txt)" RUST_BACKTRACE=1 RUST_LOG=riven=debug cargo test --features nightly,deny-unknown -- --nocapture