forked from mirror/Riven
Compare commits
122 Commits
users/ming
...
v/2.x.x
Author | SHA1 | Date |
---|---|---|
Mingwei Samuel | 886ed4032d | |
Mingwei Samuel | 5e235e3c51 | |
Guillermo Lloret Talavera | 0f5fae1193 | |
Mingwei Samuel | 416140c41d | |
Mingwei Samuel | 4039a355d3 | |
Mingwei Samuel | b52ddcd5df | |
Mingwei Samuel | 4cc241baac | |
Mingwei Samuel | 8d810ccca8 | |
Mingwei Samuel | 33ef298039 | |
Mingwei Samuel | 655d04f8df | |
Mingwei Samuel | 25f41388f0 | |
Mingwei Samuel | 83d7fc3001 | |
Mingwei Samuel | 25b5d9fd22 | |
Mingwei Samuel | 4067b0cec7 | |
Mingwei Samuel | 406df5188f | |
Mingwei Samuel | af759728e3 | |
Mingwei Samuel | 1e136feaf3 | |
Mingwei Samuel | 172bc84620 | |
Mingwei Samuel | 2c284d860c | |
Mingwei Samuel | ceac9d203b | |
Mingwei Samuel | 4265d7e3c9 | |
Mingwei Samuel | 4391d214aa | |
Mingwei Samuel | 13a06b224a | |
Mingwei Samuel | b4398e4e98 | |
Mingwei Samuel | 904a6b083f | |
Mingwei Samuel | ce2cd7c7a2 | |
Mingwei Samuel | c3982c390e | |
Mingwei Samuel | c7f5c59495 | |
Mingwei Samuel | ac12a8bfc2 | |
Mingwei Samuel | 09f0f2562b | |
Mingwei Samuel | dd77ffa6dd | |
Mingwei Samuel | a9a0990d5c | |
Mingwei Samuel | c449a4fc52 | |
Mingwei Samuel | dc73fcbf46 | |
Mingwei Samuel | fb95601526 | |
Mingwei Samuel | bd76b24b2b | |
Mingwei Samuel | 56b75ace18 | |
Mingwei Samuel | 2661acf5e9 | |
Mingwei Samuel | c4a9993ac2 | |
Mingwei Samuel | 512a7e9020 | |
Mingwei Samuel | daf18c476c | |
Mingwei Samuel | e67ffff627 | |
Mingwei Samuel | 9b08e058b7 | |
Mingwei Samuel | f79f2edab3 | |
Mingwei Samuel | 1ec4c18ae4 | |
Mingwei Samuel | c58da65298 | |
Mingwei Samuel | ac76a87367 | |
Mingwei Samuel | fc42abcbe2 | |
Mingwei Samuel | 1fc947a040 | |
Mingwei Samuel | 8e3e081944 | |
Mingwei Samuel | 41a00d68f6 | |
Mingwei Samuel | 800f9c83f4 | |
Mingwei Samuel | 7c0fff55ae | |
Mingwei Samuel | 908d0d64ed | |
Mingwei Samuel | 2aa493abfe | |
Mingwei Samuel | d15d43797e | |
Mingwei Samuel | 08bb2afd68 | |
Mingwei Samuel | 9a2e5277c1 | |
Mingwei Samuel | 3253fa4ec2 | |
Mingwei Samuel | bf51ba0a83 | |
Mingwei Samuel | 3136f84680 | |
Mingwei Samuel | 3070216709 | |
Mingwei Samuel | 78f187570f | |
Mingwei Samuel | ad08632089 | |
Mingwei Samuel | 4b3afbd8ab | |
Mingwei Samuel | cb5bd58784 | |
Mingwei Samuel | e53d78c807 | |
Mingwei Samuel | 3d1188b5c9 | |
Mingwei Samuel | 150566983e | |
Mingwei Samuel | 7e78abb7e5 | |
Mingwei Samuel | 1567bae16e | |
Mingwei Samuel | 112f6bceae | |
Mingwei Samuel | 94e0a0d1d3 | |
Mingwei Samuel | 975b954f3f | |
Mingwei Samuel | 0ea966a105 | |
Mingwei Samuel | 642ed27fa2 | |
Mingwei Samuel | 26adf882fb | |
Mingwei Samuel | ac46e74de4 | |
Mingwei Samuel | 0a1d5537cc | |
Mingwei Samuel | e5803092bf | |
Mingwei Samuel | fa3e7a4bab | |
Mingwei Samuel | 520fad7e7e | |
Mingwei Samuel | 728aa0f99a | |
Mingwei Samuel | 32fe532f07 | |
Mingwei Samuel | d05b068bb8 | |
Mingwei Samuel | d2c661b9ab | |
Mingwei Samuel | 599f88ec73 | |
Mingwei Samuel | 7f0b63bf92 | |
Mingwei Samuel | 563f9e84a7 | |
Mingwei Samuel | 9f5b12cd1b | |
Mingwei Samuel | 129002bf23 | |
Mingwei Samuel | a11b6874f6 | |
Mingwei Samuel | f51a67c1fc | |
sir naji | 6512866c26 | |
Mingwei Samuel | 97b6017b42 | |
Mingwei Samuel | d7330fcd84 | |
Mingwei Samuel | d2a213c287 | |
Mingwei Samuel | 4f5d115831 | |
Mingwei Samuel | 871044974c | |
Mingwei Samuel | 6c5af2bfd6 | |
Mingwei Samuel | 08e276a558 | |
Mingwei Samuel | 0753fe1b34 | |
Mingwei Samuel | c9bca855f2 | |
Mingwei Samuel | 342c87e682 | |
dependabot[bot] | d05c3a11d4 | |
Mingwei Samuel | 6c41bd03e4 | |
Mingwei Samuel | 998eb4ec46 | |
Mingwei Samuel | f3f34b6ff5 | |
tomchandler | 1af0539a84 | |
Mingwei Samuel | 036f818457 | |
Mingwei Samuel | 7d545b55af | |
Mingwei Samuel | a2699a695f | |
djazouli | 2f4aae6635 | |
Mingwei Samuel | 650380cdf9 | |
Mingwei Samuel | 76a48963e5 | |
Mingwei Samuel | 3ae9f36888 | |
Mingwei Samuel | 713995491e | |
Mingwei Samuel | bfa9bdc36e | |
Mingwei Samuel | 2e52b03c63 | |
Mingwei Samuel | b24fdcb765 | |
Mingwei Samuel | 104db04d9d | |
Mingwei Samuel | 20863c5bcc |
|
@ -0,0 +1,120 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [v/2.x.x]
|
||||||
|
pull_request:
|
||||||
|
branches: [v/2.x.x]
|
||||||
|
schedule:
|
||||||
|
- cron: "24 05 * * *" # Daily at 10:24 PM PDT, 9:24 PM PST.
|
||||||
|
workflow_dispatch:
|
||||||
|
# TODO: generate nightly releases
|
||||||
|
# inputs:
|
||||||
|
# should_bench:
|
||||||
|
# description: "Should Benchmark? (`true`)"
|
||||||
|
# required: true
|
||||||
|
# default: "false"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre_job:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
||||||
|
steps:
|
||||||
|
- id: skip_check
|
||||||
|
uses: fkirc/skip-duplicate-actions@v3.4.0
|
||||||
|
with:
|
||||||
|
cancel_others: "true"
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Check & Test
|
||||||
|
needs: pre_job
|
||||||
|
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Install Node dependencies
|
||||||
|
run: npm ci --prefix riven/srcgen
|
||||||
|
|
||||||
|
- name: Run codegen
|
||||||
|
run: node riven/srcgen
|
||||||
|
|
||||||
|
- name: Install Rust nightly toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
components: rustfmt
|
||||||
|
|
||||||
|
- name: Run `cargo +stable check --all-targets`
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
command: check
|
||||||
|
args: --all-targets
|
||||||
|
|
||||||
|
- name: Run `cargo +stable check --all-targets --features tracing`
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
command: check
|
||||||
|
args: --all-targets --features tracing
|
||||||
|
|
||||||
|
- name: Run `cargo check --all-targets --features nightly,tracing`
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: --all-targets --features nightly,tracing
|
||||||
|
|
||||||
|
- name: Run `cargo build --all-targets --features nightly,deny-unknown`
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --all-targets --features nightly,deny-unknown
|
||||||
|
|
||||||
|
- name: Run `cargo test --features nightly,deny-unknown`
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --no-fail-fast --features nightly,deny-unknown
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
RUSTLOG: riven=trace
|
||||||
|
RGAPI_KEY: ${{ secrets.RGAPI_KEY }}
|
||||||
|
|
||||||
|
lints:
|
||||||
|
name: Lints
|
||||||
|
needs: pre_job
|
||||||
|
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install nightly toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- name: Run cargo fmt
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
||||||
|
|
||||||
|
- name: Run cargo clippy
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
args: -- -D warnings
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"rust-analyzer.runnableEnv": [
|
||||||
|
{
|
||||||
|
// Set output levels for `tracing` logging.
|
||||||
|
"env": {
|
||||||
|
"RUST_BACKTRACE": "1",
|
||||||
|
"RUST_LOG": "riven=debug"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"riven",
|
"riven",
|
||||||
"example/proxy",
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,10 +45,10 @@ rt.block_on(async {
|
||||||
|
|
||||||
// Get champion mastery data.
|
// Get champion mastery data.
|
||||||
let masteries = riot_api.champion_mastery_v4()
|
let masteries = riot_api.champion_mastery_v4()
|
||||||
.get_all_champion_masteries(PlatformRoute::NA1, &summoner.id).await
|
.get_all_champion_masteries_by_puuid(PlatformRoute::NA1, &summoner.puuid).await
|
||||||
.expect("Get champion masteries failed.");
|
.expect("Get champion masteries failed.");
|
||||||
|
|
||||||
// Print champioon masteries.
|
// Print champion masteries.
|
||||||
for (i, mastery) in masteries.iter().take(10).enumerate() {
|
for (i, mastery) in masteries.iter().take(10).enumerate() {
|
||||||
println!("{: >2}) {: <9} {: >7} ({})", i + 1,
|
println!("{: >2}) {: <9} {: >7} ({})", i + 1,
|
||||||
mastery.champion_id.name().unwrap_or("UNKNOWN"),
|
mastery.champion_id.name().unwrap_or("UNKNOWN"),
|
||||||
|
@ -72,7 +72,7 @@ Output:
|
||||||
```
|
```
|
||||||
The [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html)
|
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)
|
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/example/proxy)
|
and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/examples/proxy)
|
||||||
provide more example usage.
|
provide more example usage.
|
||||||
|
|
||||||
## Feature Flags
|
## Feature Flags
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[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"
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "riven"
|
name = "riven"
|
||||||
version = "2.7.0"
|
version = "2.32.0"
|
||||||
authors = ["Mingwei Samuel <mingwei.samuel@gmail.com>"]
|
authors = ["Mingwei Samuel <mingwei.samuel@gmail.com>"]
|
||||||
repository = "https://github.com/MingweiSamuel/Riven"
|
repository = "https://github.com/MingweiSamuel/Riven"
|
||||||
description = "Riot Games API Library"
|
description = "Riot Games API Library"
|
||||||
|
@ -28,7 +28,15 @@ default-tls = [ "reqwest/default-tls" ]
|
||||||
native-tls = [ "reqwest/native-tls" ]
|
native-tls = [ "reqwest/native-tls" ]
|
||||||
rustls-tls = [ "reqwest/rustls-tls" ]
|
rustls-tls = [ "reqwest/rustls-tls" ]
|
||||||
|
|
||||||
|
deny-unknown = [ "deny-unknown-fields", "deny-unknown-enum-variants" ]
|
||||||
|
# If enabled, extra unknown fields encountered during deserialization will
|
||||||
|
# cause an error instead of being ignored.
|
||||||
deny-unknown-fields = []
|
deny-unknown-fields = []
|
||||||
|
# If enabled, deserialization of unknown enum variants will cause an error
|
||||||
|
# instead of being deserialized to `UNKNOWN` or other integer variants.
|
||||||
|
deny-unknown-enum-variants = [ "deny-unknown-enum-variants-strings", "deny-unknown-enum-variants-integers" ]
|
||||||
|
deny-unknown-enum-variants-strings = []
|
||||||
|
deny-unknown-enum-variants-integers = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
|
@ -47,6 +55,10 @@ tracing = { version = "0.1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
colored = "2"
|
colored = "2"
|
||||||
env_logger = "0.9"
|
env_logger = "0.10.0"
|
||||||
fake_instant = "0.4"
|
fake_instant = "0.5.0"
|
||||||
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread" ] }
|
futures = "0.3"
|
||||||
|
hyper = { version = "0.14", features = [ "server" ] }
|
||||||
|
tokio = { version = "1", features = [ "full" ] }
|
||||||
|
tracing = "0.1"
|
||||||
|
tracing-subscriber = "0.2"
|
||||||
|
|
|
@ -14,7 +14,7 @@ when Riven is at the rate limit.
|
||||||
Set `RGAPI_KEY` env var then run:
|
Set `RGAPI_KEY` env var then run:
|
||||||
```bash
|
```bash
|
||||||
export RGAPI_KEY=RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
export RGAPI_KEY=RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||||
cargo run
|
cargo run --example proxy
|
||||||
```
|
```
|
||||||
|
|
||||||
Test in your browser or using `curl`. The first path segment specifies the region:
|
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
|
$ curl http://localhost:3000/eu/val/status/v1/platform-data
|
||||||
{"id": "EU", "name": "Europe", "locales": ["..."], "maintenances": [], "incidents": []}
|
{"id": "EU", "name": "Europe", "locales": ["..."], "maintenances": [], "incidents": []}
|
||||||
|
|
||||||
$ curl http://localhost:3000/americas/lol/tournament-stub/v4/providers -H "Content-Type: application/json" -d '{"region":"JP","url":"https://github.com/MingweiSamuel/Riven"}'
|
$ curl http://localhost:3000/americas/lol/tournament-stub/v5/providers -H "Content-Type: application/json" -d '{"region":"JP","url":"https://github.com/MingweiSamuel/Riven"}'
|
||||||
764
|
1
|
||||||
|
|
||||||
$ curl http://localhost:3000/na1/unknown/endpoint
|
$ curl http://localhost:3000/na1/unknown/endpoint
|
||||||
{"error":"Riot API endpoint method not found."}
|
{"error":"Riot API endpoint method not found."}
|
|
@ -2,16 +2,14 @@
|
||||||
|
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
|
|
||||||
use hyper::http;
|
use http::{Method, Request, Response, StatusCode};
|
||||||
use http::{ Method, Request, Response, StatusCode };
|
|
||||||
use hyper::{ Body, Server };
|
|
||||||
use hyper::service::{ make_service_fn, service_fn };
|
|
||||||
use hyper::header::HeaderValue;
|
use hyper::header::HeaderValue;
|
||||||
|
use hyper::service::{make_service_fn, service_fn};
|
||||||
|
use hyper::{http, Body, Server};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use tracing as log;
|
|
||||||
|
|
||||||
use riven::{ RiotApi, RiotApiConfig };
|
|
||||||
use riven::consts::Route;
|
use riven::consts::Route;
|
||||||
|
use riven::{RiotApi, RiotApiConfig};
|
||||||
|
use tracing as log;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// Create lazy static RiotApi instance.
|
/// Create lazy static RiotApi instance.
|
||||||
|
@ -31,47 +29,64 @@ lazy_static! {
|
||||||
fn create_json_response(body: &'static str, status: StatusCode) -> Response<Body> {
|
fn create_json_response(body: &'static str, status: StatusCode) -> Response<Body> {
|
||||||
let mut resp = Response::new(Body::from(body));
|
let mut resp = Response::new(Body::from(body));
|
||||||
*resp.status_mut() = status;
|
*resp.status_mut() = status;
|
||||||
resp.headers_mut().insert(hyper::header::CONTENT_TYPE, HeaderValue::from_static("application/json"));
|
resp.headers_mut().insert(
|
||||||
|
hyper::header::CONTENT_TYPE,
|
||||||
|
HeaderValue::from_static("application/json"),
|
||||||
|
);
|
||||||
resp
|
resp
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Main request handler service.
|
/// Main request handler service.
|
||||||
async fn handle_request(req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
async fn handle_request(req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
||||||
|
|
||||||
let (parts, body) = req.into_parts();
|
let (parts, body) = req.into_parts();
|
||||||
let http::request::Parts { method, uri, .. } = parts;
|
let http::request::Parts { method, uri, .. } = parts;
|
||||||
|
|
||||||
// Handle path.
|
// Handle path.
|
||||||
let path_data_opt = parse_path(&method, uri.path());
|
let path_data_opt = parse_path(&method, uri.path());
|
||||||
let ( route, method_id, req_path ) = match path_data_opt {
|
let (route, method_id, req_path) = match path_data_opt {
|
||||||
None => return Ok(create_json_response(
|
None => {
|
||||||
r#"{"error":"Riot API endpoint method not found."}"#, StatusCode::NOT_FOUND)),
|
return Ok(create_json_response(
|
||||||
|
r#"{"error":"Riot API endpoint method not found."}"#,
|
||||||
|
StatusCode::NOT_FOUND,
|
||||||
|
))
|
||||||
|
}
|
||||||
Some(path_data) => path_data,
|
Some(path_data) => path_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
log::debug!("Request to route {:?}, method ID {:?}: {} {:?}.", route, method_id, method, req_path);
|
log::debug!(
|
||||||
|
"Request to route {:?}, method ID {:?}: {} {:?}.",
|
||||||
|
route,
|
||||||
|
method_id,
|
||||||
|
method,
|
||||||
|
req_path
|
||||||
|
);
|
||||||
|
|
||||||
// Convert http:request::Parts from hyper to reqwest's RequestBuilder.
|
// Convert http:request::Parts from hyper to reqwest's RequestBuilder.
|
||||||
let body = match hyper::body::to_bytes(body).await {
|
let body = match hyper::body::to_bytes(body).await {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::info!("Error handling request body: {:#?}", err);
|
log::info!("Error handling request body: {:#?}", err);
|
||||||
return Ok(create_json_response(
|
return Ok(create_json_response(
|
||||||
r#"{"error":"Failed to handle request body."}"#, StatusCode::BAD_REQUEST));
|
r#"{"error":"Failed to handle request body."}"#,
|
||||||
},
|
StatusCode::BAD_REQUEST,
|
||||||
|
));
|
||||||
|
}
|
||||||
Ok(bytes) => bytes,
|
Ok(bytes) => bytes,
|
||||||
};
|
};
|
||||||
|
|
||||||
let req_builder = RIOT_API.request(method, route.into(), req_path)
|
let req_builder = RIOT_API.request(method, route.into(), req_path).body(body);
|
||||||
.body(body);
|
|
||||||
|
|
||||||
// Send request to Riot API.
|
// Send request to Riot API.
|
||||||
let resp_result = RIOT_API.execute_raw(method_id, route.into(), req_builder).await;
|
let resp_result = RIOT_API
|
||||||
|
.execute_raw(method_id, route.into(), req_builder)
|
||||||
|
.await;
|
||||||
let resp_info = match resp_result {
|
let resp_info = match resp_result {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::info!("Riot API error: {:#?}", err.source_reqwest_error());
|
log::info!("Riot API error: {:#?}", err.source_reqwest_error());
|
||||||
return Ok(create_json_response(
|
return Ok(create_json_response(
|
||||||
r#"{"error":"Riot API request failed."}"#, StatusCode::INTERNAL_SERVER_ERROR));
|
r#"{"error":"Riot API request failed."}"#,
|
||||||
},
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
));
|
||||||
|
}
|
||||||
Ok(resp_info) => resp_info,
|
Ok(resp_info) => resp_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,37 +101,43 @@ async fn handle_request(req: Request<Body>) -> Result<Response<Body>, Infallible
|
||||||
}
|
}
|
||||||
// Otherwise copy body.
|
// Otherwise copy body.
|
||||||
else {
|
else {
|
||||||
*out_response.status_mut() = api_response.status();
|
*out_response.status_mut() = api_response.status();
|
||||||
|
|
||||||
// Using streams would be faster.
|
// Using streams would be faster.
|
||||||
let bytes_result = api_response.bytes().await;
|
let bytes_result = api_response.bytes().await;
|
||||||
let bytes = match bytes_result {
|
let bytes = match bytes_result {
|
||||||
Err(_err) => return Ok(create_json_response(
|
Err(_err) => {
|
||||||
r#"{"error":"Failed to get body from Riot API response."}"#, StatusCode::INTERNAL_SERVER_ERROR)),
|
return Ok(create_json_response(
|
||||||
|
r#"{"error":"Failed to get body from Riot API response."}"#,
|
||||||
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
))
|
||||||
|
}
|
||||||
Ok(bytes) => bytes,
|
Ok(bytes) => bytes,
|
||||||
};
|
};
|
||||||
*out_response.body_mut() = Body::from((&bytes[..]).to_vec());
|
*out_response.body_mut() = Body::from(bytes);
|
||||||
}
|
}
|
||||||
Ok(out_response)
|
Ok(out_response)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the region, method_id, and Riot API path based on the given http method and path.
|
/// Gets the region, method_id, and Riot API path based on the given http method and path.
|
||||||
fn parse_path<'a>(http_method: &Method, req_path: &'a str) -> Option<( Route, &'static str, &'a str )> {
|
fn parse_path<'a>(
|
||||||
|
http_method: &Method,
|
||||||
|
req_path: &'a str,
|
||||||
|
) -> Option<(Route, &'static str, &'a str)> {
|
||||||
// Split URI into region and rest of path.
|
// Split URI into region and rest of path.
|
||||||
let req_path = req_path.trim_start_matches('/');
|
let req_path = req_path.trim_start_matches('/');
|
||||||
let ( route, req_path ) = req_path.split_at(req_path.find('/')?);
|
let (route, req_path) = req_path.split_at(req_path.find('/')?);
|
||||||
let route: Route = route.to_uppercase().parse().ok()?;
|
let route: Route = route.to_uppercase().parse().ok()?;
|
||||||
|
|
||||||
// Find method_id for given path.
|
// Find method_id for given path.
|
||||||
let method_id = find_matching_method_id(http_method, req_path)?;
|
let method_id = find_matching_method_id(http_method, req_path)?;
|
||||||
|
|
||||||
Some(( route, method_id, req_path ))
|
Some((route, method_id, req_path))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds the method_id given the request path.
|
/// Finds the method_id given the request path.
|
||||||
fn find_matching_method_id(http_method: &Method, req_path: &str) -> Option<&'static str> {
|
fn find_matching_method_id(http_method: &Method, req_path: &str) -> Option<&'static str> {
|
||||||
for ( endpoint_http_method, ref_path, method_id ) in &riven::meta::ALL_ENDPOINTS {
|
for (endpoint_http_method, ref_path, method_id) in &riven::meta::ALL_ENDPOINTS {
|
||||||
if http_method == endpoint_http_method && paths_match(ref_path, req_path) {
|
if http_method == endpoint_http_method && paths_match(ref_path, req_path) {
|
||||||
return Some(method_id);
|
return Some(method_id);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +181,7 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
async { Ok::<_, Infallible>(service_fn(handle_request)) }
|
async { Ok::<_, Infallible>(service_fn(handle_request)) }
|
||||||
});
|
});
|
||||||
|
|
||||||
let addr = ([ 127, 0, 0, 1 ], 3000).into();
|
let addr = ([127, 0, 0, 1], 3000).into();
|
||||||
|
|
||||||
let server = Server::bind(&addr).serve(make_svc);
|
let server = Server::bind(&addr).serve(make_svc);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
//! Configuration of RiotApi.
|
//! Configuration of RiotApi.
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use reqwest::header::{HeaderMap, HeaderValue};
|
||||||
use reqwest::ClientBuilder;
|
use reqwest::ClientBuilder;
|
||||||
use reqwest::header::{ HeaderMap, HeaderValue };
|
|
||||||
|
|
||||||
/// Configuration for instantiating RiotApi.
|
/// Configuration for instantiating RiotApi.
|
||||||
///
|
|
||||||
///
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct RiotApiConfig {
|
pub struct RiotApiConfig {
|
||||||
pub(crate) base_url: String,
|
pub(crate) base_url: String,
|
||||||
|
@ -72,7 +70,7 @@ impl RiotApiConfig {
|
||||||
let mut default_headers = HeaderMap::new();
|
let mut default_headers = HeaderMap::new();
|
||||||
default_headers.insert(
|
default_headers.insert(
|
||||||
Self::RIOT_KEY_HEADER,
|
Self::RIOT_KEY_HEADER,
|
||||||
HeaderValue::from_bytes(api_key.as_ref()).unwrap()
|
HeaderValue::from_bytes(api_key.as_ref()).unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -82,10 +80,7 @@ impl RiotApiConfig {
|
||||||
method_rate_usage_factor: Self::DEFAULT_RATE_USAGE_FACTOR,
|
method_rate_usage_factor: Self::DEFAULT_RATE_USAGE_FACTOR,
|
||||||
burst_factor: Self::PRECONFIG_BURST_BURST_FACTOR,
|
burst_factor: Self::PRECONFIG_BURST_BURST_FACTOR,
|
||||||
duration_overhead: Self::PRECONFIG_BURST_DURATION_OVERHEAD,
|
duration_overhead: Self::PRECONFIG_BURST_DURATION_OVERHEAD,
|
||||||
client_builder: Some(
|
client_builder: Some(ClientBuilder::new().default_headers(default_headers)),
|
||||||
ClientBuilder::new()
|
|
||||||
.default_headers(default_headers)
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +186,10 @@ impl RiotApiConfig {
|
||||||
self.method_rate_usage_factor = rate_usage_factor;
|
self.method_rate_usage_factor = rate_usage_factor;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
panic!("rate_usage_factor \"{}\" not in range (0, 1].", rate_usage_factor);
|
panic!(
|
||||||
|
"rate_usage_factor \"{}\" not in range (0, 1].",
|
||||||
|
rate_usage_factor
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [Self::set_rate_usage_factor]. Setting this is useful if you have multiple
|
/// See [Self::set_rate_usage_factor]. Setting this is useful if you have multiple
|
||||||
|
@ -209,7 +207,10 @@ impl RiotApiConfig {
|
||||||
self.app_rate_usage_factor = app_rate_usage_factor;
|
self.app_rate_usage_factor = app_rate_usage_factor;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
panic!("app_rate_usage_factor \"{}\" not in range (0, 1].", app_rate_usage_factor);
|
panic!(
|
||||||
|
"app_rate_usage_factor \"{}\" not in range (0, 1].",
|
||||||
|
app_rate_usage_factor
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [Self::set_rate_usage_factor] and [Self::set_app_rate_usage_factor].
|
/// See [Self::set_rate_usage_factor] and [Self::set_app_rate_usage_factor].
|
||||||
|
@ -227,7 +228,10 @@ impl RiotApiConfig {
|
||||||
self.method_rate_usage_factor = method_rate_usage_factor;
|
self.method_rate_usage_factor = method_rate_usage_factor;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
panic!("method_rate_usage_factor \"{}\" not in range (0, 1].", method_rate_usage_factor);
|
panic!(
|
||||||
|
"method_rate_usage_factor \"{}\" not in range (0, 1].",
|
||||||
|
method_rate_usage_factor
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Burst percentage controls how many burst requests are allowed and
|
/// Burst percentage controls how many burst requests are allowed and
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -15,6 +16,7 @@ newtype_enum! {
|
||||||
///
|
///
|
||||||
/// Field | Name | Identifier | Id
|
/// Field | Name | Identifier | Id
|
||||||
/// ---|---|---|---
|
/// ---|---|---|---
|
||||||
|
/// `NONE` | None (no ban) | | -1
|
||||||
/// `AATROX` | "Aatrox" | "Aatrox" | 266
|
/// `AATROX` | "Aatrox" | "Aatrox" | 266
|
||||||
/// `AHRI` | "Ahri" | "Ahri" | 103
|
/// `AHRI` | "Ahri" | "Ahri" | 103
|
||||||
/// `AKALI` | "Akali" | "Akali" | 84
|
/// `AKALI` | "Akali" | "Akali" | 84
|
||||||
|
@ -32,6 +34,7 @@ newtype_enum! {
|
||||||
/// `BLITZCRANK` | "Blitzcrank" | "Blitzcrank" | 53
|
/// `BLITZCRANK` | "Blitzcrank" | "Blitzcrank" | 53
|
||||||
/// `BRAND` | "Brand" | "Brand" | 63
|
/// `BRAND` | "Brand" | "Brand" | 63
|
||||||
/// `BRAUM` | "Braum" | "Braum" | 201
|
/// `BRAUM` | "Braum" | "Braum" | 201
|
||||||
|
/// `BRIAR` | "Briar" | "Briar" | 233
|
||||||
/// `CAITLYN` | "Caitlyn" | "Caitlyn" | 51
|
/// `CAITLYN` | "Caitlyn" | "Caitlyn" | 51
|
||||||
/// `CAMILLE` | "Camille" | "Camille" | 164
|
/// `CAMILLE` | "Camille" | "Camille" | 164
|
||||||
/// `CASSIOPEIA` | "Cassiopeia" | "Cassiopeia" | 69
|
/// `CASSIOPEIA` | "Cassiopeia" | "Cassiopeia" | 69
|
||||||
|
@ -57,6 +60,7 @@ newtype_enum! {
|
||||||
/// `GWEN` | "Gwen" | "Gwen" | 887
|
/// `GWEN` | "Gwen" | "Gwen" | 887
|
||||||
/// `HECARIM` | "Hecarim" | "Hecarim" | 120
|
/// `HECARIM` | "Hecarim" | "Hecarim" | 120
|
||||||
/// `HEIMERDINGER` | "Heimerdinger" | "Heimerdinger" | 74
|
/// `HEIMERDINGER` | "Heimerdinger" | "Heimerdinger" | 74
|
||||||
|
/// `HWEI` | "Hwei" | "Hwei" | 910
|
||||||
/// `ILLAOI` | "Illaoi" | "Illaoi" | 420
|
/// `ILLAOI` | "Illaoi" | "Illaoi" | 420
|
||||||
/// `IRELIA` | "Irelia" | "Irelia" | 39
|
/// `IRELIA` | "Irelia" | "Irelia" | 39
|
||||||
/// `IVERN` | "Ivern" | "Ivern" | 427
|
/// `IVERN` | "Ivern" | "Ivern" | 427
|
||||||
|
@ -66,6 +70,7 @@ newtype_enum! {
|
||||||
/// `JAYCE` | "Jayce" | "Jayce" | 126
|
/// `JAYCE` | "Jayce" | "Jayce" | 126
|
||||||
/// `JHIN` | "Jhin" | "Jhin" | 202
|
/// `JHIN` | "Jhin" | "Jhin" | 202
|
||||||
/// `JINX` | "Jinx" | "Jinx" | 222
|
/// `JINX` | "Jinx" | "Jinx" | 222
|
||||||
|
/// `K_SANTE` | "K'Sante" | "KSante" | 897
|
||||||
/// `KAI_SA` | "Kai'Sa" | "Kaisa" | 145
|
/// `KAI_SA` | "Kai'Sa" | "Kaisa" | 145
|
||||||
/// `KALISTA` | "Kalista" | "Kalista" | 429
|
/// `KALISTA` | "Kalista" | "Kalista" | 429
|
||||||
/// `KARMA` | "Karma" | "Karma" | 43
|
/// `KARMA` | "Karma" | "Karma" | 43
|
||||||
|
@ -91,14 +96,17 @@ newtype_enum! {
|
||||||
/// `MALZAHAR` | "Malzahar" | "Malzahar" | 90
|
/// `MALZAHAR` | "Malzahar" | "Malzahar" | 90
|
||||||
/// `MAOKAI` | "Maokai" | "Maokai" | 57
|
/// `MAOKAI` | "Maokai" | "Maokai" | 57
|
||||||
/// `MASTER_YI` | "Master Yi" | "MasterYi" | 11
|
/// `MASTER_YI` | "Master Yi" | "MasterYi" | 11
|
||||||
|
/// `MILIO` | "Milio" | "Milio" | 902
|
||||||
/// `MISS_FORTUNE` | "Miss Fortune" | "MissFortune" | 21
|
/// `MISS_FORTUNE` | "Miss Fortune" | "MissFortune" | 21
|
||||||
/// `MORDEKAISER` | "Mordekaiser" | "Mordekaiser" | 82
|
/// `MORDEKAISER` | "Mordekaiser" | "Mordekaiser" | 82
|
||||||
/// `MORGANA` | "Morgana" | "Morgana" | 25
|
/// `MORGANA` | "Morgana" | "Morgana" | 25
|
||||||
|
/// `NAAFIRI` | "Naafiri" | "Naafiri" | 950
|
||||||
/// `NAMI` | "Nami" | "Nami" | 267
|
/// `NAMI` | "Nami" | "Nami" | 267
|
||||||
/// `NASUS` | "Nasus" | "Nasus" | 75
|
/// `NASUS` | "Nasus" | "Nasus" | 75
|
||||||
/// `NAUTILUS` | "Nautilus" | "Nautilus" | 111
|
/// `NAUTILUS` | "Nautilus" | "Nautilus" | 111
|
||||||
/// `NEEKO` | "Neeko" | "Neeko" | 518
|
/// `NEEKO` | "Neeko" | "Neeko" | 518
|
||||||
/// `NIDALEE` | "Nidalee" | "Nidalee" | 76
|
/// `NIDALEE` | "Nidalee" | "Nidalee" | 76
|
||||||
|
/// `NILAH` | "Nilah" | "Nilah" | 895
|
||||||
/// `NOCTURNE` | "Nocturne" | "Nocturne" | 56
|
/// `NOCTURNE` | "Nocturne" | "Nocturne" | 56
|
||||||
/// `NUNU_WILLUMP` | "Nunu & Willump" | "Nunu" | 20
|
/// `NUNU_WILLUMP` | "Nunu & Willump" | "Nunu" | 20
|
||||||
/// `OLAF` | "Olaf" | "Olaf" | 2
|
/// `OLAF` | "Olaf" | "Olaf" | 2
|
||||||
|
@ -131,6 +139,7 @@ newtype_enum! {
|
||||||
/// `SION` | "Sion" | "Sion" | 14
|
/// `SION` | "Sion" | "Sion" | 14
|
||||||
/// `SIVIR` | "Sivir" | "Sivir" | 15
|
/// `SIVIR` | "Sivir" | "Sivir" | 15
|
||||||
/// `SKARNER` | "Skarner" | "Skarner" | 72
|
/// `SKARNER` | "Skarner" | "Skarner" | 72
|
||||||
|
/// `SMOLDER` | "Smolder" | "Smolder" | 901
|
||||||
/// `SONA` | "Sona" | "Sona" | 37
|
/// `SONA` | "Sona" | "Sona" | 37
|
||||||
/// `SORAKA` | "Soraka" | "Soraka" | 16
|
/// `SORAKA` | "Soraka" | "Soraka" | 16
|
||||||
/// `SWAIN` | "Swain" | "Swain" | 50
|
/// `SWAIN` | "Swain" | "Swain" | 50
|
||||||
|
@ -175,9 +184,10 @@ newtype_enum! {
|
||||||
/// `ZILEAN` | "Zilean" | "Zilean" | 26
|
/// `ZILEAN` | "Zilean" | "Zilean" | 26
|
||||||
/// `ZOE` | "Zoe" | "Zoe" | 142
|
/// `ZOE` | "Zoe" | "Zoe" | 142
|
||||||
/// `ZYRA` | "Zyra" | "Zyra" | 143
|
/// `ZYRA` | "Zyra" | "Zyra" | 143
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Champion(i16) {
|
pub newtype_enum Champion(i16) {
|
||||||
|
/// `-1`, none. Appears when a champion ban is not used in champ select.
|
||||||
|
NONE = -1,
|
||||||
|
|
||||||
/// `266`.
|
/// `266`.
|
||||||
AATROX = 266,
|
AATROX = 266,
|
||||||
/// `103`.
|
/// `103`.
|
||||||
|
@ -212,6 +222,8 @@ newtype_enum! {
|
||||||
BRAND = 63,
|
BRAND = 63,
|
||||||
/// `201`.
|
/// `201`.
|
||||||
BRAUM = 201,
|
BRAUM = 201,
|
||||||
|
/// `233`.
|
||||||
|
BRIAR = 233,
|
||||||
/// `51`.
|
/// `51`.
|
||||||
CAITLYN = 51,
|
CAITLYN = 51,
|
||||||
/// `164`.
|
/// `164`.
|
||||||
|
@ -262,6 +274,8 @@ newtype_enum! {
|
||||||
HECARIM = 120,
|
HECARIM = 120,
|
||||||
/// `74`.
|
/// `74`.
|
||||||
HEIMERDINGER = 74,
|
HEIMERDINGER = 74,
|
||||||
|
/// `910`.
|
||||||
|
HWEI = 910,
|
||||||
/// `420`.
|
/// `420`.
|
||||||
ILLAOI = 420,
|
ILLAOI = 420,
|
||||||
/// `39`.
|
/// `39`.
|
||||||
|
@ -280,6 +294,8 @@ newtype_enum! {
|
||||||
JHIN = 202,
|
JHIN = 202,
|
||||||
/// `222`.
|
/// `222`.
|
||||||
JINX = 222,
|
JINX = 222,
|
||||||
|
/// `897`.
|
||||||
|
K_SANTE = 897,
|
||||||
/// `145`.
|
/// `145`.
|
||||||
KAI_SA = 145,
|
KAI_SA = 145,
|
||||||
/// `429`.
|
/// `429`.
|
||||||
|
@ -330,12 +346,16 @@ newtype_enum! {
|
||||||
MAOKAI = 57,
|
MAOKAI = 57,
|
||||||
/// `11`.
|
/// `11`.
|
||||||
MASTER_YI = 11,
|
MASTER_YI = 11,
|
||||||
|
/// `902`.
|
||||||
|
MILIO = 902,
|
||||||
/// `21`.
|
/// `21`.
|
||||||
MISS_FORTUNE = 21,
|
MISS_FORTUNE = 21,
|
||||||
/// `82`.
|
/// `82`.
|
||||||
MORDEKAISER = 82,
|
MORDEKAISER = 82,
|
||||||
/// `25`.
|
/// `25`.
|
||||||
MORGANA = 25,
|
MORGANA = 25,
|
||||||
|
/// `950`.
|
||||||
|
NAAFIRI = 950,
|
||||||
/// `267`.
|
/// `267`.
|
||||||
NAMI = 267,
|
NAMI = 267,
|
||||||
/// `75`.
|
/// `75`.
|
||||||
|
@ -346,6 +366,8 @@ newtype_enum! {
|
||||||
NEEKO = 518,
|
NEEKO = 518,
|
||||||
/// `76`.
|
/// `76`.
|
||||||
NIDALEE = 76,
|
NIDALEE = 76,
|
||||||
|
/// `895`.
|
||||||
|
NILAH = 895,
|
||||||
/// `56`.
|
/// `56`.
|
||||||
NOCTURNE = 56,
|
NOCTURNE = 56,
|
||||||
/// `20`.
|
/// `20`.
|
||||||
|
@ -410,6 +432,8 @@ newtype_enum! {
|
||||||
SIVIR = 15,
|
SIVIR = 15,
|
||||||
/// `72`.
|
/// `72`.
|
||||||
SKARNER = 72,
|
SKARNER = 72,
|
||||||
|
/// `901`.
|
||||||
|
SMOLDER = 901,
|
||||||
/// `37`.
|
/// `37`.
|
||||||
SONA = 37,
|
SONA = 37,
|
||||||
/// `16`.
|
/// `16`.
|
||||||
|
@ -522,6 +546,7 @@ impl Champion {
|
||||||
Self::BLITZCRANK => Some("Blitzcrank"),
|
Self::BLITZCRANK => Some("Blitzcrank"),
|
||||||
Self::BRAND => Some("Brand"),
|
Self::BRAND => Some("Brand"),
|
||||||
Self::BRAUM => Some("Braum"),
|
Self::BRAUM => Some("Braum"),
|
||||||
|
Self::BRIAR => Some("Briar"),
|
||||||
Self::CAITLYN => Some("Caitlyn"),
|
Self::CAITLYN => Some("Caitlyn"),
|
||||||
Self::CAMILLE => Some("Camille"),
|
Self::CAMILLE => Some("Camille"),
|
||||||
Self::CASSIOPEIA => Some("Cassiopeia"),
|
Self::CASSIOPEIA => Some("Cassiopeia"),
|
||||||
|
@ -547,6 +572,7 @@ impl Champion {
|
||||||
Self::GWEN => Some("Gwen"),
|
Self::GWEN => Some("Gwen"),
|
||||||
Self::HECARIM => Some("Hecarim"),
|
Self::HECARIM => Some("Hecarim"),
|
||||||
Self::HEIMERDINGER => Some("Heimerdinger"),
|
Self::HEIMERDINGER => Some("Heimerdinger"),
|
||||||
|
Self::HWEI => Some("Hwei"),
|
||||||
Self::ILLAOI => Some("Illaoi"),
|
Self::ILLAOI => Some("Illaoi"),
|
||||||
Self::IRELIA => Some("Irelia"),
|
Self::IRELIA => Some("Irelia"),
|
||||||
Self::IVERN => Some("Ivern"),
|
Self::IVERN => Some("Ivern"),
|
||||||
|
@ -556,6 +582,7 @@ impl Champion {
|
||||||
Self::JAYCE => Some("Jayce"),
|
Self::JAYCE => Some("Jayce"),
|
||||||
Self::JHIN => Some("Jhin"),
|
Self::JHIN => Some("Jhin"),
|
||||||
Self::JINX => Some("Jinx"),
|
Self::JINX => Some("Jinx"),
|
||||||
|
Self::K_SANTE => Some("K'Sante"),
|
||||||
Self::KAI_SA => Some("Kai'Sa"),
|
Self::KAI_SA => Some("Kai'Sa"),
|
||||||
Self::KALISTA => Some("Kalista"),
|
Self::KALISTA => Some("Kalista"),
|
||||||
Self::KARMA => Some("Karma"),
|
Self::KARMA => Some("Karma"),
|
||||||
|
@ -581,14 +608,17 @@ impl Champion {
|
||||||
Self::MALZAHAR => Some("Malzahar"),
|
Self::MALZAHAR => Some("Malzahar"),
|
||||||
Self::MAOKAI => Some("Maokai"),
|
Self::MAOKAI => Some("Maokai"),
|
||||||
Self::MASTER_YI => Some("Master Yi"),
|
Self::MASTER_YI => Some("Master Yi"),
|
||||||
|
Self::MILIO => Some("Milio"),
|
||||||
Self::MISS_FORTUNE => Some("Miss Fortune"),
|
Self::MISS_FORTUNE => Some("Miss Fortune"),
|
||||||
Self::MORDEKAISER => Some("Mordekaiser"),
|
Self::MORDEKAISER => Some("Mordekaiser"),
|
||||||
Self::MORGANA => Some("Morgana"),
|
Self::MORGANA => Some("Morgana"),
|
||||||
|
Self::NAAFIRI => Some("Naafiri"),
|
||||||
Self::NAMI => Some("Nami"),
|
Self::NAMI => Some("Nami"),
|
||||||
Self::NASUS => Some("Nasus"),
|
Self::NASUS => Some("Nasus"),
|
||||||
Self::NAUTILUS => Some("Nautilus"),
|
Self::NAUTILUS => Some("Nautilus"),
|
||||||
Self::NEEKO => Some("Neeko"),
|
Self::NEEKO => Some("Neeko"),
|
||||||
Self::NIDALEE => Some("Nidalee"),
|
Self::NIDALEE => Some("Nidalee"),
|
||||||
|
Self::NILAH => Some("Nilah"),
|
||||||
Self::NOCTURNE => Some("Nocturne"),
|
Self::NOCTURNE => Some("Nocturne"),
|
||||||
Self::NUNU_WILLUMP => Some("Nunu & Willump"),
|
Self::NUNU_WILLUMP => Some("Nunu & Willump"),
|
||||||
Self::OLAF => Some("Olaf"),
|
Self::OLAF => Some("Olaf"),
|
||||||
|
@ -621,6 +651,7 @@ impl Champion {
|
||||||
Self::SION => Some("Sion"),
|
Self::SION => Some("Sion"),
|
||||||
Self::SIVIR => Some("Sivir"),
|
Self::SIVIR => Some("Sivir"),
|
||||||
Self::SKARNER => Some("Skarner"),
|
Self::SKARNER => Some("Skarner"),
|
||||||
|
Self::SMOLDER => Some("Smolder"),
|
||||||
Self::SONA => Some("Sona"),
|
Self::SONA => Some("Sona"),
|
||||||
Self::SORAKA => Some("Soraka"),
|
Self::SORAKA => Some("Soraka"),
|
||||||
Self::SWAIN => Some("Swain"),
|
Self::SWAIN => Some("Swain"),
|
||||||
|
@ -706,6 +737,7 @@ impl Champion {
|
||||||
Self::BLITZCRANK => Some("Blitzcrank"),
|
Self::BLITZCRANK => Some("Blitzcrank"),
|
||||||
Self::BRAND => Some("Brand"),
|
Self::BRAND => Some("Brand"),
|
||||||
Self::BRAUM => Some("Braum"),
|
Self::BRAUM => Some("Braum"),
|
||||||
|
Self::BRIAR => Some("Briar"),
|
||||||
Self::CAITLYN => Some("Caitlyn"),
|
Self::CAITLYN => Some("Caitlyn"),
|
||||||
Self::CAMILLE => Some("Camille"),
|
Self::CAMILLE => Some("Camille"),
|
||||||
Self::CASSIOPEIA => Some("Cassiopeia"),
|
Self::CASSIOPEIA => Some("Cassiopeia"),
|
||||||
|
@ -731,6 +763,7 @@ impl Champion {
|
||||||
Self::GWEN => Some("Gwen"),
|
Self::GWEN => Some("Gwen"),
|
||||||
Self::HECARIM => Some("Hecarim"),
|
Self::HECARIM => Some("Hecarim"),
|
||||||
Self::HEIMERDINGER => Some("Heimerdinger"),
|
Self::HEIMERDINGER => Some("Heimerdinger"),
|
||||||
|
Self::HWEI => Some("Hwei"),
|
||||||
Self::ILLAOI => Some("Illaoi"),
|
Self::ILLAOI => Some("Illaoi"),
|
||||||
Self::IRELIA => Some("Irelia"),
|
Self::IRELIA => Some("Irelia"),
|
||||||
Self::IVERN => Some("Ivern"),
|
Self::IVERN => Some("Ivern"),
|
||||||
|
@ -740,6 +773,7 @@ impl Champion {
|
||||||
Self::JAYCE => Some("Jayce"),
|
Self::JAYCE => Some("Jayce"),
|
||||||
Self::JHIN => Some("Jhin"),
|
Self::JHIN => Some("Jhin"),
|
||||||
Self::JINX => Some("Jinx"),
|
Self::JINX => Some("Jinx"),
|
||||||
|
Self::K_SANTE => Some("KSante"),
|
||||||
Self::KAI_SA => Some("Kaisa"),
|
Self::KAI_SA => Some("Kaisa"),
|
||||||
Self::KALISTA => Some("Kalista"),
|
Self::KALISTA => Some("Kalista"),
|
||||||
Self::KARMA => Some("Karma"),
|
Self::KARMA => Some("Karma"),
|
||||||
|
@ -765,14 +799,17 @@ impl Champion {
|
||||||
Self::MALZAHAR => Some("Malzahar"),
|
Self::MALZAHAR => Some("Malzahar"),
|
||||||
Self::MAOKAI => Some("Maokai"),
|
Self::MAOKAI => Some("Maokai"),
|
||||||
Self::MASTER_YI => Some("MasterYi"),
|
Self::MASTER_YI => Some("MasterYi"),
|
||||||
|
Self::MILIO => Some("Milio"),
|
||||||
Self::MISS_FORTUNE => Some("MissFortune"),
|
Self::MISS_FORTUNE => Some("MissFortune"),
|
||||||
Self::MORDEKAISER => Some("Mordekaiser"),
|
Self::MORDEKAISER => Some("Mordekaiser"),
|
||||||
Self::MORGANA => Some("Morgana"),
|
Self::MORGANA => Some("Morgana"),
|
||||||
|
Self::NAAFIRI => Some("Naafiri"),
|
||||||
Self::NAMI => Some("Nami"),
|
Self::NAMI => Some("Nami"),
|
||||||
Self::NASUS => Some("Nasus"),
|
Self::NASUS => Some("Nasus"),
|
||||||
Self::NAUTILUS => Some("Nautilus"),
|
Self::NAUTILUS => Some("Nautilus"),
|
||||||
Self::NEEKO => Some("Neeko"),
|
Self::NEEKO => Some("Neeko"),
|
||||||
Self::NIDALEE => Some("Nidalee"),
|
Self::NIDALEE => Some("Nidalee"),
|
||||||
|
Self::NILAH => Some("Nilah"),
|
||||||
Self::NOCTURNE => Some("Nocturne"),
|
Self::NOCTURNE => Some("Nocturne"),
|
||||||
Self::NUNU_WILLUMP => Some("Nunu"),
|
Self::NUNU_WILLUMP => Some("Nunu"),
|
||||||
Self::OLAF => Some("Olaf"),
|
Self::OLAF => Some("Olaf"),
|
||||||
|
@ -805,6 +842,7 @@ impl Champion {
|
||||||
Self::SION => Some("Sion"),
|
Self::SION => Some("Sion"),
|
||||||
Self::SIVIR => Some("Sivir"),
|
Self::SIVIR => Some("Sivir"),
|
||||||
Self::SKARNER => Some("Skarner"),
|
Self::SKARNER => Some("Skarner"),
|
||||||
|
Self::SMOLDER => Some("Smolder"),
|
||||||
Self::SONA => Some("Sona"),
|
Self::SONA => Some("Sona"),
|
||||||
Self::SORAKA => Some("Soraka"),
|
Self::SORAKA => Some("Soraka"),
|
||||||
Self::SWAIN => Some("Swain"),
|
Self::SWAIN => Some("Swain"),
|
||||||
|
@ -921,6 +959,7 @@ impl std::str::FromStr for Champion {
|
||||||
/* BLIT */ [ 'B', 'L', 'I', 'T'] => Ok(Champion::BLITZCRANK),
|
/* BLIT */ [ 'B', 'L', 'I', 'T'] => Ok(Champion::BLITZCRANK),
|
||||||
/* BRAN */ [ 'B', 'R', 'A', 'N'] => Ok(Champion::BRAND),
|
/* BRAN */ [ 'B', 'R', 'A', 'N'] => Ok(Champion::BRAND),
|
||||||
/* BRAU */ [ 'B', 'R', 'A', 'U'] => Ok(Champion::BRAUM),
|
/* BRAU */ [ 'B', 'R', 'A', 'U'] => Ok(Champion::BRAUM),
|
||||||
|
/* BRIA */ [ 'B', 'R', 'I', 'A'] => Ok(Champion::BRIAR),
|
||||||
/* CAIT */ [ 'C', 'A', 'I', 'T'] => Ok(Champion::CAITLYN),
|
/* CAIT */ [ 'C', 'A', 'I', 'T'] => Ok(Champion::CAITLYN),
|
||||||
/* CAMI */ [ 'C', 'A', 'M', 'I'] => Ok(Champion::CAMILLE),
|
/* CAMI */ [ 'C', 'A', 'M', 'I'] => Ok(Champion::CAMILLE),
|
||||||
/* CASS */ [ 'C', 'A', 'S', 'S'] => Ok(Champion::CASSIOPEIA),
|
/* CASS */ [ 'C', 'A', 'S', 'S'] => Ok(Champion::CASSIOPEIA),
|
||||||
|
@ -948,6 +987,7 @@ impl std::str::FromStr for Champion {
|
||||||
/* GWEN */ [ 'G', 'W', 'E', 'N'] => Ok(Champion::GWEN),
|
/* GWEN */ [ 'G', 'W', 'E', 'N'] => Ok(Champion::GWEN),
|
||||||
/* HECA */ [ 'H', 'E', 'C', 'A'] => Ok(Champion::HECARIM),
|
/* HECA */ [ 'H', 'E', 'C', 'A'] => Ok(Champion::HECARIM),
|
||||||
/* HEIM */ [ 'H', 'E', 'I', 'M'] => Ok(Champion::HEIMERDINGER),
|
/* HEIM */ [ 'H', 'E', 'I', 'M'] => Ok(Champion::HEIMERDINGER),
|
||||||
|
/* HWEI */ [ 'H', 'W', 'E', 'I'] => Ok(Champion::HWEI),
|
||||||
/* ILLA */ [ 'I', 'L', 'L', 'A'] => Ok(Champion::ILLAOI),
|
/* ILLA */ [ 'I', 'L', 'L', 'A'] => Ok(Champion::ILLAOI),
|
||||||
/* IREL */ [ 'I', 'R', 'E', 'L'] => Ok(Champion::IRELIA),
|
/* IREL */ [ 'I', 'R', 'E', 'L'] => Ok(Champion::IRELIA),
|
||||||
/* IVER */ [ 'I', 'V', 'E', 'R'] => Ok(Champion::IVERN),
|
/* IVER */ [ 'I', 'V', 'E', 'R'] => Ok(Champion::IVERN),
|
||||||
|
@ -957,6 +997,8 @@ impl std::str::FromStr for Champion {
|
||||||
/* JAYC */ [ 'J', 'A', 'Y', 'C'] => Ok(Champion::JAYCE),
|
/* JAYC */ [ 'J', 'A', 'Y', 'C'] => Ok(Champion::JAYCE),
|
||||||
/* JHIN */ [ 'J', 'H', 'I', 'N'] => Ok(Champion::JHIN),
|
/* JHIN */ [ 'J', 'H', 'I', 'N'] => Ok(Champion::JHIN),
|
||||||
/* JINX */ [ 'J', 'I', 'N', 'X'] => Ok(Champion::JINX),
|
/* JINX */ [ 'J', 'I', 'N', 'X'] => Ok(Champion::JINX),
|
||||||
|
/* KSAN */ [ 'K', 'S', 'A', 'N'] => Ok(Champion::K_SANTE),
|
||||||
|
/* K */ [ 'K', '\0', '\0', '\0'] => Ok(Champion::K_SANTE),
|
||||||
/* KAIS */ [ 'K', 'A', 'I', 'S'] => Ok(Champion::KAI_SA),
|
/* KAIS */ [ 'K', 'A', 'I', 'S'] => Ok(Champion::KAI_SA),
|
||||||
/* KAI */ [ 'K', 'A', 'I', '\0'] => Ok(Champion::KAI_SA),
|
/* KAI */ [ 'K', 'A', 'I', '\0'] => Ok(Champion::KAI_SA),
|
||||||
/* KALI */ [ 'K', 'A', 'L', 'I'] => Ok(Champion::KALISTA),
|
/* KALI */ [ 'K', 'A', 'L', 'I'] => Ok(Champion::KALISTA),
|
||||||
|
@ -986,14 +1028,17 @@ impl std::str::FromStr for Champion {
|
||||||
/* MALZ */ [ 'M', 'A', 'L', 'Z'] => Ok(Champion::MALZAHAR),
|
/* MALZ */ [ 'M', 'A', 'L', 'Z'] => Ok(Champion::MALZAHAR),
|
||||||
/* MAOK */ [ 'M', 'A', 'O', 'K'] => Ok(Champion::MAOKAI),
|
/* MAOK */ [ 'M', 'A', 'O', 'K'] => Ok(Champion::MAOKAI),
|
||||||
/* MAST */ [ 'M', 'A', 'S', 'T'] => Ok(Champion::MASTER_YI),
|
/* MAST */ [ 'M', 'A', 'S', 'T'] => Ok(Champion::MASTER_YI),
|
||||||
|
/* MILI */ [ 'M', 'I', 'L', 'I'] => Ok(Champion::MILIO),
|
||||||
/* MISS */ [ 'M', 'I', 'S', 'S'] => Ok(Champion::MISS_FORTUNE),
|
/* MISS */ [ 'M', 'I', 'S', 'S'] => Ok(Champion::MISS_FORTUNE),
|
||||||
/* MORD */ [ 'M', 'O', 'R', 'D'] => Ok(Champion::MORDEKAISER),
|
/* MORD */ [ 'M', 'O', 'R', 'D'] => Ok(Champion::MORDEKAISER),
|
||||||
/* MORG */ [ 'M', 'O', 'R', 'G'] => Ok(Champion::MORGANA),
|
/* MORG */ [ 'M', 'O', 'R', 'G'] => Ok(Champion::MORGANA),
|
||||||
|
/* NAAF */ [ 'N', 'A', 'A', 'F'] => Ok(Champion::NAAFIRI),
|
||||||
/* NAMI */ [ 'N', 'A', 'M', 'I'] => Ok(Champion::NAMI),
|
/* NAMI */ [ 'N', 'A', 'M', 'I'] => Ok(Champion::NAMI),
|
||||||
/* NASU */ [ 'N', 'A', 'S', 'U'] => Ok(Champion::NASUS),
|
/* NASU */ [ 'N', 'A', 'S', 'U'] => Ok(Champion::NASUS),
|
||||||
/* NAUT */ [ 'N', 'A', 'U', 'T'] => Ok(Champion::NAUTILUS),
|
/* NAUT */ [ 'N', 'A', 'U', 'T'] => Ok(Champion::NAUTILUS),
|
||||||
/* NEEK */ [ 'N', 'E', 'E', 'K'] => Ok(Champion::NEEKO),
|
/* NEEK */ [ 'N', 'E', 'E', 'K'] => Ok(Champion::NEEKO),
|
||||||
/* NIDA */ [ 'N', 'I', 'D', 'A'] => Ok(Champion::NIDALEE),
|
/* NIDA */ [ 'N', 'I', 'D', 'A'] => Ok(Champion::NIDALEE),
|
||||||
|
/* NILA */ [ 'N', 'I', 'L', 'A'] => Ok(Champion::NILAH),
|
||||||
/* NOCT */ [ 'N', 'O', 'C', 'T'] => Ok(Champion::NOCTURNE),
|
/* NOCT */ [ 'N', 'O', 'C', 'T'] => Ok(Champion::NOCTURNE),
|
||||||
/* NUNU */ [ 'N', 'U', 'N', 'U'] => Ok(Champion::NUNU_WILLUMP),
|
/* NUNU */ [ 'N', 'U', 'N', 'U'] => Ok(Champion::NUNU_WILLUMP),
|
||||||
/* OLAF */ [ 'O', 'L', 'A', 'F'] => Ok(Champion::OLAF),
|
/* OLAF */ [ 'O', 'L', 'A', 'F'] => Ok(Champion::OLAF),
|
||||||
|
@ -1027,6 +1072,7 @@ impl std::str::FromStr for Champion {
|
||||||
/* SION */ [ 'S', 'I', 'O', 'N'] => Ok(Champion::SION),
|
/* SION */ [ 'S', 'I', 'O', 'N'] => Ok(Champion::SION),
|
||||||
/* SIVI */ [ 'S', 'I', 'V', 'I'] => Ok(Champion::SIVIR),
|
/* SIVI */ [ 'S', 'I', 'V', 'I'] => Ok(Champion::SIVIR),
|
||||||
/* SKAR */ [ 'S', 'K', 'A', 'R'] => Ok(Champion::SKARNER),
|
/* SKAR */ [ 'S', 'K', 'A', 'R'] => Ok(Champion::SKARNER),
|
||||||
|
/* SMOL */ [ 'S', 'M', 'O', 'L'] => Ok(Champion::SMOLDER),
|
||||||
/* SONA */ [ 'S', 'O', 'N', 'A'] => Ok(Champion::SONA),
|
/* SONA */ [ 'S', 'O', 'N', 'A'] => Ok(Champion::SONA),
|
||||||
/* SORA */ [ 'S', 'O', 'R', 'A'] => Ok(Champion::SORAKA),
|
/* SORA */ [ 'S', 'O', 'R', 'A'] => Ok(Champion::SORAKA),
|
||||||
/* SWAI */ [ 'S', 'W', 'A', 'I'] => Ok(Champion::SWAIN),
|
/* SWAI */ [ 'S', 'W', 'A', 'I'] => Ok(Champion::SWAIN),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||||
use serde::{ Serialize, Deserialize };
|
use serde::{Deserialize, Serialize};
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
|
use strum_macros::{AsRefStr, Display, EnumString, IntoStaticStr};
|
||||||
|
|
||||||
/// LoL and TFT rank divisions, I, II, III, IV, and (deprecated) V.
|
/// LoL and TFT rank divisions, I, II, III, IV, and (deprecated) V.
|
||||||
///
|
///
|
||||||
|
@ -12,25 +12,36 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
|
||||||
/// Repr'd as equivalent numeric values, (1, 2, 3, 4, 5).
|
/// Repr'd as equivalent numeric values, (1, 2, 3, 4, 5).
|
||||||
///
|
///
|
||||||
/// Implements [IntoEnumIterator](super::IntoEnumIterator). Iterator excludes deprecated `Division::V`.
|
/// Implements [IntoEnumIterator](super::IntoEnumIterator). Iterator excludes deprecated `Division::V`.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(
|
||||||
#[derive(Eq, PartialEq, Hash)]
|
Debug,
|
||||||
#[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
|
Copy,
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
Clone,
|
||||||
#[derive(Serialize, Deserialize)]
|
Eq,
|
||||||
|
PartialEq,
|
||||||
|
Hash,
|
||||||
|
EnumString,
|
||||||
|
Display,
|
||||||
|
AsRefStr,
|
||||||
|
IntoStaticStr,
|
||||||
|
IntoPrimitive,
|
||||||
|
TryFromPrimitive,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Division {
|
pub enum Division {
|
||||||
/// Division 1, the best/highest division in a [`Tier`](crate::consts::Tier), or the only division in
|
/// Division 1, the best/highest division in a [`Tier`](crate::consts::Tier), or the only division in
|
||||||
/// [apex tiers](crate::consts::Tier::is_apex).
|
/// [apex tiers](crate::consts::Tier::is_apex).
|
||||||
I = 1,
|
I = 1,
|
||||||
/// Division 2, the second highest division.
|
/// Division 2, the second highest division.
|
||||||
II = 2,
|
II = 2,
|
||||||
/// Division 3, the third highest division.
|
/// Division 3, the third highest division.
|
||||||
III = 3,
|
III = 3,
|
||||||
/// Division 4, the fourth and lowest division since 2019.
|
/// Division 4, the fourth and lowest division since 2019.
|
||||||
IV = 4,
|
IV = 4,
|
||||||
/// Division 5, the lowest division, only used before 2019.
|
/// Division 5, the lowest division, only used before 2019.
|
||||||
#[deprecated(note="Removed for 2019.")]
|
#[deprecated(note = "Removed for 2019.")]
|
||||||
V = 5,
|
V = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a DoubleEndedIterator of I, II, III, IV.
|
/// Returns a DoubleEndedIterator of I, II, III, IV.
|
||||||
|
@ -39,7 +50,7 @@ pub enum Division {
|
||||||
impl IntoEnumIterator for Division {
|
impl IntoEnumIterator for Division {
|
||||||
type Iterator = std::iter::Copied<std::slice::Iter<'static, Self>>;
|
type Iterator = std::iter::Copied<std::slice::Iter<'static, Self>>;
|
||||||
fn iter() -> Self::Iterator {
|
fn iter() -> Self::Iterator {
|
||||||
[ Self::I, Self::II, Self::III, Self::IV ].iter().copied()
|
[Self::I, Self::II, Self::III, Self::IV].iter().copied()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,4 +74,4 @@ mod tests {
|
||||||
fn sort() {
|
fn sort() {
|
||||||
assert!(Division::IV < Division::I);
|
assert!(Division::IV < Division::I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -6,16 +7,14 @@
|
||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
use strum_macros::{ EnumString, EnumVariantNames, IntoStaticStr };
|
||||||
use strum_macros::{ EnumString, IntoStaticStr };
|
|
||||||
|
|
||||||
/// League of Legends game mode, such as Classic,
|
/// League of Legends game mode, such as Classic,
|
||||||
/// ARAM, URF, One For All, Ascension, etc.
|
/// ARAM, URF, One For All, Ascension, etc.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
#[derive(Eq, PartialEq, Hash)]
|
#[derive(Eq, PartialEq, Hash)]
|
||||||
#[derive(EnumString, IntoStaticStr)]
|
#[derive(EnumString, EnumVariantNames, IntoStaticStr)]
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum GameMode {
|
pub enum GameMode {
|
||||||
/// Catch-all variant for new, unknown game modes.
|
/// Catch-all variant for new, unknown game modes.
|
||||||
|
@ -30,6 +29,8 @@ pub enum GameMode {
|
||||||
ASCENSION,
|
ASCENSION,
|
||||||
/// Blood Hunt Assassin games
|
/// Blood Hunt Assassin games
|
||||||
ASSASSINATE,
|
ASSASSINATE,
|
||||||
|
/// 2v2v2v2
|
||||||
|
CHERRY,
|
||||||
/// Classic Summoner's Rift and Twisted Treeline games
|
/// Classic Summoner's Rift and Twisted Treeline games
|
||||||
CLASSIC,
|
CLASSIC,
|
||||||
/// Dark Star: Singularity games
|
/// Dark Star: Singularity games
|
||||||
|
@ -58,6 +59,8 @@ pub enum GameMode {
|
||||||
SIEGE,
|
SIEGE,
|
||||||
/// Star Guardian Invasion games
|
/// Star Guardian Invasion games
|
||||||
STARGUARDIAN,
|
STARGUARDIAN,
|
||||||
|
/// Teamfight Tactics, used in `spectator-v4` endpoints.
|
||||||
|
TFT,
|
||||||
/// Tutorial games
|
/// Tutorial games
|
||||||
TUTORIAL,
|
TUTORIAL,
|
||||||
/// Tutorial: Welcome to League.
|
/// Tutorial: Welcome to League.
|
||||||
|
@ -72,4 +75,4 @@ pub enum GameMode {
|
||||||
URF,
|
URF,
|
||||||
}
|
}
|
||||||
|
|
||||||
string_enum_str!(GameMode);
|
serde_strum_unknown!(GameMode);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -17,9 +18,18 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum GameType {
|
pub enum GameType {
|
||||||
/// Custom games
|
/// Custom games
|
||||||
|
#[strum(to_string = "CUSTOM_GAME", serialize = "CUSTOM")]
|
||||||
|
#[serde(alias = "CUSTOM")]
|
||||||
CUSTOM_GAME,
|
CUSTOM_GAME,
|
||||||
/// all other games
|
/// all other games
|
||||||
|
#[strum(to_string = "MATCHED_GAME", serialize = "MATCHED")]
|
||||||
|
#[serde(alias = "MATCHED")]
|
||||||
MATCHED_GAME,
|
MATCHED_GAME,
|
||||||
/// Tutorial games
|
/// Tutorial games
|
||||||
|
#[strum(to_string = "TUTORIAL_GAME", serialize = "TUTORIAL")]
|
||||||
|
#[serde(alias = "TUTORIAL")]
|
||||||
TUTORIAL_GAME,
|
TUTORIAL_GAME,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test;
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
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());
|
||||||
|
}
|
|
@ -1,7 +1,13 @@
|
||||||
#![macro_use]
|
#![macro_use]
|
||||||
|
|
||||||
macro_rules! string_enum_str {
|
/// Macro for deriving `Serialize` and `Deserialize` for string enums with an
|
||||||
( $name:ident ) => {
|
/// `UNKNOWN(String)` variant.
|
||||||
|
///
|
||||||
|
/// Enum should have `#[derive(EnumString, EnumVariantNames, IntoStaticStr)]` included.
|
||||||
|
///
|
||||||
|
/// Also implements `AsRef<str>`, `Display`, and `From<&str>`.
|
||||||
|
macro_rules! serde_strum_unknown {
|
||||||
|
($name:ident) => {
|
||||||
impl AsRef<str> for $name {
|
impl AsRef<str> for $name {
|
||||||
fn as_ref(&self) -> &str {
|
fn as_ref(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
|
@ -10,13 +16,49 @@ macro_rules! string_enum_str {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for $name {
|
impl std::fmt::Display for $name {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
self.as_ref().fmt(f)
|
self.as_ref().fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
impl serde::ser::Serialize for $name {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: serde::ser::Serializer,
|
||||||
|
{
|
||||||
|
serializer.serialize_str(self.as_ref())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&str> for $name {
|
||||||
|
fn from(item: &str) -> Self {
|
||||||
|
item.parse().unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<'de> serde::de::Deserialize<'de> for $name {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::de::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
#[cfg(not(feature = "deny-unknown-enum-variants-strings"))]
|
||||||
|
{
|
||||||
|
<&str>::deserialize(deserializer).map(Into::into)
|
||||||
|
}
|
||||||
|
#[cfg(feature = "deny-unknown-enum-variants-strings")]
|
||||||
|
{
|
||||||
|
<&str>::deserialize(deserializer)
|
||||||
|
.map(Into::into)
|
||||||
|
.and_then(|item| match item {
|
||||||
|
Self::UNKNOWN(unknown) => Err(serde::de::Error::unknown_variant(
|
||||||
|
&*unknown,
|
||||||
|
<Self as strum::VariantNames>::VARIANTS,
|
||||||
|
)),
|
||||||
|
other => Ok(other),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! arr {
|
macro_rules! arr {
|
||||||
|
@ -29,6 +71,13 @@ macro_rules! arr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Macro for newtype "enums" with integer values.
|
||||||
|
///
|
||||||
|
/// For serde, use the following:
|
||||||
|
/// ```ignore
|
||||||
|
/// #[derive(Serialize, Deserialize)]
|
||||||
|
/// #[serde(from = "$repr", into = "$repr")]
|
||||||
|
/// ```
|
||||||
macro_rules! newtype_enum {
|
macro_rules! newtype_enum {
|
||||||
{
|
{
|
||||||
$( #[$attr:meta] )*
|
$( #[$attr:meta] )*
|
||||||
|
@ -70,15 +119,49 @@ macro_rules! newtype_enum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::convert::From<$name> for $repr {
|
||||||
|
fn from(value: $name ) -> Self {
|
||||||
|
value.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl serde::ser::Serialize for $name {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: serde::ser::Serializer,
|
||||||
|
{
|
||||||
|
<$repr>::serialize(&self.0, serializer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl std::convert::From<$repr> for $name {
|
impl std::convert::From<$repr> for $name {
|
||||||
fn from(value: $repr ) -> Self {
|
fn from(value: $repr ) -> Self {
|
||||||
Self(value)
|
Self(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl<'de> serde::de::Deserialize<'de> for $name {
|
||||||
impl std::convert::From<$name> for $repr {
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
fn from(value: $name ) -> Self {
|
where
|
||||||
value.0
|
D: serde::de::Deserializer<'de>
|
||||||
|
{
|
||||||
|
#[cfg(not(feature = "deny-unknown-enum-variants-integers"))]
|
||||||
|
{
|
||||||
|
<$repr>::deserialize(deserializer).map(Into::into)
|
||||||
|
}
|
||||||
|
#[cfg(feature = "deny-unknown-enum-variants-integers")]
|
||||||
|
{
|
||||||
|
<$repr>::deserialize(deserializer).map(Into::into)
|
||||||
|
.and_then(|item: Self| {
|
||||||
|
if !item.is_known() {
|
||||||
|
Err(serde::de::Error::custom(format!(
|
||||||
|
"Unknown integer enum variant: {} (\"deny-unknown-enum-variants-integers\" feature is enabled).\nExpected one of the following: {:?}",
|
||||||
|
item, Self::ALL_KNOWN
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Ok(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +170,6 @@ macro_rules! newtype_enum {
|
||||||
self.0.fmt(f)
|
self.0.fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for $name {
|
impl std::fmt::Debug for $name {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{}({}{})", stringify!($name), self.0, if self.is_known() { "" } else { "?" })
|
write!(f, "{}({}{})", stringify!($name), self.0, if self.is_known() { "" } else { "?" })
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -6,12 +7,8 @@
|
||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
|
||||||
|
|
||||||
newtype_enum! {
|
newtype_enum! {
|
||||||
/// A League of Legends map.
|
/// A League of Legends map.
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Map(u8) {
|
pub newtype_enum Map(u8) {
|
||||||
/// `1`.
|
/// `1`.
|
||||||
/// Summoner's Rift
|
/// Summoner's Rift
|
||||||
|
@ -73,5 +70,9 @@ newtype_enum! {
|
||||||
/// Convergence
|
/// Convergence
|
||||||
/// Teamfight Tactics map
|
/// Teamfight Tactics map
|
||||||
CONVERGENCE = 22,
|
CONVERGENCE = 22,
|
||||||
|
/// `30`.
|
||||||
|
/// Arena
|
||||||
|
/// Map for 2v2v2v2 (`CHERRY`). Team up with a friend or venture solo in this new game mode. Face against multiple teams in chaotic battles across diverse arenas
|
||||||
|
ARENA = 30,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,39 +8,47 @@
|
||||||
|
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod champion;
|
mod champion;
|
||||||
pub use champion::*;
|
pub use champion::*;
|
||||||
|
|
||||||
mod division;
|
mod division;
|
||||||
pub use division::*;
|
pub use division::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod game_mode;
|
mod game_mode;
|
||||||
pub use game_mode::*;
|
pub use game_mode::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod game_type;
|
mod game_type;
|
||||||
pub use game_type::*;
|
pub use game_type::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod map;
|
mod map;
|
||||||
pub use map::*;
|
pub use map::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod queue_type;
|
mod queue_type;
|
||||||
pub use queue_type::*;
|
pub use queue_type::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod queue;
|
mod queue;
|
||||||
pub use queue::*;
|
pub use queue::*;
|
||||||
|
|
||||||
pub mod ranks;
|
pub mod ranks;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod route;
|
mod route;
|
||||||
pub use route::*;
|
pub use route::*;
|
||||||
|
|
||||||
|
mod route_ext;
|
||||||
|
pub use route_ext::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod season;
|
mod season;
|
||||||
pub use season::*;
|
pub use season::*;
|
||||||
|
|
||||||
/// Trait allowing iteration of enum types, implemented by several enums in this module.
|
/// Trait allowing iteration of enum types, implemented by several enums in this module.
|
||||||
/// Re-exported from strum.
|
/// Re-exported from strum.
|
||||||
///
|
|
||||||
///
|
|
||||||
pub use strum::IntoEnumIterator;
|
pub use strum::IntoEnumIterator;
|
||||||
|
|
||||||
mod team;
|
mod team;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -6,113 +7,129 @@
|
||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
|
||||||
|
|
||||||
newtype_enum! {
|
newtype_enum! {
|
||||||
/// A League of Legends matchmaking queue.
|
/// A League of Legends matchmaking queue.
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Queue(u16) {
|
pub newtype_enum Queue(u16) {
|
||||||
/// `0`.
|
/// `0`.
|
||||||
/// Games on Custom games
|
/// Games on Custom games
|
||||||
CUSTOM = 0,
|
CUSTOM = 0,
|
||||||
/// `2`.
|
/// `2`.
|
||||||
/// 5v5 Blind Pick games on Summoner's Rift
|
/// 5v5 Blind Pick games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 430
|
/// Deprecated in patch 7.19 in favor of queueId 430
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_5V5_BLIND_PICK_DEPRECATED_2 = 2,
|
||||||
/// `4`.
|
/// `4`.
|
||||||
/// 5v5 Ranked Solo games on Summoner's Rift
|
/// 5v5 Ranked Solo games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in favor of queueId 420
|
/// Deprecated in favor of queueId 420
|
||||||
#[deprecated(note="Deprecated in favor of queueId 420")]
|
#[deprecated(note="Deprecated in favor of queueId 420")]
|
||||||
SUMMONERS_RIFT_5V5_RANKED_SOLO_DEPRECATED_4 = 4,
|
SUMMONERS_RIFT_5V5_RANKED_SOLO_DEPRECATED_4 = 4,
|
||||||
/// `6`.
|
/// `6`.
|
||||||
/// 5v5 Ranked Premade games on Summoner's Rift
|
/// 5v5 Ranked Premade games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
SUMMONERS_RIFT_5V5_RANKED_PREMADE = 6,
|
SUMMONERS_RIFT_5V5_RANKED_PREMADE = 6,
|
||||||
/// `7`.
|
/// `7`.
|
||||||
/// Co-op vs AI games on Summoner's Rift
|
/// Co-op vs AI games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in favor of queueId 32 and 33
|
/// Deprecated in favor of queueId 32 and 33
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_CO_OP_VS_AI = 7,
|
||||||
/// `8`.
|
/// `8`.
|
||||||
/// 3v3 Normal games on Twisted Treeline
|
/// 3v3 Normal games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 460
|
/// Deprecated in patch 7.19 in favor of queueId 460
|
||||||
#[deprecated(note="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,
|
TWISTED_TREELINE_3V3_NORMAL = 8,
|
||||||
/// `9`.
|
/// `9`.
|
||||||
/// 3v3 Ranked Flex games on Twisted Treeline
|
/// 3v3 Ranked Flex games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 470
|
/// Deprecated in patch 7.19 in favor of queueId 470
|
||||||
#[deprecated(note="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,
|
TWISTED_TREELINE_3V3_RANKED_FLEX_DEPRECATED_9 = 9,
|
||||||
/// `14`.
|
/// `14`.
|
||||||
/// 5v5 Draft Pick games on Summoner's Rift
|
/// 5v5 Draft Pick games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in favor of queueId 400
|
/// Deprecated in favor of queueId 400
|
||||||
#[deprecated(note="Deprecated in favor of queueId 400")]
|
#[deprecated(note="Deprecated in favor of queueId 400")]
|
||||||
SUMMONERS_RIFT_5V5_DRAFT_PICK_DEPRECATED_14 = 14,
|
SUMMONERS_RIFT_5V5_DRAFT_PICK_DEPRECATED_14 = 14,
|
||||||
/// `16`.
|
/// `16`.
|
||||||
/// 5v5 Dominion Blind Pick games on Crystal Scar
|
/// 5v5 Dominion Blind Pick games on Crystal Scar
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
CRYSTAL_SCAR_5V5_DOMINION_BLIND_PICK = 16,
|
CRYSTAL_SCAR_5V5_DOMINION_BLIND_PICK = 16,
|
||||||
/// `17`.
|
/// `17`.
|
||||||
/// 5v5 Dominion Draft Pick games on Crystal Scar
|
/// 5v5 Dominion Draft Pick games on Crystal Scar
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
CRYSTAL_SCAR_5V5_DOMINION_DRAFT_PICK = 17,
|
CRYSTAL_SCAR_5V5_DOMINION_DRAFT_PICK = 17,
|
||||||
/// `25`.
|
/// `25`.
|
||||||
/// Dominion Co-op vs AI games on Crystal Scar
|
/// Dominion Co-op vs AI games on Crystal Scar
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
CRYSTAL_SCAR_DOMINION_CO_OP_VS_AI = 25,
|
CRYSTAL_SCAR_DOMINION_CO_OP_VS_AI = 25,
|
||||||
/// `31`.
|
/// `31`.
|
||||||
/// Co-op vs AI Intro Bot games on Summoner's Rift
|
/// Co-op vs AI Intro Bot games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 830
|
/// Deprecated in patch 7.19 in favor of queueId 830
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_CO_OP_VS_AI_INTRO_BOT_DEPRECATED_31 = 31,
|
||||||
/// `32`.
|
/// `32`.
|
||||||
/// Co-op vs AI Beginner Bot games on Summoner's Rift
|
/// Co-op vs AI Beginner Bot games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 840
|
/// Deprecated in patch 7.19 in favor of queueId 840
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_CO_OP_VS_AI_BEGINNER_BOT_DEPRECATED_32 = 32,
|
||||||
/// `33`.
|
/// `33`.
|
||||||
/// Co-op vs AI Intermediate Bot games on Summoner's Rift
|
/// Co-op vs AI Intermediate Bot games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 850
|
/// Deprecated in patch 7.19 in favor of queueId 850
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_CO_OP_VS_AI_INTERMEDIATE_BOT_DEPRECATED_33 = 33,
|
||||||
/// `41`.
|
/// `41`.
|
||||||
/// 3v3 Ranked Team games on Twisted Treeline
|
/// 3v3 Ranked Team games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
TWISTED_TREELINE_3V3_RANKED_TEAM = 41,
|
TWISTED_TREELINE_3V3_RANKED_TEAM = 41,
|
||||||
/// `42`.
|
/// `42`.
|
||||||
/// 5v5 Ranked Team games on Summoner's Rift
|
/// 5v5 Ranked Team games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
SUMMONERS_RIFT_5V5_RANKED_TEAM = 42,
|
SUMMONERS_RIFT_5V5_RANKED_TEAM = 42,
|
||||||
/// `52`.
|
/// `52`.
|
||||||
/// Co-op vs AI games on Twisted Treeline
|
/// Co-op vs AI games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 800
|
/// Deprecated in patch 7.19 in favor of queueId 800
|
||||||
#[deprecated(note="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,
|
TWISTED_TREELINE_CO_OP_VS_AI = 52,
|
||||||
/// `61`.
|
/// `61`.
|
||||||
/// 5v5 Team Builder games on Summoner's Rift
|
/// 5v5 Team Builder games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
SUMMONERS_RIFT_5V5_TEAM_BUILDER = 61,
|
SUMMONERS_RIFT_5V5_TEAM_BUILDER = 61,
|
||||||
/// `65`.
|
/// `65`.
|
||||||
/// 5v5 ARAM games on Howling Abyss
|
/// 5v5 ARAM games on Howling Abyss
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 450
|
/// Deprecated in patch 7.19 in favor of queueId 450
|
||||||
#[deprecated(note="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,
|
HOWLING_ABYSS_5V5_ARAM_DEPRECATED_65 = 65,
|
||||||
/// `67`.
|
/// `67`.
|
||||||
/// ARAM Co-op vs AI games on Howling Abyss
|
/// ARAM Co-op vs AI games on Howling Abyss
|
||||||
|
///
|
||||||
/// Game mode deprecated
|
/// Game mode deprecated
|
||||||
#[deprecated(note="Game mode deprecated")]
|
#[deprecated(note="Game mode deprecated")]
|
||||||
HOWLING_ABYSS_ARAM_CO_OP_VS_AI = 67,
|
HOWLING_ABYSS_ARAM_CO_OP_VS_AI = 67,
|
||||||
/// `70`.
|
/// `70`.
|
||||||
/// One for All games on Summoner's Rift
|
/// One for All games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 8.6 in favor of queueId 1020
|
/// Deprecated in patch 8.6 in favor of queueId 1020
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_ONE_FOR_ALL_DEPRECATED_70 = 70,
|
||||||
|
@ -136,21 +153,25 @@ newtype_enum! {
|
||||||
SUMMONERS_RIFT_CO_OP_VS_AI_ULTRA_RAPID_FIRE = 83,
|
SUMMONERS_RIFT_CO_OP_VS_AI_ULTRA_RAPID_FIRE = 83,
|
||||||
/// `91`.
|
/// `91`.
|
||||||
/// Doom Bots Rank 1 games on Summoner's Rift
|
/// Doom Bots Rank 1 games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 950
|
/// Deprecated in patch 7.19 in favor of queueId 950
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_DOOM_BOTS_RANK_1 = 91,
|
||||||
/// `92`.
|
/// `92`.
|
||||||
/// Doom Bots Rank 2 games on Summoner's Rift
|
/// Doom Bots Rank 2 games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 950
|
/// Deprecated in patch 7.19 in favor of queueId 950
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_DOOM_BOTS_RANK_2 = 92,
|
||||||
/// `93`.
|
/// `93`.
|
||||||
/// Doom Bots Rank 5 games on Summoner's Rift
|
/// Doom Bots Rank 5 games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 950
|
/// Deprecated in patch 7.19 in favor of queueId 950
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_DOOM_BOTS_RANK_5 = 93,
|
||||||
/// `96`.
|
/// `96`.
|
||||||
/// Ascension games on Crystal Scar
|
/// Ascension games on Crystal Scar
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 910
|
/// Deprecated in patch 7.19 in favor of queueId 910
|
||||||
#[deprecated(note="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,
|
CRYSTAL_SCAR_ASCENSION_DEPRECATED_96 = 96,
|
||||||
|
@ -162,6 +183,7 @@ newtype_enum! {
|
||||||
BUTCHERS_BRIDGE_5V5_ARAM = 100,
|
BUTCHERS_BRIDGE_5V5_ARAM = 100,
|
||||||
/// `300`.
|
/// `300`.
|
||||||
/// Legend of the Poro King games on Howling Abyss
|
/// Legend of the Poro King games on Howling Abyss
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 920
|
/// Deprecated in patch 7.19 in favor of queueId 920
|
||||||
#[deprecated(note="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,
|
HOWLING_ABYSS_LEGEND_OF_THE_PORO_KING_DEPRECATED_300 = 300,
|
||||||
|
@ -173,6 +195,7 @@ newtype_enum! {
|
||||||
SUMMONERS_RIFT_BLACK_MARKET_BRAWLERS = 313,
|
SUMMONERS_RIFT_BLACK_MARKET_BRAWLERS = 313,
|
||||||
/// `315`.
|
/// `315`.
|
||||||
/// Nexus Siege games on Summoner's Rift
|
/// Nexus Siege games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 940
|
/// Deprecated in patch 7.19 in favor of queueId 940
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_NEXUS_SIEGE_DEPRECATED_315 = 315,
|
||||||
|
@ -181,6 +204,7 @@ newtype_enum! {
|
||||||
CRYSTAL_SCAR_DEFINITELY_NOT_DOMINION = 317,
|
CRYSTAL_SCAR_DEFINITELY_NOT_DOMINION = 317,
|
||||||
/// `318`.
|
/// `318`.
|
||||||
/// ARURF games on Summoner's Rift
|
/// ARURF games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Deprecated in patch 7.19 in favor of queueId 900
|
/// Deprecated in patch 7.19 in favor of queueId 900
|
||||||
#[deprecated(note="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,
|
SUMMONERS_RIFT_ARURF_DEPRECATED_318 = 318,
|
||||||
|
@ -192,6 +216,7 @@ newtype_enum! {
|
||||||
SUMMONERS_RIFT_5V5_DRAFT_PICK = 400,
|
SUMMONERS_RIFT_5V5_DRAFT_PICK = 400,
|
||||||
/// `410`.
|
/// `410`.
|
||||||
/// 5v5 Ranked Dynamic games on Summoner's Rift
|
/// 5v5 Ranked Dynamic games on Summoner's Rift
|
||||||
|
///
|
||||||
/// Game mode deprecated in patch 6.22
|
/// Game mode deprecated in patch 6.22
|
||||||
#[deprecated(note="Game mode deprecated in patch 6.22")]
|
#[deprecated(note="Game mode deprecated in patch 6.22")]
|
||||||
SUMMONERS_RIFT_5V5_RANKED_DYNAMIC = 410,
|
SUMMONERS_RIFT_5V5_RANKED_DYNAMIC = 410,
|
||||||
|
@ -209,14 +234,21 @@ newtype_enum! {
|
||||||
HOWLING_ABYSS_5V5_ARAM = 450,
|
HOWLING_ABYSS_5V5_ARAM = 450,
|
||||||
/// `460`.
|
/// `460`.
|
||||||
/// 3v3 Blind Pick games on Twisted Treeline
|
/// 3v3 Blind Pick games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 9.23
|
/// Deprecated in patch 9.23
|
||||||
#[deprecated(note="Deprecated in patch 9.23")]
|
#[deprecated(note="Deprecated in patch 9.23")]
|
||||||
TWISTED_TREELINE_3V3_BLIND_PICK = 460,
|
TWISTED_TREELINE_3V3_BLIND_PICK = 460,
|
||||||
/// `470`.
|
/// `470`.
|
||||||
/// 3v3 Ranked Flex games on Twisted Treeline
|
/// 3v3 Ranked Flex games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 9.23
|
/// Deprecated in patch 9.23
|
||||||
#[deprecated(note="Deprecated in patch 9.23")]
|
#[deprecated(note="Deprecated in patch 9.23")]
|
||||||
TWISTED_TREELINE_3V3_RANKED_FLEX_DEPRECATED_470 = 470,
|
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`.
|
/// `600`.
|
||||||
/// Blood Hunt Assassin games on Summoner's Rift
|
/// Blood Hunt Assassin games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_BLOOD_HUNT_ASSASSIN = 600,
|
SUMMONERS_RIFT_BLOOD_HUNT_ASSASSIN = 600,
|
||||||
|
@ -224,15 +256,20 @@ newtype_enum! {
|
||||||
/// Dark Star: Singularity games on Cosmic Ruins
|
/// Dark Star: Singularity games on Cosmic Ruins
|
||||||
COSMIC_RUINS_DARK_STAR_SINGULARITY = 610,
|
COSMIC_RUINS_DARK_STAR_SINGULARITY = 610,
|
||||||
/// `700`.
|
/// `700`.
|
||||||
/// Clash games on Summoner's Rift
|
/// Summoner's Rift Clash games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_CLASH = 700,
|
SUMMONERS_RIFT_CLASH = 700,
|
||||||
|
/// `720`.
|
||||||
|
/// ARAM Clash games on Howling Abyss
|
||||||
|
HOWLING_ABYSS_ARAM_CLASH = 720,
|
||||||
/// `800`.
|
/// `800`.
|
||||||
/// Co-op vs. AI Intermediate Bot games on Twisted Treeline
|
/// Co-op vs. AI Intermediate Bot games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 9.23
|
/// Deprecated in patch 9.23
|
||||||
#[deprecated(note="Deprecated in patch 9.23")]
|
#[deprecated(note="Deprecated in patch 9.23")]
|
||||||
TWISTED_TREELINE_CO_OP_VS_AI_INTERMEDIATE_BOT = 800,
|
TWISTED_TREELINE_CO_OP_VS_AI_INTERMEDIATE_BOT = 800,
|
||||||
/// `810`.
|
/// `810`.
|
||||||
/// Co-op vs. AI Intro Bot games on Twisted Treeline
|
/// Co-op vs. AI Intro Bot games on Twisted Treeline
|
||||||
|
///
|
||||||
/// Deprecated in patch 9.23
|
/// Deprecated in patch 9.23
|
||||||
#[deprecated(note="Deprecated in patch 9.23")]
|
#[deprecated(note="Deprecated in patch 9.23")]
|
||||||
TWISTED_TREELINE_CO_OP_VS_AI_INTRO_BOT = 810,
|
TWISTED_TREELINE_CO_OP_VS_AI_INTRO_BOT = 810,
|
||||||
|
@ -318,19 +355,29 @@ newtype_enum! {
|
||||||
/// Ranked Teamfight Tactics (Hyper Roll) games on Convergence
|
/// Ranked Teamfight Tactics (Hyper Roll) games on Convergence
|
||||||
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_HYPER_ROLL_ = 1130,
|
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_HYPER_ROLL_ = 1130,
|
||||||
/// `1150`.
|
/// `1150`.
|
||||||
/// Ranked Teamfight Tactics (Double Up Beta) games on Convergence
|
/// Ranked Teamfight Tactics (Double Up Workshop) games on Convergence
|
||||||
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_DOUBLE_UP_BETA_ = 1150,
|
///
|
||||||
|
/// 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,
|
||||||
|
/// `1160`.
|
||||||
|
/// Ranked Teamfight Tactics (Double Up Workshop) games on Convergence
|
||||||
|
CONVERGENCE_RANKED_TEAMFIGHT_TACTICS_DOUBLE_UP_WORKSHOP_ = 1160,
|
||||||
/// `1200`.
|
/// `1200`.
|
||||||
/// Nexus Blitz games on Nexus Blitz
|
/// Nexus Blitz games on Nexus Blitz
|
||||||
|
///
|
||||||
/// Deprecated in patch 9.2 in favor of queueId 1300
|
/// Deprecated in patch 9.2 in favor of queueId 1300
|
||||||
#[deprecated(note="Deprecated in patch 9.2 in favor of queueId 1300")]
|
#[deprecated(note="Deprecated in patch 9.2 in favor of queueId 1300")]
|
||||||
NEXUS_BLITZ_NEXUS_BLITZ_DEPRECATED_1200 = 1200,
|
NEXUS_BLITZ_DEPRECATED_1200 = 1200,
|
||||||
/// `1300`.
|
/// `1300`.
|
||||||
/// Nexus Blitz games on Nexus Blitz
|
/// Nexus Blitz games on Nexus Blitz
|
||||||
NEXUS_BLITZ_NEXUS_BLITZ = 1300,
|
NEXUS_BLITZ = 1300,
|
||||||
/// `1400`.
|
/// `1400`.
|
||||||
/// Ultimate Spellbook games on Summoner's Rift
|
/// Ultimate Spellbook games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_ULTIMATE_SPELLBOOK = 1400,
|
SUMMONERS_RIFT_ULTIMATE_SPELLBOOK = 1400,
|
||||||
|
/// `1700`.
|
||||||
|
/// 2v2v2v2 `CHERRY` games on Arena
|
||||||
|
ARENA_2V2V2V2_CHERRY_ = 1700,
|
||||||
/// `1900`.
|
/// `1900`.
|
||||||
/// Pick URF games on Summoner's Rift
|
/// Pick URF games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_PICK_URF = 1900,
|
SUMMONERS_RIFT_PICK_URF = 1900,
|
||||||
|
@ -343,5 +390,8 @@ newtype_enum! {
|
||||||
/// `2020`.
|
/// `2020`.
|
||||||
/// Tutorial 3 games on Summoner's Rift
|
/// Tutorial 3 games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_TUTORIAL_3 = 2020,
|
SUMMONERS_RIFT_TUTORIAL_3 = 2020,
|
||||||
|
/// `6000`.
|
||||||
|
/// Teamfight Tactics Set 3.5 Revival games on Convergence
|
||||||
|
CONVERGENCE_TEAMFIGHT_TACTICS_SET_3_5_REVIVAL = 6000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,311 +1,48 @@
|
||||||
// use serde::{ Serialize, Deserialize };
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
// use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
|
///////////////////////////////////////////////
|
||||||
|
// //
|
||||||
|
// ! //
|
||||||
|
// This file is automatically generated! //
|
||||||
|
// Do not directly edit! //
|
||||||
|
// //
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// /// LoL or TFT ranked queue types.
|
use strum_macros::{ EnumString, EnumVariantNames, IntoStaticStr };
|
||||||
// #[non_exhaustive]
|
|
||||||
// #[derive(Debug, Clone)]
|
|
||||||
// #[derive(Eq, PartialEq, Hash)]
|
|
||||||
// #[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
|
|
||||||
// #[derive(Deserialize)]
|
|
||||||
// #[serde(try_from = "&str")]
|
|
||||||
// pub enum QueueType {
|
|
||||||
// /// Catch-all variant for new, unknown queue types.
|
|
||||||
// #[strum(default)]
|
|
||||||
// UNKNOWN(String),
|
|
||||||
|
|
||||||
// /// League of Legends, Summoner's Rift (5v5), Ranked Solo Queue.
|
/// LoL or TFT ranked queue types.
|
||||||
// RANKED_SOLO_5x5,
|
#[non_exhaustive]
|
||||||
// /// League of Legends, Summoner's Rift (5v5), Flex Queue.
|
#[derive(Debug, Clone)]
|
||||||
// RANKED_FLEX_SR,
|
#[derive(Eq, PartialEq, Hash)]
|
||||||
// /// League of Legends, Twisted Treeline (3v3), Flex Queue.
|
#[derive(EnumString, EnumVariantNames, IntoStaticStr)]
|
||||||
// RANKED_FLEX_TT,
|
#[repr(u8)]
|
||||||
// /// Ranked Teamfight Tactics.
|
pub enum QueueType {
|
||||||
// RANKED_TFT,
|
/// Catch-all variant for new, unknown queue types.
|
||||||
// /// Ranked Teamfight Tactics, Hyper Roll gamemode.
|
#[strum(default)]
|
||||||
// RANKED_TFT_TURBO,
|
UNKNOWN(String),
|
||||||
// /// Ranked Teamfight Tactics, Double Up gamemode.
|
|
||||||
// RANKED_TFT_DOUBLE_UP,
|
|
||||||
|
|
||||||
// /// Ranked Teamfight Tactics, OLD Double Up gamemode. Changed some time before June 2022.
|
/// 5v5 Ranked Solo games
|
||||||
// #[deprecated(note="Use RANKED_TFT_DOUBLE_UP instead.")]
|
RANKED_SOLO_5x5,
|
||||||
// RANKED_TFT_PAIRS,
|
/// 5v5 Ranked Flex games
|
||||||
// }
|
RANKED_FLEX_SR,
|
||||||
|
/// 3v3 Ranked Flex games
|
||||||
|
/// Deprecated in patch 9.23
|
||||||
|
#[deprecated(note="Deprecated in patch 9.23")]
|
||||||
|
RANKED_FLEX_TT,
|
||||||
|
/// Ranked Teamfight Tactics games
|
||||||
|
RANKED_TFT,
|
||||||
|
/// 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`)")]
|
||||||
|
RANKED_TFT_PAIRS,
|
||||||
|
/// Ranked Teamfight Tactics (Double Up Workshop) games
|
||||||
|
RANKED_TFT_DOUBLE_UP,
|
||||||
|
/// 2v2v2v2 "Arena" games
|
||||||
|
CHERRY,
|
||||||
|
}
|
||||||
|
|
||||||
// #[cfg(test)]
|
serde_strum_unknown!(QueueType);
|
||||||
// mod test {
|
|
||||||
// use super::*;
|
|
||||||
|
|
||||||
// #[test]
|
#[cfg(test)]
|
||||||
// fn check_as_ref() {
|
mod test;
|
||||||
// assert_eq!("RANKED_SOLO_5x5", QueueType::RANKED_SOLO_5x5.as_ref());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn check_to_string() {
|
|
||||||
// assert_eq!("RANKED_SOLO_5x5", QueueType::RANKED_SOLO_5x5.to_string());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn check_from_string() {
|
|
||||||
// assert_eq!(Some(QueueType::RANKED_SOLO_5x5), "RANKED_SOLO_5x5".parse().ok());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn check_deserialize_unknown() {
|
|
||||||
// use std::collections::HashMap;
|
|
||||||
|
|
||||||
// let s = r#"{
|
|
||||||
// "a": "RANKED_SOLO_5x5",
|
|
||||||
// "b": "RANKED_TFT_DOUBLE_UP",
|
|
||||||
// "c": "RANKED_TFT_PAIRS",
|
|
||||||
// "d": "RANKED_UNKNOWN_ASDF"
|
|
||||||
// }
|
|
||||||
// "#;
|
|
||||||
// let dict: HashMap<String, QueueType> = serde_json::from_str(s).expect("Failed to parse.");
|
|
||||||
// let expected: HashMap<String, QueueType> = std::iter::IntoIterator::into_iter([
|
|
||||||
// ("a", QueueType::RANKED_SOLO_5x5),
|
|
||||||
// ("b", QueueType::RANKED_TFT_DOUBLE_UP),
|
|
||||||
// ("c", QueueType::RANKED_TFT_PAIRS),
|
|
||||||
// ("d", QueueType::UNKNOWN("RANKED_UNKNOWN_ASDF".to_owned())),
|
|
||||||
// ]).map(|(k, v)| (k.to_owned(), v)).collect();
|
|
||||||
// assert_eq!(expected, dict);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
|
||||||
use strum_macros::{EnumString, Display, AsRefStr, IntoStaticStr};
|
|
||||||
/// LoL or TFT ranked queue types.
|
|
||||||
#[non_exhaustive]
|
|
||||||
// #[serde(try_from = "&str")]
|
|
||||||
pub enum QueueType {
|
|
||||||
/// Catch-all variant for new, unknown queue types.
|
|
||||||
// #[strum(default)]
|
|
||||||
UNKNOWN(String),
|
|
||||||
/// League of Legends, Summoner's Rift (5v5), Ranked Solo Queue.
|
|
||||||
RANKED_SOLO_5x5,
|
|
||||||
/// League of Legends, Summoner's Rift (5v5), Flex Queue.
|
|
||||||
RANKED_FLEX_SR,
|
|
||||||
/// League of Legends, Twisted Treeline (3v3), Flex Queue.
|
|
||||||
RANKED_FLEX_TT,
|
|
||||||
/// Ranked Teamfight Tactics.
|
|
||||||
RANKED_TFT,
|
|
||||||
/// Ranked Teamfight Tactics, Hyper Roll gamemode.
|
|
||||||
RANKED_TFT_TURBO,
|
|
||||||
/// Ranked Teamfight Tactics, Double Up gamemode.
|
|
||||||
RANKED_TFT_DOUBLE_UP,
|
|
||||||
/// Ranked Teamfight Tactics, OLD Double Up gamemode. Changed some time before June 2022.
|
|
||||||
#[deprecated(note = "Use RANKED_TFT_DOUBLE_UP instead.")]
|
|
||||||
RANKED_TFT_PAIRS,
|
|
||||||
}
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
|
||||||
const _: () = {
|
|
||||||
#[allow(unused_extern_crates, clippy::useless_attribute)]
|
|
||||||
extern crate serde as _serde;
|
|
||||||
#[automatically_derived]
|
|
||||||
impl<'de> _serde::Deserialize<'de> for QueueType {
|
|
||||||
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error>
|
|
||||||
where
|
|
||||||
__D: _serde::Deserializer<'de>,
|
|
||||||
{
|
|
||||||
_serde::__private::Result::and_then(
|
|
||||||
<&str as _serde::Deserialize>::deserialize(__deserializer),
|
|
||||||
|v| _serde::__private::TryFrom::try_from(v).map_err(_serde::de::Error::custom),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
impl ::std::str::FromStr for QueueType {
|
|
||||||
type Err = ::strum::ParseError;
|
|
||||||
fn from_str(s: &str) -> ::std::result::Result<QueueType, Self::Err> {
|
|
||||||
match s {
|
|
||||||
"RANKED_SOLO_5x5" => ::std::result::Result::Ok(QueueType::RANKED_SOLO_5x5),
|
|
||||||
"RANKED_FLEX_SR" => ::std::result::Result::Ok(QueueType::RANKED_FLEX_SR),
|
|
||||||
"RANKED_FLEX_TT" => ::std::result::Result::Ok(QueueType::RANKED_FLEX_TT),
|
|
||||||
"RANKED_TFT" => ::std::result::Result::Ok(QueueType::RANKED_TFT),
|
|
||||||
"RANKED_TFT_TURBO" => ::std::result::Result::Ok(QueueType::RANKED_TFT_TURBO),
|
|
||||||
"RANKED_TFT_DOUBLE_UP" => {
|
|
||||||
::std::result::Result::Ok(QueueType::RANKED_TFT_DOUBLE_UP)
|
|
||||||
}
|
|
||||||
"RANKED_TFT_PAIRS" => ::std::result::Result::Ok(QueueType::RANKED_TFT_PAIRS),
|
|
||||||
default => ::std::result::Result::Ok(QueueType::UNKNOWN(default.into())),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ::std::fmt::Display for QueueType {
|
|
||||||
fn fmt(
|
|
||||||
&self,
|
|
||||||
f: &mut ::std::fmt::Formatter,
|
|
||||||
) -> ::std::result::Result<(), ::std::fmt::Error> {
|
|
||||||
match *self {
|
|
||||||
QueueType::UNKNOWN(..) => f.pad("UNKNOWN"),
|
|
||||||
QueueType::RANKED_SOLO_5x5 => f.pad("RANKED_SOLO_5x5"),
|
|
||||||
QueueType::RANKED_FLEX_SR => f.pad("RANKED_FLEX_SR"),
|
|
||||||
QueueType::RANKED_FLEX_TT => f.pad("RANKED_FLEX_TT"),
|
|
||||||
QueueType::RANKED_TFT => f.pad("RANKED_TFT"),
|
|
||||||
QueueType::RANKED_TFT_TURBO => f.pad("RANKED_TFT_TURBO"),
|
|
||||||
QueueType::RANKED_TFT_DOUBLE_UP => f.pad("RANKED_TFT_DOUBLE_UP"),
|
|
||||||
QueueType::RANKED_TFT_PAIRS => f.pad("RANKED_TFT_PAIRS"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ::std::convert::AsRef<str> for QueueType {
|
|
||||||
fn as_ref(&self) -> &str {
|
|
||||||
match *self {
|
|
||||||
QueueType::UNKNOWN(..) => "UNKNOWN",
|
|
||||||
QueueType::RANKED_SOLO_5x5 => "RANKED_SOLO_5x5",
|
|
||||||
QueueType::RANKED_FLEX_SR => "RANKED_FLEX_SR",
|
|
||||||
QueueType::RANKED_FLEX_TT => "RANKED_FLEX_TT",
|
|
||||||
QueueType::RANKED_TFT => "RANKED_TFT",
|
|
||||||
QueueType::RANKED_TFT_TURBO => "RANKED_TFT_TURBO",
|
|
||||||
QueueType::RANKED_TFT_DOUBLE_UP => "RANKED_TFT_DOUBLE_UP",
|
|
||||||
QueueType::RANKED_TFT_PAIRS => "RANKED_TFT_PAIRS",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ::std::convert::From<QueueType> for &'static str {
|
|
||||||
fn from(x: QueueType) -> &'static str {
|
|
||||||
match x {
|
|
||||||
QueueType::UNKNOWN(..) => "UNKNOWN",
|
|
||||||
QueueType::RANKED_SOLO_5x5 => "RANKED_SOLO_5x5",
|
|
||||||
QueueType::RANKED_FLEX_SR => "RANKED_FLEX_SR",
|
|
||||||
QueueType::RANKED_FLEX_TT => "RANKED_FLEX_TT",
|
|
||||||
QueueType::RANKED_TFT => "RANKED_TFT",
|
|
||||||
QueueType::RANKED_TFT_TURBO => "RANKED_TFT_TURBO",
|
|
||||||
QueueType::RANKED_TFT_DOUBLE_UP => "RANKED_TFT_DOUBLE_UP",
|
|
||||||
QueueType::RANKED_TFT_PAIRS => "RANKED_TFT_PAIRS",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<'_derivative_strum> ::std::convert::From<&'_derivative_strum QueueType> for &'static str {
|
|
||||||
fn from(x: &'_derivative_strum QueueType) -> &'static str {
|
|
||||||
match *x {
|
|
||||||
QueueType::UNKNOWN(..) => "UNKNOWN",
|
|
||||||
QueueType::RANKED_SOLO_5x5 => "RANKED_SOLO_5x5",
|
|
||||||
QueueType::RANKED_FLEX_SR => "RANKED_FLEX_SR",
|
|
||||||
QueueType::RANKED_FLEX_TT => "RANKED_FLEX_TT",
|
|
||||||
QueueType::RANKED_TFT => "RANKED_TFT",
|
|
||||||
QueueType::RANKED_TFT_TURBO => "RANKED_TFT_TURBO",
|
|
||||||
QueueType::RANKED_TFT_DOUBLE_UP => "RANKED_TFT_DOUBLE_UP",
|
|
||||||
QueueType::RANKED_TFT_PAIRS => "RANKED_TFT_PAIRS",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ::core::marker::StructuralEq for QueueType {}
|
|
||||||
#[automatically_derived]
|
|
||||||
#[allow(unused_qualifications)]
|
|
||||||
impl ::core::cmp::Eq for QueueType {
|
|
||||||
#[inline]
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[no_coverage]
|
|
||||||
fn assert_receiver_is_total_eq(&self) -> () {
|
|
||||||
{
|
|
||||||
let _: ::core::cmp::AssertParamIsEq<String>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ::core::marker::StructuralPartialEq for QueueType {}
|
|
||||||
#[automatically_derived]
|
|
||||||
#[allow(unused_qualifications)]
|
|
||||||
impl ::core::cmp::PartialEq for QueueType {
|
|
||||||
#[inline]
|
|
||||||
fn eq(&self, other: &QueueType) -> bool {
|
|
||||||
{
|
|
||||||
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
|
|
||||||
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
|
|
||||||
if true && __self_vi == __arg_1_vi {
|
|
||||||
match (&*self, &*other) {
|
|
||||||
(&QueueType::UNKNOWN(ref __self_0), &QueueType::UNKNOWN(ref __arg_1_0)) => {
|
|
||||||
(*__self_0) == (*__arg_1_0)
|
|
||||||
}
|
|
||||||
_ => true,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &QueueType) -> bool {
|
|
||||||
{
|
|
||||||
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
|
|
||||||
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
|
|
||||||
if true && __self_vi == __arg_1_vi {
|
|
||||||
match (&*self, &*other) {
|
|
||||||
(&QueueType::UNKNOWN(ref __self_0), &QueueType::UNKNOWN(ref __arg_1_0)) => {
|
|
||||||
(*__self_0) != (*__arg_1_0)
|
|
||||||
}
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[automatically_derived]
|
|
||||||
#[allow(unused_qualifications)]
|
|
||||||
impl ::core::hash::Hash for QueueType {
|
|
||||||
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
|
|
||||||
match (&*self,) {
|
|
||||||
(&QueueType::UNKNOWN(ref __self_0),) => {
|
|
||||||
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state);
|
|
||||||
::core::hash::Hash::hash(&(*__self_0), state)
|
|
||||||
}
|
|
||||||
_ => ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[automatically_derived]
|
|
||||||
#[allow(unused_qualifications)]
|
|
||||||
impl ::core::fmt::Debug for QueueType {
|
|
||||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
|
||||||
match (&*self,) {
|
|
||||||
(&QueueType::UNKNOWN(ref __self_0),) => {
|
|
||||||
let debug_trait_builder =
|
|
||||||
&mut ::core::fmt::Formatter::debug_tuple(f, "UNKNOWN");
|
|
||||||
let _ = ::core::fmt::DebugTuple::field(debug_trait_builder, &&(*__self_0));
|
|
||||||
::core::fmt::DebugTuple::finish(debug_trait_builder)
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_SOLO_5x5,) => {
|
|
||||||
::core::fmt::Formatter::write_str(f, "RANKED_SOLO_5x5")
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_FLEX_SR,) => {
|
|
||||||
::core::fmt::Formatter::write_str(f, "RANKED_FLEX_SR")
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_FLEX_TT,) => {
|
|
||||||
::core::fmt::Formatter::write_str(f, "RANKED_FLEX_TT")
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_TFT,) => ::core::fmt::Formatter::write_str(f, "RANKED_TFT"),
|
|
||||||
(&QueueType::RANKED_TFT_TURBO,) => {
|
|
||||||
::core::fmt::Formatter::write_str(f, "RANKED_TFT_TURBO")
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_TFT_DOUBLE_UP,) => {
|
|
||||||
::core::fmt::Formatter::write_str(f, "RANKED_TFT_DOUBLE_UP")
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_TFT_PAIRS,) => {
|
|
||||||
::core::fmt::Formatter::write_str(f, "RANKED_TFT_PAIRS")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[automatically_derived]
|
|
||||||
#[allow(unused_qualifications)]
|
|
||||||
impl ::core::clone::Clone for QueueType {
|
|
||||||
#[inline]
|
|
||||||
fn clone(&self) -> QueueType {
|
|
||||||
match (&*self,) {
|
|
||||||
(&QueueType::UNKNOWN(ref __self_0),) => {
|
|
||||||
QueueType::UNKNOWN(::core::clone::Clone::clone(&(*__self_0)))
|
|
||||||
}
|
|
||||||
(&QueueType::RANKED_SOLO_5x5,) => QueueType::RANKED_SOLO_5x5,
|
|
||||||
(&QueueType::RANKED_FLEX_SR,) => QueueType::RANKED_FLEX_SR,
|
|
||||||
(&QueueType::RANKED_FLEX_TT,) => QueueType::RANKED_FLEX_TT,
|
|
||||||
(&QueueType::RANKED_TFT,) => QueueType::RANKED_TFT,
|
|
||||||
(&QueueType::RANKED_TFT_TURBO,) => QueueType::RANKED_TFT_TURBO,
|
|
||||||
(&QueueType::RANKED_TFT_DOUBLE_UP,) => QueueType::RANKED_TFT_DOUBLE_UP,
|
|
||||||
(&QueueType::RANKED_TFT_PAIRS,) => QueueType::RANKED_TFT_PAIRS,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn check_as_ref() {
|
||||||
|
assert_eq!("RANKED_SOLO_5x5", QueueType::RANKED_SOLO_5x5.as_ref());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn check_to_string() {
|
||||||
|
assert_eq!("RANKED_SOLO_5x5", QueueType::RANKED_SOLO_5x5.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn check_from_string() {
|
||||||
|
assert_eq!(QueueType::RANKED_SOLO_5x5, "RANKED_SOLO_5x5".into());
|
||||||
|
assert_eq!(QueueType::UNKNOWN("RANKED_MYSTERY_UNKNOWN".to_owned()), "RANKED_MYSTERY_UNKNOWN".into());
|
||||||
|
assert_eq!("RANKED_MYSTERY_UNKNOWN", QueueType::UNKNOWN("RANKED_MYSTERY_UNKNOWN".to_owned()).as_ref());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn check_serialize() {
|
||||||
|
assert_eq!(Some("\"RANKED_TFT_DOUBLE_UP\""),
|
||||||
|
serde_json::to_string(&QueueType::RANKED_TFT_DOUBLE_UP)
|
||||||
|
.ok().as_deref());
|
||||||
|
assert_eq!(Some("\"RANKED_MYSTERY_UNKNOWN\""),
|
||||||
|
serde_json::to_string(&QueueType::UNKNOWN("RANKED_MYSTERY_UNKNOWN".to_owned()))
|
||||||
|
.ok().as_deref());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
// Note: this test is often not run due to this condition below.
|
||||||
|
#[cfg(not(feature = "deny-unknown-enum-variants-strings"))]
|
||||||
|
fn check_deserialize() {
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
let dict: BTreeMap<usize, QueueType> = serde_json::from_str(
|
||||||
|
r#"{
|
||||||
|
"100": "RANKED_SOLO_5x5",
|
||||||
|
"200": "RANKED_TFT_TURBO",
|
||||||
|
"210": "RANKED_TFT_DOUBLE_UP",
|
||||||
|
"211": "RANKED_TFT_PAIRS",
|
||||||
|
"900": "RANKED_MYSTERY_UNKNOWN"
|
||||||
|
}"#
|
||||||
|
).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(Some(&QueueType::RANKED_SOLO_5x5), dict.get(&100));
|
||||||
|
assert_eq!(Some(&QueueType::RANKED_TFT_TURBO), dict.get(&200));
|
||||||
|
assert_eq!(Some(&QueueType::RANKED_TFT_DOUBLE_UP), dict.get(&210));
|
||||||
|
assert_eq!(Some(&QueueType::RANKED_TFT_PAIRS), dict.get(&211));
|
||||||
|
assert_eq!(Some(&QueueType::UNKNOWN("RANKED_MYSTERY_UNKNOWN".to_owned())), dict.get(&900));
|
||||||
|
|
||||||
|
}
|
|
@ -4,10 +4,10 @@ use std::iter::Peekable;
|
||||||
|
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
|
|
||||||
use super::{ Tier, Division };
|
use super::{Division, Tier};
|
||||||
|
|
||||||
/// (Tier, Division) tuple representing a rank.
|
/// (Tier, Division) tuple representing a rank.
|
||||||
pub type Rank = ( Tier, Division );
|
pub type Rank = (Tier, Division);
|
||||||
|
|
||||||
/// Iterator for iterating `(Tier, Division)` rank tuples.
|
/// Iterator for iterating `(Tier, Division)` rank tuples.
|
||||||
pub struct Iter {
|
pub struct Iter {
|
||||||
|
@ -20,13 +20,12 @@ impl Iterator for Iter {
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
// First find the tier (innermost loop).
|
// First find the tier (innermost loop).
|
||||||
// If none found, we go to next tier (in unwrap_or_else case).
|
// If none found, we go to next tier (in unwrap_or_else case).
|
||||||
let div = self.div_iter.next()
|
let div = self.div_iter.next().unwrap_or_else(|| {
|
||||||
.unwrap_or_else(|| {
|
// If no divisions available, go to next tier, reset the divisions, and return I.
|
||||||
// If no divisions available, go to next tier, reset the divisions, and return I.
|
self.tier_iter.next();
|
||||||
self.tier_iter.next();
|
self.div_iter = Division::iter();
|
||||||
self.div_iter = Division::iter();
|
self.div_iter.next().unwrap()
|
||||||
self.div_iter.next().unwrap()
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Then find the tier.
|
// Then find the tier.
|
||||||
let tier = *self.tier_iter.peek()?;
|
let tier = *self.tier_iter.peek()?;
|
||||||
|
@ -36,7 +35,7 @@ impl Iterator for Iter {
|
||||||
self.div_iter = Division::iter();
|
self.div_iter = Division::iter();
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(( tier, div ))
|
Some((tier, div))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,33 +65,16 @@ pub fn non_apex_iter() -> Iter {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{ Tier, Division };
|
use super::{Division, Tier};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn iter() {
|
fn iter() {
|
||||||
let mut it = super::iter();
|
let mut it = super::iter();
|
||||||
assert_eq!(Some(( Tier::CHALLENGER, Division::I )), it.next());
|
assert_eq!(Some((Tier::CHALLENGER, Division::I)), it.next());
|
||||||
assert_eq!(Some(( Tier::GRANDMASTER, Division::I )), it.next());
|
assert_eq!(Some((Tier::GRANDMASTER, Division::I)), it.next());
|
||||||
assert_eq!(Some(( Tier::MASTER, Division::I )), it.next());
|
assert_eq!(Some((Tier::MASTER, Division::I)), it.next());
|
||||||
assert_eq!(Some(( Tier::DIAMOND, Division::I )), it.next());
|
assert_eq!(Some((Tier::DIAMOND, Division::I)), it.next());
|
||||||
assert_eq!(Some(( Tier::DIAMOND, Division::II )), it.next());
|
assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next());
|
||||||
let mut last = None;
|
|
||||||
for next in &mut it {
|
|
||||||
last = Some(next);
|
|
||||||
}
|
|
||||||
assert_eq!(Some(( Tier::IRON, Division::IV )), last);
|
|
||||||
assert_eq!(None, it.next());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn non_apex_iter() {
|
|
||||||
let mut it = super::non_apex_iter();
|
|
||||||
assert_eq!(Some((Tier::DIAMOND, Division::I)), it.next());
|
|
||||||
assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next());
|
|
||||||
assert_eq!(Some((Tier::DIAMOND, Division::III)), it.next());
|
|
||||||
assert_eq!(Some((Tier::DIAMOND, Division::IV)), it.next());
|
|
||||||
assert_eq!(Some((Tier::PLATINUM, Division::I)), it.next());
|
|
||||||
let mut last = None;
|
let mut last = None;
|
||||||
for next in &mut it {
|
for next in &mut it {
|
||||||
last = Some(next);
|
last = Some(next);
|
||||||
|
@ -100,4 +82,20 @@ mod tests {
|
||||||
assert_eq!(Some((Tier::IRON, Division::IV)), last);
|
assert_eq!(Some((Tier::IRON, Division::IV)), last);
|
||||||
assert_eq!(None, it.next());
|
assert_eq!(None, it.next());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#[test]
|
||||||
|
fn non_apex_iter() {
|
||||||
|
let mut it = super::non_apex_iter();
|
||||||
|
assert_eq!(Some((Tier::DIAMOND, Division::I)), it.next());
|
||||||
|
assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next());
|
||||||
|
assert_eq!(Some((Tier::DIAMOND, Division::III)), it.next());
|
||||||
|
assert_eq!(Some((Tier::DIAMOND, Division::IV)), it.next());
|
||||||
|
assert_eq!(Some((Tier::EMERALD, Division::I)), it.next());
|
||||||
|
assert_eq!(Some((Tier::EMERALD, Division::II)), it.next());
|
||||||
|
assert_eq!(Some((Tier::EMERALD, Division::III)), it.next());
|
||||||
|
assert_eq!(Some((Tier::EMERALD, Division::IV)), it.next());
|
||||||
|
assert_eq!(Some((Tier::PLATINUM, Division::I)), it.next());
|
||||||
|
let last = it.last();
|
||||||
|
assert_eq!(Some((Tier::IRON, Division::IV)), last);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
// //
|
||||||
|
// ! //
|
||||||
|
// This file is automatically generated! //
|
||||||
|
// Do not directly edit! //
|
||||||
|
// //
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
||||||
use strum_macros::{ EnumString, EnumIter, Display, IntoStaticStr };
|
use strum_macros::{ EnumString, EnumIter, Display, IntoStaticStr };
|
||||||
|
|
||||||
/// Regional routes, used in tournament services, Legends of Runterra, and other endpoints.
|
/// Regional routes, used in tournament services, Legends of Runeterra (LoR), and other some endpoints.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
@ -10,20 +19,40 @@ use strum_macros::{ EnumString, EnumIter, Display, IntoStaticStr };
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum RegionalRoute {
|
pub enum RegionalRoute {
|
||||||
/// Americas.
|
/// North and South America.
|
||||||
|
///
|
||||||
|
/// `1` (riotapi-schema ID/repr)
|
||||||
AMERICAS = 1,
|
AMERICAS = 1,
|
||||||
|
|
||||||
/// Asia.
|
/// Asia, used for LoL matches (`match-v5`) and TFT matches (`tft-match-v1`).
|
||||||
|
///
|
||||||
|
/// `2` (riotapi-schema ID/repr)
|
||||||
ASIA = 2,
|
ASIA = 2,
|
||||||
|
|
||||||
/// Europe.
|
/// Europe.
|
||||||
|
///
|
||||||
|
/// `3` (riotapi-schema ID/repr)
|
||||||
EUROPE = 3,
|
EUROPE = 3,
|
||||||
|
|
||||||
/// Southeast Asia. Only usable with the LoR endpoints.
|
/// South East Asia, used for LoR, LoL matches (`match-v5`), and TFT matches (`tft-match-v1`).
|
||||||
|
///
|
||||||
|
/// `4` (riotapi-schema ID/repr)
|
||||||
SEA = 4,
|
SEA = 4,
|
||||||
|
|
||||||
|
/// Asia-Pacific, deprecated, for some old matches in `lor-match-v1`.
|
||||||
|
///
|
||||||
|
/// `10` (riotapi-schema ID/repr)
|
||||||
|
#[deprecated]
|
||||||
|
APAC = 10,
|
||||||
|
|
||||||
|
/// Special esports platform for `account-v1`. Do not confuse with the `esports` Valorant platform route.
|
||||||
|
///
|
||||||
|
/// `11` (riotapi-schema ID/repr)
|
||||||
|
ESPORTS = 11,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Platform routes for League of Legends and Teamfight Tactics.
|
/// Platform routes for League of Legends (LoL), Teamfight Tactics (TFT), and Legends of Runeterra (LoR).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
@ -34,91 +63,202 @@ pub enum RegionalRoute {
|
||||||
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
||||||
pub enum PlatformRoute {
|
pub enum PlatformRoute {
|
||||||
/// Brazil.
|
/// Brazil.
|
||||||
|
///
|
||||||
|
/// `16` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="BR1", serialize="BR")]
|
#[strum(to_string="BR1", serialize="BR")]
|
||||||
BR1 = 16,
|
BR1 = 16,
|
||||||
|
|
||||||
/// North-east Europe.
|
/// Europe, Northeast.
|
||||||
|
///
|
||||||
|
/// `17` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="EUN1", serialize="EUNE")]
|
#[strum(to_string="EUN1", serialize="EUNE")]
|
||||||
EUN1 = 17,
|
EUN1 = 17,
|
||||||
|
|
||||||
/// West Europe.
|
/// Europe, West.
|
||||||
|
///
|
||||||
|
/// `18` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="EUW1", serialize="EUW")]
|
#[strum(to_string="EUW1", serialize="EUW")]
|
||||||
EUW1 = 18,
|
EUW1 = 18,
|
||||||
|
|
||||||
/// Japan.
|
/// Japan.
|
||||||
|
///
|
||||||
|
/// `19` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="JP1", serialize="JP")]
|
#[strum(to_string="JP1", serialize="JP")]
|
||||||
JP1 = 19,
|
JP1 = 19,
|
||||||
|
|
||||||
/// Korea.
|
/// Korea.
|
||||||
|
///
|
||||||
|
/// `20` (riotapi-schema ID/repr)
|
||||||
KR = 20,
|
KR = 20,
|
||||||
|
|
||||||
/// North Latin America.
|
/// Latin America, North.
|
||||||
|
///
|
||||||
|
/// `21` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="LA1", serialize="LAN")]
|
#[strum(to_string="LA1", serialize="LAN")]
|
||||||
LA1 = 21,
|
LA1 = 21,
|
||||||
|
|
||||||
/// South Latin America.
|
/// Latin America, South.
|
||||||
|
///
|
||||||
|
/// `22` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="LA2", serialize="LAS")]
|
#[strum(to_string="LA2", serialize="LAS")]
|
||||||
LA2 = 22,
|
LA2 = 22,
|
||||||
|
|
||||||
/// North America.
|
/// North America.
|
||||||
|
///
|
||||||
|
/// `23` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="NA1", serialize="NA")]
|
#[strum(to_string="NA1", serialize="NA")]
|
||||||
NA1 = 23,
|
NA1 = 23,
|
||||||
|
|
||||||
/// Oceania.
|
/// Oceania.
|
||||||
|
///
|
||||||
|
/// `24` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="OC1", serialize="OCE")]
|
#[strum(to_string="OC1", serialize="OCE")]
|
||||||
OC1 = 24,
|
OC1 = 24,
|
||||||
|
|
||||||
/// Russia.
|
/// Philippines
|
||||||
|
///
|
||||||
|
/// `32` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="PH2", serialize="PH")]
|
||||||
|
PH2 = 32,
|
||||||
|
|
||||||
|
/// Russia
|
||||||
|
///
|
||||||
|
/// `25` (riotapi-schema ID/repr)
|
||||||
RU = 25,
|
RU = 25,
|
||||||
|
|
||||||
/// Turkey.
|
/// Singapore
|
||||||
|
///
|
||||||
|
/// `33` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="SG2", serialize="SG")]
|
||||||
|
SG2 = 33,
|
||||||
|
|
||||||
|
/// Thailand
|
||||||
|
///
|
||||||
|
/// `34` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="TH2", serialize="TH")]
|
||||||
|
TH2 = 34,
|
||||||
|
|
||||||
|
/// Turkey
|
||||||
|
///
|
||||||
|
/// `26` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="TR1", serialize="TR")]
|
#[strum(to_string="TR1", serialize="TR")]
|
||||||
TR1 = 26,
|
TR1 = 26,
|
||||||
|
|
||||||
|
/// Taiwan
|
||||||
|
///
|
||||||
|
/// `35` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="TW2", serialize="TW")]
|
||||||
|
TW2 = 35,
|
||||||
|
|
||||||
/// Public beta environment. Only functional in certain endpoints.
|
/// Vietnam
|
||||||
|
///
|
||||||
|
/// `36` (riotapi-schema ID/repr)
|
||||||
|
#[strum(to_string="VN2", serialize="VN")]
|
||||||
|
VN2 = 36,
|
||||||
|
|
||||||
|
/// Public Beta Environment, special beta testing platform. Located in North America.
|
||||||
|
///
|
||||||
|
/// `31` (riotapi-schema ID/repr)
|
||||||
#[strum(to_string="PBE1", serialize="PBE")]
|
#[strum(to_string="PBE1", serialize="PBE")]
|
||||||
PBE1 = 31,
|
PBE1 = 31,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlatformRoute {
|
impl PlatformRoute {
|
||||||
/// Converts this [`PlatformRoute`] into its corresponding
|
/// Converts this [`PlatformRoute`] into its corresponding
|
||||||
/// [`RegionalRoute`]. Useful, for example, in [`match-v5` endpoints](crate::endpoints::MatchV5).
|
/// [`RegionalRoute`] for LoL and TFT match endpoints.
|
||||||
|
/// For example, [`match-v5`](crate::endpoints::MatchV5).
|
||||||
pub fn to_regional(self) -> RegionalRoute {
|
pub fn to_regional(self) -> RegionalRoute {
|
||||||
match self {
|
match self {
|
||||||
Self::BR1 => RegionalRoute::AMERICAS,
|
Self::BR1 => RegionalRoute::AMERICAS,
|
||||||
Self::LA1 => RegionalRoute::AMERICAS,
|
|
||||||
Self::LA2 => RegionalRoute::AMERICAS,
|
|
||||||
Self::NA1 => RegionalRoute::AMERICAS,
|
|
||||||
Self::OC1 => RegionalRoute::AMERICAS,
|
|
||||||
Self::PBE1 => RegionalRoute::AMERICAS,
|
|
||||||
|
|
||||||
Self::JP1 => RegionalRoute::ASIA,
|
|
||||||
Self::KR => RegionalRoute::ASIA,
|
|
||||||
|
|
||||||
Self::EUN1 => RegionalRoute::EUROPE,
|
Self::EUN1 => RegionalRoute::EUROPE,
|
||||||
Self::EUW1 => RegionalRoute::EUROPE,
|
Self::EUW1 => RegionalRoute::EUROPE,
|
||||||
Self::RU => RegionalRoute::EUROPE,
|
Self::JP1 => RegionalRoute::ASIA,
|
||||||
Self::TR1 => RegionalRoute::EUROPE,
|
Self::KR => RegionalRoute::ASIA,
|
||||||
|
Self::LA1 => RegionalRoute::AMERICAS,
|
||||||
|
Self::LA2 => RegionalRoute::AMERICAS,
|
||||||
|
Self::NA1 => RegionalRoute::AMERICAS,
|
||||||
|
Self::OC1 => RegionalRoute::SEA,
|
||||||
|
Self::PH2 => RegionalRoute::SEA,
|
||||||
|
Self::RU => RegionalRoute::EUROPE,
|
||||||
|
Self::SG2 => RegionalRoute::SEA,
|
||||||
|
Self::TH2 => RegionalRoute::SEA,
|
||||||
|
Self::TR1 => RegionalRoute::EUROPE,
|
||||||
|
Self::TW2 => RegionalRoute::SEA,
|
||||||
|
Self::VN2 => RegionalRoute::SEA,
|
||||||
|
Self::PBE1 => RegionalRoute::AMERICAS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used in Tournament API.
|
/// Converts this [`PlatformRoute`] into its corresponding
|
||||||
|
/// [`RegionalRoute`] for LoR endpoints.
|
||||||
|
/// For example, [`lor-match-v1`](crate::endpoints::LorMatchV1).
|
||||||
|
pub fn to_regional_lor(self) -> RegionalRoute {
|
||||||
|
match self {
|
||||||
|
Self::BR1 => RegionalRoute::AMERICAS,
|
||||||
|
Self::EUN1 => RegionalRoute::EUROPE,
|
||||||
|
Self::EUW1 => RegionalRoute::EUROPE,
|
||||||
|
Self::JP1 => RegionalRoute::ASIA,
|
||||||
|
Self::KR => RegionalRoute::ASIA,
|
||||||
|
Self::LA1 => RegionalRoute::AMERICAS,
|
||||||
|
Self::LA2 => RegionalRoute::AMERICAS,
|
||||||
|
Self::NA1 => RegionalRoute::AMERICAS,
|
||||||
|
Self::OC1 => RegionalRoute::SEA,
|
||||||
|
Self::PH2 => RegionalRoute::SEA,
|
||||||
|
Self::RU => RegionalRoute::SEA,
|
||||||
|
Self::SG2 => RegionalRoute::SEA,
|
||||||
|
Self::TH2 => RegionalRoute::SEA,
|
||||||
|
Self::TR1 => RegionalRoute::SEA,
|
||||||
|
Self::TW2 => RegionalRoute::SEA,
|
||||||
|
Self::VN2 => RegionalRoute::SEA,
|
||||||
|
Self::PBE1 => RegionalRoute::AMERICAS,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Used in the LoL Tournament API. Specifically
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
pub fn to_tournament_region(self) -> Option<TournamentRegion> {
|
||||||
|
match self {
|
||||||
|
Self::BR1 => Some(TournamentRegion::BR),
|
||||||
|
Self::EUN1 => Some(TournamentRegion::EUNE),
|
||||||
|
Self::EUW1 => Some(TournamentRegion::EUW),
|
||||||
|
Self::JP1 => Some(TournamentRegion::JP),
|
||||||
|
Self::LA1 => Some(TournamentRegion::LAN),
|
||||||
|
Self::LA2 => Some(TournamentRegion::LAS),
|
||||||
|
Self::NA1 => Some(TournamentRegion::NA),
|
||||||
|
Self::OC1 => Some(TournamentRegion::OCE),
|
||||||
|
Self::TR1 => Some(TournamentRegion::TR),
|
||||||
|
Self::PBE1 => Some(TournamentRegion::PBE),
|
||||||
|
_other => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the slightly more human-friendly alternate name for this `PlatformRoute`. Specifically
|
||||||
|
/// excludes any trailing numbers and appends extra N(orth), S(outh), E(ast), and/or W(est)
|
||||||
|
/// suffixes to some names. Some of these are old region names which are often still used as
|
||||||
|
/// user-facing names, e.g. on op.gg.
|
||||||
|
///
|
||||||
|
/// Note these strings *are* handled by the `FromStr` implementation, if you wish to parse them
|
||||||
|
/// back into `PlatformRoute`s.
|
||||||
pub fn as_region_str(self) -> &'static str {
|
pub fn as_region_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::BR1 => "BR",
|
Self::BR1 => "BR",
|
||||||
Self::EUN1 => "EUNE",
|
Self::EUN1 => "EUNE",
|
||||||
Self::EUW1 => "EUW",
|
Self::EUW1 => "EUW",
|
||||||
Self::JP1 => "JP",
|
Self::JP1 => "JP",
|
||||||
Self::LA1 => "LAN",
|
Self::LA1 => "LAN",
|
||||||
Self::LA2 => "LAS",
|
Self::LA2 => "LAS",
|
||||||
Self::NA1 => "NA",
|
Self::NA1 => "NA",
|
||||||
Self::OC1 => "OCE",
|
Self::OC1 => "OCE",
|
||||||
|
Self::PH2 => "PH",
|
||||||
|
Self::SG2 => "SG",
|
||||||
|
Self::TH2 => "TH",
|
||||||
|
Self::TR1 => "TR",
|
||||||
|
Self::TW2 => "TW",
|
||||||
|
Self::VN2 => "VN",
|
||||||
Self::PBE1 => "PBE",
|
Self::PBE1 => "PBE",
|
||||||
Self::RU => "RU",
|
other => other.into(),
|
||||||
Self::TR1 => "TR",
|
|
||||||
|
|
||||||
Self::KR => "KR",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,208 +272,74 @@ impl PlatformRoute {
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum ValPlatformRoute {
|
pub enum ValPlatformRoute {
|
||||||
/// Valorant's Asian Pacific platform.
|
/// Asia-Pacific.
|
||||||
|
///
|
||||||
|
/// `64` (riotapi-schema ID/repr)
|
||||||
AP = 64,
|
AP = 64,
|
||||||
|
|
||||||
/// Valorant's Brazil platform.
|
/// Brazil.
|
||||||
|
///
|
||||||
|
/// `65` (riotapi-schema ID/repr)
|
||||||
BR = 65,
|
BR = 65,
|
||||||
|
|
||||||
/// Valorant's Europe platform.
|
/// Europe.
|
||||||
|
///
|
||||||
|
/// `66` (riotapi-schema ID/repr)
|
||||||
EU = 66,
|
EU = 66,
|
||||||
|
|
||||||
/// Valorant's Latin America platform.
|
/// Korea.
|
||||||
LATAM = 68,
|
///
|
||||||
|
/// `70` (riotapi-schema ID/repr)
|
||||||
/// Valorant's North America platform.
|
|
||||||
NA = 69,
|
|
||||||
|
|
||||||
/// Valorant's Korea platform.
|
|
||||||
KR = 70,
|
KR = 70,
|
||||||
|
|
||||||
|
/// Latin America.
|
||||||
|
///
|
||||||
|
/// `68` (riotapi-schema ID/repr)
|
||||||
|
LATAM = 68,
|
||||||
|
|
||||||
/// Valorant's esports platform.
|
/// North America.
|
||||||
|
///
|
||||||
|
/// `69` (riotapi-schema ID/repr)
|
||||||
|
NA = 69,
|
||||||
|
|
||||||
|
/// Special esports platform.
|
||||||
|
///
|
||||||
|
/// `95` (riotapi-schema ID/repr)
|
||||||
ESPORTS = 95,
|
ESPORTS = 95,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Utility enum containing all routing variants.
|
/// Tournament regions for League of Legends (LoL) used in
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum Route {
|
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
||||||
/// Sub-variant for [`RegionalRoute`]s.
|
pub enum TournamentRegion {
|
||||||
Regional(RegionalRoute),
|
/// Brazil.
|
||||||
/// Sub-variant for [`PlatformRoute`]s.
|
BR = 16,
|
||||||
Platform(PlatformRoute),
|
/// Europe, Northeast.
|
||||||
/// Sub-variant for [`ValPlatformRoute`]s.
|
EUNE = 17,
|
||||||
ValPlatform(ValPlatformRoute),
|
/// Europe, West.
|
||||||
}
|
EUW = 18,
|
||||||
|
/// Japan.
|
||||||
impl From<Route> for &'static str {
|
JP = 19,
|
||||||
fn from(route: Route) -> Self {
|
/// Latin America, North.
|
||||||
match route {
|
LAN = 21,
|
||||||
Route::Regional(r) => r.into(),
|
/// Latin America, South.
|
||||||
Route::Platform(r) => r.into(),
|
LAS = 22,
|
||||||
Route::ValPlatform(r) => r.into(),
|
/// North America.
|
||||||
}
|
NA = 23,
|
||||||
}
|
/// Oceania.
|
||||||
}
|
OCE = 24,
|
||||||
|
/// Turkey
|
||||||
impl From<Route> for u8 {
|
TR = 26,
|
||||||
fn from(route: Route) -> Self {
|
/// Public Beta Environment, special beta testing platform. Located in North America.
|
||||||
match route {
|
PBE = 31,
|
||||||
Route::Regional(r) => r.into(),
|
|
||||||
Route::Platform(r) => r.into(),
|
|
||||||
Route::ValPlatform(r) => r.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl num_enum::TryFromPrimitive for Route {
|
|
||||||
type Primitive = u8;
|
|
||||||
|
|
||||||
const NAME: &'static str = stringify!(Route);
|
|
||||||
|
|
||||||
fn try_from_primitive(number: Self::Primitive) -> Result<Self, num_enum::TryFromPrimitiveError<Self>> {
|
|
||||||
RegionalRoute::try_from_primitive(number)
|
|
||||||
.map(Route::Regional)
|
|
||||||
.or_else(|_| PlatformRoute::try_from_primitive(number)
|
|
||||||
.map(Route::Platform))
|
|
||||||
.or_else(|_| ValPlatformRoute::try_from_primitive(number)
|
|
||||||
.map(Route::ValPlatform))
|
|
||||||
.map_err(|_| num_enum::TryFromPrimitiveError { number })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::convert::TryFrom<u8> for Route {
|
|
||||||
type Error = num_enum::TryFromPrimitiveError<Self>;
|
|
||||||
fn try_from(number: u8) -> Result<Self, num_enum::TryFromPrimitiveError<Self>> {
|
|
||||||
Self::try_from_primitive(number)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::fmt::Display for Route {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
match self {
|
|
||||||
Self::Regional(r) => r.fmt(f),
|
|
||||||
Self::Platform(r) => r.fmt(f),
|
|
||||||
Self::ValPlatform(r) => r.fmt(f),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::str::FromStr for Route {
|
|
||||||
type Err = strum::ParseError;
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
RegionalRoute::from_str(s)
|
|
||||||
.map(Self::Regional)
|
|
||||||
.or_else(|_| PlatformRoute::from_str(s)
|
|
||||||
.map(Self::Platform))
|
|
||||||
.or_else(|_| ValPlatformRoute::from_str(s)
|
|
||||||
.map(Self::ValPlatform))
|
|
||||||
.map_err(|_| strum::ParseError::VariantNotFound)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Route {
|
|
||||||
/// Returns an iterator over all routes. Starts with [`Self::Regional`],
|
|
||||||
/// then [`Self::Platform`], and finally [`Self::ValPlatform`].
|
|
||||||
pub fn iter() -> impl Iterator<Item = Self> {
|
|
||||||
use strum::IntoEnumIterator;
|
|
||||||
|
|
||||||
let regional = RegionalRoute::iter()
|
|
||||||
.map(Self::Regional);
|
|
||||||
let platform = PlatformRoute::iter()
|
|
||||||
.map(Self::Platform);
|
|
||||||
let val_platform = ValPlatformRoute::iter()
|
|
||||||
.map(Self::ValPlatform);
|
|
||||||
|
|
||||||
regional
|
|
||||||
.chain(platform)
|
|
||||||
.chain(val_platform)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_route_tostring() {
|
|
||||||
assert_eq!("AMERICAS", Into::<&'static str>::into(Route::Regional(RegionalRoute::AMERICAS)));
|
|
||||||
assert_eq!("KR", Into::<&'static str>::into(Route::Platform(PlatformRoute::KR)));
|
|
||||||
assert_eq!("KR", Into::<&'static str>::into(Route::ValPlatform(ValPlatformRoute::KR)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_route_iter() {
|
|
||||||
for (i, route) in Route::iter().enumerate() {
|
|
||||||
println!("{:>2} {:<10} {:>3}", i, route, u8::from(route));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_route_tryfrom() {
|
|
||||||
for x in u8::MIN..=u8::MAX {
|
|
||||||
if let Ok(route) = std::convert::TryInto::<Route>::try_into(x) {
|
|
||||||
println!("{:>3} {:<8}", x, route);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_regional_tostring() {
|
|
||||||
assert_eq!("AMERICAS", RegionalRoute::AMERICAS.to_string());
|
|
||||||
assert_eq!("SEA", RegionalRoute::SEA.to_string());
|
|
||||||
|
|
||||||
assert_eq!("AMERICAS", Into::<&'static str>::into(RegionalRoute::AMERICAS));
|
|
||||||
assert_eq!("SEA", Into::<&'static str>::into(RegionalRoute::SEA));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_regional_parse() {
|
|
||||||
assert_eq!(Ok(RegionalRoute::AMERICAS), "AMERICAS".parse());
|
|
||||||
assert_eq!(Ok(RegionalRoute::SEA), "SEA".parse());
|
|
||||||
assert!("NA".parse::<RegionalRoute>().is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_platform_tostring() {
|
|
||||||
assert_eq!("BR1", PlatformRoute::BR1.to_string());
|
|
||||||
assert_eq!("KR", PlatformRoute::KR.to_string());
|
|
||||||
|
|
||||||
assert_eq!("BR1", Into::<&'static str>::into(PlatformRoute::BR1));
|
|
||||||
assert_eq!("KR", Into::<&'static str>::into(PlatformRoute::KR));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_platform_parse() {
|
|
||||||
assert_eq!(Ok(PlatformRoute::BR1), "BR1".parse());
|
|
||||||
assert_eq!(Ok(PlatformRoute::KR), "KR".parse());
|
|
||||||
assert_eq!(Ok(PlatformRoute::JP1), "JP1".parse());
|
|
||||||
assert_eq!(Ok(PlatformRoute::JP1), "JP".parse());
|
|
||||||
assert_eq!(Ok(PlatformRoute::NA1), "NA1".parse());
|
|
||||||
assert_eq!(Ok(PlatformRoute::NA1), "NA".parse());
|
|
||||||
assert!("LA".parse::<PlatformRoute>().is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_valplatform_tostring() {
|
|
||||||
assert_eq!("AP", ValPlatformRoute::AP.to_string());
|
|
||||||
assert_eq!("KR", ValPlatformRoute::KR.to_string());
|
|
||||||
assert_eq!("ESPORTS", ValPlatformRoute::ESPORTS.to_string());
|
|
||||||
|
|
||||||
assert_eq!("AP", Into::<&'static str>::into(ValPlatformRoute::AP));
|
|
||||||
assert_eq!("KR", Into::<&'static str>::into(ValPlatformRoute::KR));
|
|
||||||
assert_eq!("ESPORTS", Into::<&'static str>::into(ValPlatformRoute::ESPORTS));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_valplatform_parse() {
|
|
||||||
assert_eq!(Ok(ValPlatformRoute::AP), "AP".parse());
|
|
||||||
assert_eq!(Ok(ValPlatformRoute::KR), "KR".parse());
|
|
||||||
assert_eq!(Ok(ValPlatformRoute::ESPORTS), "ESPORTS".parse());
|
|
||||||
assert!("SEA".parse::<ValPlatformRoute>().is_err());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,198 @@
|
||||||
|
use super::{PlatformRoute, RegionalRoute, ValPlatformRoute};
|
||||||
|
|
||||||
|
/// Utility enum containing all routing variants.
|
||||||
|
#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub enum Route {
|
||||||
|
/// Sub-variant for [`RegionalRoute`]s.
|
||||||
|
Regional(RegionalRoute),
|
||||||
|
/// Sub-variant for [`PlatformRoute`]s.
|
||||||
|
Platform(PlatformRoute),
|
||||||
|
/// Sub-variant for [`ValPlatformRoute`]s.
|
||||||
|
ValPlatform(ValPlatformRoute),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Route> for &'static str {
|
||||||
|
fn from(route: Route) -> Self {
|
||||||
|
match route {
|
||||||
|
Route::Regional(r) => r.into(),
|
||||||
|
Route::Platform(r) => r.into(),
|
||||||
|
Route::ValPlatform(r) => r.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Route> for u8 {
|
||||||
|
fn from(route: Route) -> Self {
|
||||||
|
match route {
|
||||||
|
Route::Regional(r) => r.into(),
|
||||||
|
Route::Platform(r) => r.into(),
|
||||||
|
Route::ValPlatform(r) => r.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl num_enum::TryFromPrimitive for Route {
|
||||||
|
type Primitive = u8;
|
||||||
|
|
||||||
|
const NAME: &'static str = stringify!(Route);
|
||||||
|
|
||||||
|
fn try_from_primitive(
|
||||||
|
number: Self::Primitive,
|
||||||
|
) -> Result<Self, num_enum::TryFromPrimitiveError<Self>> {
|
||||||
|
RegionalRoute::try_from_primitive(number)
|
||||||
|
.map(Route::Regional)
|
||||||
|
.or_else(|_| PlatformRoute::try_from_primitive(number).map(Route::Platform))
|
||||||
|
.or_else(|_| ValPlatformRoute::try_from_primitive(number).map(Route::ValPlatform))
|
||||||
|
.map_err(|_| num_enum::TryFromPrimitiveError { number })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::convert::TryFrom<u8> for Route {
|
||||||
|
type Error = num_enum::TryFromPrimitiveError<Self>;
|
||||||
|
fn try_from(number: u8) -> Result<Self, num_enum::TryFromPrimitiveError<Self>> {
|
||||||
|
<Self as num_enum::TryFromPrimitive>::try_from_primitive(number)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for Route {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Regional(r) => r.fmt(f),
|
||||||
|
Self::Platform(r) => r.fmt(f),
|
||||||
|
Self::ValPlatform(r) => r.fmt(f),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::str::FromStr for Route {
|
||||||
|
type Err = strum::ParseError;
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
RegionalRoute::from_str(s)
|
||||||
|
.map(Self::Regional)
|
||||||
|
.or_else(|_| PlatformRoute::from_str(s).map(Self::Platform))
|
||||||
|
.or_else(|_| ValPlatformRoute::from_str(s).map(Self::ValPlatform))
|
||||||
|
.map_err(|_| strum::ParseError::VariantNotFound)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Route {
|
||||||
|
/// Returns an iterator over all routes. Starts with [`Self::Regional`],
|
||||||
|
/// then [`Self::Platform`], and finally [`Self::ValPlatform`].
|
||||||
|
pub fn iter() -> impl Iterator<Item = Self> {
|
||||||
|
use strum::IntoEnumIterator;
|
||||||
|
|
||||||
|
let regional = RegionalRoute::iter().map(Self::Regional);
|
||||||
|
let platform = PlatformRoute::iter().map(Self::Platform);
|
||||||
|
let val_platform = ValPlatformRoute::iter().map(Self::ValPlatform);
|
||||||
|
|
||||||
|
regional.chain(platform).chain(val_platform)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_route_tostring() {
|
||||||
|
assert_eq!(
|
||||||
|
"AMERICAS",
|
||||||
|
Into::<&'static str>::into(Route::Regional(RegionalRoute::AMERICAS))
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
"KR",
|
||||||
|
Into::<&'static str>::into(Route::Platform(PlatformRoute::KR))
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
"KR",
|
||||||
|
Into::<&'static str>::into(Route::ValPlatform(ValPlatformRoute::KR))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_route_iter() {
|
||||||
|
for (i, route) in Route::iter().enumerate() {
|
||||||
|
println!("{:>2} {:<10} {:>3}", i, route, u8::from(route));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_route_tryfrom() {
|
||||||
|
for x in u8::MIN..=u8::MAX {
|
||||||
|
if let Ok(route) = std::convert::TryInto::<Route>::try_into(x) {
|
||||||
|
println!("{:>3} {:<8}", x, route);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_regional_tostring() {
|
||||||
|
assert_eq!("AMERICAS", RegionalRoute::AMERICAS.to_string());
|
||||||
|
assert_eq!("SEA", RegionalRoute::SEA.to_string());
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
"AMERICAS",
|
||||||
|
Into::<&'static str>::into(RegionalRoute::AMERICAS)
|
||||||
|
);
|
||||||
|
assert_eq!("SEA", Into::<&'static str>::into(RegionalRoute::SEA));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_regional_parse() {
|
||||||
|
assert_eq!(Ok(RegionalRoute::AMERICAS), "AMERICAS".parse());
|
||||||
|
assert_eq!(Ok(RegionalRoute::SEA), "SEA".parse());
|
||||||
|
assert!("NA".parse::<RegionalRoute>().is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_platform_tostring() {
|
||||||
|
assert_eq!("BR1", PlatformRoute::BR1.to_string());
|
||||||
|
assert_eq!("KR", PlatformRoute::KR.to_string());
|
||||||
|
|
||||||
|
assert_eq!("BR1", Into::<&'static str>::into(PlatformRoute::BR1));
|
||||||
|
assert_eq!("KR", Into::<&'static str>::into(PlatformRoute::KR));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_platform_parse() {
|
||||||
|
assert_eq!(Ok(PlatformRoute::BR1), "BR1".parse());
|
||||||
|
assert_eq!(Ok(PlatformRoute::KR), "KR".parse());
|
||||||
|
assert_eq!(Ok(PlatformRoute::JP1), "JP1".parse());
|
||||||
|
assert_eq!(Ok(PlatformRoute::JP1), "JP".parse());
|
||||||
|
assert_eq!(Ok(PlatformRoute::NA1), "NA1".parse());
|
||||||
|
assert_eq!(Ok(PlatformRoute::NA1), "NA".parse());
|
||||||
|
assert!("LA".parse::<PlatformRoute>().is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_valplatform_tostring() {
|
||||||
|
assert_eq!("AP", ValPlatformRoute::AP.to_string());
|
||||||
|
assert_eq!("KR", ValPlatformRoute::KR.to_string());
|
||||||
|
assert_eq!("ESPORTS", ValPlatformRoute::ESPORTS.to_string());
|
||||||
|
|
||||||
|
assert_eq!("AP", Into::<&'static str>::into(ValPlatformRoute::AP));
|
||||||
|
assert_eq!("KR", Into::<&'static str>::into(ValPlatformRoute::KR));
|
||||||
|
assert_eq!(
|
||||||
|
"ESPORTS",
|
||||||
|
Into::<&'static str>::into(ValPlatformRoute::ESPORTS)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_valplatform_parse() {
|
||||||
|
assert_eq!(Ok(ValPlatformRoute::AP), "AP".parse());
|
||||||
|
assert_eq!(Ok(ValPlatformRoute::KR), "KR".parse());
|
||||||
|
assert_eq!(Ok(ValPlatformRoute::ESPORTS), "ESPORTS".parse());
|
||||||
|
assert!("SEA".parse::<ValPlatformRoute>().is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tournament_region_serde() {
|
||||||
|
use crate::consts::TournamentRegion;
|
||||||
|
let json = serde_json::to_string(&TournamentRegion::EUNE);
|
||||||
|
assert!(json.is_ok());
|
||||||
|
assert_eq!("\"EUNE\"", &*json.unwrap());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -6,12 +7,8 @@
|
||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
|
||||||
|
|
||||||
newtype_enum! {
|
newtype_enum! {
|
||||||
/// A League of Legends season for competitive matchmaking.
|
/// A League of Legends season for competitive matchmaking.
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Season(u8) {
|
pub newtype_enum Season(u8) {
|
||||||
/// `0`.
|
/// `0`.
|
||||||
PRESEASON_3 = 0,
|
PRESEASON_3 = 0,
|
||||||
|
|
|
@ -1,13 +1,26 @@
|
||||||
use serde_repr::{ Serialize_repr, Deserialize_repr };
|
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||||
|
|
||||||
/// League of Legends team.
|
/// League of Legends team.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(
|
||||||
#[derive(Eq, PartialEq, Hash, Ord, PartialOrd)]
|
Debug,
|
||||||
#[derive(Serialize_repr, Deserialize_repr)]
|
Copy,
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
Clone,
|
||||||
|
Eq,
|
||||||
|
PartialEq,
|
||||||
|
Hash,
|
||||||
|
Ord,
|
||||||
|
PartialOrd,
|
||||||
|
Serialize_repr,
|
||||||
|
Deserialize_repr,
|
||||||
|
IntoPrimitive,
|
||||||
|
TryFromPrimitive,
|
||||||
|
)]
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
pub enum Team {
|
pub enum Team {
|
||||||
|
/// Team ID zero for 2v2v2v2 Arena `CHERRY` game mode. (TODO: SUBJECT TO CHANGE?)
|
||||||
|
ZERO = 0,
|
||||||
|
|
||||||
/// Blue team (bottom left on Summoner's Rift).
|
/// Blue team (bottom left on Summoner's Rift).
|
||||||
BLUE = 100,
|
BLUE = 100,
|
||||||
/// Red team (top right on Summoner's Rift).
|
/// Red team (top right on Summoner's Rift).
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||||
use serde::{ Serialize, Deserialize };
|
use serde::{Deserialize, Serialize};
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
|
use strum_macros::{AsRefStr, Display, EnumString, IntoStaticStr};
|
||||||
|
|
||||||
/// LoL and TFT ranked tiers, such as gold, diamond, challenger, etc.
|
/// LoL and TFT ranked tiers, such as gold, diamond, challenger, etc.
|
||||||
///
|
///
|
||||||
|
@ -10,36 +10,51 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
|
||||||
/// Repr'd as arbitrary `u8` values.
|
/// Repr'd as arbitrary `u8` values.
|
||||||
///
|
///
|
||||||
/// Implements [IntoEnumIterator](super::IntoEnumIterator).
|
/// Implements [IntoEnumIterator](super::IntoEnumIterator).
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(
|
||||||
#[derive(Eq, PartialEq, Hash, PartialOrd, Ord)]
|
Debug,
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
Copy,
|
||||||
#[derive(EnumString, Display, AsRefStr, IntoStaticStr)]
|
Clone,
|
||||||
#[derive(Serialize, Deserialize)]
|
Eq,
|
||||||
|
PartialEq,
|
||||||
|
Hash,
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
IntoPrimitive,
|
||||||
|
TryFromPrimitive,
|
||||||
|
EnumString,
|
||||||
|
Display,
|
||||||
|
AsRefStr,
|
||||||
|
IntoStaticStr,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Tier {
|
pub enum Tier {
|
||||||
/// Challenger, the highest tier, an apex tier. Repr: `220_u8`.
|
/// Challenger, the highest tier, an apex tier. Repr: `220_u8`.
|
||||||
CHALLENGER = 220,
|
CHALLENGER = 220,
|
||||||
/// Grand Master, an apex tier. Repr: `200_u8`.
|
/// Grand Master, an apex tier. Repr: `200_u8`.
|
||||||
GRANDMASTER = 200,
|
GRANDMASTER = 200,
|
||||||
/// Master, an apex tier. Repr: `180_u8`.
|
/// Master, an apex tier. Repr: `180_u8`.
|
||||||
MASTER = 180,
|
MASTER = 180,
|
||||||
/// Diamond, the higest non-apex tier. Repr: `140_u8`.
|
/// Diamond, the higest non-apex tier. Repr: `140_u8`.
|
||||||
DIAMOND = 140,
|
DIAMOND = 140,
|
||||||
|
/// Emerald. Added in 2023. Repr: `130_u8`.
|
||||||
|
EMERALD = 130,
|
||||||
/// Platinum. Repr: `120_u8`.
|
/// Platinum. Repr: `120_u8`.
|
||||||
PLATINUM = 120,
|
PLATINUM = 120,
|
||||||
/// Gold. Repr: `100_u8`.
|
/// Gold. Repr: `100_u8`.
|
||||||
GOLD = 100,
|
GOLD = 100,
|
||||||
/// Silver. Repr: `80_u8`.
|
/// Silver. Repr: `80_u8`.
|
||||||
SILVER = 80,
|
SILVER = 80,
|
||||||
/// Bronze. Repr: `60_u8`.
|
/// Bronze. Repr: `60_u8`.
|
||||||
BRONZE = 60,
|
BRONZE = 60,
|
||||||
/// Iron, the lowest tier. Repr: `40_u8`.
|
/// Iron, the lowest tier. Repr: `40_u8`.
|
||||||
IRON = 40,
|
IRON = 40,
|
||||||
|
|
||||||
/// Unranked, no tier. Repr: `0_u8`.
|
/// Unranked, no tier. Repr: `0_u8`.
|
||||||
/// Also deserializes from "NONE" returned by `lol-challenges-v1.getChallengePercentiles`.
|
/// Also deserializes from "NONE" returned by `lol-challenges-v1.getChallengePercentiles`.
|
||||||
#[serde(alias = "NONE")]
|
#[serde(alias = "NONE")]
|
||||||
UNRANKED = 0,
|
UNRANKED = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tier {
|
impl Tier {
|
||||||
|
@ -63,7 +78,7 @@ impl Tier {
|
||||||
|
|
||||||
/// If this tier is ranked. Returns true for iron through challenger, false for unranked.
|
/// If this tier is ranked. Returns true for iron through challenger, false for unranked.
|
||||||
pub const fn is_ranked(self) -> bool {
|
pub const fn is_ranked(self) -> bool {
|
||||||
// Casts needed for const.
|
// Casts needed for const.
|
||||||
(Self::UNRANKED as u8) < (self as u8)
|
(Self::UNRANKED as u8) < (self as u8)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +92,11 @@ impl Tier {
|
||||||
|
|
||||||
/// Converts UNRANKED to None and all ranked tiers to Some(...).
|
/// Converts UNRANKED to None and all ranked tiers to Some(...).
|
||||||
pub fn to_ranked(self) -> Option<Self> {
|
pub fn to_ranked(self) -> Option<Self> {
|
||||||
if self.is_unranked() { None } else { Some(self) }
|
if self.is_unranked() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,10 +107,19 @@ impl IntoEnumIterator for Tier {
|
||||||
type Iterator = std::iter::Copied<std::slice::Iter<'static, Self>>;
|
type Iterator = std::iter::Copied<std::slice::Iter<'static, Self>>;
|
||||||
fn iter() -> Self::Iterator {
|
fn iter() -> Self::Iterator {
|
||||||
[
|
[
|
||||||
Self::CHALLENGER, Self::GRANDMASTER, Self::MASTER,
|
Self::CHALLENGER,
|
||||||
Self::DIAMOND, Self::PLATINUM, Self::GOLD,
|
Self::GRANDMASTER,
|
||||||
Self::SILVER, Self::BRONZE, Self::IRON
|
Self::MASTER,
|
||||||
].iter().copied()
|
Self::DIAMOND,
|
||||||
|
Self::EMERALD,
|
||||||
|
Self::PLATINUM,
|
||||||
|
Self::GOLD,
|
||||||
|
Self::SILVER,
|
||||||
|
Self::BRONZE,
|
||||||
|
Self::IRON,
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.copied()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +191,7 @@ mod tests {
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
assert_eq!(Some(Tier::DIAMOND), iter.next());
|
assert_eq!(Some(Tier::DIAMOND), iter.next());
|
||||||
|
assert_eq!(Some(Tier::EMERALD), iter.next());
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
|
@ -177,6 +206,7 @@ mod tests {
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
|
assert_eq!(Some(Tier::EMERALD), iter.next());
|
||||||
assert_eq!(Some(Tier::DIAMOND), iter.next());
|
assert_eq!(Some(Tier::DIAMOND), iter.next());
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -7,7 +8,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version 8afe7b8e927da46a6f41108e6dc7e1a8c71d89b9
|
// Version d4f02b20da80dd2c869da349ba774ef6eddc22fa
|
||||||
|
|
||||||
//! Automatically generated endpoint handles.
|
//! Automatically generated endpoint handles.
|
||||||
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
||||||
|
@ -197,6 +198,15 @@ impl RiotApi {
|
||||||
pub fn tft_match_v1(&self) -> TftMatchV1 {
|
pub fn tft_match_v1(&self) -> TftMatchV1 {
|
||||||
TftMatchV1 { base: self }
|
TftMatchV1 { base: self }
|
||||||
}
|
}
|
||||||
|
/// Returns a handle for accessing [TftStatusV1](crate::endpoints::TftStatusV1) endpoints.
|
||||||
|
/// # Riot Developer API Reference
|
||||||
|
/// <a href="https://developer.riotgames.com/apis#tft-status-v1" target="_blank">`tft-status-v1`</a>
|
||||||
|
///
|
||||||
|
/// Note: this method is automatically generated.
|
||||||
|
#[inline]
|
||||||
|
pub fn tft_status_v1(&self) -> TftStatusV1 {
|
||||||
|
TftStatusV1 { base: self }
|
||||||
|
}
|
||||||
/// Returns a handle for accessing [TftSummonerV1](crate::endpoints::TftSummonerV1) endpoints.
|
/// Returns a handle for accessing [TftSummonerV1](crate::endpoints::TftSummonerV1) endpoints.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
|
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
|
||||||
|
@ -206,23 +216,23 @@ impl RiotApi {
|
||||||
pub fn tft_summoner_v1(&self) -> TftSummonerV1 {
|
pub fn tft_summoner_v1(&self) -> TftSummonerV1 {
|
||||||
TftSummonerV1 { base: self }
|
TftSummonerV1 { base: self }
|
||||||
}
|
}
|
||||||
/// Returns a handle for accessing [TournamentStubV4](crate::endpoints::TournamentStubV4) endpoints.
|
/// Returns a handle for accessing [TournamentStubV5](crate::endpoints::TournamentStubV5) endpoints.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
|
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v5" target="_blank">`tournament-stub-v5`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn tournament_stub_v4(&self) -> TournamentStubV4 {
|
pub fn tournament_stub_v5(&self) -> TournamentStubV5 {
|
||||||
TournamentStubV4 { base: self }
|
TournamentStubV5 { base: self }
|
||||||
}
|
}
|
||||||
/// Returns a handle for accessing [TournamentV4](crate::endpoints::TournamentV4) endpoints.
|
/// Returns a handle for accessing [TournamentV5](crate::endpoints::TournamentV5) endpoints.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
|
/// <a href="https://developer.riotgames.com/apis#tournament-v5" target="_blank">`tournament-v5`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn tournament_v4(&self) -> TournamentV4 {
|
pub fn tournament_v5(&self) -> TournamentV5 {
|
||||||
TournamentV4 { base: self }
|
TournamentV5 { base: self }
|
||||||
}
|
}
|
||||||
/// Returns a handle for accessing [ValContentV1](crate::endpoints::ValContentV1) endpoints.
|
/// Returns a handle for accessing [ValContentV1](crate::endpoints::ValContentV1) endpoints.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
|
@ -294,8 +304,8 @@ impl<'a> AccountV1<'a> {
|
||||||
/// Get account by riot id
|
/// Get account by riot id
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `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. However not all accounts have a gameName and tagLine associated so these fields may not be included in the response.
|
/// * `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. 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.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#account-v1/GET_getByRiotId" target="_blank">`account-v1.getByRiotId`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#account-v1/GET_getByRiotId" target="_blank">`account-v1.getByRiotId`</a>
|
||||||
///
|
///
|
||||||
|
@ -363,61 +373,82 @@ pub struct ChampionMasteryV4<'a> {
|
||||||
base: &'a RiotApi,
|
base: &'a RiotApi,
|
||||||
}
|
}
|
||||||
impl<'a> ChampionMasteryV4<'a> {
|
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
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
|
/// * `encrypted_puuid` (required, in path)
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteries" target="_blank">`champion-mastery-v4.getAllChampionMasteries`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getAllChampionMasteriesByPUUID" target="_blank">`champion-mastery-v4.getAllChampionMasteriesByPUUID`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_all_champion_masteries(&self, route: PlatformRoute, encrypted_summoner_id: &str)
|
pub fn get_all_champion_masteries_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
|
||||||
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
|
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}", encrypted_summoner_id));
|
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.getAllChampionMasteries", route_str, request);
|
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getAllChampionMasteriesByPUUID", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getAllChampionMasteries"));
|
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getAllChampionMasteriesByPUUID"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a champion mastery by player ID and champion ID.
|
/// Get a champion mastery by puuid and champion ID.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `champion_id` (required, in path) - Champion ID to retrieve Champion Mastery for
|
/// * `encrypted_puuid` (required, in path)
|
||||||
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
|
/// * `champion_id` (required, in path) - Champion ID to retrieve Champion Mastery.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMastery" target="_blank">`champion-mastery-v4.getChampionMastery`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryByPUUID" target="_blank">`champion-mastery-v4.getChampionMasteryByPUUID`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_champion_mastery(&self, route: PlatformRoute, encrypted_summoner_id: &str, champion_id: crate::consts::Champion)
|
pub fn get_champion_mastery_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str, champion_id: crate::consts::Champion)
|
||||||
-> impl Future<Output = Result<Option<champion_mastery_v4::ChampionMastery>>> + 'a
|
-> impl Future<Output = Result<champion_mastery_v4::ChampionMastery>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
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 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_opt::<champion_mastery_v4::ChampionMastery>("champion-mastery-v4.getChampionMastery", route_str, request);
|
let future = self.base.execute_val::<champion_mastery_v4::ChampionMastery>("champion-mastery-v4.getChampionMasteryByPUUID", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMastery"));
|
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryByPUUID"));
|
||||||
|
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.
|
||||||
|
/// # Riot Developer API Reference
|
||||||
|
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getTopChampionMasteriesByPUUID" target="_blank">`champion-mastery-v4.getTopChampionMasteriesByPUUID`</a>
|
||||||
|
///
|
||||||
|
/// Note: this method is automatically generated.
|
||||||
|
pub fn get_top_champion_masteries_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &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);
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteriesByPUUID"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
|
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
|
/// * `encrypted_puuid` (required, in path)
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScore" target="_blank">`champion-mastery-v4.getChampionMasteryScore`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getChampionMasteryScoreByPUUID" target="_blank">`champion-mastery-v4.getChampionMasteryScoreByPUUID`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_champion_mastery_score(&self, route: PlatformRoute, encrypted_summoner_id: &str)
|
pub fn get_champion_mastery_score_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
|
||||||
-> impl Future<Output = Result<i32>> + 'a
|
-> impl Future<Output = Result<i32>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/scores/by-summoner/{}", encrypted_summoner_id));
|
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.getChampionMasteryScore", route_str, request);
|
let future = self.base.execute_val::<i32>("champion-mastery-v4.getChampionMasteryScoreByPUUID", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryScore"));
|
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryScoreByPUUID"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +618,7 @@ impl<'a> LeagueExpV4<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
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 = self.base.request(Method::GET, route_str, &format!("/lol/league-exp/v4/entries/{}/{}/{}", queue, tier, division));
|
||||||
let mut request = request; if let Some(page) = page { request = request.query(&[ ("page", page) ]); }
|
let request = if let Some(page) = page { request.query(&[ ("page", page) ]) } else { request };
|
||||||
let future = self.base.execute_val::<Vec<league_exp_v4::LeagueEntry>>("league-exp-v4.getLeagueEntries", route_str, request);
|
let future = self.base.execute_val::<Vec<league_exp_v4::LeagueEntry>>("league-exp-v4.getLeagueEntries", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("league-exp-v4.getLeagueEntries"));
|
let future = future.instrument(tracing::info_span!("league-exp-v4.getLeagueEntries"));
|
||||||
|
@ -660,7 +691,7 @@ impl<'a> LeagueV4<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/league/v4/entries/{}/{}/{}", queue, tier, division));
|
let request = self.base.request(Method::GET, route_str, &format!("/lol/league/v4/entries/{}/{}/{}", queue, tier, division));
|
||||||
let mut request = request; if let Some(page) = page { request = request.query(&[ ("page", page) ]); }
|
let request = if let Some(page) = page { request.query(&[ ("page", page) ]) } else { request };
|
||||||
let future = self.base.execute_val::<Vec<league_v4::LeagueEntry>>("league-v4.getLeagueEntries", route_str, request);
|
let future = self.base.execute_val::<Vec<league_v4::LeagueEntry>>("league-v4.getLeagueEntries", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("league-v4.getLeagueEntries"));
|
let future = future.instrument(tracing::info_span!("league-v4.getLeagueEntries"));
|
||||||
|
@ -806,7 +837,7 @@ impl<'a> LolChallengesV1<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
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 = self.base.request(Method::GET, route_str, &format!("/lol/challenges/v1/challenges/{}/leaderboards/by-level/{}", challenge_id, level));
|
||||||
let mut request = request; if let Some(limit) = limit { request = request.query(&[ ("limit", limit) ]); }
|
let request = if let Some(limit) = limit { request.query(&[ ("limit", limit) ]) } else { request };
|
||||||
let future = self.base.execute_opt::<Vec<lol_challenges_v1::ApexPlayerInfo>>("lol-challenges-v1.getChallengeLeaderboards", route_str, request);
|
let future = self.base.execute_opt::<Vec<lol_challenges_v1::ApexPlayerInfo>>("lol-challenges-v1.getChallengeLeaderboards", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("lol-challenges-v1.getChallengeLeaderboards"));
|
let future = future.instrument(tracing::info_span!("lol-challenges-v1.getChallengeLeaderboards"));
|
||||||
|
@ -1139,12 +1170,12 @@ impl<'a> MatchV5<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
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 = self.base.request(Method::GET, route_str, &format!("/lol/match/v5/matches/by-puuid/{}/ids", puuid));
|
||||||
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
|
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
|
||||||
let mut request = request; if let Some(end_time) = end_time { request = request.query(&[ ("endTime", end_time) ]); }
|
let request = if let Some(end_time) = end_time { request.query(&[ ("endTime", end_time) ]) } else { request };
|
||||||
let mut request = request; if let Some(queue) = queue { request = request.query(&[ ("queue", queue) ]); }
|
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
|
||||||
let mut request = request; if let Some(start_time) = start_time { request = request.query(&[ ("startTime", start_time) ]); }
|
let request = if let Some(start_time) = start_time { request.query(&[ ("startTime", start_time) ]) } else { request };
|
||||||
let mut request = request; if let Some(start) = start { request = request.query(&[ ("start", start) ]); }
|
let request = if let Some(start) = start { request.query(&[ ("start", start) ]) } else { request };
|
||||||
let mut request = request; if let Some(r#type) = r#type { request = request.query(&[ ("type", r#type) ]); }
|
let request = if let Some(r#type) = r#type { request.query(&[ ("type", r#type) ]) } else { request };
|
||||||
let future = self.base.execute_val::<Vec<String>>("match-v5.getMatchIdsByPUUID", route_str, request);
|
let future = self.base.execute_val::<Vec<String>>("match-v5.getMatchIdsByPUUID", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("match-v5.getMatchIdsByPUUID"));
|
let future = future.instrument(tracing::info_span!("match-v5.getMatchIdsByPUUID"));
|
||||||
|
@ -1250,6 +1281,25 @@ pub struct SummonerV4<'a> {
|
||||||
base: &'a RiotApi,
|
base: &'a RiotApi,
|
||||||
}
|
}
|
||||||
impl<'a> SummonerV4<'a> {
|
impl<'a> SummonerV4<'a> {
|
||||||
|
/// Get a summoner by its RSO encrypted PUUID.
|
||||||
|
/// # Parameters
|
||||||
|
/// * `route` - Route to query.
|
||||||
|
/// * `rso_puuid` (required, in path) - Summoner ID
|
||||||
|
/// # Riot Developer API Reference
|
||||||
|
/// <a href="https://developer.riotgames.com/api-methods/#summoner-v4/GET_getByRSOPUUID" target="_blank">`summoner-v4.getByRSOPUUID`</a>
|
||||||
|
///
|
||||||
|
/// Note: this method is automatically generated.
|
||||||
|
pub fn get_by_rsopuuid(&self, route: PlatformRoute, rso_puuid: &str)
|
||||||
|
-> impl Future<Output = Result<summoner_v4::Summoner>> + 'a
|
||||||
|
{
|
||||||
|
let route_str = route.into();
|
||||||
|
let request = self.base.request(Method::GET, route_str, &format!("/fulfillment/v1/summoners/by-puuid/{}", rso_puuid));
|
||||||
|
let future = self.base.execute_val::<summoner_v4::Summoner>("summoner-v4.getByRSOPUUID", route_str, request);
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
let future = future.instrument(tracing::info_span!("summoner-v4.getByRSOPUUID"));
|
||||||
|
future
|
||||||
|
}
|
||||||
|
|
||||||
/// Get a summoner by account ID.
|
/// Get a summoner by account ID.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
|
@ -1361,15 +1411,17 @@ impl<'a> TftLeagueV1<'a> {
|
||||||
/// Get the challenger league.
|
/// Get the challenger league.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
|
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getChallengerLeague" target="_blank">`tft-league-v1.getChallengerLeague`</a>
|
/// <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.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_challenger_league(&self, route: PlatformRoute)
|
pub fn get_challenger_league(&self, route: PlatformRoute, queue: Option<&str>)
|
||||||
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
|
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/challenger");
|
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);
|
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getChallengerLeague", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tft-league-v1.getChallengerLeague"));
|
let future = future.instrument(tracing::info_span!("tft-league-v1.getChallengerLeague"));
|
||||||
|
@ -1400,17 +1452,19 @@ impl<'a> TftLeagueV1<'a> {
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `tier` (required, in path)
|
/// * `tier` (required, in path)
|
||||||
/// * `division` (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.
|
/// * `page` (optional, in query) - Defaults to 1. Starts with page 1.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueEntries" target="_blank">`tft-league-v1.getLeagueEntries`</a>
|
/// <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.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_league_entries(&self, route: PlatformRoute, tier: crate::consts::Tier, division: &str, page: Option<i32>)
|
pub fn get_league_entries(&self, route: PlatformRoute, tier: crate::consts::Tier, division: &str, page: Option<i32>, queue: Option<&str>)
|
||||||
-> impl Future<Output = Result<Vec<tft_league_v1::LeagueEntry>>> + 'a
|
-> impl Future<Output = Result<Vec<tft_league_v1::LeagueEntry>>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/tft/league/v1/entries/{}/{}", tier, division));
|
let request = self.base.request(Method::GET, route_str, &format!("/tft/league/v1/entries/{}/{}", tier, division));
|
||||||
let mut request = request; if let Some(page) = page { request = request.query(&[ ("page", page) ]); }
|
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 future = self.base.execute_val::<Vec<tft_league_v1::LeagueEntry>>("tft-league-v1.getLeagueEntries", route_str, request);
|
let future = self.base.execute_val::<Vec<tft_league_v1::LeagueEntry>>("tft-league-v1.getLeagueEntries", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tft-league-v1.getLeagueEntries"));
|
let future = future.instrument(tracing::info_span!("tft-league-v1.getLeagueEntries"));
|
||||||
|
@ -1420,15 +1474,17 @@ impl<'a> TftLeagueV1<'a> {
|
||||||
/// Get the grandmaster league.
|
/// Get the grandmaster league.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
|
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getGrandmasterLeague" target="_blank">`tft-league-v1.getGrandmasterLeague`</a>
|
/// <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.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_grandmaster_league(&self, route: PlatformRoute)
|
pub fn get_grandmaster_league(&self, route: PlatformRoute, queue: Option<&str>)
|
||||||
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
|
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/grandmaster");
|
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);
|
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getGrandmasterLeague", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tft-league-v1.getGrandmasterLeague"));
|
let future = future.instrument(tracing::info_span!("tft-league-v1.getGrandmasterLeague"));
|
||||||
|
@ -1457,15 +1513,17 @@ impl<'a> TftLeagueV1<'a> {
|
||||||
/// Get the master league.
|
/// Get the master league.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
|
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getMasterLeague" target="_blank">`tft-league-v1.getMasterLeague`</a>
|
/// <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.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_master_league(&self, route: PlatformRoute)
|
pub fn get_master_league(&self, route: PlatformRoute, queue: Option<&str>)
|
||||||
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
|
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/master");
|
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);
|
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getMasterLeague", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tft-league-v1.getMasterLeague"));
|
let future = future.instrument(tracing::info_span!("tft-league-v1.getMasterLeague"));
|
||||||
|
@ -1520,10 +1578,10 @@ impl<'a> TftMatchV1<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
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 = self.base.request(Method::GET, route_str, &format!("/tft/match/v1/matches/by-puuid/{}/ids", puuid));
|
||||||
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
|
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
|
||||||
let mut request = request; if let Some(end_time) = end_time { request = request.query(&[ ("endTime", end_time) ]); }
|
let request = if let Some(end_time) = end_time { request.query(&[ ("endTime", end_time) ]) } else { request };
|
||||||
let mut request = request; if let Some(start) = start { request = request.query(&[ ("start", start) ]); }
|
let request = if let Some(start) = start { request.query(&[ ("start", start) ]) } else { request };
|
||||||
let mut request = request; if let Some(start_time) = start_time { request = request.query(&[ ("startTime", start_time) ]); }
|
let request = if let Some(start_time) = start_time { request.query(&[ ("startTime", start_time) ]) } else { request };
|
||||||
let future = self.base.execute_val::<Vec<String>>("tft-match-v1.getMatchIdsByPUUID", route_str, request);
|
let future = self.base.execute_val::<Vec<String>>("tft-match-v1.getMatchIdsByPUUID", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tft-match-v1.getMatchIdsByPUUID"));
|
let future = future.instrument(tracing::info_span!("tft-match-v1.getMatchIdsByPUUID"));
|
||||||
|
@ -1551,6 +1609,36 @@ impl<'a> TftMatchV1<'a> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TftStatusV1 endpoints handle, accessed by calling [`tft_status_v1()`](crate::RiotApi::tft_status_v1) on a [`RiotApi`](crate::RiotApi) instance.
|
||||||
|
/// # Riot Developer API Reference
|
||||||
|
/// <a href="https://developer.riotgames.com/apis#tft-status-v1" target="_blank">`tft-status-v1`</a>
|
||||||
|
///
|
||||||
|
/// Note: this struct is automatically generated.
|
||||||
|
#[repr(transparent)]
|
||||||
|
pub struct TftStatusV1<'a> {
|
||||||
|
base: &'a RiotApi,
|
||||||
|
}
|
||||||
|
impl<'a> TftStatusV1<'a> {
|
||||||
|
/// Get Teamfight Tactics status for the given platform.
|
||||||
|
/// # Parameters
|
||||||
|
/// * `route` - Route to query.
|
||||||
|
/// # Riot Developer API Reference
|
||||||
|
/// <a href="https://developer.riotgames.com/api-methods/#tft-status-v1/GET_getPlatformData" target="_blank">`tft-status-v1.getPlatformData`</a>
|
||||||
|
///
|
||||||
|
/// Note: this method is automatically generated.
|
||||||
|
pub fn get_platform_data(&self, route: PlatformRoute)
|
||||||
|
-> impl Future<Output = Result<tft_status_v1::PlatformData>> + 'a
|
||||||
|
{
|
||||||
|
let route_str = route.into();
|
||||||
|
let request = self.base.request(Method::GET, route_str, "/tft/status/v1/platform-data");
|
||||||
|
let future = self.base.execute_val::<tft_status_v1::PlatformData>("tft-status-v1.getPlatformData", route_str, request);
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
let future = future.instrument(tracing::info_span!("tft-status-v1.getPlatformData"));
|
||||||
|
future
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// TftSummonerV1 endpoints handle, accessed by calling [`tft_summoner_v1()`](crate::RiotApi::tft_summoner_v1) on a [`RiotApi`](crate::RiotApi) instance.
|
/// TftSummonerV1 endpoints handle, accessed by calling [`tft_summoner_v1()`](crate::RiotApi::tft_summoner_v1) on a [`RiotApi`](crate::RiotApi) instance.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
|
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
|
||||||
|
@ -1659,130 +1747,149 @@ impl<'a> TftSummonerV1<'a> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TournamentStubV4 endpoints handle, accessed by calling [`tournament_stub_v4()`](crate::RiotApi::tournament_stub_v4) on a [`RiotApi`](crate::RiotApi) instance.
|
/// TournamentStubV5 endpoints handle, accessed by calling [`tournament_stub_v5()`](crate::RiotApi::tournament_stub_v5) on a [`RiotApi`](crate::RiotApi) instance.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
|
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v5" target="_blank">`tournament-stub-v5`</a>
|
||||||
///
|
///
|
||||||
/// Note: this struct is automatically generated.
|
/// Note: this struct is automatically generated.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct TournamentStubV4<'a> {
|
pub struct TournamentStubV5<'a> {
|
||||||
base: &'a RiotApi,
|
base: &'a RiotApi,
|
||||||
}
|
}
|
||||||
impl<'a> TournamentStubV4<'a> {
|
impl<'a> TournamentStubV5<'a> {
|
||||||
/// Create a mock tournament code for the given tournament.
|
/// Create a tournament code for the given tournament - Stub method
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `count` (optional, in query) - The number of codes to create (max 1000)
|
/// * `count` (optional, in query) - The number of codes to create (max 1000)
|
||||||
/// * `tournament_id` (required, in query) - The tournament ID
|
/// * `tournament_id` (required, in query) - The tournament ID
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_createTournamentCode" target="_blank">`tournament-stub-v4.createTournamentCode`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/POST_createTournamentCode" target="_blank">`tournament-stub-v5.createTournamentCode`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_stub_v4::TournamentCodeParameters, tournament_id: i64, count: Option<i32>)
|
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_stub_v5::TournamentCodeParametersV5, tournament_id: i64, count: Option<i32>)
|
||||||
-> impl Future<Output = Result<Vec<String>>> + 'a
|
-> impl Future<Output = Result<Vec<String>>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/codes");
|
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v5/codes");
|
||||||
let request = request.query(&[ ("tournamentId", tournament_id) ]);
|
let request = request.query(&[ ("tournamentId", tournament_id) ]);
|
||||||
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
|
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute_val::<Vec<String>>("tournament-stub-v4.createTournamentCode", route_str, request);
|
let future = self.base.execute_val::<Vec<String>>("tournament-stub-v5.createTournamentCode", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-stub-v4.createTournamentCode"));
|
let future = future.instrument(tracing::info_span!("tournament-stub-v5.createTournamentCode"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a mock list of lobby events by tournament code.
|
/// 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
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
|
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/GET_getLobbyEventsByCode" target="_blank">`tournament-stub-v4.getLobbyEventsByCode`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/GET_getLobbyEventsByCode" target="_blank">`tournament-stub-v5.getLobbyEventsByCode`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_lobby_events_by_code(&self, route: RegionalRoute, tournament_code: &str)
|
pub fn get_lobby_events_by_code(&self, route: RegionalRoute, tournament_code: &str)
|
||||||
-> impl Future<Output = Result<tournament_stub_v4::LobbyEventWrapper>> + 'a
|
-> impl Future<Output = Result<tournament_stub_v5::LobbyEventV5Wrapper>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament-stub/v4/lobby-events/by-code/{}", tournament_code));
|
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_v4::LobbyEventWrapper>("tournament-stub-v4.getLobbyEventsByCode", route_str, request);
|
let future = self.base.execute_val::<tournament_stub_v5::LobbyEventV5Wrapper>("tournament-stub-v5.getLobbyEventsByCode", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-stub-v4.getLobbyEventsByCode"));
|
let future = future.instrument(tracing::info_span!("tournament-stub-v5.getLobbyEventsByCode"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a mock tournament provider and returns its ID.
|
/// Creates a tournament provider and returns its ID - Stub method
|
||||||
/// ## Implementation Notes
|
/// ## 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.
|
/// 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
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_registerProviderData" target="_blank">`tournament-stub-v4.registerProviderData`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/POST_registerProviderData" target="_blank">`tournament-stub-v5.registerProviderData`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_stub_v4::ProviderRegistrationParameters)
|
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_stub_v5::ProviderRegistrationParametersV5)
|
||||||
-> impl Future<Output = Result<i32>> + 'a
|
-> impl Future<Output = Result<i32>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/providers");
|
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v5/providers");
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute_val::<i32>("tournament-stub-v4.registerProviderData", route_str, request);
|
let future = self.base.execute_val::<i32>("tournament-stub-v5.registerProviderData", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-stub-v4.registerProviderData"));
|
let future = future.instrument(tracing::info_span!("tournament-stub-v5.registerProviderData"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a mock tournament and returns its ID.
|
/// Creates a tournament and returns its ID - Stub method
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_registerTournament" target="_blank">`tournament-stub-v4.registerTournament`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v5/POST_registerTournament" target="_blank">`tournament-stub-v5.registerTournament`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_stub_v4::TournamentRegistrationParameters)
|
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_stub_v5::TournamentRegistrationParametersV5)
|
||||||
-> impl Future<Output = Result<i32>> + 'a
|
-> impl Future<Output = Result<i32>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/tournaments");
|
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v5/tournaments");
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute_val::<i32>("tournament-stub-v4.registerTournament", route_str, request);
|
let future = self.base.execute_val::<i32>("tournament-stub-v5.registerTournament", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-stub-v4.registerTournament"));
|
let future = future.instrument(tracing::info_span!("tournament-stub-v5.registerTournament"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TournamentV4 endpoints handle, accessed by calling [`tournament_v4()`](crate::RiotApi::tournament_v4) on a [`RiotApi`](crate::RiotApi) instance.
|
/// TournamentV5 endpoints handle, accessed by calling [`tournament_v5()`](crate::RiotApi::tournament_v5) on a [`RiotApi`](crate::RiotApi) instance.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
|
/// <a href="https://developer.riotgames.com/apis#tournament-v5" target="_blank">`tournament-v5`</a>
|
||||||
///
|
///
|
||||||
/// Note: this struct is automatically generated.
|
/// Note: this struct is automatically generated.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct TournamentV4<'a> {
|
pub struct TournamentV5<'a> {
|
||||||
base: &'a RiotApi,
|
base: &'a RiotApi,
|
||||||
}
|
}
|
||||||
impl<'a> TournamentV4<'a> {
|
impl<'a> TournamentV5<'a> {
|
||||||
/// Create a tournament code for the given tournament.
|
/// Create a tournament code for the given tournament.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `count` (optional, in query) - The number of codes to create (max 1000)
|
|
||||||
/// * `tournament_id` (required, in query) - The tournament ID
|
/// * `tournament_id` (required, in query) - The tournament ID
|
||||||
|
/// * `count` (optional, in query) - The number of codes to create (max 1000)
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_createTournamentCode" target="_blank">`tournament-v4.createTournamentCode`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_createTournamentCode" target="_blank">`tournament-v5.createTournamentCode`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_v4::TournamentCodeParameters, tournament_id: i64, count: Option<i32>)
|
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_v5::TournamentCodeParametersV5, tournament_id: i64, count: Option<i32>)
|
||||||
-> impl Future<Output = Result<Vec<String>>> + 'a
|
-> impl Future<Output = Result<Vec<String>>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/codes");
|
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/codes");
|
||||||
let request = request.query(&[ ("tournamentId", tournament_id) ]);
|
let request = request.query(&[ ("tournamentId", tournament_id) ]);
|
||||||
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
|
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute_val::<Vec<String>>("tournament-v4.createTournamentCode", route_str, request);
|
let future = self.base.execute_val::<Vec<String>>("tournament-v5.createTournamentCode", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-v4.createTournamentCode"));
|
let future = future.instrument(tracing::info_span!("tournament-v5.createTournamentCode"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1791,37 +1898,62 @@ impl<'a> TournamentV4<'a> {
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `tournament_code` (required, in path) - The tournament code string.
|
/// * `tournament_code` (required, in path) - The tournament code string.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getTournamentCode" target="_blank">`tournament-v4.getTournamentCode`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getTournamentCode" target="_blank">`tournament-v5.getTournamentCode`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_tournament_code(&self, route: RegionalRoute, tournament_code: &str)
|
pub fn get_tournament_code(&self, route: RegionalRoute, tournament_code: &str)
|
||||||
-> impl Future<Output = Result<tournament_v4::TournamentCode>> + 'a
|
-> impl Future<Output = Result<tournament_v5::TournamentCodeV5>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v4/codes/{}", tournament_code));
|
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v5/codes/{}", tournament_code));
|
||||||
let future = self.base.execute_val::<tournament_v4::TournamentCode>("tournament-v4.getTournamentCode", route_str, request);
|
let future = self.base.execute_val::<tournament_v5::TournamentCodeV5>("tournament-v5.getTournamentCode", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-v4.getTournamentCode"));
|
let future = future.instrument(tracing::info_span!("tournament-v5.getTournamentCode"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the pick type, map, spectator type, or allowed summoners for a code.
|
/// Update the pick type, map, spectator type, or allowed puuids for a code.
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `tournament_code` (required, in path) - The tournament code to update
|
/// * `tournament_code` (required, in path) - The tournament code to update
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/PUT_updateCode" target="_blank">`tournament-v4.updateCode`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/PUT_updateCode" target="_blank">`tournament-v5.updateCode`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn update_code(&self, route: RegionalRoute, body: &tournament_v4::TournamentCodeUpdateParameters, tournament_code: &str)
|
pub fn update_code(&self, route: RegionalRoute, body: &tournament_v5::TournamentCodeUpdateParametersV5, tournament_code: &str)
|
||||||
-> impl Future<Output = Result<()>> + 'a
|
-> impl Future<Output = Result<()>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::PUT, route_str, &format!("/lol/tournament/v4/codes/{}", tournament_code));
|
let request = self.base.request(Method::PUT, route_str, &format!("/lol/tournament/v5/codes/{}", tournament_code));
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute("tournament-v4.updateCode", route_str, request);
|
let future = self.base.execute("tournament-v5.updateCode", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-v4.updateCode"));
|
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"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1830,17 +1962,17 @@ impl<'a> TournamentV4<'a> {
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
|
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/GET_getLobbyEventsByCode" target="_blank">`tournament-v4.getLobbyEventsByCode`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getLobbyEventsByCode" target="_blank">`tournament-v5.getLobbyEventsByCode`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn get_lobby_events_by_code(&self, route: RegionalRoute, tournament_code: &str)
|
pub fn get_lobby_events_by_code(&self, route: RegionalRoute, tournament_code: &str)
|
||||||
-> impl Future<Output = Result<tournament_v4::LobbyEventWrapper>> + 'a
|
-> impl Future<Output = Result<tournament_v5::LobbyEventV5Wrapper>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v4/lobby-events/by-code/{}", tournament_code));
|
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_v4::LobbyEventWrapper>("tournament-v4.getLobbyEventsByCode", route_str, request);
|
let future = self.base.execute_val::<tournament_v5::LobbyEventV5Wrapper>("tournament-v5.getLobbyEventsByCode", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-v4.getLobbyEventsByCode"));
|
let future = future.instrument(tracing::info_span!("tournament-v5.getLobbyEventsByCode"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1850,18 +1982,18 @@ impl<'a> TournamentV4<'a> {
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_registerProviderData" target="_blank">`tournament-v4.registerProviderData`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_registerProviderData" target="_blank">`tournament-v5.registerProviderData`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_v4::ProviderRegistrationParameters)
|
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_v5::ProviderRegistrationParametersV5)
|
||||||
-> impl Future<Output = Result<i32>> + 'a
|
-> impl Future<Output = Result<i32>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/providers");
|
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/providers");
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute_val::<i32>("tournament-v4.registerProviderData", route_str, request);
|
let future = self.base.execute_val::<i32>("tournament-v5.registerProviderData", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-v4.registerProviderData"));
|
let future = future.instrument(tracing::info_span!("tournament-v5.registerProviderData"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1869,18 +2001,18 @@ impl<'a> TournamentV4<'a> {
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// * `route` - Route to query.
|
/// * `route` - Route to query.
|
||||||
/// # Riot Developer API Reference
|
/// # Riot Developer API Reference
|
||||||
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_registerTournament" target="_blank">`tournament-v4.registerTournament`</a>
|
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_registerTournament" target="_blank">`tournament-v5.registerTournament`</a>
|
||||||
///
|
///
|
||||||
/// Note: this method is automatically generated.
|
/// Note: this method is automatically generated.
|
||||||
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_v4::TournamentRegistrationParameters)
|
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_v5::TournamentRegistrationParametersV5)
|
||||||
-> impl Future<Output = Result<i32>> + 'a
|
-> impl Future<Output = Result<i32>> + 'a
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/tournaments");
|
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/tournaments");
|
||||||
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
let request = request.body(serde_json::ser::to_vec(body).unwrap());
|
||||||
let future = self.base.execute_val::<i32>("tournament-v4.registerTournament", route_str, request);
|
let future = self.base.execute_val::<i32>("tournament-v5.registerTournament", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("tournament-v4.registerTournament"));
|
let future = future.instrument(tracing::info_span!("tournament-v5.registerTournament"));
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1909,7 +2041,7 @@ impl<'a> ValContentV1<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
let route_str = route.into();
|
||||||
let request = self.base.request(Method::GET, route_str, "/val/content/v1/contents");
|
let request = self.base.request(Method::GET, route_str, "/val/content/v1/contents");
|
||||||
let mut request = request; if let Some(locale) = locale { request = request.query(&[ ("locale", locale) ]); }
|
let request = if let Some(locale) = locale { request.query(&[ ("locale", locale) ]) } else { request };
|
||||||
let future = self.base.execute_val::<val_content_v1::Content>("val-content-v1.getContent", route_str, request);
|
let future = self.base.execute_val::<val_content_v1::Content>("val-content-v1.getContent", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("val-content-v1.getContent"));
|
let future = future.instrument(tracing::info_span!("val-content-v1.getContent"));
|
||||||
|
@ -2014,8 +2146,8 @@ impl<'a> ValRankedV1<'a> {
|
||||||
{
|
{
|
||||||
let route_str = route.into();
|
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 = self.base.request(Method::GET, route_str, &format!("/val/ranked/v1/leaderboards/by-act/{}", act_id));
|
||||||
let mut request = request; if let Some(size) = size { request = request.query(&[ ("size", size) ]); }
|
let request = if let Some(size) = size { request.query(&[ ("size", size) ]) } else { request };
|
||||||
let mut request = request; if let Some(start_index) = start_index { request = request.query(&[ ("startIndex", start_index) ]); }
|
let request = if let Some(start_index) = start_index { request.query(&[ ("startIndex", start_index) ]) } else { request };
|
||||||
let future = self.base.execute_opt::<val_ranked_v1::Leaderboard>("val-ranked-v1.getLeaderboard", route_str, request);
|
let future = self.base.execute_opt::<val_ranked_v1::Leaderboard>("val-ranked-v1.getLeaderboard", route_str, request);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let future = future.instrument(tracing::info_span!("val-ranked-v1.getLeaderboard"));
|
let future = future.instrument(tracing::info_span!("val-ranked-v1.getLeaderboard"));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use reqwest::{ Error, Response, StatusCode };
|
use reqwest::{Error, Response, StatusCode};
|
||||||
|
|
||||||
/// Result containing RiotApiError on failure.
|
/// Result containing RiotApiError on failure.
|
||||||
pub type Result<T> = std::result::Result<T, RiotApiError>;
|
pub type Result<T> = std::result::Result<T, RiotApiError>;
|
||||||
|
@ -17,7 +17,12 @@ pub struct RiotApiError {
|
||||||
status_code: Option<StatusCode>,
|
status_code: Option<StatusCode>,
|
||||||
}
|
}
|
||||||
impl RiotApiError {
|
impl RiotApiError {
|
||||||
pub(crate) fn new(reqwest_error: Error, retries: u8, response: Option<Response>, status_code: Option<StatusCode>) -> Self {
|
pub(crate) fn new(
|
||||||
|
reqwest_error: Error,
|
||||||
|
retries: u8,
|
||||||
|
response: Option<Response>,
|
||||||
|
status_code: Option<StatusCode>,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
reqwest_error,
|
reqwest_error,
|
||||||
retries,
|
retries,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -19,47 +20,47 @@
|
||||||
//! <!--<a href="https://travis-ci.com/MingweiSamuel/Riven"><img src="https://img.shields.io/travis/com/mingweisamuel/riven?style=flat-square" alt="Travis CI"></a>-->
|
//! <!--<a href="https://travis-ci.com/MingweiSamuel/Riven"><img src="https://img.shields.io/travis/com/mingweisamuel/riven?style=flat-square" alt="Travis CI"></a>-->
|
||||||
//! <a href="https://github.com/rust-secure-code/safety-dance/"><img src="https://img.shields.io/badge/unsafe-forbidden-green.svg?style=flat-square" alt="unsafe forbidden"></a>
|
//! <a href="https://github.com/rust-secure-code/safety-dance/"><img src="https://img.shields.io/badge/unsafe-forbidden-green.svg?style=flat-square" alt="unsafe forbidden"></a>
|
||||||
//! </p>
|
//! </p>
|
||||||
//!
|
//!
|
||||||
//! Rust Library for the [Riot Games API](https://developer.riotgames.com/).
|
//! Rust Library for the [Riot Games API](https://developer.riotgames.com/).
|
||||||
//!
|
//!
|
||||||
//! Riven's goals are _speed_, _reliability_, and _maintainability_. Riven handles rate limits and large requests with ease.
|
//! Riven's goals are _speed_, _reliability_, and _maintainability_. Riven handles rate limits and large requests with ease.
|
||||||
//! Data structs and endpoints are automatically generated from the
|
//! Data structs and endpoints are automatically generated from the
|
||||||
//! [Riot API Reference](https://developer.riotgames.com/api-methods/) ([Swagger](http://www.mingweisamuel.com/riotapi-schema/tool/)).
|
//! [Riot API Reference](https://developer.riotgames.com/api-methods/) ([Swagger](http://www.mingweisamuel.com/riotapi-schema/tool/)).
|
||||||
//!
|
//!
|
||||||
//! # Design
|
//! # Design
|
||||||
//!
|
//!
|
||||||
//! * Fast, asynchronous, thread-safe.
|
//! * Fast, asynchronous, thread-safe.
|
||||||
//! * Automatically retries failed requests.
|
//! * Automatically retries failed requests.
|
||||||
//! * Supports all endpoints, kept up-to-date using [riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).
|
//! * Supports all endpoints, kept up-to-date using [riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).
|
||||||
//!
|
//!
|
||||||
//! # Usage
|
//! # Usage
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use riven::RiotApi;
|
//! use riven::RiotApi;
|
||||||
//! use riven::consts::PlatformRoute;
|
//! use riven::consts::PlatformRoute;
|
||||||
//!
|
//!
|
||||||
//! // Enter tokio async runtime.
|
//! // Enter tokio async runtime.
|
||||||
//! let rt = tokio::runtime::Runtime::new().unwrap();
|
//! let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
//! rt.block_on(async {
|
//! rt.block_on(async {
|
||||||
//! // Create RiotApi instance from key string.
|
//! // Create RiotApi instance from key string.
|
||||||
//! let api_key = std::env!("RGAPI_KEY"); // "RGAPI-01234567-89ab-cdef-0123-456789abcdef";
|
//! let api_key = std::env!("RGAPI_KEY"); // "RGAPI-01234567-89ab-cdef-0123-456789abcdef";
|
||||||
//! let riot_api = RiotApi::new(api_key);
|
//! let riot_api = RiotApi::new(api_key);
|
||||||
//!
|
//!
|
||||||
//! // Get summoner data.
|
//! // Get summoner data.
|
||||||
//! let summoner = riot_api.summoner_v4()
|
//! let summoner = riot_api.summoner_v4()
|
||||||
//! .get_by_summoner_name(PlatformRoute::NA1, "잘 못").await
|
//! .get_by_summoner_name(PlatformRoute::NA1, "잘 못").await
|
||||||
//! .expect("Get summoner failed.")
|
//! .expect("Get summoner failed.")
|
||||||
//! .expect("There is no summoner with that name.");
|
//! .expect("There is no summoner with that name.");
|
||||||
//!
|
//!
|
||||||
//! // Print summoner name.
|
//! // Print summoner name.
|
||||||
//! println!("{} Champion Masteries:", summoner.name);
|
//! println!("{} Champion Masteries:", summoner.name);
|
||||||
//!
|
//!
|
||||||
//! // Get champion mastery data.
|
//! // Get champion mastery data.
|
||||||
//! let masteries = riot_api.champion_mastery_v4()
|
//! let masteries = riot_api.champion_mastery_v4()
|
||||||
//! .get_all_champion_masteries(PlatformRoute::NA1, &summoner.id).await
|
//! .get_all_champion_masteries_by_puuid(PlatformRoute::NA1, &summoner.puuid).await
|
||||||
//! .expect("Get champion masteries failed.");
|
//! .expect("Get champion masteries failed.");
|
||||||
//!
|
//!
|
||||||
//! // Print champioon masteries.
|
//! // Print champion masteries.
|
||||||
//! for (i, mastery) in masteries.iter().take(10).enumerate() {
|
//! for (i, mastery) in masteries.iter().take(10).enumerate() {
|
||||||
//! println!("{: >2}) {: <9} {: >7} ({})", i + 1,
|
//! println!("{: >2}) {: <9} {: >7} ({})", i + 1,
|
||||||
//! mastery.champion_id.name().unwrap_or("UNKNOWN"),
|
//! mastery.champion_id.name().unwrap_or("UNKNOWN"),
|
||||||
|
@ -83,106 +84,106 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! The [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html)
|
//! 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)
|
//! 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/example/proxy)
|
//! and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/examples/proxy)
|
||||||
//! provide more example usage.
|
//! provide more example usage.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! ### Nightly vs Stable
|
//! ### Nightly vs Stable
|
||||||
//!
|
//!
|
||||||
//! Enable the `nightly` feature to use nightly-only functionality. This enables
|
//! Enable the `nightly` feature to use nightly-only functionality. This enables
|
||||||
//! [nightly optimizations in the `parking_lot` crate](https://github.com/Amanieu/parking_lot#nightly-vs-stable).
|
//! [nightly optimizations in the `parking_lot` crate](https://github.com/Amanieu/parking_lot#nightly-vs-stable).
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! riven = { version = "...", features = [ "nightly" ] }
|
//! riven = { version = "...", features = [ "nightly" ] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ### rustls
|
//! ### rustls
|
||||||
//!
|
//!
|
||||||
//! Riven uses [reqwest](https://github.com/seanmonstar/reqwest) for making requests. By default, reqwest uses the native TLS library.
|
//! Riven uses [reqwest](https://github.com/seanmonstar/reqwest) for making requests. By default, reqwest uses the native TLS library.
|
||||||
//! If you prefer using [rustls](https://github.com/ctz/rustls) you can do so by turning off the Riven default features
|
//! If you prefer using [rustls](https://github.com/ctz/rustls) you can do so by turning off the Riven default features
|
||||||
//! and specifying the `rustls-tls` feature:
|
//! and specifying the `rustls-tls` feature:
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! riven = { version = "...", default-features = false, features = [ "rustls-tls" ] }
|
//! riven = { version = "...", default-features = false, features = [ "rustls-tls" ] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Riven is additionally able to produce [tracing](https://docs.rs/tracing) spans for requests if the `tracing` feature is enabled. This feature is disabled by default.
|
//! Riven is additionally able to produce [tracing](https://docs.rs/tracing) spans for requests if the `tracing` feature is enabled. This feature is disabled by default.
|
||||||
//!
|
//!
|
||||||
//! ## Docs
|
//! ## Docs
|
||||||
//!
|
//!
|
||||||
//! [On docs.rs](https://docs.rs/riven/).
|
//! [On docs.rs](https://docs.rs/riven/).
|
||||||
//!
|
//!
|
||||||
//! ## Error Handling
|
//! ## Error Handling
|
||||||
//!
|
//!
|
||||||
//! Riven returns either `Result<T>` or `Result<Option<T>>` within futures.
|
//! Riven returns either `Result<T>` or `Result<Option<T>>` within futures.
|
||||||
//!
|
//!
|
||||||
//! If the `Result` is errored, this indicates that the API request failed to
|
//! If the `Result` is errored, this indicates that the API request failed to
|
||||||
//! complete successfully, which may be due to bad user input, Riot server errors,
|
//! complete successfully, which may be due to bad user input, Riot server errors,
|
||||||
//! incorrect API key, etc.
|
//! incorrect API key, etc.
|
||||||
//!
|
//!
|
||||||
//! If the `Option` is `None`, this indicates that the request completed
|
//! If the `Option` is `None`, this indicates that the request completed
|
||||||
//! successfully but no data was returned. This happens in several situations, such
|
//! successfully but no data was returned. This happens in several situations, such
|
||||||
//! as getting a summoner (by name) or match (by id) that doesn't exist, or getting
|
//! as getting a summoner (by name) or match (by id) that doesn't exist, or getting
|
||||||
//! spectator data for a summoner who is not in-game.
|
//! spectator data for a summoner who is not in-game.
|
||||||
//! Specifically, the API returned a 404 HTTP status code in this situation.
|
//! Specifically, the API returned a 404 HTTP status code in this situation.
|
||||||
//!
|
//!
|
||||||
//! The error type used by Riven is `riven::RiotApiError`. It provides some basic
|
//! The error type used by Riven is `riven::RiotApiError`. It provides some basic
|
||||||
//! diagnostic information, such as the source Reqwest error, the number of retries
|
//! diagnostic information, such as the source Reqwest error, the number of retries
|
||||||
//! attempted, and the Reqwest `Response` object.
|
//! attempted, and the Reqwest `Response` object.
|
||||||
//!
|
//!
|
||||||
//! You can configure the number of time Riven retries using
|
//! You can configure the number of time Riven retries using
|
||||||
//! `RiotApiConfig::set_retries(...)` and the `RiotApi::from_config(config)`
|
//! `RiotApiConfig::set_retries(...)` and the `RiotApi::from_config(config)`
|
||||||
//! constructor. By default, Riven retries up to 3 times (4 requests total).
|
//! constructor. By default, Riven retries up to 3 times (4 requests total).
|
||||||
//! Some errors, such as 400 client errors, are not retried as they would
|
//! Some errors, such as 400 client errors, are not retried as they would
|
||||||
//! inevitably fail again.
|
//! inevitably fail again.
|
||||||
//!
|
//!
|
||||||
//! ## Semantic Versioning
|
//! ## Semantic Versioning
|
||||||
//!
|
//!
|
||||||
//! This package follows semantic versioning to an extent. However, the Riot API
|
//! This package follows semantic versioning to an extent. However, the Riot API
|
||||||
//! itself changes often and does not follow semantic versioning, which makes
|
//! itself changes often and does not follow semantic versioning, which makes
|
||||||
//! things difficult. Out-of-date versions will slowly partially cease to work due
|
//! things difficult. Out-of-date versions will slowly partially cease to work due
|
||||||
//! to this.
|
//! to this.
|
||||||
//!
|
//!
|
||||||
//! When the API changes, this may result in breaking changes in the `models`
|
//! When the API changes, this may result in breaking changes in the `models`
|
||||||
//! module, `endpoints` module, and some of the `consts` module. "Handle accessor"
|
//! module, `endpoints` module, and some of the `consts` module. "Handle accessor"
|
||||||
//! methods may be removed from `RiotApi` if the corresponding endpoint is removed
|
//! methods may be removed from `RiotApi` if the corresponding endpoint is removed
|
||||||
//! from the Riot API. These breaking changes will increment the **MINOR** version,
|
//! from the Riot API. These breaking changes will increment the **MINOR** version,
|
||||||
//! not the major version.
|
//! not the major version.
|
||||||
//!
|
//!
|
||||||
//! Parts of Riven that do not depend on Riot API changes do follow semantic
|
//! Parts of Riven that do not depend on Riot API changes do follow semantic
|
||||||
//! versioning.
|
//! versioning.
|
||||||
//!
|
//!
|
||||||
//! ## Additional Help
|
//! ## Additional Help
|
||||||
//!
|
//!
|
||||||
//! Feel free to [make an issue](https://github.com/MingweiSamuel/Riven/issues/new)
|
//! Feel free to [make an issue](https://github.com/MingweiSamuel/Riven/issues/new)
|
||||||
//! if you are have any questions or trouble with Riven.
|
//! if you are have any questions or trouble with Riven.
|
||||||
//!
|
//!
|
||||||
//! # Development
|
//! # Development
|
||||||
//!
|
//!
|
||||||
//! NodeJS is used to generate code for Riven. The
|
//! NodeJS is used to generate code for Riven. The
|
||||||
//! [`riven/srcgen`](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/srcgen)
|
//! [`riven/srcgen`](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/srcgen)
|
||||||
//! folder contains the code and [doT.js](https://olado.github.io/doT/index.html)
|
//! folder contains the code and [doT.js](https://olado.github.io/doT/index.html)
|
||||||
//! templates. `index.js` lists the JSON files downloaded and used to generate the
|
//! templates. `index.js` lists the JSON files downloaded and used to generate the
|
||||||
//! code.
|
//! code.
|
||||||
//!
|
//!
|
||||||
//! To set up the srcgen, you will first need to install NodeJS. Then enter the
|
//! To set up the srcgen, you will first need to install NodeJS. Then enter the
|
||||||
//! `riven/srcgen` folder and run `npm ci` (or `npm install`) to install
|
//! `riven/srcgen` folder and run `npm ci` (or `npm install`) to install
|
||||||
//! dependencies.
|
//! dependencies.
|
||||||
//!
|
//!
|
||||||
//! To run the srcgen use `node riven/srcgen` from the repository root.
|
//! To run the srcgen use `node riven/srcgen` from the repository root.
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
|
|
||||||
// Re-exported reqwest types.
|
// Re-exported reqwest types.
|
||||||
pub use reqwest;
|
pub use reqwest;
|
||||||
|
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::RiotApiConfig;
|
pub use config::RiotApiConfig;
|
||||||
|
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod endpoints;
|
pub mod endpoints;
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -190,6 +191,7 @@ pub use error::*;
|
||||||
|
|
||||||
pub mod meta;
|
pub mod meta;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod models;
|
pub mod models;
|
||||||
mod models_impls;
|
mod models_impls;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -7,7 +8,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version 8afe7b8e927da46a6f41108e6dc7e1a8c71d89b9
|
// Version d4f02b20da80dd2c869da349ba774ef6eddc22fa
|
||||||
|
|
||||||
//! Metadata about the Riot API and Riven.
|
//! Metadata about the Riot API and Riven.
|
||||||
//!
|
//!
|
||||||
|
@ -15,14 +16,15 @@
|
||||||
|
|
||||||
/// Metadata for endpoints. Each tuple corresponds to one endpoint and contains
|
/// Metadata for endpoints. Each tuple corresponds to one endpoint and contains
|
||||||
/// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID.
|
/// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID.
|
||||||
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 75] = [
|
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 80] = [
|
||||||
(reqwest::Method::GET, "/riot/account/v1/accounts/by-puuid/{puuid}", "account-v1.getByPuuid"),
|
(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/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/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, "/riot/account/v1/active-shards/by-game/{game}/by-puuid/{puuid}", "account-v1.getActiveShard"),
|
||||||
(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-puuid/{encryptedPUUID}", "champion-mastery-v4.getAllChampionMasteriesByPUUID"),
|
||||||
(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-puuid/{encryptedPUUID}/by-champion/{championId}", "champion-mastery-v4.getChampionMasteryByPUUID"),
|
||||||
(reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getChampionMasteryScore"),
|
(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/platform/v3/champion-rotations", "champion-v3.getChampionInfo"),
|
(reqwest::Method::GET, "/lol/platform/v3/champion-rotations", "champion-v3.getChampionInfo"),
|
||||||
(reqwest::Method::GET, "/lol/clash/v1/players/by-summoner/{summonerId}", "clash-v1.getPlayersBySummoner"),
|
(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/teams/{teamId}", "clash-v1.getTeamById"),
|
||||||
|
@ -56,6 +58,7 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 75] = [
|
||||||
(reqwest::Method::GET, "/lol/match/v5/matches/{matchId}/timeline", "match-v5.getTimeline"),
|
(reqwest::Method::GET, "/lol/match/v5/matches/{matchId}/timeline", "match-v5.getTimeline"),
|
||||||
(reqwest::Method::GET, "/lol/spectator/v4/active-games/by-summoner/{encryptedSummonerId}", "spectator-v4.getCurrentGameInfoBySummoner"),
|
(reqwest::Method::GET, "/lol/spectator/v4/active-games/by-summoner/{encryptedSummonerId}", "spectator-v4.getCurrentGameInfoBySummoner"),
|
||||||
(reqwest::Method::GET, "/lol/spectator/v4/featured-games", "spectator-v4.getFeaturedGames"),
|
(reqwest::Method::GET, "/lol/spectator/v4/featured-games", "spectator-v4.getFeaturedGames"),
|
||||||
|
(reqwest::Method::GET, "/fulfillment/v1/summoners/by-puuid/{rsoPUUID}", "summoner-v4.getByRSOPUUID"),
|
||||||
(reqwest::Method::GET, "/lol/summoner/v4/summoners/by-account/{encryptedAccountId}", "summoner-v4.getByAccountId"),
|
(reqwest::Method::GET, "/lol/summoner/v4/summoners/by-account/{encryptedAccountId}", "summoner-v4.getByAccountId"),
|
||||||
(reqwest::Method::GET, "/lol/summoner/v4/summoners/by-name/{summonerName}", "summoner-v4.getBySummonerName"),
|
(reqwest::Method::GET, "/lol/summoner/v4/summoners/by-name/{summonerName}", "summoner-v4.getBySummonerName"),
|
||||||
(reqwest::Method::GET, "/lol/summoner/v4/summoners/by-puuid/{encryptedPUUID}", "summoner-v4.getByPUUID"),
|
(reqwest::Method::GET, "/lol/summoner/v4/summoners/by-puuid/{encryptedPUUID}", "summoner-v4.getByPUUID"),
|
||||||
|
@ -70,21 +73,24 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 75] = [
|
||||||
(reqwest::Method::GET, "/tft/league/v1/rated-ladders/{queue}/top", "tft-league-v1.getTopRatedLadder"),
|
(reqwest::Method::GET, "/tft/league/v1/rated-ladders/{queue}/top", "tft-league-v1.getTopRatedLadder"),
|
||||||
(reqwest::Method::GET, "/tft/match/v1/matches/by-puuid/{puuid}/ids", "tft-match-v1.getMatchIdsByPUUID"),
|
(reqwest::Method::GET, "/tft/match/v1/matches/by-puuid/{puuid}/ids", "tft-match-v1.getMatchIdsByPUUID"),
|
||||||
(reqwest::Method::GET, "/tft/match/v1/matches/{matchId}", "tft-match-v1.getMatch"),
|
(reqwest::Method::GET, "/tft/match/v1/matches/{matchId}", "tft-match-v1.getMatch"),
|
||||||
|
(reqwest::Method::GET, "/tft/status/v1/platform-data", "tft-status-v1.getPlatformData"),
|
||||||
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-account/{encryptedAccountId}", "tft-summoner-v1.getByAccountId"),
|
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-account/{encryptedAccountId}", "tft-summoner-v1.getByAccountId"),
|
||||||
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-name/{summonerName}", "tft-summoner-v1.getBySummonerName"),
|
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-name/{summonerName}", "tft-summoner-v1.getBySummonerName"),
|
||||||
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-puuid/{encryptedPUUID}", "tft-summoner-v1.getByPUUID"),
|
(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/me", "tft-summoner-v1.getByAccessToken"),
|
||||||
(reqwest::Method::GET, "/tft/summoner/v1/summoners/{encryptedSummonerId}", "tft-summoner-v1.getBySummonerId"),
|
(reqwest::Method::GET, "/tft/summoner/v1/summoners/{encryptedSummonerId}", "tft-summoner-v1.getBySummonerId"),
|
||||||
(reqwest::Method::POST, "/lol/tournament-stub/v4/codes", "tournament-stub-v4.createTournamentCode"),
|
(reqwest::Method::POST, "/lol/tournament-stub/v5/codes", "tournament-stub-v5.createTournamentCode"),
|
||||||
(reqwest::Method::GET, "/lol/tournament-stub/v4/lobby-events/by-code/{tournamentCode}", "tournament-stub-v4.getLobbyEventsByCode"),
|
(reqwest::Method::GET, "/lol/tournament-stub/v5/codes/{tournamentCode}", "tournament-stub-v5.getTournamentCode"),
|
||||||
(reqwest::Method::POST, "/lol/tournament-stub/v4/providers", "tournament-stub-v4.registerProviderData"),
|
(reqwest::Method::GET, "/lol/tournament-stub/v5/lobby-events/by-code/{tournamentCode}", "tournament-stub-v5.getLobbyEventsByCode"),
|
||||||
(reqwest::Method::POST, "/lol/tournament-stub/v4/tournaments", "tournament-stub-v4.registerTournament"),
|
(reqwest::Method::POST, "/lol/tournament-stub/v5/providers", "tournament-stub-v5.registerProviderData"),
|
||||||
(reqwest::Method::POST, "/lol/tournament/v4/codes", "tournament-v4.createTournamentCode"),
|
(reqwest::Method::POST, "/lol/tournament-stub/v5/tournaments", "tournament-stub-v5.registerTournament"),
|
||||||
(reqwest::Method::GET, "/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.getTournamentCode"),
|
(reqwest::Method::POST, "/lol/tournament/v5/codes", "tournament-v5.createTournamentCode"),
|
||||||
(reqwest::Method::PUT, "/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.updateCode"),
|
(reqwest::Method::GET, "/lol/tournament/v5/codes/{tournamentCode}", "tournament-v5.getTournamentCode"),
|
||||||
(reqwest::Method::GET, "/lol/tournament/v4/lobby-events/by-code/{tournamentCode}", "tournament-v4.getLobbyEventsByCode"),
|
(reqwest::Method::PUT, "/lol/tournament/v5/codes/{tournamentCode}", "tournament-v5.updateCode"),
|
||||||
(reqwest::Method::POST, "/lol/tournament/v4/providers", "tournament-v4.registerProviderData"),
|
(reqwest::Method::GET, "/lol/tournament/v5/games/by-code/{tournamentCode}", "tournament-v5.getGames"),
|
||||||
(reqwest::Method::POST, "/lol/tournament/v4/tournaments", "tournament-v4.registerTournament"),
|
(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::GET, "/val/content/v1/contents", "val-content-v1.getContent"),
|
(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/matches/{matchId}", "val-match-v1.getMatch"),
|
||||||
(reqwest::Method::GET, "/val/match/v1/matchlists/by-puuid/{puuid}", "val-match-v1.getMatchlist"),
|
(reqwest::Method::GET, "/val/match/v1/matchlists/by-puuid/{puuid}", "val-match-v1.getMatchlist"),
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -7,7 +8,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version 8afe7b8e927da46a6f41108e6dc7e1a8c71d89b9
|
// Version d4f02b20da80dd2c869da349ba774ef6eddc22fa
|
||||||
|
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
|
@ -94,6 +95,9 @@ pub mod champion_mastery_v4 {
|
||||||
/// The token earned for this champion at the current championLevel. When the championLevel is advanced the tokensEarned resets to 0.
|
/// The token earned for this champion at the current championLevel. When the championLevel is advanced the tokensEarned resets to 0.
|
||||||
#[serde(rename = "tokensEarned")]
|
#[serde(rename = "tokensEarned")]
|
||||||
pub tokens_earned: i32,
|
pub tokens_earned: i32,
|
||||||
|
#[serde(rename = "puuid")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub puuid: Option<String>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,15 +270,18 @@ pub mod league_v4 {
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct LeagueList {
|
pub struct LeagueList {
|
||||||
#[serde(rename = "leagueId")]
|
#[serde(rename = "leagueId")]
|
||||||
pub league_id: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub league_id: Option<String>,
|
||||||
#[serde(rename = "entries")]
|
#[serde(rename = "entries")]
|
||||||
pub entries: std::vec::Vec<LeagueItem>,
|
pub entries: std::vec::Vec<LeagueItem>,
|
||||||
#[serde(rename = "tier")]
|
#[serde(rename = "tier")]
|
||||||
pub tier: crate::consts::Tier,
|
pub tier: crate::consts::Tier,
|
||||||
#[serde(rename = "name")]
|
#[serde(rename = "name")]
|
||||||
pub name: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub name: Option<String>,
|
||||||
#[serde(rename = "queue")]
|
#[serde(rename = "queue")]
|
||||||
pub queue: crate::consts::QueueType,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub queue: Option<crate::consts::QueueType>,
|
||||||
}
|
}
|
||||||
/// LeagueItem data object.
|
/// LeagueItem data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -481,7 +488,8 @@ pub mod lol_challenges_v1 {
|
||||||
#[serde(rename = "value")]
|
#[serde(rename = "value")]
|
||||||
pub value: f64,
|
pub value: f64,
|
||||||
#[serde(rename = "achievedTime")]
|
#[serde(rename = "achievedTime")]
|
||||||
pub achieved_time: i64,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub achieved_time: Option<i64>,
|
||||||
#[serde(rename = "position")]
|
#[serde(rename = "position")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub position: Option<i64>,
|
pub position: Option<i64>,
|
||||||
|
@ -503,6 +511,12 @@ pub mod lol_challenges_v1 {
|
||||||
#[serde(rename = "challengeIds")]
|
#[serde(rename = "challengeIds")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub challenge_ids: Option<std::vec::Vec<i64>>,
|
pub challenge_ids: Option<std::vec::Vec<i64>>,
|
||||||
|
#[serde(rename = "crestBorder")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub crest_border: Option<String>,
|
||||||
|
#[serde(rename = "prestigeCrestBorderLevel")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub prestige_crest_border_level: Option<i32>,
|
||||||
}
|
}
|
||||||
/// ChallengePoints data object.
|
/// ChallengePoints data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -638,10 +652,12 @@ pub mod lol_status_v4 {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
/// (Legal values: scheduled, in_progress, complete)
|
/// (Legal values: scheduled, in_progress, complete)
|
||||||
#[serde(rename = "maintenance_status")]
|
#[serde(rename = "maintenance_status")]
|
||||||
pub maintenance_status: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub maintenance_status: Option<String>,
|
||||||
/// (Legal values: info, warning, critical)
|
/// (Legal values: info, warning, critical)
|
||||||
#[serde(rename = "incident_severity")]
|
#[serde(rename = "incident_severity")]
|
||||||
pub incident_severity: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub incident_severity: Option<String>,
|
||||||
#[serde(rename = "titles")]
|
#[serde(rename = "titles")]
|
||||||
pub titles: std::vec::Vec<Content>,
|
pub titles: std::vec::Vec<Content>,
|
||||||
#[serde(rename = "updates")]
|
#[serde(rename = "updates")]
|
||||||
|
@ -649,9 +665,11 @@ pub mod lol_status_v4 {
|
||||||
#[serde(rename = "created_at")]
|
#[serde(rename = "created_at")]
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
#[serde(rename = "archive_at")]
|
#[serde(rename = "archive_at")]
|
||||||
pub archive_at: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub archive_at: Option<String>,
|
||||||
#[serde(rename = "updated_at")]
|
#[serde(rename = "updated_at")]
|
||||||
pub updated_at: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub updated_at: Option<String>,
|
||||||
/// (Legal values: windows, macos, android, ios, ps4, xbone, switch)
|
/// (Legal values: windows, macos, android, ios, ps4, xbone, switch)
|
||||||
#[serde(rename = "platforms")]
|
#[serde(rename = "platforms")]
|
||||||
pub platforms: std::vec::Vec<String>,
|
pub platforms: std::vec::Vec<String>,
|
||||||
|
@ -782,6 +800,9 @@ pub mod lor_match_v1 {
|
||||||
pub game_start_time_utc: String,
|
pub game_start_time_utc: String,
|
||||||
#[serde(rename = "game_version")]
|
#[serde(rename = "game_version")]
|
||||||
pub game_version: String,
|
pub game_version: String,
|
||||||
|
/// (Legal values: standard, eternal)
|
||||||
|
#[serde(rename = "game_format")]
|
||||||
|
pub game_format: String,
|
||||||
#[serde(rename = "players")]
|
#[serde(rename = "players")]
|
||||||
pub players: std::vec::Vec<Player>,
|
pub players: std::vec::Vec<Player>,
|
||||||
/// Total turns taken by both players.
|
/// Total turns taken by both players.
|
||||||
|
@ -1143,7 +1164,11 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "quadraKills")]
|
#[serde(rename = "quadraKills")]
|
||||||
pub quadra_kills: i32,
|
pub quadra_kills: i32,
|
||||||
#[serde(rename = "riotIdName")]
|
#[serde(rename = "riotIdName")]
|
||||||
pub riot_id_name: String,
|
#[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>,
|
||||||
#[serde(rename = "riotIdTagline")]
|
#[serde(rename = "riotIdTagline")]
|
||||||
pub riot_id_tagline: String,
|
pub riot_id_tagline: String,
|
||||||
#[serde(rename = "role")]
|
#[serde(rename = "role")]
|
||||||
|
@ -1231,9 +1256,120 @@ pub mod match_v5 {
|
||||||
pub wards_placed: i32,
|
pub wards_placed: i32,
|
||||||
#[serde(rename = "win")]
|
#[serde(rename = "win")]
|
||||||
pub win: bool,
|
pub win: bool,
|
||||||
|
#[serde(rename = "allInPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub all_in_pings: Option<i32>,
|
||||||
|
#[serde(rename = "assistMePings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub assist_me_pings: Option<i32>,
|
||||||
|
#[serde(rename = "baitPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub bait_pings: Option<i32>,
|
||||||
|
#[serde(rename = "basicPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub basic_pings: Option<i32>,
|
||||||
|
#[serde(rename = "commandPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub command_pings: Option<i32>,
|
||||||
|
#[serde(rename = "dangerPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub danger_pings: Option<i32>,
|
||||||
|
#[serde(rename = "enemyMissingPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub enemy_missing_pings: Option<i32>,
|
||||||
|
#[serde(rename = "enemyVisionPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub enemy_vision_pings: Option<i32>,
|
||||||
|
#[serde(rename = "getBackPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub get_back_pings: Option<i32>,
|
||||||
|
#[serde(rename = "holdPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub hold_pings: Option<i32>,
|
||||||
|
#[serde(rename = "needVisionPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub need_vision_pings: Option<i32>,
|
||||||
|
#[serde(rename = "onMyWayPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub on_my_way_pings: Option<i32>,
|
||||||
|
#[serde(rename = "pushPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub push_pings: Option<i32>,
|
||||||
|
#[serde(rename = "visionClearedPings")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub vision_cleared_pings: Option<i32>,
|
||||||
|
#[serde(rename = "eligibleForProgression")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub eligible_for_progression: Option<bool>,
|
||||||
#[serde(rename = "challenges")]
|
#[serde(rename = "challenges")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub challenges: Option<ParticipantChallenges>,
|
pub challenges: Option<ParticipantChallenges>,
|
||||||
|
#[serde(rename = "totalAllyJungleMinionsKilled")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub total_ally_jungle_minions_killed: Option<i32>,
|
||||||
|
#[serde(rename = "totalEnemyJungleMinionsKilled")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub total_enemy_jungle_minions_killed: Option<i32>,
|
||||||
|
#[serde(rename = "playerAugment1")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub player_augment1: Option<i32>,
|
||||||
|
#[serde(rename = "playerAugment2")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub player_augment2: Option<i32>,
|
||||||
|
#[serde(rename = "playerAugment3")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub player_augment3: Option<i32>,
|
||||||
|
#[serde(rename = "playerAugment4")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub player_augment4: Option<i32>,
|
||||||
|
#[serde(rename = "playerSubteamId")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub player_subteam_id: Option<i32>,
|
||||||
|
#[serde(rename = "subteamPlacement")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub subteam_placement: Option<i32>,
|
||||||
|
#[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.
|
/// Perks data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -1324,6 +1460,9 @@ pub mod match_v5 {
|
||||||
pub rift_herald: Objective,
|
pub rift_herald: Objective,
|
||||||
#[serde(rename = "tower")]
|
#[serde(rename = "tower")]
|
||||||
pub tower: Objective,
|
pub tower: Objective,
|
||||||
|
#[serde(rename = "horde")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub horde: Option<Objective>,
|
||||||
}
|
}
|
||||||
/// Objective data object.
|
/// Objective data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -1452,6 +1591,9 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "fastestLegendary")]
|
#[serde(rename = "fastestLegendary")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub fastest_legendary: Option<f64>,
|
pub fastest_legendary: Option<f64>,
|
||||||
|
#[serde(rename = "firstTurretKilled")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub first_turret_killed: Option<f64>,
|
||||||
#[serde(rename = "firstTurretKilledTime")]
|
#[serde(rename = "firstTurretKilledTime")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub first_turret_killed_time: Option<f64>,
|
pub first_turret_killed_time: Option<f64>,
|
||||||
|
@ -1512,6 +1654,9 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "killedChampTookFullTeamDamageSurvived")]
|
#[serde(rename = "killedChampTookFullTeamDamageSurvived")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub killed_champ_took_full_team_damage_survived: Option<f64>,
|
pub killed_champ_took_full_team_damage_survived: Option<f64>,
|
||||||
|
#[serde(rename = "killingSprees")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub killing_sprees: Option<f64>,
|
||||||
#[serde(rename = "killParticipation")]
|
#[serde(rename = "killParticipation")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub kill_participation: Option<f64>,
|
pub kill_participation: Option<f64>,
|
||||||
|
@ -1605,6 +1750,9 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "pickKillWithAlly")]
|
#[serde(rename = "pickKillWithAlly")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub pick_kill_with_ally: Option<f64>,
|
pub pick_kill_with_ally: Option<f64>,
|
||||||
|
#[serde(rename = "playedChampSelectPosition")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub played_champ_select_position: Option<f64>,
|
||||||
#[serde(rename = "poroExplosions")]
|
#[serde(rename = "poroExplosions")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub poro_explosions: Option<f64>,
|
pub poro_explosions: Option<f64>,
|
||||||
|
@ -1671,6 +1819,9 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "takedownsFirst25Minutes")]
|
#[serde(rename = "takedownsFirst25Minutes")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub takedowns_first25_minutes: Option<f64>,
|
pub takedowns_first25_minutes: Option<f64>,
|
||||||
|
#[serde(rename = "takedownsFirstXMinutes")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub takedowns_first_x_minutes: Option<f64>,
|
||||||
#[serde(rename = "takedownsInAlcove")]
|
#[serde(rename = "takedownsInAlcove")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub takedowns_in_alcove: Option<f64>,
|
pub takedowns_in_alcove: Option<f64>,
|
||||||
|
@ -1713,6 +1864,9 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "twentyMinionsIn3SecondsCount")]
|
#[serde(rename = "twentyMinionsIn3SecondsCount")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub twenty_minions_in3_seconds_count: Option<f64>,
|
pub twenty_minions_in3_seconds_count: Option<f64>,
|
||||||
|
#[serde(rename = "twoWardsOneSweeperCount")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub two_wards_one_sweeper_count: Option<i32>,
|
||||||
#[serde(rename = "unseenRecalls")]
|
#[serde(rename = "unseenRecalls")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub unseen_recalls: Option<f64>,
|
pub unseen_recalls: Option<f64>,
|
||||||
|
@ -1731,6 +1885,39 @@ pub mod match_v5 {
|
||||||
#[serde(rename = "wardTakedownsBefore20M")]
|
#[serde(rename = "wardTakedownsBefore20M")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub ward_takedowns_before20_m: Option<f64>,
|
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.
|
/// MatchTimelineInfoFrameEvent data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -1996,10 +2183,14 @@ pub mod match_v5 {
|
||||||
pub x7: MatchTimelineInfoFrameParticipantFrame,
|
pub x7: MatchTimelineInfoFrameParticipantFrame,
|
||||||
#[serde(rename = "8")]
|
#[serde(rename = "8")]
|
||||||
pub x8: MatchTimelineInfoFrameParticipantFrame,
|
pub x8: MatchTimelineInfoFrameParticipantFrame,
|
||||||
|
/// Possibly null for the Arena 2v2v2v2 (`CHERRY`) game mode.
|
||||||
#[serde(rename = "9")]
|
#[serde(rename = "9")]
|
||||||
pub x9: MatchTimelineInfoFrameParticipantFrame,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub x9: Option<MatchTimelineInfoFrameParticipantFrame>,
|
||||||
|
/// Possibly null for the Arena 2v2v2v2 (`CHERRY`) game mode.
|
||||||
#[serde(rename = "10")]
|
#[serde(rename = "10")]
|
||||||
pub x10: MatchTimelineInfoFrameParticipantFrame,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub x10: Option<MatchTimelineInfoFrameParticipantFrame>,
|
||||||
}
|
}
|
||||||
/// MatchTimelineInfoFrame data object.
|
/// MatchTimelineInfoFrame data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -2161,6 +2352,10 @@ pub mod spectator_v4 {
|
||||||
/// The encrypted summoner ID of this participant
|
/// The encrypted summoner ID of this participant
|
||||||
#[serde(rename = "summonerId")]
|
#[serde(rename = "summonerId")]
|
||||||
pub summoner_id: String,
|
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
|
/// The ID of the first summoner spell used by this participant
|
||||||
#[serde(rename = "spell1Id")]
|
#[serde(rename = "spell1Id")]
|
||||||
pub spell1_id: i64,
|
pub spell1_id: i64,
|
||||||
|
@ -2208,7 +2403,8 @@ pub mod spectator_v4 {
|
||||||
pub game_list: std::vec::Vec<FeaturedGameInfo>,
|
pub game_list: std::vec::Vec<FeaturedGameInfo>,
|
||||||
/// The suggested interval to wait before requesting FeaturedGames again
|
/// The suggested interval to wait before requesting FeaturedGames again
|
||||||
#[serde(rename = "clientRefreshInterval")]
|
#[serde(rename = "clientRefreshInterval")]
|
||||||
pub client_refresh_interval: i64,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub client_refresh_interval: Option<i64>,
|
||||||
}
|
}
|
||||||
/// FeaturedGameInfo data object.
|
/// FeaturedGameInfo data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -2241,9 +2437,6 @@ pub mod spectator_v4 {
|
||||||
/// The queue type (queue types are documented on the Game Constants page)
|
/// The queue type (queue types are documented on the Game Constants page)
|
||||||
#[serde(rename = "gameQueueConfigId")]
|
#[serde(rename = "gameQueueConfigId")]
|
||||||
pub game_queue_config_id: crate::consts::Queue,
|
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
|
/// The participant information
|
||||||
#[serde(rename = "participants")]
|
#[serde(rename = "participants")]
|
||||||
pub participants: std::vec::Vec<Participant>,
|
pub participants: std::vec::Vec<Participant>,
|
||||||
|
@ -2268,6 +2461,14 @@ pub mod spectator_v4 {
|
||||||
/// The summoner name of this participant
|
/// The summoner name of this participant
|
||||||
#[serde(rename = "summonerName")]
|
#[serde(rename = "summonerName")]
|
||||||
pub summoner_name: String,
|
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
|
/// The ID of the champion played by this participant
|
||||||
#[serde(rename = "championId")]
|
#[serde(rename = "championId")]
|
||||||
pub champion_id: crate::consts::Champion,
|
pub champion_id: crate::consts::Champion,
|
||||||
|
@ -2329,15 +2530,18 @@ pub mod tft_league_v1 {
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct LeagueList {
|
pub struct LeagueList {
|
||||||
#[serde(rename = "leagueId")]
|
#[serde(rename = "leagueId")]
|
||||||
pub league_id: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub league_id: Option<String>,
|
||||||
#[serde(rename = "entries")]
|
#[serde(rename = "entries")]
|
||||||
pub entries: std::vec::Vec<LeagueItem>,
|
pub entries: std::vec::Vec<LeagueItem>,
|
||||||
#[serde(rename = "tier")]
|
#[serde(rename = "tier")]
|
||||||
pub tier: crate::consts::Tier,
|
pub tier: crate::consts::Tier,
|
||||||
#[serde(rename = "name")]
|
#[serde(rename = "name")]
|
||||||
pub name: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub name: Option<String>,
|
||||||
#[serde(rename = "queue")]
|
#[serde(rename = "queue")]
|
||||||
pub queue: crate::consts::QueueType,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub queue: Option<crate::consts::QueueType>,
|
||||||
}
|
}
|
||||||
/// LeagueItem data object.
|
/// LeagueItem data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -2390,6 +2594,10 @@ pub mod tft_league_v1 {
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct LeagueEntry {
|
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.
|
/// Not included for the RANKED_TFT_TURBO queueType.
|
||||||
#[serde(rename = "leagueId")]
|
#[serde(rename = "leagueId")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -2414,7 +2622,7 @@ pub mod tft_league_v1 {
|
||||||
#[serde(rename = "tier")]
|
#[serde(rename = "tier")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub tier: Option<crate::consts::Tier>,
|
pub tier: Option<crate::consts::Tier>,
|
||||||
/// A player's division within a tier. Not included for the RANKED_TFT_TURBO queueType.
|
/// The player's division within a tier. Not included for the RANKED_TFT_TURBO queueType.
|
||||||
#[serde(rename = "rank")]
|
#[serde(rename = "rank")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub rank: Option<crate::consts::Division>,
|
pub rank: Option<crate::consts::Division>,
|
||||||
|
@ -2508,6 +2716,12 @@ pub mod tft_match_v1 {
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct Info {
|
pub struct Info {
|
||||||
|
#[serde(rename = "tft_game_type")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tft_game_type: Option<String>,
|
||||||
|
#[serde(rename = "tft_set_core_name")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tft_set_core_name: Option<String>,
|
||||||
/// Unix timestamp.
|
/// Unix timestamp.
|
||||||
#[serde(rename = "game_datetime")]
|
#[serde(rename = "game_datetime")]
|
||||||
pub game_datetime: i64,
|
pub game_datetime: i64,
|
||||||
|
@ -2525,7 +2739,7 @@ pub mod tft_match_v1 {
|
||||||
pub participants: std::vec::Vec<Participant>,
|
pub participants: std::vec::Vec<Participant>,
|
||||||
/// Please refer to the League of Legends documentation.
|
/// Please refer to the League of Legends documentation.
|
||||||
#[serde(rename = "queue_id")]
|
#[serde(rename = "queue_id")]
|
||||||
pub queue_id: i32,
|
pub queue_id: crate::consts::Queue,
|
||||||
/// Teamfight Tactics set number.
|
/// Teamfight Tactics set number.
|
||||||
#[serde(rename = "tft_set_number")]
|
#[serde(rename = "tft_set_number")]
|
||||||
pub tft_set_number: i32,
|
pub tft_set_number: i32,
|
||||||
|
@ -2535,6 +2749,12 @@ pub mod tft_match_v1 {
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct Participant {
|
pub struct Participant {
|
||||||
|
#[serde(rename = "augments")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub augments: Option<std::vec::Vec<String>>,
|
||||||
|
#[serde(rename = "partner_group_id")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub partner_group_id: Option<i32>,
|
||||||
/// Participant's companion.
|
/// Participant's companion.
|
||||||
#[serde(rename = "companion")]
|
#[serde(rename = "companion")]
|
||||||
pub companion: Companion,
|
pub companion: Companion,
|
||||||
|
@ -2596,9 +2816,13 @@ pub mod tft_match_v1 {
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct Unit {
|
pub struct Unit {
|
||||||
|
#[serde(rename = "itemNames")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub item_names: Option<std::vec::Vec<String>>,
|
||||||
/// A list of the unit's items. Please refer to the Teamfight Tactics documentation for item ids.
|
/// A list of the unit's items. Please refer to the Teamfight Tactics documentation for item ids.
|
||||||
#[serde(rename = "items")]
|
#[serde(rename = "items")]
|
||||||
pub items: std::vec::Vec<i32>,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub items: Option<std::vec::Vec<i32>>,
|
||||||
/// This field was introduced in patch 9.22 with data_version 2.
|
/// This field was introduced in patch 9.22 with data_version 2.
|
||||||
#[serde(rename = "character_id")]
|
#[serde(rename = "character_id")]
|
||||||
pub character_id: String,
|
pub character_id: String,
|
||||||
|
@ -2621,6 +2845,9 @@ pub mod tft_match_v1 {
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct Companion {
|
pub struct Companion {
|
||||||
|
#[serde(rename = "item_ID")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub item_id: Option<i32>,
|
||||||
#[serde(rename = "skin_ID")]
|
#[serde(rename = "skin_ID")]
|
||||||
pub skin_id: i32,
|
pub skin_id: i32,
|
||||||
#[serde(rename = "content_ID")]
|
#[serde(rename = "content_ID")]
|
||||||
|
@ -2630,6 +2857,87 @@ pub mod tft_match_v1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Data structs used by [`TftStatusV1`](crate::endpoints::TftStatusV1).
|
||||||
|
///
|
||||||
|
/// Note: this module is automatically generated.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod tft_status_v1 {
|
||||||
|
/// PlatformData data object.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
|
pub struct PlatformData {
|
||||||
|
#[serde(rename = "id")]
|
||||||
|
pub id: String,
|
||||||
|
#[serde(rename = "name")]
|
||||||
|
pub name: String,
|
||||||
|
#[serde(rename = "locales")]
|
||||||
|
pub locales: std::vec::Vec<String>,
|
||||||
|
#[serde(rename = "maintenances")]
|
||||||
|
pub maintenances: std::vec::Vec<Status>,
|
||||||
|
#[serde(rename = "incidents")]
|
||||||
|
pub incidents: std::vec::Vec<Status>,
|
||||||
|
}
|
||||||
|
/// Status data object.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
|
pub struct Status {
|
||||||
|
#[serde(rename = "id")]
|
||||||
|
pub id: i32,
|
||||||
|
/// (Legal values: scheduled, in_progress, complete)
|
||||||
|
#[serde(rename = "maintenance_status")]
|
||||||
|
pub maintenance_status: String,
|
||||||
|
/// (Legal values: info, warning, critical)
|
||||||
|
#[serde(rename = "incident_severity")]
|
||||||
|
pub incident_severity: String,
|
||||||
|
#[serde(rename = "titles")]
|
||||||
|
pub titles: std::vec::Vec<Content>,
|
||||||
|
#[serde(rename = "updates")]
|
||||||
|
pub updates: std::vec::Vec<Update>,
|
||||||
|
#[serde(rename = "created_at")]
|
||||||
|
pub created_at: String,
|
||||||
|
#[serde(rename = "archive_at")]
|
||||||
|
pub archive_at: String,
|
||||||
|
#[serde(rename = "updated_at")]
|
||||||
|
pub updated_at: String,
|
||||||
|
/// (Legal values: windows, macos, android, ios, ps4, xbone, switch)
|
||||||
|
#[serde(rename = "platforms")]
|
||||||
|
pub platforms: std::vec::Vec<String>,
|
||||||
|
}
|
||||||
|
/// Content data object.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
|
pub struct Content {
|
||||||
|
#[serde(rename = "locale")]
|
||||||
|
pub locale: String,
|
||||||
|
#[serde(rename = "content")]
|
||||||
|
pub content: String,
|
||||||
|
}
|
||||||
|
/// Update data object.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
|
pub struct Update {
|
||||||
|
#[serde(rename = "id")]
|
||||||
|
pub id: i32,
|
||||||
|
#[serde(rename = "author")]
|
||||||
|
pub author: String,
|
||||||
|
#[serde(rename = "publish")]
|
||||||
|
pub publish: bool,
|
||||||
|
/// (Legal values: riotclient, riotstatus, game)
|
||||||
|
#[serde(rename = "publish_locations")]
|
||||||
|
pub publish_locations: std::vec::Vec<String>,
|
||||||
|
#[serde(rename = "translations")]
|
||||||
|
pub translations: std::vec::Vec<Content>,
|
||||||
|
#[serde(rename = "created_at")]
|
||||||
|
pub created_at: String,
|
||||||
|
#[serde(rename = "updated_at")]
|
||||||
|
pub updated_at: String,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Data structs used by [`TftSummonerV1`](crate::endpoints::TftSummonerV1).
|
/// Data structs used by [`TftSummonerV1`](crate::endpoints::TftSummonerV1).
|
||||||
///
|
///
|
||||||
/// Note: this module is automatically generated.
|
/// Note: this module is automatically generated.
|
||||||
|
@ -2668,20 +2976,20 @@ pub mod tft_summoner_v1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data structs used by [`TournamentStubV4`](crate::endpoints::TournamentStubV4).
|
/// Data structs used by [`TournamentStubV5`](crate::endpoints::TournamentStubV5).
|
||||||
///
|
///
|
||||||
/// Note: this module is automatically generated.
|
/// Note: this module is automatically generated.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub mod tournament_stub_v4 {
|
pub mod tournament_stub_v5 {
|
||||||
/// TournamentCodeParameters data object.
|
/// TournamentCodeParametersV5 data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct TournamentCodeParameters {
|
pub struct TournamentCodeParametersV5 {
|
||||||
/// 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.
|
/// 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 = "allowedSummonerIds")]
|
#[serde(rename = "allowedParticipants")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub allowed_summoner_ids: Option<std::vec::Vec<String>>,
|
pub allowed_participants: 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.
|
/// 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(rename = "metadata")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -2694,104 +3002,22 @@ pub mod tournament_stub_v4 {
|
||||||
#[serde(rename = "pickType")]
|
#[serde(rename = "pickType")]
|
||||||
pub pick_type: String,
|
pub pick_type: String,
|
||||||
/// The map type of the game.<br>
|
/// The map type of the game.<br>
|
||||||
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
|
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
|
||||||
#[serde(rename = "mapType")]
|
#[serde(rename = "mapType")]
|
||||||
pub map_type: String,
|
pub map_type: String,
|
||||||
/// The spectator type of the game.<br>
|
/// The spectator type of the game.<br>
|
||||||
/// (Legal values: NONE, LOBBYONLY, ALL)
|
/// (Legal values: NONE, LOBBYONLY, ALL)
|
||||||
#[serde(rename = "spectatorType")]
|
#[serde(rename = "spectatorType")]
|
||||||
pub spectator_type: String,
|
pub spectator_type: String,
|
||||||
|
/// Checks if allowed participants are enough to make full teams.
|
||||||
|
#[serde(rename = "enoughPlayers")]
|
||||||
|
pub enough_players: bool,
|
||||||
}
|
}
|
||||||
/// LobbyEventWrapper data object.
|
/// TournamentCodeV5 data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct LobbyEventWrapper {
|
pub struct TournamentCodeV5 {
|
||||||
#[serde(rename = "eventList")]
|
|
||||||
pub event_list: std::vec::Vec<LobbyEvent>,
|
|
||||||
}
|
|
||||||
/// LobbyEvent data object.
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
|
||||||
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,
|
|
||||||
/// Timestamp from the event
|
|
||||||
#[serde(rename = "timestamp")]
|
|
||||||
pub timestamp: String,
|
|
||||||
}
|
|
||||||
/// ProviderRegistrationParameters data object.
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
|
||||||
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)
|
|
||||||
#[serde(rename = "region")]
|
|
||||||
pub region: String,
|
|
||||||
/// 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,
|
|
||||||
}
|
|
||||||
/// TournamentRegistrationParameters data object.
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
|
||||||
pub struct TournamentRegistrationParameters {
|
|
||||||
/// The provider ID to specify the regional registered provider data to associate this tournament.
|
|
||||||
#[serde(rename = "providerId")]
|
|
||||||
pub provider_id: i32,
|
|
||||||
/// The optional name of the tournament.
|
|
||||||
#[serde(rename = "name")]
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub name: Option<String>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Data structs used by [`TournamentV4`](crate::endpoints::TournamentV4).
|
|
||||||
///
|
|
||||||
/// Note: this module is automatically generated.
|
|
||||||
#[allow(dead_code)]
|
|
||||||
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 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_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")]
|
|
||||||
pub metadata: Option<String>,
|
|
||||||
/// The team size of the game. Valid values are 1-5.
|
|
||||||
#[serde(rename = "teamSize")]
|
|
||||||
pub team_size: i32,
|
|
||||||
/// The pick type of the game.<br>
|
|
||||||
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
|
|
||||||
#[serde(rename = "pickType")]
|
|
||||||
pub pick_type: String,
|
|
||||||
/// The map type of the game.<br>
|
|
||||||
/// (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,
|
|
||||||
}
|
|
||||||
/// TournamentCode data object.
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
|
||||||
pub struct TournamentCode {
|
|
||||||
/// The tournament code.
|
/// The tournament code.
|
||||||
#[serde(rename = "code")]
|
#[serde(rename = "code")]
|
||||||
pub code: String,
|
pub code: String,
|
||||||
|
@ -2823,31 +3049,165 @@ pub mod tournament_v4 {
|
||||||
#[serde(rename = "id")]
|
#[serde(rename = "id")]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
/// The tournament code's region.<br>
|
/// The tournament code's region.<br>
|
||||||
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
|
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
|
||||||
#[serde(rename = "region")]
|
#[serde(rename = "region")]
|
||||||
pub region: String,
|
pub region: String,
|
||||||
/// The game map for the tournament code game
|
/// The game map for the tournament code game
|
||||||
#[serde(rename = "map")]
|
#[serde(rename = "map")]
|
||||||
pub map: String,
|
pub map: String,
|
||||||
/// The summonerIds of the participants (Encrypted)
|
/// The puuids of the participants (Encrypted)
|
||||||
#[serde(rename = "participants")]
|
#[serde(rename = "participants")]
|
||||||
pub participants: std::vec::Vec<String>,
|
pub participants: std::vec::Vec<String>,
|
||||||
}
|
}
|
||||||
/// TournamentCodeUpdateParameters data object.
|
/// LobbyEventV5Wrapper data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct TournamentCodeUpdateParameters {
|
pub struct LobbyEventV5Wrapper {
|
||||||
/// 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 = "eventList")]
|
||||||
#[serde(rename = "allowedSummonerIds")]
|
pub event_list: std::vec::Vec<LobbyEventV5>,
|
||||||
|
}
|
||||||
|
/// LobbyEventV5 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,
|
||||||
|
/// 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,
|
||||||
|
}
|
||||||
|
/// ProviderRegistrationParametersV5 data object.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
|
pub struct ProviderRegistrationParametersV5 {
|
||||||
|
/// 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)
|
||||||
|
#[serde(rename = "region")]
|
||||||
|
pub region: String,
|
||||||
|
/// 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.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
|
pub struct TournamentRegistrationParametersV5 {
|
||||||
|
/// The provider ID to specify the regional registered provider data to associate this tournament.
|
||||||
|
#[serde(rename = "providerId")]
|
||||||
|
pub provider_id: i32,
|
||||||
|
/// The optional name of the tournament.
|
||||||
|
#[serde(rename = "name")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub allowed_summoner_ids: Option<std::vec::Vec<String>>,
|
pub name: Option<String>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Data structs used by [`TournamentV5`](crate::endpoints::TournamentV5).
|
||||||
|
///
|
||||||
|
/// Note: this module is automatically generated.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod tournament_v5 {
|
||||||
|
/// TournamentCodeParametersV5 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")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub allowed_participants: 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")]
|
||||||
|
pub metadata: Option<String>,
|
||||||
|
/// The team size of the game. Valid values are 1-5.
|
||||||
|
#[serde(rename = "teamSize")]
|
||||||
|
pub team_size: i32,
|
||||||
|
/// The pick type of the game.<br>
|
||||||
|
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
|
||||||
|
#[serde(rename = "pickType")]
|
||||||
|
pub pick_type: String,
|
||||||
|
/// The map type of the game.<br>
|
||||||
|
/// (Legal values: SUMMONERS_RIFT, 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.
|
||||||
|
#[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>,
|
||||||
|
}
|
||||||
|
/// TournamentCodeUpdateParametersV5 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")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub allowed_participants: Option<std::vec::Vec<String>>,
|
||||||
/// The pick type<br>
|
/// The pick type<br>
|
||||||
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
|
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
|
||||||
#[serde(rename = "pickType")]
|
#[serde(rename = "pickType")]
|
||||||
pub pick_type: String,
|
pub pick_type: String,
|
||||||
/// The map type<br>
|
/// The map type<br>
|
||||||
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
|
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
|
||||||
#[serde(rename = "mapType")]
|
#[serde(rename = "mapType")]
|
||||||
pub map_type: String,
|
pub map_type: String,
|
||||||
/// The spectator type<br>
|
/// The spectator type<br>
|
||||||
|
@ -2855,47 +3215,87 @@ pub mod tournament_v4 {
|
||||||
#[serde(rename = "spectatorType")]
|
#[serde(rename = "spectatorType")]
|
||||||
pub spectator_type: String,
|
pub spectator_type: String,
|
||||||
}
|
}
|
||||||
/// LobbyEventWrapper data object.
|
/// TournamentGamesV5 data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct LobbyEventWrapper {
|
pub struct TournamentGamesV5 {
|
||||||
#[serde(rename = "eventList")]
|
#[serde(rename = "winningTeam")]
|
||||||
pub event_list: std::vec::Vec<LobbyEvent>,
|
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,
|
||||||
}
|
}
|
||||||
/// LobbyEvent data object.
|
/// TournamentTeamV5 data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct LobbyEvent {
|
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 {
|
||||||
|
#[serde(rename = "eventList")]
|
||||||
|
pub event_list: std::vec::Vec<LobbyEventV5>,
|
||||||
|
}
|
||||||
|
/// LobbyEventV5 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
|
/// Timestamp from the event
|
||||||
#[serde(rename = "timestamp")]
|
#[serde(rename = "timestamp")]
|
||||||
pub timestamp: String,
|
pub timestamp: String,
|
||||||
/// The type of event that was triggered
|
/// The type of event that was triggered
|
||||||
#[serde(rename = "eventType")]
|
#[serde(rename = "eventType")]
|
||||||
pub event_type: String,
|
pub event_type: String,
|
||||||
/// The summonerId that triggered the event (Encrypted)
|
/// The puuid that triggered the event (Encrypted)
|
||||||
#[serde(rename = "summonerId")]
|
#[serde(rename = "puuid")]
|
||||||
pub summoner_id: String,
|
pub puuid: String,
|
||||||
}
|
}
|
||||||
/// ProviderRegistrationParameters data object.
|
/// ProviderRegistrationParametersV5 data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct ProviderRegistrationParameters {
|
pub struct ProviderRegistrationParametersV5 {
|
||||||
/// The region in which the provider will be running tournaments.<br>
|
/// The region in which the provider will be running tournaments.<br>
|
||||||
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
|
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
|
||||||
#[serde(rename = "region")]
|
#[serde(rename = "region")]
|
||||||
pub region: String,
|
pub region: String,
|
||||||
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
|
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
|
||||||
#[serde(rename = "url")]
|
#[serde(rename = "url")]
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
/// TournamentRegistrationParameters data object.
|
/// TournamentRegistrationParametersV5 data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||||
pub struct TournamentRegistrationParameters {
|
pub struct TournamentRegistrationParametersV5 {
|
||||||
/// The provider ID to specify the regional registered provider data to associate this tournament.
|
/// The provider ID to specify the regional registered provider data to associate this tournament.
|
||||||
#[serde(rename = "providerId")]
|
#[serde(rename = "providerId")]
|
||||||
pub provider_id: i32,
|
pub provider_id: i32,
|
||||||
|
@ -2949,6 +3349,10 @@ pub mod val_content_v1 {
|
||||||
#[serde(rename = "ceremonies")]
|
#[serde(rename = "ceremonies")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub ceremonies: Option<std::vec::Vec<ContentItem>>,
|
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.
|
/// ContentItem data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -3357,8 +3761,8 @@ pub mod val_match_v1 {
|
||||||
pub match_id: String,
|
pub match_id: String,
|
||||||
#[serde(rename = "gameStartTimeMillis")]
|
#[serde(rename = "gameStartTimeMillis")]
|
||||||
pub game_start_time_millis: i64,
|
pub game_start_time_millis: i64,
|
||||||
#[serde(rename = "teamId")]
|
#[serde(rename = "queueId")]
|
||||||
pub team_id: String,
|
pub queue_id: String,
|
||||||
}
|
}
|
||||||
/// RecentMatches data object.
|
/// RecentMatches data object.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::models::match_v5::Participant;
|
|
||||||
use crate::consts::Champion;
|
use crate::consts::Champion;
|
||||||
|
use crate::models::match_v5::Participant;
|
||||||
|
|
||||||
impl Participant {
|
impl Participant {
|
||||||
/// This method takes the [`Self::champion_id`] field if it is valid
|
/// This method takes the [`Self::champion_id`] field if it is valid
|
||||||
|
|
|
@ -4,9 +4,9 @@ mod rate_limit;
|
||||||
pub use rate_limit::*;
|
pub use rate_limit::*;
|
||||||
|
|
||||||
mod rate_limit_type;
|
mod rate_limit_type;
|
||||||
pub use rate_limit_type::*;
|
use std::time::Instant;
|
||||||
|
|
||||||
use std::time::Instant; // Hack for token_bucket_test.rs.
|
pub use rate_limit_type::*; // Hack for token_bucket_test.rs.
|
||||||
mod token_bucket;
|
mod token_bucket;
|
||||||
pub use token_bucket::*;
|
pub use token_bucket::*;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::time::{ Duration, Instant };
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
#[cfg(not(feature="tracing"))]
|
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
|
||||||
use log as log;
|
use reqwest::{Response, StatusCode};
|
||||||
#[cfg(feature="tracing")]
|
|
||||||
use tracing as log;
|
|
||||||
|
|
||||||
use parking_lot::{ RwLock, RwLockUpgradableReadGuard };
|
|
||||||
use reqwest::{ StatusCode, Response };
|
|
||||||
use scan_fmt::scan_fmt;
|
use scan_fmt::scan_fmt;
|
||||||
use tokio::sync::Notify;
|
use tokio::sync::Notify;
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
use tracing as log;
|
||||||
|
|
||||||
|
use super::{RateLimitType, TokenBucket, VectorTokenBucket};
|
||||||
use crate::RiotApiConfig;
|
use crate::RiotApiConfig;
|
||||||
use super::{ TokenBucket, VectorTokenBucket };
|
|
||||||
use super::RateLimitType;
|
|
||||||
|
|
||||||
pub struct RateLimit {
|
pub struct RateLimit {
|
||||||
rate_limit_type: RateLimitType,
|
rate_limit_type: RateLimitType,
|
||||||
|
@ -42,8 +38,8 @@ impl RateLimit {
|
||||||
const HEADER_XRATELIMITTYPE_SERVICE: &'static str = "service";
|
const HEADER_XRATELIMITTYPE_SERVICE: &'static str = "service";
|
||||||
|
|
||||||
pub fn new(rate_limit_type: RateLimitType) -> Self {
|
pub fn new(rate_limit_type: RateLimitType) -> Self {
|
||||||
let initial_bucket = VectorTokenBucket::new(
|
let initial_bucket =
|
||||||
Duration::from_secs(1), 1, Duration::new(0, 0), 1.0, 1.0);
|
VectorTokenBucket::new(Duration::from_secs(1), 1, Duration::new(0, 0), 1.0, 1.0);
|
||||||
RateLimit {
|
RateLimit {
|
||||||
rate_limit_type,
|
rate_limit_type,
|
||||||
// Rate limit before getting from response: 1/s.
|
// Rate limit before getting from response: 1/s.
|
||||||
|
@ -65,13 +61,19 @@ impl RateLimit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn acquire_both_or_duration(app_rate_limit: &Self, method_rate_limit: &Self) -> Option<Duration> {
|
fn acquire_both_or_duration(
|
||||||
|
app_rate_limit: &Self,
|
||||||
|
method_rate_limit: &Self,
|
||||||
|
) -> Option<Duration> {
|
||||||
// Check retry after.
|
// Check retry after.
|
||||||
{
|
{
|
||||||
let retry_after_delay = app_rate_limit.get_retry_after_delay()
|
let retry_after_delay = app_rate_limit.get_retry_after_delay().and_then(|a| {
|
||||||
.and_then(|a| method_rate_limit.get_retry_after_delay().map(|m| cmp::max(a, m)));
|
method_rate_limit
|
||||||
|
.get_retry_after_delay()
|
||||||
|
.map(|m| cmp::max(a, m))
|
||||||
|
});
|
||||||
if retry_after_delay.is_some() {
|
if retry_after_delay.is_some() {
|
||||||
return retry_after_delay
|
return retry_after_delay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check buckets.
|
// Check buckets.
|
||||||
|
@ -88,97 +90,151 @@ impl RateLimit {
|
||||||
bucket.get_tokens(1);
|
bucket.get_tokens(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
log::trace!("Tokens obtained, buckets: APP {:?} METHOD {:?}", app_buckets, method_buckets);
|
log::trace!(
|
||||||
|
"Tokens obtained, buckets: APP {:?} METHOD {:?}",
|
||||||
|
app_buckets,
|
||||||
|
method_buckets
|
||||||
|
);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_retry_after_delay(&self) -> Option<Duration> {
|
pub fn get_retry_after_delay(&self) -> Option<Duration> {
|
||||||
self.retry_after.read().and_then(|i| Instant::now().checked_duration_since(i))
|
self.retry_after
|
||||||
|
.read()
|
||||||
|
.and_then(|i| Instant::now().checked_duration_since(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_response(&self, config: &RiotApiConfig, response: &Response) {
|
/// Update retry-after and rate limits based on an API response.
|
||||||
self.on_response_retry_after(response);
|
/// Returns the retry-after delay if set.
|
||||||
|
pub fn on_response(&self, config: &RiotApiConfig, response: &Response) -> Option<Duration> {
|
||||||
|
let retry_after = self.on_response_retry_after(response);
|
||||||
self.on_response_rate_limits(config, response);
|
self.on_response_rate_limits(config, response);
|
||||||
|
retry_after
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `on_response` helper for retry after check.
|
/// `on_response` helper for retry after check.
|
||||||
|
/// Returns the retry-after delay if set.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn on_response_retry_after(&self, response: &Response) {
|
fn on_response_retry_after(&self, response: &Response) -> Option<Duration> {
|
||||||
if let Some(retry_after) = || -> Option<Instant> {
|
// Only care about 429s.
|
||||||
// Only care about 429s.
|
if StatusCode::TOO_MANY_REQUESTS != response.status() {
|
||||||
if StatusCode::TOO_MANY_REQUESTS != response.status() {
|
return None;
|
||||||
return None;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Get the X-Rate-Limit-Type header, `Some("application" | "method" | "service")` or `None`.
|
// Get the X-Rate-Limit-Type header, `Some("application" | "method" | "service")` or `None`.
|
||||||
let header_opt = response.headers()
|
let header_opt = response.headers()
|
||||||
.get(Self::HEADER_XRATELIMITTYPE)
|
.get(Self::HEADER_XRATELIMITTYPE)
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
log::info!("429 response missing {} header.", Self::HEADER_XRATELIMITTYPE);
|
log::info!("429 response missing {} header.", Self::HEADER_XRATELIMITTYPE);
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.and_then(|header_value| header_value.to_str()
|
.and_then(|header_value| header_value.to_str()
|
||||||
.map_err(|e| log::info!("429 response, error parsing '{}' header as string: {}. Header value: {:#?}",
|
.map_err(|e| log::info!("429 response, error parsing '{}' header as string: {}. Header value: {:#?}",
|
||||||
Self::HEADER_XRATELIMITTYPE, e, header_value))
|
Self::HEADER_XRATELIMITTYPE, e, header_value))
|
||||||
.ok());
|
.ok());
|
||||||
|
|
||||||
// This match checks the valid possibilities. Otherwise returns none to ignore.
|
// This match checks the valid possibilities. Otherwise returns none to ignore.
|
||||||
// `Application` handles "application", `Method` handles all other values.
|
// `Application` handles "application", `Method` handles all other values.
|
||||||
let application_should_handle = match header_opt {
|
let is_responsible = match header_opt {
|
||||||
Some(Self::HEADER_XRATELIMITTYPE_APPLICATION) => true,
|
Some(Self::HEADER_XRATELIMITTYPE_APPLICATION) => {
|
||||||
Some(Self::HEADER_XRATELIMITTYPE_METHOD | Self::HEADER_XRATELIMITTYPE_SERVICE) => false,
|
self.rate_limit_type == RateLimitType::Application
|
||||||
other => {
|
}
|
||||||
// Method handles unknown values.
|
Some(Self::HEADER_XRATELIMITTYPE_METHOD | Self::HEADER_XRATELIMITTYPE_SERVICE) => {
|
||||||
|
self.rate_limit_type == RateLimitType::Method
|
||||||
|
}
|
||||||
|
other => {
|
||||||
|
// RateLimitType::Method handles unknown values.
|
||||||
|
if self.rate_limit_type == RateLimitType::Method {
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"429 response has None (missing or invalid) or unknown {} header value {:?}, {:?} rate limit obeying retry-after.",
|
"429 response has None (missing or invalid) or unknown {} header value {:?}, {:?} rate limit obeying retry-after.",
|
||||||
Self::HEADER_XRATELIMITTYPE, other, self.rate_limit_type);
|
Self::HEADER_XRATELIMITTYPE, other, self.rate_limit_type);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
false
|
false
|
||||||
},
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (self.rate_limit_type == RateLimitType::Application) != application_should_handle {
|
|
||||||
return None;
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if !is_responsible {
|
||||||
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get retry after header. Only care if it exists.
|
|
||||||
let retry_after_header = response.headers()
|
|
||||||
.get(reqwest::header::RETRY_AFTER)?.to_str()
|
|
||||||
.expect("Failed to read retry-after header as string.");
|
|
||||||
|
|
||||||
log::info!("429 response, rate limit {:?}, retry-after {} secs.", self.rate_limit_type, retry_after_header);
|
|
||||||
|
|
||||||
// Header currently only returns ints, but float is more general. Can be zero.
|
|
||||||
let retry_after_secs: f32 = retry_after_header.parse()
|
|
||||||
.expect("Failed to parse retry-after header as f32.");
|
|
||||||
// Add 0.5 seconds to account for rounding, cases when response is zero.
|
|
||||||
let delay = Duration::from_secs_f32(0.5 + retry_after_secs);
|
|
||||||
Some(Instant::now() + delay)
|
|
||||||
}() {
|
|
||||||
*self.retry_after.write() = Some(retry_after);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get retry after header. Only care if it exists.
|
||||||
|
let retry_after_header = response
|
||||||
|
.headers()
|
||||||
|
.get(reqwest::header::RETRY_AFTER)
|
||||||
|
.and_then(|h| {
|
||||||
|
h.to_str()
|
||||||
|
.map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to read retry-after header as visible ASCII string: {:?}.",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.ok()
|
||||||
|
})?;
|
||||||
|
|
||||||
|
log::info!(
|
||||||
|
"429 response, rate limit {:?}, retry-after {} secs.",
|
||||||
|
self.rate_limit_type,
|
||||||
|
retry_after_header
|
||||||
|
);
|
||||||
|
|
||||||
|
// Header currently only returns ints, but float is more general. Can be zero.
|
||||||
|
let retry_after_secs = retry_after_header
|
||||||
|
.parse::<f32>()
|
||||||
|
.map_err(|e| log::error!("Failed to parse read-after header as f32: {:?}.", e))
|
||||||
|
.ok()?;
|
||||||
|
|
||||||
|
// Add 0.5 seconds to account for rounding, cases when response is zero.
|
||||||
|
let delay = Duration::from_secs_f32(0.5 + retry_after_secs);
|
||||||
|
|
||||||
|
// Set `self.retry_after`.
|
||||||
|
*self.retry_after.write() = Some(Instant::now() + delay);
|
||||||
|
Some(delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn on_response_rate_limits(&self, config: &RiotApiConfig, response: &Response) {
|
fn on_response_rate_limits(&self, config: &RiotApiConfig, response: &Response) {
|
||||||
// Check if rate limits changed.
|
// Check if rate limits changed.
|
||||||
let headers = response.headers();
|
let headers = response.headers();
|
||||||
let limit_header_opt = headers.get(self.rate_limit_type.limit_header())
|
let limit_header_opt = headers
|
||||||
.map(|h| h.to_str().expect("Failed to read limit header as string."));
|
.get(self.rate_limit_type.limit_header())
|
||||||
let count_header_opt = headers.get(self.rate_limit_type.count_header())
|
.and_then(|h| {
|
||||||
.map(|h| h.to_str().expect("Failed to read count header as string."));
|
h.to_str()
|
||||||
|
.map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to read limit header as visible ASCII string: {:?}.",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.ok()
|
||||||
|
});
|
||||||
|
let count_header_opt = headers
|
||||||
|
.get(self.rate_limit_type.count_header())
|
||||||
|
.and_then(|h| {
|
||||||
|
h.to_str()
|
||||||
|
.map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to read count header as visible ASCII string: {:?}.",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.ok()
|
||||||
|
});
|
||||||
|
|
||||||
if let (Some(limit_header), Some(count_header)) = (limit_header_opt, count_header_opt) {
|
if let (Some(limit_header), Some(count_header)) = (limit_header_opt, count_header_opt) {
|
||||||
{
|
{
|
||||||
let buckets = self.buckets.upgradable_read();
|
let buckets = self.buckets.upgradable_read();
|
||||||
if !buckets_require_updating(limit_header, &*buckets) {
|
if !buckets_require_updating(limit_header, &buckets) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buckets require updating. Upgrade to write lock.
|
// Buckets require updating. Upgrade to write lock.
|
||||||
let mut buckets = RwLockUpgradableReadGuard::upgrade(buckets);
|
let mut buckets = RwLockUpgradableReadGuard::upgrade(buckets);
|
||||||
*buckets = buckets_from_header(config, limit_header, count_header, self.rate_limit_type);
|
*buckets =
|
||||||
|
buckets_from_header(config, limit_header, count_header, self.rate_limit_type);
|
||||||
}
|
}
|
||||||
// Notify waiters that buckets have updated (after unlocking).
|
// Notify waiters that buckets have updated (after unlocking).
|
||||||
self.update_notify.notify_waiters();
|
self.update_notify.notify_waiters();
|
||||||
|
@ -192,7 +248,11 @@ fn buckets_require_updating(limit_header: &str, buckets: &[VectorTokenBucket]) -
|
||||||
}
|
}
|
||||||
for (limit_header_entry, bucket) in limit_header.split(',').zip(buckets) {
|
for (limit_header_entry, bucket) in limit_header.split(',').zip(buckets) {
|
||||||
// limit_header_entry "100:60" means 100 req per 60 sec.
|
// limit_header_entry "100:60" means 100 req per 60 sec.
|
||||||
let bucket_entry = format!("{}:{}", bucket.get_total_limit(), bucket.get_bucket_duration().as_secs());
|
let bucket_entry = format!(
|
||||||
|
"{}:{}",
|
||||||
|
bucket.get_total_limit(),
|
||||||
|
bucket.get_bucket_duration().as_secs()
|
||||||
|
);
|
||||||
if limit_header_entry != bucket_entry {
|
if limit_header_entry != bucket_entry {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +260,12 @@ fn buckets_require_updating(limit_header: &str, buckets: &[VectorTokenBucket]) -
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buckets_from_header(config: &RiotApiConfig, limit_header: &str, count_header: &str, rate_limit_type: RateLimitType) -> Vec<VectorTokenBucket> {
|
fn buckets_from_header(
|
||||||
|
config: &RiotApiConfig,
|
||||||
|
limit_header: &str,
|
||||||
|
count_header: &str,
|
||||||
|
rate_limit_type: RateLimitType,
|
||||||
|
) -> Vec<VectorTokenBucket> {
|
||||||
// Limits: "20000:10,1200000:600"
|
// Limits: "20000:10,1200000:600"
|
||||||
// Counts: "7:10,58:600"
|
// Counts: "7:10,58:600"
|
||||||
let size = limit_header.split(',').count();
|
let size = limit_header.split(',').count();
|
||||||
|
@ -223,21 +288,20 @@ fn buckets_from_header(config: &RiotApiConfig, limit_header: &str, count_header:
|
||||||
let limit_f32 = limit as f32;
|
let limit_f32 = limit as f32;
|
||||||
let scaled_burst_factor = config.burst_factor * limit_f32 / (limit_f32 + 1.0);
|
let scaled_burst_factor = config.burst_factor * limit_f32 / (limit_f32 + 1.0);
|
||||||
|
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_secs(limit_secs), limit,
|
let bucket = VectorTokenBucket::new(
|
||||||
config.duration_overhead, scaled_burst_factor, rate_usage_factor);
|
Duration::from_secs(limit_secs),
|
||||||
|
limit,
|
||||||
|
config.duration_overhead,
|
||||||
|
scaled_burst_factor,
|
||||||
|
rate_usage_factor,
|
||||||
|
);
|
||||||
bucket.get_tokens(count);
|
bucket.get_tokens(count);
|
||||||
out.push(bucket);
|
out.push(bucket);
|
||||||
}
|
}
|
||||||
log::debug!("Set buckets to {} limit, {} count.", limit_header, count_header);
|
log::debug!(
|
||||||
|
"Set buckets to {} limit, {} count.",
|
||||||
|
limit_header,
|
||||||
|
count_header
|
||||||
|
);
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
// use super::*;
|
|
||||||
|
|
||||||
// fn send_sync() {
|
|
||||||
// fn is_send_sync<T: Send + Sync>() {}
|
|
||||||
// is_send_sync::<RateLimit>();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,23 +1,15 @@
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[cfg(not(feature="tracing"))]
|
use reqwest::{RequestBuilder, StatusCode};
|
||||||
use log as log;
|
#[cfg(feature = "tracing")]
|
||||||
#[cfg(feature="tracing")]
|
|
||||||
use tracing as log;
|
use tracing as log;
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
use tracing::Instrument;
|
use tracing::Instrument;
|
||||||
|
|
||||||
use reqwest::{ StatusCode, RequestBuilder };
|
use super::{RateLimit, RateLimitType};
|
||||||
|
|
||||||
use crate::util::InsertOnlyCHashMap;
|
use crate::util::InsertOnlyCHashMap;
|
||||||
use crate::ResponseInfo;
|
use crate::{ResponseInfo, Result, RiotApiConfig, RiotApiError};
|
||||||
use crate::Result;
|
|
||||||
use crate::RiotApiConfig;
|
|
||||||
use crate::RiotApiError;
|
|
||||||
|
|
||||||
use super::RateLimit;
|
|
||||||
use super::RateLimitType;
|
|
||||||
|
|
||||||
pub struct RegionalRequester {
|
pub struct RegionalRequester {
|
||||||
/// The app rate limit.
|
/// The app rate limit.
|
||||||
|
@ -40,19 +32,21 @@ impl RegionalRequester {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute<'a>(self: Arc<Self>,
|
pub fn execute<'a>(
|
||||||
|
self: Arc<Self>,
|
||||||
config: &'a RiotApiConfig,
|
config: &'a RiotApiConfig,
|
||||||
method_id: &'static str, request: RequestBuilder)
|
method_id: &'static str,
|
||||||
-> impl Future<Output = Result<ResponseInfo>> + 'a
|
request: RequestBuilder,
|
||||||
{
|
) -> impl Future<Output = Result<ResponseInfo>> + 'a {
|
||||||
async move {
|
async move {
|
||||||
let mut retries: u8 = 0;
|
let mut retries: u8 = 0;
|
||||||
loop {
|
loop {
|
||||||
let method_rate_limit: Arc<RateLimit> = self.method_rate_limits
|
let method_rate_limit: Arc<RateLimit> = self
|
||||||
|
.method_rate_limits
|
||||||
.get_or_insert_with(method_id, || RateLimit::new(RateLimitType::Method));
|
.get_or_insert_with(method_id, || RateLimit::new(RateLimitType::Method));
|
||||||
|
|
||||||
// Rate limit.
|
// Rate limit.
|
||||||
let rate_limit = RateLimit::acquire_both(&self.app_rate_limit, &*method_rate_limit);
|
let rate_limit = RateLimit::acquire_both(&self.app_rate_limit, &method_rate_limit);
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
let rate_limit = rate_limit.instrument(tracing::info_span!("rate_limit"));
|
let rate_limit = rate_limit.instrument(tracing::info_span!("rate_limit"));
|
||||||
rate_limit.await;
|
rate_limit.await;
|
||||||
|
@ -69,35 +63,67 @@ impl RegionalRequester {
|
||||||
.map_err(|e| RiotApiError::new(e, retries, None, None))?;
|
.map_err(|e| RiotApiError::new(e, retries, None, None))?;
|
||||||
|
|
||||||
// Maybe update rate limits (based on response headers).
|
// Maybe update rate limits (based on response headers).
|
||||||
self.app_rate_limit.on_response(config, &response);
|
// Use single bar for no short circuiting.
|
||||||
method_rate_limit.on_response(config, &response);
|
let retry_after_app = self.app_rate_limit.on_response(config, &response);
|
||||||
|
let retry_after_method = method_rate_limit.on_response(config, &response);
|
||||||
|
let retry_after = retry_after_app.or(retry_after_method); // Note: Edge case if both are Some(_) not handled.
|
||||||
|
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
// Handle normal success / failure cases.
|
// Handle normal success / failure cases.
|
||||||
let status_none = Self::NONE_STATUS_CODES.contains(&status);
|
let status_none = Self::NONE_STATUS_CODES.contains(&status);
|
||||||
// Success case.
|
// Success case.
|
||||||
if status.is_success() || status_none {
|
if status.is_success() || status_none {
|
||||||
log::trace!("Response {} (retried {} times), success, returning result.", status, retries);
|
log::trace!(
|
||||||
|
"Response {} (retried {} times), success, returning result.",
|
||||||
|
status,
|
||||||
|
retries
|
||||||
|
);
|
||||||
break Ok(ResponseInfo {
|
break Ok(ResponseInfo {
|
||||||
response,
|
response,
|
||||||
retries,
|
retries,
|
||||||
status_none,
|
status_none,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let err = response.error_for_status_ref().err().unwrap_or_else(
|
let err = response.error_for_status_ref().err().unwrap_or_else(|| {
|
||||||
|| panic!("Unhandlable response status code, neither success nor failure: {}.", status));
|
panic!(
|
||||||
|
"Unhandlable response status code, neither success nor failure: {}.",
|
||||||
|
status
|
||||||
|
)
|
||||||
|
});
|
||||||
// Failure, may or may not be retryable.
|
// Failure, may or may not be retryable.
|
||||||
// Not-retryable: no more retries or 4xx or ? (3xx, redirects exceeded).
|
// Not-retryable: no more retries or 4xx or ? (3xx, redirects exceeded).
|
||||||
// Retryable: retries remaining, and 429 or 5xx.
|
// Retryable: retries remaining, and 429 or 5xx.
|
||||||
if retries >= config.retries ||
|
if retries >= config.retries
|
||||||
(StatusCode::TOO_MANY_REQUESTS != status
|
|| (StatusCode::TOO_MANY_REQUESTS != status && !status.is_server_error())
|
||||||
&& !status.is_server_error())
|
|
||||||
{
|
{
|
||||||
log::debug!("Response {} (retried {} times), failure, returning error.", status, retries);
|
log::debug!(
|
||||||
break Err(RiotApiError::new(err, retries, Some(response), Some(status)));
|
"Response {} (retried {} times), failure, returning error.",
|
||||||
|
status,
|
||||||
|
retries
|
||||||
|
);
|
||||||
|
break Err(RiotApiError::new(
|
||||||
|
err,
|
||||||
|
retries,
|
||||||
|
Some(response),
|
||||||
|
Some(status),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
log::debug!("Response {} (retried {} times), retrying.", status, retries);
|
|
||||||
|
|
||||||
|
// Is retryable, do exponential backoff if retry-after wasn't specified.
|
||||||
|
// 1 sec, 2 sec, 4 sec, 8 sec.
|
||||||
|
match retry_after {
|
||||||
|
None => {
|
||||||
|
let delay = std::time::Duration::from_secs(2_u64.pow(retries as u32));
|
||||||
|
log::debug!("Response {} (retried {} times), NO `retry-after`, using exponential backoff, retrying after {:?}.", status, retries, delay);
|
||||||
|
let backoff = tokio::time::sleep(delay);
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
let backoff = backoff.instrument(tracing::info_span!("backoff"));
|
||||||
|
backoff.await;
|
||||||
|
}
|
||||||
|
Some(delay) => {
|
||||||
|
log::debug!("Response {} (retried {} times), `retry-after` set, retrying after {:?}.", status, retries, delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
retries += 1;
|
retries += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use std::fmt;
|
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
use std::fmt;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use parking_lot::{Mutex, MutexGuard};
|
use parking_lot::{Mutex, MutexGuard};
|
||||||
|
@ -58,32 +58,41 @@ pub struct VectorTokenBucket {
|
||||||
/// Limit allowed per burst_duration, for burst factor.
|
/// Limit allowed per burst_duration, for burst factor.
|
||||||
burst_limit: usize,
|
burst_limit: usize,
|
||||||
|
|
||||||
|
|
||||||
/// Record of timestamps (synchronized).
|
/// Record of timestamps (synchronized).
|
||||||
timestamps: Mutex<VecDeque<Instant>>,
|
timestamps: Mutex<VecDeque<Instant>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VectorTokenBucket {
|
impl VectorTokenBucket {
|
||||||
pub fn new(duration: Duration, given_total_limit: usize,
|
pub fn new(
|
||||||
duration_overhead: Duration, burst_factor: f32,
|
duration: Duration,
|
||||||
rate_usage_factor: f32) -> Self
|
given_total_limit: usize,
|
||||||
{
|
duration_overhead: Duration,
|
||||||
debug_assert!(0.0 < rate_usage_factor && rate_usage_factor <= 1.0,
|
burst_factor: f32,
|
||||||
"BAD rate_usage_factor {}.", rate_usage_factor);
|
rate_usage_factor: f32,
|
||||||
debug_assert!(0.0 < burst_factor && burst_factor <= 1.0,
|
) -> Self {
|
||||||
"BAD burst_factor {}.", burst_factor);
|
debug_assert!(
|
||||||
|
0.0 < rate_usage_factor && rate_usage_factor <= 1.0,
|
||||||
|
"BAD rate_usage_factor {}.",
|
||||||
|
rate_usage_factor
|
||||||
|
);
|
||||||
|
debug_assert!(
|
||||||
|
0.0 < burst_factor && burst_factor <= 1.0,
|
||||||
|
"BAD burst_factor {}.",
|
||||||
|
burst_factor
|
||||||
|
);
|
||||||
// Float ops may lose precision, but nothing should be that precise.
|
// Float ops may lose precision, but nothing should be that precise.
|
||||||
// API always uses round numbers, burst_factor is frac of 256.
|
// API always uses round numbers, burst_factor is frac of 256.
|
||||||
|
|
||||||
// Adjust everything by rate_usage_factor.
|
// Adjust everything by rate_usage_factor.
|
||||||
let total_limit = std::cmp::max(1,
|
let total_limit = std::cmp::max(
|
||||||
(given_total_limit as f32 * rate_usage_factor).floor() as usize);
|
1,
|
||||||
|
(given_total_limit as f32 * rate_usage_factor).floor() as usize,
|
||||||
|
);
|
||||||
|
|
||||||
// Effective duration.
|
// Effective duration.
|
||||||
let d_eff = duration + duration_overhead;
|
let d_eff = duration + duration_overhead;
|
||||||
let burst_duration = d_eff.mul_f32(burst_factor);
|
let burst_duration = d_eff.mul_f32(burst_factor);
|
||||||
let burst_limit = std::cmp::max(1,
|
let burst_limit = std::cmp::max(1, (total_limit as f32 * burst_factor).floor() as usize);
|
||||||
(total_limit as f32 * burst_factor).floor() as usize);
|
|
||||||
debug_assert!(burst_limit <= total_limit);
|
debug_assert!(burst_limit <= total_limit);
|
||||||
|
|
||||||
VectorTokenBucket {
|
VectorTokenBucket {
|
||||||
|
@ -113,21 +122,23 @@ impl VectorTokenBucket {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TokenBucket for VectorTokenBucket {
|
impl TokenBucket for VectorTokenBucket {
|
||||||
|
|
||||||
fn get_delay(&self) -> Option<Duration> {
|
fn get_delay(&self) -> Option<Duration> {
|
||||||
let timestamps = self.update_get_timestamps();
|
let timestamps = self.update_get_timestamps();
|
||||||
|
|
||||||
// Full rate limit.
|
// Full rate limit.
|
||||||
if let Some(ts) = timestamps.get(self.total_limit - 1) {
|
if let Some(ts) = timestamps.get(self.total_limit - 1) {
|
||||||
// Return amount of time needed for timestamp `ts` to go away.
|
// Return amount of time needed for timestamp `ts` to go away.
|
||||||
Instant::now().checked_duration_since(*ts)
|
Instant::now()
|
||||||
.and_then(|passed_dur| (self.duration + self.duration_overhead)
|
.checked_duration_since(*ts)
|
||||||
.checked_sub(passed_dur))
|
.and_then(|passed_dur| {
|
||||||
|
(self.duration + self.duration_overhead).checked_sub(passed_dur)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// Otherwise burst rate limit.
|
// Otherwise burst rate limit.
|
||||||
else if let Some(ts) = timestamps.get(self.burst_limit - 1) {
|
else if let Some(ts) = timestamps.get(self.burst_limit - 1) {
|
||||||
// Return amount of time needed for timestamp `ts` to go away.
|
// Return amount of time needed for timestamp `ts` to go away.
|
||||||
Instant::now().checked_duration_since(*ts)
|
Instant::now()
|
||||||
|
.checked_duration_since(*ts)
|
||||||
.and_then(|passed_dur| self.burst_duration.checked_sub(passed_dur))
|
.and_then(|passed_dur| self.burst_duration.checked_sub(passed_dur))
|
||||||
}
|
}
|
||||||
// No delay needed.
|
// No delay needed.
|
||||||
|
@ -173,6 +184,12 @@ impl TokenBucket for VectorTokenBucket {
|
||||||
|
|
||||||
impl fmt::Debug for VectorTokenBucket {
|
impl fmt::Debug for VectorTokenBucket {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "({}/{}:{})", self.timestamps.lock().len(), self.total_limit, self.duration.as_secs())
|
write!(
|
||||||
|
f,
|
||||||
|
"({}/{}:{})",
|
||||||
|
self.timestamps.lock().len(),
|
||||||
|
self.total_limit,
|
||||||
|
self.duration.as_secs()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
|
|
||||||
use fake_instant::FakeClock as Instant;
|
use fake_instant::FakeInstant as Instant;
|
||||||
|
|
||||||
/// This is a hack to test token bucket, substituting FakeClock for Instant.
|
/// This is a hack to test token bucket, substituting `FakeInstant` in place of `Instant`.
|
||||||
mod token_bucket {
|
mod token_bucket {
|
||||||
include!("token_bucket.rs");
|
include!("token_bucket.rs");
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref D00: Duration = Duration::new(0, 0);
|
pub static ref ZERO: Duration = Duration::new(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_basic() {
|
fn test_basic() {
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.95, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 0.95, 1.0);
|
||||||
assert!(bucket.get_tokens(50), "Should have not violated limit.");
|
assert!(bucket.get_tokens(50), "Should have not violated limit.");
|
||||||
assert_eq!(None, bucket.get_delay(), "Can get stuff.");
|
assert_eq!(None, bucket.get_delay(), "Can get stuff.");
|
||||||
assert!(!bucket.get_tokens(51), "Should have violated limit.");
|
assert!(!bucket.get_tokens(51), "Should have violated limit.");
|
||||||
|
@ -25,36 +26,45 @@ mod token_bucket {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_internal_constructor() {
|
fn test_internal_constructor() {
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1.0, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 1.0, 1.0);
|
||||||
assert_eq!(100, bucket.burst_limit);
|
assert_eq!(100, bucket.burst_limit);
|
||||||
|
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1e-6, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 1e-6, 1.0);
|
||||||
assert_eq!(1, bucket.burst_limit);
|
assert_eq!(1, bucket.burst_limit);
|
||||||
|
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1.0, 1e-6);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 1.0, 1e-6);
|
||||||
assert_eq!(1, bucket.total_limit);
|
assert_eq!(1, bucket.total_limit);
|
||||||
assert_eq!(1, bucket.burst_limit);
|
assert_eq!(1, bucket.burst_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_saturated_100_burst() {
|
fn test_saturated_100_burst() {
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1.00, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 1.00, 1.0);
|
||||||
|
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
assert!(bucket.get_tokens(100), "All tokens should be immediately available.");
|
assert!(
|
||||||
|
bucket.get_tokens(100),
|
||||||
|
"All tokens should be immediately available."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
|
|
||||||
Instant::advance_time(1001); // Extra buffer for Duration(0).
|
Instant::advance_time(1001); // Extra buffer for Duration(0).
|
||||||
assert!(bucket.get_tokens(100), "All tokens should be available after a bucket duration.");
|
assert!(
|
||||||
|
bucket.get_tokens(100),
|
||||||
|
"All tokens should be available after a bucket duration."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_saturated_95_burst() {
|
fn test_saturated_95_burst() {
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.95, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 0.95, 1.0);
|
||||||
|
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
assert!(bucket.get_tokens(95), "95 tokens should be immediately available.");
|
assert!(
|
||||||
|
bucket.get_tokens(95),
|
||||||
|
"95 tokens should be immediately available."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
|
|
||||||
Instant::advance_time(475);
|
Instant::advance_time(475);
|
||||||
|
@ -75,7 +85,7 @@ mod token_bucket {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_violated_50_burst() {
|
fn test_violated_50_burst() {
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.50, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 0.50, 1.0);
|
||||||
|
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
assert!(!bucket.get_tokens(90), "Burst should be violated.");
|
assert!(!bucket.get_tokens(90), "Burst should be violated.");
|
||||||
|
@ -84,18 +94,27 @@ mod token_bucket {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_saturated_50_burst() {
|
fn test_saturated_50_burst() {
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.50, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 0.50, 1.0);
|
||||||
|
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
assert!(bucket.get_tokens(50), "Half the tokens should be immediately available.");
|
assert!(
|
||||||
|
bucket.get_tokens(50),
|
||||||
|
"Half the tokens should be immediately available."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
|
|
||||||
Instant::advance_time(501); // Extra buffer for Duration(0).
|
Instant::advance_time(501); // Extra buffer for Duration(0).
|
||||||
assert!(bucket.get_tokens(50), "Half the tokens should be available after a half bucket duration.");
|
assert!(
|
||||||
|
bucket.get_tokens(50),
|
||||||
|
"Half the tokens should be available after a half bucket duration."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
|
|
||||||
Instant::advance_time(501);
|
Instant::advance_time(501);
|
||||||
assert!(bucket.get_tokens(50), "Half the tokens should be available after a full bucket duration.");
|
assert!(
|
||||||
|
bucket.get_tokens(50),
|
||||||
|
"Half the tokens should be available after a full bucket duration."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
|
|
||||||
Instant::advance_time(501);
|
Instant::advance_time(501);
|
||||||
|
@ -106,10 +125,19 @@ mod token_bucket {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_saturated_90_burst_rate_usage_factor_50() {
|
fn test_saturated_90_burst_rate_usage_factor_50() {
|
||||||
let rate_usage_factor = 0.5;
|
let rate_usage_factor = 0.5;
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.90, rate_usage_factor);
|
let bucket = VectorTokenBucket::new(
|
||||||
|
Duration::from_millis(1000),
|
||||||
|
100,
|
||||||
|
*ZERO,
|
||||||
|
0.90,
|
||||||
|
rate_usage_factor,
|
||||||
|
);
|
||||||
|
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
assert!(bucket.get_tokens(45), "45 tokens should be immediately available.");
|
assert!(
|
||||||
|
bucket.get_tokens(45),
|
||||||
|
"45 tokens should be immediately available."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
|
||||||
|
|
||||||
Instant::advance_time(475);
|
Instant::advance_time(475);
|
||||||
|
@ -131,18 +159,42 @@ mod token_bucket {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_many() {
|
fn test_many() {
|
||||||
Instant::set_time(50_000);
|
Instant::set_time(50_000);
|
||||||
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.5, 1.0);
|
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *ZERO, 0.5, 1.0);
|
||||||
assert!(bucket.get_tokens(50), "Should have not violated limit. i=-1.");
|
assert!(
|
||||||
|
bucket.get_tokens(50),
|
||||||
|
"Should have not violated limit. i=-1."
|
||||||
|
);
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay. i=-1.");
|
assert_ne!(None, bucket.get_delay(), "Bucket should have delay. i=-1.");
|
||||||
for i in 0..20_000 {
|
for i in 0..20_000 {
|
||||||
Instant::advance_time(501);
|
Instant::advance_time(501);
|
||||||
assert!(bucket.get_tokens(50), "Should have not violated limit. i={}.", i);
|
assert!(
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay. i={}.", i);
|
bucket.get_tokens(50),
|
||||||
|
"Should have not violated limit. i={}.",
|
||||||
|
i
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
None,
|
||||||
|
bucket.get_delay(),
|
||||||
|
"Bucket should have delay. i={}.",
|
||||||
|
i
|
||||||
|
);
|
||||||
Instant::advance_time(501);
|
Instant::advance_time(501);
|
||||||
assert!(bucket.get_tokens(50), "Should have not violated limit. i={}.", i);
|
assert!(
|
||||||
assert_ne!(None, bucket.get_delay(), "Bucket should have delay. i={}.", i);
|
bucket.get_tokens(50),
|
||||||
|
"Should have not violated limit. i={}.",
|
||||||
|
i
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
None,
|
||||||
|
bucket.get_delay(),
|
||||||
|
"Bucket should have delay. i={}.",
|
||||||
|
i
|
||||||
|
);
|
||||||
}
|
}
|
||||||
assert!(bucket.timestamps.lock().len() < 110, "Should not memory leak.");
|
assert!(
|
||||||
|
bucket.timestamps.lock().len() < 110,
|
||||||
|
"Should not memory leak."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,13 @@
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[cfg(not(feature="tracing"))]
|
use reqwest::{Client, Method, RequestBuilder};
|
||||||
use log as log;
|
#[cfg(feature = "tracing")]
|
||||||
#[cfg(feature="tracing")]
|
|
||||||
use tracing as log;
|
use tracing as log;
|
||||||
|
|
||||||
use reqwest::{ Client, RequestBuilder, Method };
|
|
||||||
|
|
||||||
use crate::Result;
|
|
||||||
use crate::ResponseInfo;
|
|
||||||
use crate::RiotApiConfig;
|
|
||||||
use crate::RiotApiError;
|
|
||||||
use crate::req::RegionalRequester;
|
use crate::req::RegionalRequester;
|
||||||
use crate::util::InsertOnlyCHashMap;
|
use crate::util::InsertOnlyCHashMap;
|
||||||
|
use crate::{ResponseInfo, Result, RiotApiConfig, RiotApiError};
|
||||||
|
|
||||||
/// For retrieving data from the Riot Games API.
|
/// For retrieving data from the Riot Games API.
|
||||||
///
|
///
|
||||||
|
@ -59,11 +53,15 @@ impl RiotApi {
|
||||||
/// Constructs a new instance from an API key (e.g. `"RGAPI-01234567-89ab-cdef-0123-456789abcdef"`) or a [RiotApiConfig].
|
/// Constructs a new instance from an API key (e.g. `"RGAPI-01234567-89ab-cdef-0123-456789abcdef"`) or a [RiotApiConfig].
|
||||||
pub fn new(config: impl Into<RiotApiConfig>) -> Self {
|
pub fn new(config: impl Into<RiotApiConfig>) -> Self {
|
||||||
let mut config = config.into();
|
let mut config = config.into();
|
||||||
let client_builder = config.client_builder.take()
|
let client_builder = config
|
||||||
|
.client_builder
|
||||||
|
.take()
|
||||||
.expect("CLIENT_BUILDER IN CONFIG SHOULD NOT BE NONE.");
|
.expect("CLIENT_BUILDER IN CONFIG SHOULD NOT BE NONE.");
|
||||||
Self {
|
Self {
|
||||||
config,
|
config,
|
||||||
client: client_builder.build().expect("Failed to create client from builder."),
|
client: client_builder
|
||||||
|
.build()
|
||||||
|
.expect("Failed to create client from builder."),
|
||||||
regional_requesters: InsertOnlyCHashMap::new(),
|
regional_requesters: InsertOnlyCHashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +76,8 @@ impl RiotApi {
|
||||||
/// * `path` - The URL path, appended to the base URL.
|
/// * `path` - The URL path, appended to the base URL.
|
||||||
pub fn request(&self, method: Method, region_platform: &str, path: &str) -> RequestBuilder {
|
pub fn request(&self, method: Method, region_platform: &str, path: &str) -> RequestBuilder {
|
||||||
let base_url_platform = self.config.base_url.replace("{}", region_platform);
|
let base_url_platform = self.config.base_url.replace("{}", region_platform);
|
||||||
self.client.request(method, format!("{}{}", base_url_platform, path))
|
self.client
|
||||||
|
.request(method, format!("{}{}", base_url_platform, path))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This method should generally not be used directly. Consider using endpoint wrappers instead.
|
/// This method should generally not be used directly. Consider using endpoint wrappers instead.
|
||||||
|
@ -92,11 +91,15 @@ impl RiotApi {
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// A future resolving to a `Result` containg either a `T` (success) or a `RiotApiError` (failure).
|
/// A future resolving to a `Result` containg either a `T` (success) or a `RiotApiError` (failure).
|
||||||
pub async fn execute_val<'a, T: serde::de::DeserializeOwned + 'a>(&'a self,
|
pub async fn execute_val<'a, T: serde::de::DeserializeOwned + 'a>(
|
||||||
method_id: &'static str, region_platform: &'static str, request: RequestBuilder)
|
&'a self,
|
||||||
-> Result<T>
|
method_id: &'static str,
|
||||||
{
|
region_platform: &'static str,
|
||||||
let rinfo = self.execute_raw(method_id, region_platform, request).await?;
|
request: RequestBuilder,
|
||||||
|
) -> Result<T> {
|
||||||
|
let rinfo = self
|
||||||
|
.execute_raw(method_id, region_platform, request)
|
||||||
|
.await?;
|
||||||
let retries = rinfo.retries;
|
let retries = rinfo.retries;
|
||||||
let status = rinfo.response.status();
|
let status = rinfo.response.status();
|
||||||
let value = rinfo.response.json::<T>().await;
|
let value = rinfo.response.json::<T>().await;
|
||||||
|
@ -114,11 +117,15 @@ impl RiotApi {
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// A future resolving to a `Result` containg either an `Option<T>` (success) or a `RiotApiError` (failure).
|
/// A future resolving to a `Result` containg either an `Option<T>` (success) or a `RiotApiError` (failure).
|
||||||
pub async fn execute_opt<'a, T: serde::de::DeserializeOwned + 'a>(&'a self,
|
pub async fn execute_opt<'a, T: serde::de::DeserializeOwned + 'a>(
|
||||||
method_id: &'static str, region_platform: &'static str, request: RequestBuilder)
|
&'a self,
|
||||||
-> Result<Option<T>>
|
method_id: &'static str,
|
||||||
{
|
region_platform: &'static str,
|
||||||
let rinfo = self.execute_raw(method_id, region_platform, request).await?;
|
request: RequestBuilder,
|
||||||
|
) -> Result<Option<T>> {
|
||||||
|
let rinfo = self
|
||||||
|
.execute_raw(method_id, region_platform, request)
|
||||||
|
.await?;
|
||||||
if rinfo.status_none {
|
if rinfo.status_none {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
@ -139,14 +146,20 @@ impl RiotApi {
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// A future resolving to a `Result` containg either `()` (success) or a `RiotApiError` (failure).
|
/// A future resolving to a `Result` containg either `()` (success) or a `RiotApiError` (failure).
|
||||||
pub async fn execute(&self,
|
pub async fn execute(
|
||||||
method_id: &'static str, region_platform: &'static str, request: RequestBuilder)
|
&self,
|
||||||
-> Result<()>
|
method_id: &'static str,
|
||||||
{
|
region_platform: &'static str,
|
||||||
let rinfo = self.execute_raw(method_id, region_platform, request).await?;
|
request: RequestBuilder,
|
||||||
|
) -> Result<()> {
|
||||||
|
let rinfo = self
|
||||||
|
.execute_raw(method_id, region_platform, request)
|
||||||
|
.await?;
|
||||||
let retries = rinfo.retries;
|
let retries = rinfo.retries;
|
||||||
let status = rinfo.response.status();
|
let status = rinfo.response.status();
|
||||||
rinfo.response.error_for_status()
|
rinfo
|
||||||
|
.response
|
||||||
|
.error_for_status()
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
.map_err(|e| RiotApiError::new(e, retries, None, Some(status)))
|
.map_err(|e| RiotApiError::new(e, retries, None, Some(status)))
|
||||||
}
|
}
|
||||||
|
@ -164,18 +177,25 @@ impl RiotApi {
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// A future resolving to a `Result` containg either a `ResponseInfo` (success) or a `RiotApiError` (failure).
|
/// A future resolving to a `Result` containg either a `ResponseInfo` (success) or a `RiotApiError` (failure).
|
||||||
pub fn execute_raw(&self, method_id: &'static str, region_platform: &'static str, request: RequestBuilder)
|
pub fn execute_raw(
|
||||||
-> impl Future<Output = Result<ResponseInfo>> + '_
|
&self,
|
||||||
{
|
method_id: &'static str,
|
||||||
|
region_platform: &'static str,
|
||||||
|
request: RequestBuilder,
|
||||||
|
) -> impl Future<Output = Result<ResponseInfo>> + '_ {
|
||||||
self.regional_requester(region_platform)
|
self.regional_requester(region_platform)
|
||||||
.execute(&self.config, method_id, request)
|
.execute(&self.config, method_id, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get or create the RegionalRequester for the given region.
|
/// Get or create the RegionalRequester for the given region.
|
||||||
fn regional_requester(&self, region_platform: &'static str) -> Arc<RegionalRequester> {
|
fn regional_requester(&self, region_platform: &'static str) -> Arc<RegionalRequester> {
|
||||||
self.regional_requesters.get_or_insert_with(region_platform, || {
|
self.regional_requesters
|
||||||
log::debug!("Creating requester for region platform {}.", region_platform);
|
.get_or_insert_with(region_platform, || {
|
||||||
RegionalRequester::new()
|
log::debug!(
|
||||||
})
|
"Creating requester for region platform {}.",
|
||||||
|
region_platform
|
||||||
|
);
|
||||||
|
RegionalRequester::new()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ impl<K: Hash + Eq, V> InsertOnlyCHashMap<K, V> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
base: Mutex::new(HashMap::new())
|
base: Mutex::new(HashMap::new()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,12 @@ impl<K: Hash + Eq, V> InsertOnlyCHashMap<K, V> {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_or_insert_with<F: FnOnce() -> V>(&self, key: K, default: F) -> Arc<V>
|
pub fn get_or_insert_with<F: FnOnce() -> V>(&self, key: K, default: F) -> Arc<V> {
|
||||||
{
|
Arc::clone(
|
||||||
Arc::clone(self.base.lock()
|
self.base
|
||||||
.entry(key)
|
.lock()
|
||||||
.or_insert_with(|| Arc::new(default())))
|
.entry(key)
|
||||||
|
.or_insert_with(|| Arc::new(default())),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ newtype_enum! {
|
||||||
///
|
///
|
||||||
/// Field | Name | Identifier | Id
|
/// Field | Name | Identifier | Id
|
||||||
/// ---|---|---|---
|
/// ---|---|---|---
|
||||||
|
/// `NONE` | None (no ban) | | -1
|
||||||
{{
|
{{
|
||||||
for (const { id, alias, name } of champions) {
|
for (const { id, alias, name } of champions) {
|
||||||
}}
|
}}
|
||||||
|
@ -24,9 +25,10 @@ newtype_enum! {
|
||||||
{{
|
{{
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Champion(i16) {
|
pub newtype_enum Champion(i16) {
|
||||||
|
/// `-1`, none. Appears when a champion ban is not used in champ select.
|
||||||
|
NONE = -1,
|
||||||
|
|
||||||
{{
|
{{
|
||||||
for (const { id, alias, name } of champions) {
|
for (const { id, alias, name } of champions) {
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -3,16 +3,14 @@
|
||||||
const gameModes = require('./.gameModes.json');
|
const gameModes = require('./.gameModes.json');
|
||||||
}}{{= dotUtils.preamble() }}
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
use strum_macros::{ EnumString, EnumVariantNames, IntoStaticStr };
|
||||||
use strum_macros::{ EnumString, IntoStaticStr };
|
|
||||||
|
|
||||||
/// League of Legends game mode, such as Classic,
|
/// League of Legends game mode, such as Classic,
|
||||||
/// ARAM, URF, One For All, Ascension, etc.
|
/// ARAM, URF, One For All, Ascension, etc.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
#[derive(Eq, PartialEq, Hash)]
|
#[derive(Eq, PartialEq, Hash)]
|
||||||
#[derive(EnumString, IntoStaticStr)]
|
#[derive(EnumString, EnumVariantNames, IntoStaticStr)]
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum GameMode {
|
pub enum GameMode {
|
||||||
/// Catch-all variant for new, unknown game modes.
|
/// Catch-all variant for new, unknown game modes.
|
||||||
|
@ -32,4 +30,4 @@ pub enum GameMode {
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
string_enum_str!(GameMode);
|
serde_strum_unknown!(GameMode);
|
||||||
|
|
|
@ -16,12 +16,18 @@ pub enum GameType {
|
||||||
{{
|
{{
|
||||||
for (const e of gameTypes) {
|
for (const e of gameTypes) {
|
||||||
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
|
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
|
||||||
|
const nameNoGame = e['x-name'].replace(/_GAME$/, "");
|
||||||
}}
|
}}
|
||||||
{{~ desc :line }}
|
{{~ desc :line }}
|
||||||
/// {{= line }}
|
/// {{= line }}
|
||||||
{{~}}
|
{{~}}
|
||||||
|
#[strum(to_string = "{{= e['x-name'] }}", serialize = "{{= nameNoGame }}")]
|
||||||
|
#[serde(alias = "{{= nameNoGame }}")]
|
||||||
{{= e['x-name'] }},
|
{{= e['x-name'] }},
|
||||||
{{
|
{{
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test;
|
||||||
|
|
|
@ -3,12 +3,8 @@
|
||||||
const maps = require('./.maps.json');
|
const maps = require('./.maps.json');
|
||||||
}}{{= dotUtils.preamble() }}
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
|
||||||
|
|
||||||
newtype_enum! {
|
newtype_enum! {
|
||||||
/// A League of Legends map.
|
/// A League of Legends map.
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Map(u8) {
|
pub newtype_enum Map(u8) {
|
||||||
{{
|
{{
|
||||||
for (const e of maps) {
|
for (const e of maps) {
|
||||||
|
|
|
@ -3,12 +3,8 @@
|
||||||
const queues = require('./.queues.json');
|
const queues = require('./.queues.json');
|
||||||
}}{{= dotUtils.preamble() }}
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
|
||||||
|
|
||||||
newtype_enum! {
|
newtype_enum! {
|
||||||
/// A League of Legends matchmaking queue.
|
/// A League of Legends matchmaking queue.
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Queue(u16) {
|
pub newtype_enum Queue(u16) {
|
||||||
{{
|
{{
|
||||||
for (const e of queues) {
|
for (const e of queues) {
|
||||||
|
@ -18,8 +14,11 @@ newtype_enum! {
|
||||||
{{~ desc :line }}
|
{{~ desc :line }}
|
||||||
/// {{= line }}
|
/// {{= line }}
|
||||||
{{~}}
|
{{~}}
|
||||||
{{? e['x-deprecated'] }}
|
{{? e.notes }}
|
||||||
|
///
|
||||||
/// {{= e.notes }}
|
/// {{= e.notes }}
|
||||||
|
{{?}}
|
||||||
|
{{? e['x-deprecated'] }}
|
||||||
#[deprecated(note="{{= e.notes }}")]
|
#[deprecated(note="{{= e.notes }}")]
|
||||||
{{?}}
|
{{?}}
|
||||||
{{= e['x-name'] }} = {{= e['x-value'] }},
|
{{= e['x-name'] }} = {{= e['x-value'] }},
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
{{
|
||||||
|
const dotUtils = require('./dotUtils.js');
|
||||||
|
const queueTypes = require('./.queueTypes.json');
|
||||||
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
|
use strum_macros::{ EnumString, EnumVariantNames, IntoStaticStr };
|
||||||
|
|
||||||
|
/// LoL or TFT ranked queue types.
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[derive(Eq, PartialEq, Hash)]
|
||||||
|
#[derive(EnumString, EnumVariantNames, IntoStaticStr)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum QueueType {
|
||||||
|
/// Catch-all variant for new, unknown queue types.
|
||||||
|
#[strum(default)]
|
||||||
|
UNKNOWN(String),
|
||||||
|
|
||||||
|
{{
|
||||||
|
for (const e of queueTypes) {
|
||||||
|
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
|
||||||
|
}}
|
||||||
|
{{~ desc :line }}
|
||||||
|
/// {{= line }}
|
||||||
|
{{~}}
|
||||||
|
{{? e['x-deprecated'] }}
|
||||||
|
/// {{= e.notes }}
|
||||||
|
#[deprecated(note="{{= e.notes }}")]
|
||||||
|
{{?}}
|
||||||
|
{{= e['x-name'] }},
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
serde_strum_unknown!(QueueType);
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test;
|
|
@ -0,0 +1,196 @@
|
||||||
|
{{
|
||||||
|
const dotUtils = require('./dotUtils.js');
|
||||||
|
const routesTable = require('./.routesTable.json');
|
||||||
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
|
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
||||||
|
use strum_macros::{ EnumString, EnumIter, Display, IntoStaticStr };
|
||||||
|
|
||||||
|
/// Regional routes, used in tournament services, Legends of Runeterra (LoR), and other some endpoints.
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub enum RegionalRoute {
|
||||||
|
{{
|
||||||
|
for (const [ name, { id, description, deprecated } ] of Object.entries(routesTable['regional'])) {
|
||||||
|
const desc = description.split('\n');
|
||||||
|
}}
|
||||||
|
{{~ desc :line }}
|
||||||
|
/// {{= line }}
|
||||||
|
{{~}}
|
||||||
|
///
|
||||||
|
/// `{{= id }}` (riotapi-schema ID/repr)
|
||||||
|
{{? deprecated }}
|
||||||
|
#[deprecated]
|
||||||
|
{{?}}
|
||||||
|
{{= name.toUpperCase() }} = {{= id }},
|
||||||
|
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Platform routes for League of Legends (LoL), Teamfight Tactics (TFT), and Legends of Runeterra (LoR).
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
||||||
|
pub enum PlatformRoute {
|
||||||
|
{{
|
||||||
|
for (const [ name, { id, description, altName, deprecated } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
const desc = description.split('\n');
|
||||||
|
}}
|
||||||
|
{{~ desc :line }}
|
||||||
|
/// {{= line }}
|
||||||
|
{{~}}
|
||||||
|
///
|
||||||
|
/// `{{= id }}` (riotapi-schema ID/repr)
|
||||||
|
{{? deprecated }}
|
||||||
|
#[deprecated]
|
||||||
|
{{?}}
|
||||||
|
{{? altName }}
|
||||||
|
#[strum(to_string="{{= name.toUpperCase() }}", serialize="{{= altName }}")]
|
||||||
|
{{?}}
|
||||||
|
{{= name.toUpperCase() }} = {{= id }},
|
||||||
|
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PlatformRoute {
|
||||||
|
/// Converts this [`PlatformRoute`] into its corresponding
|
||||||
|
/// [`RegionalRoute`] for LoL and TFT match endpoints.
|
||||||
|
/// For example, [`match-v5`](crate::endpoints::MatchV5).
|
||||||
|
pub fn to_regional(self) -> RegionalRoute {
|
||||||
|
match self {
|
||||||
|
{{
|
||||||
|
for (const [ name, { regionalRoute } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
}}
|
||||||
|
Self::{{= name.toUpperCase() }} => RegionalRoute::{{= regionalRoute.toUpperCase() }},
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Converts this [`PlatformRoute`] into its corresponding
|
||||||
|
/// [`RegionalRoute`] for LoR endpoints.
|
||||||
|
/// For example, [`lor-match-v1`](crate::endpoints::LorMatchV1).
|
||||||
|
pub fn to_regional_lor(self) -> RegionalRoute {
|
||||||
|
match self {
|
||||||
|
{{
|
||||||
|
for (const [ name, { regionalRouteLor } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
}}
|
||||||
|
Self::{{= name.toUpperCase() }} => RegionalRoute::{{= regionalRouteLor.toUpperCase() }},
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Used in the LoL Tournament API. Specifically
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
pub fn to_tournament_region(self) -> Option<TournamentRegion> {
|
||||||
|
match self {
|
||||||
|
{{
|
||||||
|
for (const [ name, { tournamentRegion } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
if (!tournamentRegion) continue;
|
||||||
|
}}
|
||||||
|
Self::{{= name.toUpperCase() }} => Some(TournamentRegion::{{= tournamentRegion }}),
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
_other => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the slightly more human-friendly alternate name for this `PlatformRoute`. Specifically
|
||||||
|
/// excludes any trailing numbers and appends extra N(orth), S(outh), E(ast), and/or W(est)
|
||||||
|
/// suffixes to some names. Some of these are old region names which are often still used as
|
||||||
|
/// user-facing names, e.g. on op.gg.
|
||||||
|
///
|
||||||
|
/// Note these strings *are* handled by the `FromStr` implementation, if you wish to parse them
|
||||||
|
/// back into `PlatformRoute`s.
|
||||||
|
pub fn as_region_str(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
{{
|
||||||
|
for (const [ name, { altName } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
if (!altName) continue;
|
||||||
|
}}
|
||||||
|
Self::{{= name.toUpperCase() }} => "{{= altName }}",
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
other => other.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Platform routes for Valorant.
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub enum ValPlatformRoute {
|
||||||
|
{{
|
||||||
|
for (const [ name, { id, description, deprecated } ] of Object.entries(routesTable['val-platform'])) {
|
||||||
|
const desc = description.split('\n');
|
||||||
|
}}
|
||||||
|
{{~ desc :line }}
|
||||||
|
/// {{= line }}
|
||||||
|
{{~}}
|
||||||
|
///
|
||||||
|
/// `{{= id }}` (riotapi-schema ID/repr)
|
||||||
|
{{? deprecated }}
|
||||||
|
#[deprecated]
|
||||||
|
{{?}}
|
||||||
|
{{= name.toUpperCase() }} = {{= id }},
|
||||||
|
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Tournament regions for League of Legends (LoL) used in
|
||||||
|
/// [`tournament-stub-v4.registerProviderData`](crate::endpoints::TournamentStubV4::register_provider_data)
|
||||||
|
/// and [`tournament-v4.registerProviderData`](crate::endpoints::TournamentV4::register_provider_data).
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||||
|
#[derive(EnumString, EnumIter, Display, IntoStaticStr)]
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
// Note: strum(serialize = ...) actually specifies extra DEserialization values.
|
||||||
|
pub enum TournamentRegion {
|
||||||
|
{{
|
||||||
|
for (const [ name, { id, description, tournamentRegion, deprecated } ] of Object.entries(routesTable['platform'])) {
|
||||||
|
if (tournamentRegion) {
|
||||||
|
const desc = description.split('\n');
|
||||||
|
}}
|
||||||
|
{{~ desc :line }}
|
||||||
|
/// {{= line }}
|
||||||
|
{{~}}
|
||||||
|
{{? deprecated }}
|
||||||
|
#[deprecated]
|
||||||
|
{{?}}
|
||||||
|
{{= tournamentRegion }} = {{= id }},
|
||||||
|
{{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
|
@ -3,12 +3,8 @@
|
||||||
const seasons = require('./.seasons.json');
|
const seasons = require('./.seasons.json');
|
||||||
}}{{= dotUtils.preamble() }}
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
use serde::{ Serialize, Deserialize };
|
|
||||||
|
|
||||||
newtype_enum! {
|
newtype_enum! {
|
||||||
/// A League of Legends season for competitive matchmaking.
|
/// A League of Legends season for competitive matchmaking.
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(transparent)]
|
|
||||||
pub newtype_enum Season(u8) {
|
pub newtype_enum Season(u8) {
|
||||||
{{
|
{{
|
||||||
for (const e of seasons) {
|
for (const e of seasons) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ Array.prototype.sortBy = function(lambda) {
|
||||||
|
|
||||||
function preamble() {
|
function preamble() {
|
||||||
return `\
|
return `\
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// ! //
|
// ! //
|
||||||
|
@ -103,16 +104,16 @@ function formatJsonProperty(name) {
|
||||||
function formatAddQueryParam(param) {
|
function formatAddQueryParam(param) {
|
||||||
const k = `"${param.name}"`;
|
const k = `"${param.name}"`;
|
||||||
const name = normalizePropName(param.name);
|
const name = normalizePropName(param.name);
|
||||||
const condStart = param.required ? '' : `mut request = request; if let Some(${name}) = ${name} { `;
|
const condStart = param.required ? '' : `if let Some(${name}) = ${name} { `;
|
||||||
const condEnd = param.required ? '' : ' }'
|
const condEnd = param.required ? '' : ' } else { request }'
|
||||||
const prop = param.schema;
|
const prop = param.schema;
|
||||||
switch (prop.type) {
|
switch (prop.type) {
|
||||||
case 'array': return `let ${condStart}request = request.query(&*${name}.iter()`
|
case 'array': return `let request = ${condStart}request.query(&*${name}.iter()`
|
||||||
+ `.map(|w| ( ${k}, w )).collect::<Vec<_>>());${condEnd}`;
|
+ `.map(|w| ( ${k}, w )).collect::<Vec<_>>())${condEnd};`;
|
||||||
case 'object':
|
case 'object':
|
||||||
throw 'unsupported';
|
throw 'unsupported';
|
||||||
default:
|
default:
|
||||||
return `let ${condStart}request = request.query(&[ (${k}, ${name}) ]);${condEnd}`;
|
return `let request = ${condStart}request.query(&[ (${k}, ${name}) ])${condEnd};`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ const files = [
|
||||||
'http://www.mingweisamuel.com/riotapi-schema/enums/queues.json',
|
'http://www.mingweisamuel.com/riotapi-schema/enums/queues.json',
|
||||||
'.queues.json'
|
'.queues.json'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'http://www.mingweisamuel.com/riotapi-schema/enums/queueTypes.json',
|
||||||
|
'.queueTypes.json'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'http://www.mingweisamuel.com/riotapi-schema/enums/gameTypes.json',
|
'http://www.mingweisamuel.com/riotapi-schema/enums/gameTypes.json',
|
||||||
'.gameTypes.json'
|
'.gameTypes.json'
|
||||||
|
@ -34,8 +38,12 @@ const files = [
|
||||||
[
|
[
|
||||||
'http://www.mingweisamuel.com/riotapi-schema/enums/maps.json',
|
'http://www.mingweisamuel.com/riotapi-schema/enums/maps.json',
|
||||||
'.maps.json'
|
'.maps.json'
|
||||||
]
|
],
|
||||||
]
|
[
|
||||||
|
'http://www.mingweisamuel.com/riotapi-schema/routesTable.json',
|
||||||
|
'.routesTable.json'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
const downloadFilesPromise = Promise.all(files.map(([url, file]) => req(url)
|
const downloadFilesPromise = Promise.all(files.map(([url, file]) => req(url)
|
||||||
.then(body => fs.writeFileAsync(file, body, "utf8"))));
|
.then(body => fs.writeFileAsync(file, body, "utf8"))));
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
{{~ readme :line }}
|
{{~ readme :line }}
|
||||||
//! {{= line }}
|
//!{{= line ? (' ' + line) : '' }}
|
||||||
{{~}}
|
{{~}}
|
||||||
|
|
||||||
// Re-exported reqwest types.
|
// Re-exported reqwest types.
|
||||||
pub use reqwest;
|
pub use reqwest;
|
||||||
|
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::RiotApiConfig;
|
pub use config::RiotApiConfig;
|
||||||
|
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod endpoints;
|
pub mod endpoints;
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -26,6 +26,7 @@ pub use error::*;
|
||||||
|
|
||||||
pub mod meta;
|
pub mod meta;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod models;
|
pub mod models;
|
||||||
mod models_impls;
|
mod models_impls;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,792 @@
|
||||||
{
|
{
|
||||||
"name": "dot-gen",
|
"name": "dot-gen",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "dot-gen",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "GPL-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"change-case": "^3.1.0",
|
||||||
|
"dot": "^1.1.3",
|
||||||
|
"glob": "^7.1.2",
|
||||||
|
"glob-promise": "^3.3.0",
|
||||||
|
"request": "^2.88.0",
|
||||||
|
"request-promise-native": "^1.0.7"
|
||||||
|
},
|
||||||
|
"devDependencies": {}
|
||||||
|
},
|
||||||
|
"node_modules/@types/events": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/glob": {
|
||||||
|
"version": "7.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
|
||||||
|
"integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/events": "*",
|
||||||
|
"@types/minimatch": "*",
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/minimatch": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||||
|
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "12.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.1.tgz",
|
||||||
|
"integrity": "sha512-TJtwsqZ39pqcljJpajeoofYRfeZ7/I/OMUQ5pR4q5wOKf2ocrUvBAZUMhWsOvKx3dVc/aaV5GluBivt0sWqA5A=="
|
||||||
|
},
|
||||||
|
"node_modules/ajv": {
|
||||||
|
"version": "6.12.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||||
|
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||||
|
"dependencies": {
|
||||||
|
"fast-deep-equal": "^3.1.1",
|
||||||
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
|
"json-schema-traverse": "^0.4.1",
|
||||||
|
"uri-js": "^4.2.2"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/epoberezkin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ajv/node_modules/fast-deep-equal": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||||
|
},
|
||||||
|
"node_modules/asn1": {
|
||||||
|
"version": "0.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
|
||||||
|
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": "~2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/assert-plus": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||||
|
},
|
||||||
|
"node_modules/aws-sign2": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||||
|
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/aws4": {
|
||||||
|
"version": "1.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
|
||||||
|
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||||
|
},
|
||||||
|
"node_modules/balanced-match": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||||
|
},
|
||||||
|
"node_modules/bcrypt-pbkdf": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
|
||||||
|
"dependencies": {
|
||||||
|
"tweetnacl": "^0.14.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/camel-case": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0",
|
||||||
|
"upper-case": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/caseless": {
|
||||||
|
"version": "0.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||||
|
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||||
|
},
|
||||||
|
"node_modules/change-case": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/change-case/-/change-case-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-2AZp7uJZbYEzRPsFoa+ijKdvp9zsrnnt6+yFokfwEpeJm0xuJDVoxiRCAaTzyJND8GJkofo2IcKWaUZ/OECVzw==",
|
||||||
|
"dependencies": {
|
||||||
|
"camel-case": "^3.0.0",
|
||||||
|
"constant-case": "^2.0.0",
|
||||||
|
"dot-case": "^2.1.0",
|
||||||
|
"header-case": "^1.0.0",
|
||||||
|
"is-lower-case": "^1.1.0",
|
||||||
|
"is-upper-case": "^1.1.0",
|
||||||
|
"lower-case": "^1.1.1",
|
||||||
|
"lower-case-first": "^1.0.0",
|
||||||
|
"no-case": "^2.3.2",
|
||||||
|
"param-case": "^2.1.0",
|
||||||
|
"pascal-case": "^2.0.0",
|
||||||
|
"path-case": "^2.1.0",
|
||||||
|
"sentence-case": "^2.1.0",
|
||||||
|
"snake-case": "^2.1.0",
|
||||||
|
"swap-case": "^1.1.0",
|
||||||
|
"title-case": "^2.1.0",
|
||||||
|
"upper-case": "^1.1.1",
|
||||||
|
"upper-case-first": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||||
|
},
|
||||||
|
"node_modules/constant-case": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/constant-case/-/constant-case-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-QXV2TTidP6nI7NKRhu1gBSQ7akY=",
|
||||||
|
"dependencies": {
|
||||||
|
"snake-case": "^2.1.0",
|
||||||
|
"upper-case": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/core-util-is": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||||
|
},
|
||||||
|
"node_modules/dashdash": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||||
|
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dot": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot/-/dot-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-/nt74Rm+PcfnirXGEdhZleTwGC2LMnuKTeeTIlI82xb5loBBoXNYzr2ezCroPSMtilK8EZIfcNZwOcHN+ib1Lg==",
|
||||||
|
"engines": [
|
||||||
|
"node >=0.2.6"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"dottojs": "bin/dot-packer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dot-case": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-case/-/dot-case-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-NNzzf1Co6TwrO8qLt/uRVcfaO+4=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ecc-jsbn": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||||
|
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
|
||||||
|
"dependencies": {
|
||||||
|
"jsbn": "~0.1.0",
|
||||||
|
"safer-buffer": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/extend": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||||
|
},
|
||||||
|
"node_modules/extsprintf": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
||||||
|
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
|
||||||
|
"engines": [
|
||||||
|
"node >=0.6.0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/fast-json-stable-stringify": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
|
||||||
|
},
|
||||||
|
"node_modules/forever-agent": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||||
|
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.6",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fs.realpath": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
|
},
|
||||||
|
"node_modules/getpass": {
|
||||||
|
"version": "0.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||||
|
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/glob": {
|
||||||
|
"version": "7.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
|
||||||
|
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
||||||
|
"dependencies": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/glob-promise": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob-promise/-/glob-promise-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-q08RJ6O+eJn+dVanerAndJwIcumgbDdYiUT7zFQl3Wm1xD6fBKtah7H8ZJChj4wP+8C+QfeVy8xautR7rdmKEw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/glob": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"glob": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/har-schema": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/har-validator": {
|
||||||
|
"version": "5.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
|
||||||
|
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
|
||||||
|
"deprecated": "this library is no longer supported",
|
||||||
|
"dependencies": {
|
||||||
|
"ajv": "^6.5.5",
|
||||||
|
"har-schema": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/header-case": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/header-case/-/header-case-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-lTWXMZfBRLCWE81l0xfvGZY70C0=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0",
|
||||||
|
"upper-case": "^1.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/http-signature": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": "^1.0.0",
|
||||||
|
"jsprim": "^1.2.2",
|
||||||
|
"sshpk": "^1.7.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8",
|
||||||
|
"npm": ">=1.3.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/inflight": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
|
"node_modules/is-lower-case": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz",
|
||||||
|
"integrity": "sha1-fhR75HaNxGbbO/shzGCzHmrWk5M=",
|
||||||
|
"dependencies": {
|
||||||
|
"lower-case": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-typedarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
|
||||||
|
},
|
||||||
|
"node_modules/is-upper-case": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz",
|
||||||
|
"integrity": "sha1-jQsfp+eTOh5YSDYA7H2WYcuvdW8=",
|
||||||
|
"dependencies": {
|
||||||
|
"upper-case": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/isstream": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||||
|
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||||
|
},
|
||||||
|
"node_modules/jsbn": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||||
|
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||||
|
},
|
||||||
|
"node_modules/json-schema": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="
|
||||||
|
},
|
||||||
|
"node_modules/json-schema-traverse": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||||
|
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
||||||
|
},
|
||||||
|
"node_modules/json-stringify-safe": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||||
|
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||||
|
},
|
||||||
|
"node_modules/jsprim": {
|
||||||
|
"version": "1.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
|
||||||
|
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": "1.0.0",
|
||||||
|
"extsprintf": "1.3.0",
|
||||||
|
"json-schema": "0.4.0",
|
||||||
|
"verror": "1.10.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
|
},
|
||||||
|
"node_modules/lower-case": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz",
|
||||||
|
"integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw="
|
||||||
|
},
|
||||||
|
"node_modules/lower-case-first": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lower-case-first/-/lower-case-first-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-5dp8JvKacHO+AtUrrJmA5ZIq36E=",
|
||||||
|
"dependencies": {
|
||||||
|
"lower-case": "^1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.40.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
|
||||||
|
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.24",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
|
||||||
|
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.40.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/minimatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/no-case": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"lower-case": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/oauth-sign": {
|
||||||
|
"version": "0.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
||||||
|
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
|
"dependencies": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/param-case": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pascal-case": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-2.0.1.tgz",
|
||||||
|
"integrity": "sha1-LVeNNFX2YNpl7KGO+VtODekSdh4=",
|
||||||
|
"dependencies": {
|
||||||
|
"camel-case": "^3.0.0",
|
||||||
|
"upper-case-first": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-case": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-case/-/path-case-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-lLgDfDctP+KQbkZbtF4l0ibo7qU=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-is-absolute": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/performance-now": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||||
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
|
},
|
||||||
|
"node_modules/psl": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw=="
|
||||||
|
},
|
||||||
|
"node_modules/punycode": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qs": {
|
||||||
|
"version": "6.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||||
|
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/request": {
|
||||||
|
"version": "2.88.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
|
||||||
|
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
|
||||||
|
"deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
|
||||||
|
"dependencies": {
|
||||||
|
"aws-sign2": "~0.7.0",
|
||||||
|
"aws4": "^1.8.0",
|
||||||
|
"caseless": "~0.12.0",
|
||||||
|
"combined-stream": "~1.0.6",
|
||||||
|
"extend": "~3.0.2",
|
||||||
|
"forever-agent": "~0.6.1",
|
||||||
|
"form-data": "~2.3.2",
|
||||||
|
"har-validator": "~5.1.0",
|
||||||
|
"http-signature": "~1.2.0",
|
||||||
|
"is-typedarray": "~1.0.0",
|
||||||
|
"isstream": "~0.1.2",
|
||||||
|
"json-stringify-safe": "~5.0.1",
|
||||||
|
"mime-types": "~2.1.19",
|
||||||
|
"oauth-sign": "~0.9.0",
|
||||||
|
"performance-now": "^2.1.0",
|
||||||
|
"qs": "~6.5.2",
|
||||||
|
"safe-buffer": "^5.1.2",
|
||||||
|
"tough-cookie": "~2.4.3",
|
||||||
|
"tunnel-agent": "^0.6.0",
|
||||||
|
"uuid": "^3.3.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/request-promise-core": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==",
|
||||||
|
"dependencies": {
|
||||||
|
"lodash": "^4.17.11"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"request": "^2.34"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/request-promise-native": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==",
|
||||||
|
"deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142",
|
||||||
|
"dependencies": {
|
||||||
|
"request-promise-core": "1.1.2",
|
||||||
|
"stealthy-require": "^1.1.1",
|
||||||
|
"tough-cookie": "^2.3.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.12.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"request": "^2.34"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/safe-buffer": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
|
||||||
|
},
|
||||||
|
"node_modules/safer-buffer": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
|
},
|
||||||
|
"node_modules/sentence-case": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-H24t2jnBaL+S0T+G1KkYkz9mftQ=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0",
|
||||||
|
"upper-case-first": "^1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/snake-case": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz",
|
||||||
|
"integrity": "sha1-Qb2xtz8w7GagTU4srRt2OH1NbZ8=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sshpk": {
|
||||||
|
"version": "1.16.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||||
|
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
|
||||||
|
"dependencies": {
|
||||||
|
"asn1": "~0.2.3",
|
||||||
|
"assert-plus": "^1.0.0",
|
||||||
|
"bcrypt-pbkdf": "^1.0.0",
|
||||||
|
"dashdash": "^1.12.0",
|
||||||
|
"ecc-jsbn": "~0.1.1",
|
||||||
|
"getpass": "^0.1.1",
|
||||||
|
"jsbn": "~0.1.0",
|
||||||
|
"safer-buffer": "^2.0.2",
|
||||||
|
"tweetnacl": "~0.14.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"sshpk-conv": "bin/sshpk-conv",
|
||||||
|
"sshpk-sign": "bin/sshpk-sign",
|
||||||
|
"sshpk-verify": "bin/sshpk-verify"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/stealthy-require": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/swap-case": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz",
|
||||||
|
"integrity": "sha1-w5IDpFhzhfrTyFCgvRvK+ggZdOM=",
|
||||||
|
"dependencies": {
|
||||||
|
"lower-case": "^1.1.1",
|
||||||
|
"upper-case": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/title-case": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/title-case/-/title-case-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-PhJyFtpY0rxb7PE3q5Ha46fNj6o=",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^2.2.0",
|
||||||
|
"upper-case": "^1.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tough-cookie": {
|
||||||
|
"version": "2.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
||||||
|
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"psl": "^1.1.24",
|
||||||
|
"punycode": "^1.4.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tough-cookie/node_modules/punycode": {
|
||||||
|
"version": "1.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
|
||||||
|
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
|
||||||
|
},
|
||||||
|
"node_modules/tunnel-agent": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||||
|
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tweetnacl": {
|
||||||
|
"version": "0.14.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||||
|
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
|
||||||
|
},
|
||||||
|
"node_modules/upper-case": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz",
|
||||||
|
"integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg="
|
||||||
|
},
|
||||||
|
"node_modules/upper-case-first": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz",
|
||||||
|
"integrity": "sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU=",
|
||||||
|
"dependencies": {
|
||||||
|
"upper-case": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/uri-js": {
|
||||||
|
"version": "4.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
|
||||||
|
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"punycode": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/uuid": {
|
||||||
|
"version": "3.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||||
|
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
|
||||||
|
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
||||||
|
"bin": {
|
||||||
|
"uuid": "bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/verror": {
|
||||||
|
"version": "1.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||||
|
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
|
||||||
|
"engines": [
|
||||||
|
"node >=0.6.0"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": "^1.0.0",
|
||||||
|
"core-util-is": "1.0.2",
|
||||||
|
"extsprintf": "^1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/events": {
|
"@types/events": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
|
@ -341,9 +1125,9 @@
|
||||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||||
},
|
},
|
||||||
"json-schema": {
|
"json-schema": {
|
||||||
"version": "0.2.3",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
|
||||||
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
|
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="
|
||||||
},
|
},
|
||||||
"json-schema-traverse": {
|
"json-schema-traverse": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
|
@ -356,13 +1140,13 @@
|
||||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||||
},
|
},
|
||||||
"jsprim": {
|
"jsprim": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
|
||||||
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
|
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"assert-plus": "1.0.0",
|
"assert-plus": "1.0.0",
|
||||||
"extsprintf": "1.3.0",
|
"extsprintf": "1.3.0",
|
||||||
"json-schema": "0.2.3",
|
"json-schema": "0.4.0",
|
||||||
"verror": "1.10.0"
|
"verror": "1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -398,9 +1182,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
|
@ -472,9 +1256,9 @@
|
||||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||||
},
|
},
|
||||||
"qs": {
|
"qs": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA=="
|
||||||
},
|
},
|
||||||
"request": {
|
"request": {
|
||||||
"version": "2.88.0",
|
"version": "2.88.0",
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#![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(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,34 +3,44 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::*;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
use riven::models::tournament_stub_v4::*;
|
use riven::models::tournament_stub_v5::*;
|
||||||
|
use testutils::*;
|
||||||
|
|
||||||
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
|
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
|
||||||
|
|
||||||
static MATCHES: &[&str] = &[
|
static MATCHES: &[&str] = &[
|
||||||
"NA1_3923487226",
|
|
||||||
"NA1_4049206905",
|
|
||||||
"NA1_4052515784",
|
|
||||||
"NA1_4062578191",
|
|
||||||
"NA1_4097036960",
|
|
||||||
|
|
||||||
// New games with `match-v5.ParticipantDto.challenges` field.
|
// New games with `match-v5.ParticipantDto.challenges` field.
|
||||||
"NA1_4209556127",
|
"NA1_4209556127",
|
||||||
"NA1_4212715433",
|
"NA1_4212715433",
|
||||||
"NA1_4265913704", // `match-v5.ParticipantDto.challenges.mejaisFullStackInTime`
|
"NA1_4265913704", // `match-v5.ParticipantDto.challenges.mejaisFullStackInTime`
|
||||||
];
|
];
|
||||||
|
|
||||||
async_tests!{
|
async_tests! {
|
||||||
my_runner {
|
my_runner {
|
||||||
// Champion Mastery tests.
|
// 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 {
|
tournamentstub: async {
|
||||||
let tsv4 = RIOT_API.tournament_stub_v4();
|
let ts = RIOT_API.tournament_stub_v5();
|
||||||
let provider_id = tsv4.register_provider_data(ROUTE, &ProviderRegistrationParameters {
|
let provider_id = ts.register_provider_data(ROUTE, &ProviderRegistrationParametersV5 {
|
||||||
region: PlatformRoute::NA1.as_region_str().to_owned(),
|
region: PlatformRoute::NA1.as_region_str().to_owned(),
|
||||||
url: "https://github.com/MingweiSamuel/Riven".to_owned(),
|
url: "https://github.com/MingweiSamuel/Riven".to_owned(),
|
||||||
})
|
})
|
||||||
|
@ -39,7 +49,7 @@ async_tests!{
|
||||||
|
|
||||||
println!("provider_id: {}", provider_id);
|
println!("provider_id: {}", provider_id);
|
||||||
|
|
||||||
let tournament_id = tsv4.register_tournament(ROUTE, &TournamentRegistrationParameters {
|
let tournament_id = ts.register_tournament(ROUTE, &TournamentRegistrationParametersV5 {
|
||||||
name: Some("Riven Tourney :)".to_owned()),
|
name: Some("Riven Tourney :)".to_owned()),
|
||||||
provider_id,
|
provider_id,
|
||||||
})
|
})
|
||||||
|
@ -48,13 +58,14 @@ async_tests!{
|
||||||
|
|
||||||
println!("tournament_id: {}", tournament_id);
|
println!("tournament_id: {}", tournament_id);
|
||||||
|
|
||||||
let codes_result = tsv4.create_tournament_code(ROUTE, &TournamentCodeParameters {
|
let codes_result = ts.create_tournament_code(ROUTE, &TournamentCodeParametersV5 {
|
||||||
map_type: "SUMMONERS_RIFT".to_owned(),
|
map_type: "SUMMONERS_RIFT".to_owned(),
|
||||||
metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
|
metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
|
||||||
pick_type: "TOURNAMENT_DRAFT".to_owned(),
|
pick_type: "TOURNAMENT_DRAFT".to_owned(),
|
||||||
spectator_type: "ALL".to_owned(),
|
spectator_type: "ALL".to_owned(),
|
||||||
team_size: 5,
|
team_size: 5,
|
||||||
allowed_summoner_ids: None,
|
allowed_participants: None,
|
||||||
|
enough_players: false,
|
||||||
}, tournament_id as i64, Some(300))
|
}, tournament_id as i64, Some(300))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
|
|
||||||
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
|
|
||||||
|
|
||||||
mod async_tests;
|
|
||||||
mod testutils;
|
|
||||||
use testutils::*;
|
|
||||||
|
|
||||||
use colored::*;
|
|
||||||
|
|
||||||
use riven::consts::*;
|
|
||||||
|
|
||||||
const ROUTE: RegionalRoute = RegionalRoute::ASIA;
|
|
||||||
|
|
||||||
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",
|
|
||||||
];
|
|
||||||
|
|
||||||
async_tests! {
|
|
||||||
my_runner {
|
|
||||||
match_v5_get: async {
|
|
||||||
match_v5_get(ROUTE, MATCHES).await
|
|
||||||
},
|
|
||||||
match_v5_get_timeline: async {
|
|
||||||
match_v5_get_timeline(ROUTE, MATCHES).await
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,15 +3,31 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::*;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
|
use testutils::*;
|
||||||
|
|
||||||
const ROUTE: PlatformRoute = PlatformRoute::JP1;
|
const ROUTE: PlatformRoute = PlatformRoute::JP1;
|
||||||
|
|
||||||
async_tests!{
|
static MATCHES: &[&str] = &[
|
||||||
|
// Only has participant IDs for blue team.
|
||||||
|
"JP1_391732436",
|
||||||
|
// New field `ParticipantChallenges` `twoWardsOneSweeperCount`
|
||||||
|
"JP1_397348569",
|
||||||
|
// New fields:
|
||||||
|
// `match-v5.ParticipantDto.playerAugment[1234],playerSubteamId,subteamPlacement`
|
||||||
|
"JP1_400700181",
|
||||||
|
// New field: `match-v5.ParticipantDto.placement`
|
||||||
|
"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! {
|
||||||
my_runner {
|
my_runner {
|
||||||
// Summoner tests.
|
// Summoner tests.
|
||||||
summoner_get_kanjikana: async {
|
summoner_get_kanjikana: async {
|
||||||
|
@ -42,7 +58,7 @@ async_tests!{
|
||||||
},
|
},
|
||||||
// Make sure 403 is handled as expected.
|
// Make sure 403 is handled as expected.
|
||||||
tournament_forbidden: async {
|
tournament_forbidden: async {
|
||||||
let p = RIOT_API.tournament_v4().get_tournament_code(ROUTE.to_regional(), "INVALID_CODE");
|
let p = RIOT_API.tournament_v5().get_tournament_code(ROUTE.to_regional(), "INVALID_CODE");
|
||||||
let r = p.await;
|
let r = p.await;
|
||||||
rassert!(r.is_err());
|
rassert!(r.is_err());
|
||||||
rassert_eq!(Some(reqwest::StatusCode::FORBIDDEN), r.unwrap_err().status_code());
|
rassert_eq!(Some(reqwest::StatusCode::FORBIDDEN), r.unwrap_err().status_code());
|
||||||
|
@ -68,5 +84,16 @@ async_tests!{
|
||||||
rassert!(!lr.is_empty());
|
rassert!(!lr.is_empty());
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ASIA regional tests
|
||||||
|
league_v4_match_v5_latest_combo: async {
|
||||||
|
league_v4_match_v5_latest_combo(ROUTE).await
|
||||||
|
},
|
||||||
|
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
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,20 +3,28 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::*;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
|
use testutils::*;
|
||||||
|
|
||||||
const ROUTE: RegionalRoute = RegionalRoute::EUROPE;
|
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] = &[
|
static MATCHES: &[&str] = &[
|
||||||
// Illegal big `championId`s. https://github.com/RiotGames/developer-relations/issues/553
|
// New ARENA 2v2v2v2 game mode
|
||||||
"EUW1_5097684633",
|
"EUW1_6511808246", // https://github.com/MingweiSamuel/Camille/issues/99
|
||||||
"EUW1_5097963383",
|
// Added 2023-08-27
|
||||||
"EUW1_5102203800", // https://github.com/MingweiSamuel/Riven/issues/36
|
"EUW1_6569580003",
|
||||||
"EUW1_5765650307", // https://gist.github.com/MingweiSamuel/d5f9dc40cc5a80a9255e488f27705c56?permalink_comment_id=4088256#gistcomment-4088256
|
"EUW1_6569417645",
|
||||||
|
"EUW1_6568707352",
|
||||||
|
"EUW1_6568635198",
|
||||||
|
"EUW1_6568537080",
|
||||||
];
|
];
|
||||||
|
|
||||||
async_tests! {
|
async_tests! {
|
||||||
|
|
|
@ -3,77 +3,73 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::*;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
|
use testutils::*;
|
||||||
|
|
||||||
const ROUTE: PlatformRoute = PlatformRoute::EUW1;
|
const ROUTE: PlatformRoute = PlatformRoute::EUW1;
|
||||||
|
|
||||||
async_tests!{
|
async_tests! {
|
||||||
my_runner {
|
my_runner {
|
||||||
// Champion Mastery tests.
|
// 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 {
|
championmastery_getscore_ma5tery: async {
|
||||||
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
|
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
|
||||||
let sum = sum.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get summoner".to_owned())?;
|
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 p = RIOT_API.champion_mastery_v4().get_champion_mastery_score_by_puuid(ROUTE, &sum.puuid);
|
||||||
let s = p.await.map_err(|e| e.to_string())?;
|
let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?;
|
||||||
rassert!((969..=1000).contains(&s), "Unexpected ma5tery score: {}.", s);
|
rassert!((969..=1000).contains(&s), "Unexpected ma5tery score: {}.", s);
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
championmastery_getall_ma5tery: async {
|
championmastery_getall_ma5tery: async {
|
||||||
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
|
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
|
||||||
let sum = sum.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get summoner".to_owned())?;
|
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_all_champion_masteries(ROUTE, &*sum.id);
|
let p = RIOT_API.champion_mastery_v4().get_all_champion_masteries_by_puuid(ROUTE, &sum.puuid);
|
||||||
let s = p.await.map_err(|e| e.to_string())?;
|
let s = p.await.map_err(|e| format!("Error getting all champion masteries: {}", e))?;
|
||||||
rassert!(s.len() >= 142, "Expected masteries: {}.", s.len());
|
rassert!(s.len() >= 142, "Expected masteries: {}.", s.len());
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: https://github.com/RiotGames/developer-relations/issues/602
|
// https://github.com/RiotGames/developer-relations/issues/602
|
||||||
// spectator_combo: async {
|
spectator_combo: async {
|
||||||
// let featured_p = RIOT_API.spectator_v4().get_featured_games(ROUTE);
|
let featured_p = RIOT_API.spectator_v4().get_featured_games(ROUTE);
|
||||||
// let featured = featured_p.await.map_err(|e| e.to_string())?;
|
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_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_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 get summoner".to_owned())?;
|
// let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to find summoner".to_owned())?;
|
||||||
|
|
||||||
// let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner.id);
|
let featured_game = &featured.game_list[0];
|
||||||
// let livegame_o = livegame_p.await.map_err(|e| e.to_string())?;
|
let participant = &featured_game.participants[0];
|
||||||
// if let Some(livegame) = livegame_o {
|
let summoner_id = participant.summoner_id.as_ref()
|
||||||
// let participant_match = livegame.participants.iter().find(|p| p.summoner_name == *summoner_name);
|
.ok_or_else(|| format!("Summoner in spectator featured game missing summoner ID: {}", &participant.summoner_name))?;
|
||||||
// rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", summoner_name);
|
|
||||||
// }
|
|
||||||
// Ok(())
|
|
||||||
// },
|
|
||||||
|
|
||||||
// // TFT tests.
|
let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner_id);
|
||||||
// tftleaguev1_getchallengerleague: async {
|
let livegame_o = livegame_p.await.map_err(|e| e.to_string())?;
|
||||||
// let p = RIOT_API.tft_league_v1().get_challenger_league(Region::EUW);
|
if let Some(livegame) = livegame_o {
|
||||||
// let l = p.await.map_err(|e| e.to_string())?;
|
let participant_match = livegame.participants.iter().find(|p| p.summoner_name == participant.summoner_name);
|
||||||
// rassert!(l.entries.len() > 10, "Expected a few challenger players, got: {}.", l.entries.len());
|
rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", &participant.summoner_name);
|
||||||
// Ok(())
|
}
|
||||||
// },
|
Ok(())
|
||||||
// tftmatchv1_getmatch: async {
|
},
|
||||||
// let p = RIOT_API.tft_match_v1().get_match(Region::EUROPE, "EUW1_4568680990");
|
|
||||||
// let _m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT match.".to_owned())?;
|
|
||||||
// Ok(())
|
|
||||||
// },
|
|
||||||
// tftsummonerv1_getbyname: async {
|
|
||||||
// let p = RIOT_API.tft_summoner_v1().get_by_summoner_name(Region::EUW, "相当猥琐");
|
|
||||||
// let _s = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT summoner.".to_owned())?;
|
|
||||||
// Ok(())
|
|
||||||
// },
|
|
||||||
// tftsummonerv1_getbyname_none: async {
|
|
||||||
// let p = RIOT_API.tft_summoner_v1().get_by_summoner_name(Region::EUW, "this summoner does not exist");
|
|
||||||
// rassert!(p.await.map_err(|e| e.to_string())?.is_none());
|
|
||||||
// Ok(())
|
|
||||||
// },
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
#![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::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! {
|
||||||
|
my_runner {
|
||||||
|
tftmatchv1_get_list: async {
|
||||||
|
tft_match_v1_get(ROUTE.to_regional(), TFT_MATCHES).await
|
||||||
|
},
|
||||||
|
|
||||||
|
// // Don't have acecess to tft-status-v1.
|
||||||
|
// tftstatusv1_getplatformdata: async {
|
||||||
|
// let p = RIOT_API.tft_status_v1().get_platform_data(ROUTE);
|
||||||
|
// let _s = p.await.map_err(|e| e.to_string())?;
|
||||||
|
// Ok(())
|
||||||
|
// },
|
||||||
|
tftleaguev1_gettopratedladder: async {
|
||||||
|
let p = RIOT_API.tft_league_v1().get_top_rated_ladder(ROUTE, QueueType::RANKED_TFT_TURBO);
|
||||||
|
let l = p.await.map_err(|e| e.to_string())?;
|
||||||
|
rassert!(l.len() > 10, "Expected a few ranked players, got: {}.", l.len());
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
tftmatchv1_getmatch: async {
|
||||||
|
let p = RIOT_API.tft_match_v1().get_match(ROUTE.to_regional(), "EUW1_6455483163");
|
||||||
|
let _m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT match.".to_owned())?;
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
tftsummonerv1_getbyname: async {
|
||||||
|
let p = RIOT_API.tft_summoner_v1().get_by_summoner_name(ROUTE, "相当猥琐");
|
||||||
|
let _s = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT summoner.".to_owned())?;
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
tftsummonerv1_getbyname_none: async {
|
||||||
|
let p = RIOT_API.tft_summoner_v1().get_by_summoner_name(ROUTE, "this summoner does not exist");
|
||||||
|
rassert!(p.await.map_err(|e| e.to_string())?.is_none());
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
// Get top rated player, get some of their matches.
|
||||||
|
tft_combo: async {
|
||||||
|
let top_players = RIOT_API.tft_league_v1().get_top_rated_ladder(ROUTE, QueueType::RANKED_TFT_TURBO);
|
||||||
|
let top_players = top_players.await.map_err(|e| e.to_string())?;
|
||||||
|
rassert!(!top_players.is_empty());
|
||||||
|
let top_player_entry = &top_players[0];
|
||||||
|
let top_player = RIOT_API.tft_summoner_v1().get_by_summoner_id(ROUTE, &top_player_entry.summoner_id);
|
||||||
|
let top_player = top_player.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("Top player is {} with `puuid` {}.", top_player.name, top_player.puuid);
|
||||||
|
let match_ids = RIOT_API.tft_match_v1().get_match_ids_by_puuid(
|
||||||
|
ROUTE.to_regional(), &top_player.puuid, Some(10), None, None, None);
|
||||||
|
let match_ids = match_ids.await.map_err(|e| e.to_string())?;
|
||||||
|
tft_match_v1_get(ROUTE.to_regional(), &*match_ids).await?;
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,7 +36,7 @@ async_tests!{
|
||||||
REGION, &leagueentry.summoner_id);
|
REGION, &leagueentry.summoner_id);
|
||||||
summonerfuture.await
|
summonerfuture.await
|
||||||
.map_err(|e| e.to_string())?
|
.map_err(|e| e.to_string())?
|
||||||
.ok_or(format!("Failed to get summoner_id {}.",
|
.ok_or(format!("Failed to find summoner_id {}.",
|
||||||
leagueentry.summoner_id))
|
leagueentry.summoner_id))
|
||||||
});
|
});
|
||||||
future::join_all(summoners).await
|
future::join_all(summoners).await
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::RIOT_API;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
|
use testutils::RIOT_API;
|
||||||
|
|
||||||
const ROUTE: PlatformRoute = PlatformRoute::LA1;
|
const ROUTE: PlatformRoute = PlatformRoute::LA1;
|
||||||
|
|
||||||
|
@ -40,7 +38,7 @@ async_tests! {
|
||||||
// Spot check 10% for `player-data`.
|
// Spot check 10% for `player-data`.
|
||||||
for entry in leaderboard.iter().step_by(10)
|
for entry in leaderboard.iter().step_by(10)
|
||||||
{
|
{
|
||||||
let player_data = RIOT_API.lol_challenges_v1().get_player_data(ROUTE, &*entry.puuid)
|
let _player_data = RIOT_API.lol_challenges_v1().get_player_data(ROUTE, &entry.puuid)
|
||||||
.await.map_err(|e| format!("Failed to get player data PUUID {}: {}", entry.puuid, e))?;
|
.await.map_err(|e| format!("Failed to get player data PUUID {}: {}", entry.puuid, e))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,30 +3,33 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::*;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
use riven::models::summoner_v4::*;
|
use riven::models::summoner_v4::*;
|
||||||
|
use testutils::*;
|
||||||
|
|
||||||
fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
|
fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
|
||||||
rassert_eq!(s1.name, s2.name, "Names didn't match {}.", "");
|
rassert_eq!(s1.name, s2.name, "Names didn't match {}.", "");
|
||||||
rassert_eq!(s1.id, s2.id, "SummonerId didn't match {}.", "");
|
rassert_eq!(s1.id, s2.id, "SummonerId didn't match {}.", "");
|
||||||
rassert_eq!(s1.account_id, s2.account_id, "AccountId didn't match {}.", "");
|
rassert_eq!(
|
||||||
|
s1.account_id,
|
||||||
|
s2.account_id,
|
||||||
|
"AccountId didn't match {}.",
|
||||||
|
""
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
const ROUTE: PlatformRoute = PlatformRoute::NA1;
|
const ROUTE: PlatformRoute = PlatformRoute::NA1;
|
||||||
|
|
||||||
async_tests!{
|
async_tests! {
|
||||||
my_runner {
|
my_runner {
|
||||||
// Summoner tests.
|
// Summoner tests.
|
||||||
summoner_double: async {
|
summoner_double: async {
|
||||||
let l1p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "lug nuts k");
|
let l1p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "lug nuts k");
|
||||||
let l2p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "lugnuts k");
|
let l2p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "lugnuts k");
|
||||||
let l1 = l1p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get l1".to_owned())?;
|
let l1 = l1p.await.map_err(|e| e.to_string())?.ok_or_else(|| "'lug nuts k' not found!".to_owned())?;
|
||||||
let l2 = l2p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get l2".to_owned())?;
|
let l2 = l2p.await.map_err(|e| e.to_string())?.ok_or_else(|| "'lugnuts k' not found!".to_owned())?;
|
||||||
validate_summoners(l1, l2)?;
|
validate_summoners(l1, l2)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
@ -44,20 +47,17 @@ async_tests!{
|
||||||
leagueexp_get: async {
|
leagueexp_get: async {
|
||||||
let p = RIOT_API.league_exp_v4().get_league_entries(ROUTE, QueueType::RANKED_SOLO_5x5, Tier::CHALLENGER, Division::I, None);
|
let p = RIOT_API.league_exp_v4().get_league_entries(ROUTE, QueueType::RANKED_SOLO_5x5, Tier::CHALLENGER, Division::I, None);
|
||||||
let d = p.await.map_err(|e| e.to_string())?;
|
let d = p.await.map_err(|e| e.to_string())?;
|
||||||
rassert!(!d.is_empty(), "Challenger shouldn't be empty.");
|
if d.is_empty() {
|
||||||
|
eprintln!("Off-season, challenger league is empty.");
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
// TO TEST THIS BUG: https://github.com/RiotGames/developer-relations/issues/572.
|
champion_mastery_v4: async {
|
||||||
league_getforsummoner_tftbug: async {
|
let summoner = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "LugnutsK");
|
||||||
let summoner_fut = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "TheNicoNi");
|
let summoner = summoner.await.map_err(|e| e.to_string())?.ok_or_else(|| "'LugnutsK' not found!".to_owned())?;
|
||||||
let summoner = summoner_fut.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get \"TheNicoNi\"".to_owned())?;
|
let masteries = RIOT_API.champion_mastery_v4().get_all_champion_masteries_by_puuid(ROUTE, &summoner.puuid);
|
||||||
let league_fut = RIOT_API.league_v4().get_league_entries_for_summoner(ROUTE, &*summoner.id);
|
let masteries = masteries.await.map_err(|e| e.to_string())?;
|
||||||
let league = league_fut.await.map_err(|e| e.to_string())?;
|
rassert!(74 <= masteries.len());
|
||||||
rassert_eq!(1, league.len()); // BRITTLE!
|
|
||||||
#[allow(deprecated)]
|
|
||||||
{
|
|
||||||
rassert_eq!(league[0].queue_type, QueueType::RANKED_TFT_PAIRS);
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -165,5 +165,12 @@ async_tests!{
|
||||||
assert!(team.is_none());
|
assert!(team.is_none());
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
|
status: async {
|
||||||
|
let p = RIOT_API.lol_status_v4().get_platform_data(ROUTE);
|
||||||
|
let status = p.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("{:?}", status);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#![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::PH2;
|
||||||
|
|
||||||
|
async_tests! {
|
||||||
|
my_runner {
|
||||||
|
status: async {
|
||||||
|
let p = RIOT_API.lol_status_v4().get_platform_data(ROUTE);
|
||||||
|
let status = p.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("{:?}", status);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#![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::SG2;
|
||||||
|
|
||||||
|
async_tests! {
|
||||||
|
my_runner {
|
||||||
|
status: async {
|
||||||
|
let p = RIOT_API.lol_status_v4().get_platform_data(ROUTE);
|
||||||
|
let status = p.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("{:?}", status);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#![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::TH2;
|
||||||
|
|
||||||
|
async_tests! {
|
||||||
|
my_runner {
|
||||||
|
status: async {
|
||||||
|
let p = RIOT_API.lol_status_v4().get_platform_data(ROUTE);
|
||||||
|
let status = p.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("{:?}", status);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,17 +3,14 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::RIOT_API;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
use riven::models::summoner_v4::Summoner;
|
use riven::models::summoner_v4::Summoner;
|
||||||
|
use testutils::RIOT_API;
|
||||||
|
|
||||||
const ROUTE: PlatformRoute = PlatformRoute::TR1;
|
const ROUTE: PlatformRoute = PlatformRoute::TR1;
|
||||||
|
|
||||||
|
async_tests! {
|
||||||
async_tests!{
|
|
||||||
my_runner {
|
my_runner {
|
||||||
league_summoner_bulk_test: async {
|
league_summoner_bulk_test: async {
|
||||||
let p = RIOT_API.league_v4().get_challenger_league(ROUTE, QueueType::RANKED_SOLO_5x5);
|
let p = RIOT_API.league_v4().get_challenger_league(ROUTE, QueueType::RANKED_SOLO_5x5);
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
|
||||||
|
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
|
||||||
|
|
||||||
|
mod async_tests;
|
||||||
|
mod testutils;
|
||||||
|
use testutils::*;
|
||||||
|
|
||||||
|
use colored::*;
|
||||||
|
|
||||||
|
use riven::consts::*;
|
||||||
|
|
||||||
|
const ROUTE: PlatformRoute = PlatformRoute::TW2;
|
||||||
|
|
||||||
|
async_tests!{
|
||||||
|
my_runner {
|
||||||
|
// TODO: for some reason status is not available on TW2...
|
||||||
|
// https://developer.riotgames.com/apis#lol-status-v4/GET_getPlatformData
|
||||||
|
status: async {
|
||||||
|
let p = RIOT_API.lol_status_v4().get_platform_data(ROUTE);
|
||||||
|
let status = p.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("{:?}", status);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,42 +3,40 @@
|
||||||
|
|
||||||
mod async_tests;
|
mod async_tests;
|
||||||
mod testutils;
|
mod testutils;
|
||||||
use testutils::RIOT_API;
|
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use riven::consts::*;
|
use riven::consts::*;
|
||||||
|
use testutils::RIOT_API;
|
||||||
|
|
||||||
const ROUTE: ValPlatformRoute = ValPlatformRoute::LATAM;
|
const ROUTE: ValPlatformRoute = ValPlatformRoute::LATAM;
|
||||||
|
|
||||||
|
async_tests! {
|
||||||
async_tests!{
|
|
||||||
my_runner {
|
my_runner {
|
||||||
val_content_ranked_test: async {
|
val_content_ranked_test: async {
|
||||||
let p = RIOT_API.val_content_v1().get_content(ROUTE, Some("zh-CN"));
|
let p = RIOT_API.val_content_v1().get_content(ROUTE, Some("zh-CN"));
|
||||||
let contents = p.await.map_err(|e| e.to_string())?;
|
let contents = p.await.map_err(|e| format!("Failed to get content: {}", e))?;
|
||||||
|
|
||||||
// Find the LAST active act, via `.rev().find(...)`.
|
// Find the LAST active act, via `.rev().find(...)`.
|
||||||
let _act = contents.acts.iter().rev().find(|act| act.is_active)
|
// Added filter when parent id is 0000... as there are multiple that are active, the last active seems to be episode 5
|
||||||
|
// Not sure if this a bandaid fix
|
||||||
|
let act = contents.acts.iter().rev().find(|act| act.is_active && act.parent_id != Some("00000000-0000-0000-0000-000000000000".to_string()))
|
||||||
.ok_or(format!("No active acts of {} found.", contents.acts.len()))?;
|
.ok_or(format!("No active acts of {} found.", contents.acts.len()))?;
|
||||||
|
|
||||||
// TODO: RE-ENABLE THIS, figure out why it is failing. Seems to be a Riot issue.
|
let p = RIOT_API.val_ranked_v1().get_leaderboard(ROUTE, &act.id, None, None);
|
||||||
// let p = RIOT_API.val_ranked_v1().get_leaderboard(ROUTE, &act.id, None, None);
|
let leaderboard = p.await.map_err(|e| e.to_string())?
|
||||||
// let leaderboard = p.await.map_err(|e| e.to_string())?
|
.ok_or(format!("Failed to get act leaderboard {} {}.", act.id, act.name))?;
|
||||||
// .ok_or(format!("Failed to get act leaderboard {} {}.", act.id, act.name))?;
|
|
||||||
|
|
||||||
// rassert_eq!(act.id, leaderboard.act_id);
|
rassert_eq!(act.id, leaderboard.act_id);
|
||||||
|
|
||||||
// for (i, p) in leaderboard.players.iter().take(10).enumerate() {
|
for (i, p) in leaderboard.players.iter().take(10).enumerate() {
|
||||||
// rassert_eq!(i + 1, p.leaderboard_rank as usize);
|
rassert_eq!(i + 1, p.leaderboard_rank as usize);
|
||||||
// println!("{:>2}: {:>4} {:<22} ({} wins)",
|
println!("{:>2}: {:>4} {:<22} ({} wins)",
|
||||||
// p.leaderboard_rank,
|
p.leaderboard_rank,
|
||||||
// p.ranked_rating,
|
p.ranked_rating,
|
||||||
// format!("{}#{}",
|
format!("{}#{}",
|
||||||
// p.game_name.as_deref().unwrap_or("<NONE>"),
|
p.game_name.as_deref().unwrap_or("<NONE>"),
|
||||||
// p.tag_line.as_deref().unwrap_or("<NONE>")),
|
p.tag_line.as_deref().unwrap_or("<NONE>")),
|
||||||
// p.number_of_wins);
|
p.number_of_wins);
|
||||||
// }
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#![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::VN2;
|
||||||
|
|
||||||
|
async_tests! {
|
||||||
|
my_runner {
|
||||||
|
status: async {
|
||||||
|
let p = RIOT_API.lol_status_v4().get_platform_data(ROUTE);
|
||||||
|
let status = p.await.map_err(|e| e.to_string())?;
|
||||||
|
println!("{:?}", status);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use std::future::Future;
|
||||||
|
|
||||||
use riven::consts::RegionalRoute;
|
use lazy_static::lazy_static;
|
||||||
|
use riven::consts::{PlatformRoute, QueueType, RegionalRoute};
|
||||||
use riven::{RiotApi, RiotApiConfig};
|
use riven::{RiotApi, RiotApiConfig};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
@ -15,16 +16,115 @@ lazy_static! {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod ids {
|
pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(), String> {
|
||||||
pub const SUMMONER_ID_LUGNUTSK: &str = "SBM8Ubipo4ge2yj7bhEzL7yvV0C9Oc1XA2l6v5okGMA_nCw";
|
const NUM_MATCHES: usize = 10;
|
||||||
pub const SUMMONER_ID_MA5TERY: &str = "IbC4uyFEEW3ZkZw6FZF4bViw3P1EynclAcI6-p-vCpI99Ec";
|
|
||||||
pub const SUMMONER_ID_C9SNEAKY: &str = "ghHSdADqgxKwcRl_vWndx6wKiyZx0xKQv-LOhOcU5LU";
|
let challenger_future = RIOT_API
|
||||||
pub const ACCOUNT_ID_C9SNEAKY: &str = "ML_CcLT94UUHp1iDvXOXCidfmzzPrk_Jbub1f_INhw";
|
.league_v4()
|
||||||
pub const ACCOUNT_ID_LUGNUTSK: &str = "iheZF2uJ50S84Hfq6Ob8GNlJAUmBmac-EsEEWBJjD01q1jQ";
|
.get_challenger_league(route, QueueType::RANKED_SOLO_5x5);
|
||||||
|
let challenger_league = challenger_future
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to get challenger league: {}", e))?;
|
||||||
|
|
||||||
|
let Some(queue) = challenger_league.queue else {
|
||||||
|
assert!(challenger_league.entries.is_empty());
|
||||||
|
eprintln!("Off-season, challenger league is empty.");
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
|
|
||||||
|
if QueueType::RANKED_SOLO_5x5 != queue {
|
||||||
|
return Err(format!("Unexpected `queue`: {:?}", queue));
|
||||||
|
}
|
||||||
|
if challenger_league.entries.is_empty() {
|
||||||
|
return Err("Challenger league is unexpectedly empty!".to_owned());
|
||||||
|
}
|
||||||
|
|
||||||
|
let match_ids_futures = challenger_league
|
||||||
|
.entries
|
||||||
|
.iter()
|
||||||
|
.take(5)
|
||||||
|
.map(|entry| async move {
|
||||||
|
let summoner_future = RIOT_API
|
||||||
|
.summoner_v4()
|
||||||
|
.get_by_summoner_id(route, &entry.summoner_id);
|
||||||
|
let summoner_info = summoner_future
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to find summoner info: {}", e))?;
|
||||||
|
|
||||||
|
let match_ids_future = RIOT_API.match_v5().get_match_ids_by_puuid(
|
||||||
|
route.to_regional(),
|
||||||
|
&summoner_info.puuid,
|
||||||
|
Some(5),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
let match_ids = match_ids_future
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to find summoner match IDs: {}", e))?;
|
||||||
|
Ok(match_ids) as Result<_, String>
|
||||||
|
});
|
||||||
|
|
||||||
|
let match_ids = futures::future::try_join_all(match_ids_futures).await?;
|
||||||
|
|
||||||
|
let mut match_ids: Vec<String> = match_ids.into_iter().flatten().collect();
|
||||||
|
match_ids.sort_unstable_by(|a, b| a.cmp(b).reverse()); // Sort descending, so latest are first.
|
||||||
|
|
||||||
|
let _ = tokio::try_join!(
|
||||||
|
match_v5_get(route.to_regional(), match_ids.iter().take(NUM_MATCHES)),
|
||||||
|
match_v5_get_timeline(route.to_regional(), match_ids.iter().take(NUM_MATCHES)),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn match_v5_get(route: RegionalRoute, matches: &[&'static str]) -> Result<(), String> {
|
pub async fn tft_match_v1_get(
|
||||||
for &matche in matches {
|
route: RegionalRoute,
|
||||||
|
matches: impl IntoIterator<Item = impl AsRef<str>>,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
let futures = matches.into_iter().map(|matche| async move {
|
||||||
|
let matche = matche.as_ref();
|
||||||
|
let p = RIOT_API.tft_match_v1().get_match(route, matche);
|
||||||
|
let m = p
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to get match {}: {:?}", matche, e))?
|
||||||
|
.ok_or(format!("Match {} not found.", matche))?;
|
||||||
|
|
||||||
|
if matche != &*m.metadata.match_id {
|
||||||
|
return Err(format!(
|
||||||
|
"Bad match id? Sent {}, received {}.",
|
||||||
|
matche, m.metadata.match_id
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if m.metadata.participants.is_empty() {
|
||||||
|
return Err(format!(
|
||||||
|
"Match {} should have participants (metadata).",
|
||||||
|
matche
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if m.metadata.participants.len() != m.info.participants.len() {
|
||||||
|
return Err(format!(
|
||||||
|
"Match {} participants do not line up with participant UUIDs.",
|
||||||
|
matche
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if m.info.participants.is_empty() {
|
||||||
|
return Err(format!("Match {} should have participants (info).", matche));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
futures::future::try_join_all(futures).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn match_v5_get(
|
||||||
|
route: RegionalRoute,
|
||||||
|
matches: impl IntoIterator<Item = impl AsRef<str>>,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
let futures = matches.into_iter().map(|matche| async move {
|
||||||
|
let matche = matche.as_ref();
|
||||||
let p = RIOT_API.match_v5().get_match(route, matche);
|
let p = RIOT_API.match_v5().get_match(route, matche);
|
||||||
let m = p
|
let m = p
|
||||||
.await
|
.await
|
||||||
|
@ -38,26 +138,35 @@ pub async fn match_v5_get(route: RegionalRoute, matches: &[&'static str]) -> Res
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if m.metadata.participants.is_empty() {
|
if m.metadata.participants.is_empty() {
|
||||||
return Err("Match should have participants.".to_owned());
|
return Err(format!("Match {} should have participants.", matche));
|
||||||
}
|
}
|
||||||
if m.metadata.participants.len() != m.info.participants.len() {
|
if m.metadata.participants.len() != m.info.participants.len() {
|
||||||
return Err("Match participants do not line up with participant UUIDs.".to_owned());
|
// Sometimes only returns match IDs for one team? JP1_391732436
|
||||||
|
// Do not return error.
|
||||||
|
eprintln!(
|
||||||
|
"Match {} participants do not line up with participant UUIDs.",
|
||||||
|
matche
|
||||||
|
);
|
||||||
}
|
}
|
||||||
for participant in &m.info.participants {
|
for participant in &m.info.participants {
|
||||||
participant.champion().map_err(|e| format!("Failed to determine champion: {}", e))?;
|
participant
|
||||||
|
.champion()
|
||||||
|
.map_err(|e| format!("Failed to determine match {} champion: {}", matche, e))?;
|
||||||
}
|
}
|
||||||
if m.info.teams.is_empty() {
|
if m.info.teams.is_empty() {
|
||||||
return Err("Match should have teams.".to_owned());
|
return Err(format!("Match {} should have teams.", matche));
|
||||||
}
|
}
|
||||||
}
|
Ok(())
|
||||||
Ok(())
|
});
|
||||||
|
join_all_future_errs(futures).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn match_v5_get_timeline(
|
pub async fn match_v5_get_timeline(
|
||||||
route: RegionalRoute,
|
route: RegionalRoute,
|
||||||
matches: &[&'static str],
|
matches: impl IntoIterator<Item = impl AsRef<str>>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
for &matche in matches {
|
let futures = matches.into_iter().map(|matche| async move {
|
||||||
|
let matche = matche.as_ref();
|
||||||
let p = RIOT_API.match_v5().get_timeline(route, matche);
|
let p = RIOT_API.match_v5().get_timeline(route, matche);
|
||||||
let m = p
|
let m = p
|
||||||
.await
|
.await
|
||||||
|
@ -70,16 +179,30 @@ pub async fn match_v5_get_timeline(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if m.metadata.participants.is_empty() {
|
if m.metadata.participants.is_empty() {
|
||||||
return Err("Match should have participants.".to_owned());
|
return Err(format!("Match {} should have participants.", matche));
|
||||||
}
|
}
|
||||||
if let Some(game_id) = m.info.game_id {
|
if let Some(game_id) = m.info.game_id {
|
||||||
if matche[(matche.find('_').unwrap() + 1)..] != game_id.to_string() {
|
if matche[(matche.find('_').unwrap() + 1)..] != game_id.to_string() {
|
||||||
return Err("Match number ID should match.".to_owned());
|
return Err(format!("Match {} number ID should match.", matche));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.info.frames.is_empty() {
|
if m.info.frames.is_empty() {
|
||||||
return Err("Match timleine should have frames.".to_owned());
|
return Err(format!("Match {} timleine should have frames.", matche));
|
||||||
}
|
}
|
||||||
}
|
Ok(())
|
||||||
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(()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
|
@ -0,0 +1,10 @@
|
||||||
|
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
|
|
@ -1,12 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -euxo pipefail
|
||||||
|
|
||||||
# Ensure stable builds.
|
# Ensure stable builds.
|
||||||
cargo +stable test --no-run
|
cargo +stable check --all-targets
|
||||||
cargo +stable test --no-run --features tracing
|
cargo +stable check --all-targets --features tracing
|
||||||
|
|
||||||
# Ensure nightly builds.
|
# Ensure nightly builds.
|
||||||
cargo +nightly test --no-run --features nightly,tracing
|
cargo check --all-targets --features nightly,tracing
|
||||||
|
cargo build --all-targets --features nightly,deny-unknown
|
||||||
|
|
||||||
# Run tests on nightly.
|
# Run nightly tests.
|
||||||
RGAPI_KEY="$(cat apikey.txt)" RUST_BACKTRACE=1 RUST_LOG=riven=trace cargo +nightly test --features nightly,deny-unknown-fields -- --nocapture
|
bash test.bash
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
RGAPI_KEY="$(cat apikey.txt)" RUST_BACKTRACE=1 RUST_LOG=riven=trace cargo +nightly test --features nightly,deny-unknown-fields $1 -- --nocapture
|
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
|
||||||
|
|
Loading…
Reference in New Issue