forked from mirror/Riven
1
0
Fork 0

Regen for Naafiri, removed champion-mastery-v4 by-puuid endpoints, off-season nullables

emerald
Mingwei Samuel 2023-07-19 13:51:58 -07:00
parent d15d43797e
commit 2aa493abfe
6 changed files with 56 additions and 122 deletions

View File

@ -97,6 +97,7 @@ newtype_enum! {
/// `MISS_FORTUNE` | "Miss Fortune" | "MissFortune" | 21
/// `MORDEKAISER` | "Mordekaiser" | "Mordekaiser" | 82
/// `MORGANA` | "Morgana" | "Morgana" | 25
/// `NAAFIRI` | "Naafiri" | "Naafiri" | 950
/// `NAMI` | "Nami" | "Nami" | 267
/// `NASUS` | "Nasus" | "Nasus" | 75
/// `NAUTILUS` | "Nautilus" | "Nautilus" | 111
@ -345,6 +346,8 @@ newtype_enum! {
MORDEKAISER = 82,
/// `25`.
MORGANA = 25,
/// `950`.
NAAFIRI = 950,
/// `267`.
NAMI = 267,
/// `75`.
@ -597,6 +600,7 @@ impl Champion {
Self::MISS_FORTUNE => Some("Miss Fortune"),
Self::MORDEKAISER => Some("Mordekaiser"),
Self::MORGANA => Some("Morgana"),
Self::NAAFIRI => Some("Naafiri"),
Self::NAMI => Some("Nami"),
Self::NASUS => Some("Nasus"),
Self::NAUTILUS => Some("Nautilus"),
@ -784,6 +788,7 @@ impl Champion {
Self::MISS_FORTUNE => Some("MissFortune"),
Self::MORDEKAISER => Some("Mordekaiser"),
Self::MORGANA => Some("Morgana"),
Self::NAAFIRI => Some("Naafiri"),
Self::NAMI => Some("Nami"),
Self::NASUS => Some("Nasus"),
Self::NAUTILUS => Some("Nautilus"),
@ -1009,6 +1014,7 @@ impl std::str::FromStr for Champion {
/* MISS */ [ 'M', 'I', 'S', 'S'] => Ok(Champion::MISS_FORTUNE),
/* MORD */ [ 'M', 'O', 'R', 'D'] => Ok(Champion::MORDEKAISER),
/* MORG */ [ 'M', 'O', 'R', 'G'] => Ok(Champion::MORGANA),
/* NAAF */ [ 'N', 'A', 'A', 'F'] => Ok(Champion::NAAFIRI),
/* NAMI */ [ 'N', 'A', 'M', 'I'] => Ok(Champion::NAMI),
/* NASU */ [ 'N', 'A', 'S', 'U'] => Ok(Champion::NASUS),
/* NAUT */ [ 'N', 'A', 'U', 'T'] => Ok(Champion::NAUTILUS),

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba
// Version 7d71fe40a50ce14ad12ed6db791a4d0bae0f810e
//! Automatically generated endpoint handles.
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
@ -372,66 +372,6 @@ pub struct ChampionMasteryV4<'a> {
base: &'a RiotApi,
}
impl<'a> ChampionMasteryV4<'a> {
/// Get all champion mastery entries sorted by number of champion points descending.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// # Riot Developer API Reference
/// <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.
pub fn get_all_champion_masteries_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}", encrypted_puuid));
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getAllChampionMasteriesByPUUID", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getAllChampionMasteriesByPUUID"));
future
}
/// Get a champion mastery by puuid and champion ID.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// * `champion_id` (required, in path) - Champion ID to retrieve Champion Mastery.
/// # Riot Developer API Reference
/// <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.
pub fn get_champion_mastery_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str, champion_id: &str)
-> impl Future<Output = Result<champion_mastery_v4::ChampionMastery>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-puuid/{}/by-champion/{}", encrypted_puuid, champion_id));
let future = self.base.execute_val::<champion_mastery_v4::ChampionMastery>("champion-mastery-v4.getChampionMasteryByPUUID", route_str, request);
#[cfg(feature = "tracing")]
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 mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getTopChampionMasteriesByPUUID", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteriesByPUUID"));
future
}
/// Get all champion mastery entries sorted by number of champion points descending,
/// # Parameters
/// * `route` - Route to query.
@ -492,25 +432,6 @@ impl<'a> ChampionMasteryV4<'a> {
future
}
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_puuid` (required, in path)
/// # Riot Developer API Reference
/// <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.
pub fn get_champion_mastery_score_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/scores/by-puuid/{}", encrypted_puuid));
let future = self.base.execute_val::<i32>("champion-mastery-v4.getChampionMasteryScoreByPUUID", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getChampionMasteryScoreByPUUID"));
future
}
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
/// # Parameters
/// * `route` - Route to query.

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba
// Version 7d71fe40a50ce14ad12ed6db791a4d0bae0f810e
//! Metadata about the Riot API and Riven.
//!
@ -15,18 +15,14 @@
/// Metadata for endpoints. Each tuple corresponds to one endpoint and contains
/// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID.
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 83] = [
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 79] = [
(reqwest::Method::GET, "/riot/account/v1/accounts/by-puuid/{puuid}", "account-v1.getByPuuid"),
(reqwest::Method::GET, "/riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine}", "account-v1.getByRiotId"),
(reqwest::Method::GET, "/riot/account/v1/accounts/me", "account-v1.getByAccessToken"),
(reqwest::Method::GET, "/riot/account/v1/active-shards/by-game/{game}/by-puuid/{puuid}", "account-v1.getActiveShard"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}", "champion-mastery-v4.getAllChampionMasteriesByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}/by-champion/{championId}", "champion-mastery-v4.getChampionMasteryByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-puuid/{encryptedPUUID}/top", "champion-mastery-v4.getTopChampionMasteriesByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getAllChampionMasteries"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/by-champion/{championId}", "champion-mastery-v4.getChampionMastery"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/top", "champion-mastery-v4.getTopChampionMasteries"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-puuid/{encryptedPUUID}", "champion-mastery-v4.getChampionMasteryScoreByPUUID"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getChampionMasteryScore"),
(reqwest::Method::GET, "/lol/platform/v3/champion-rotations", "champion-v3.getChampionInfo"),
(reqwest::Method::GET, "/lol/clash/v1/players/by-puuid/{encryptedPUUID}", "clash-v1.getPlayersByPUUID"),

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 54c6fd7144adb63e54515df33a6a557eed0f17ba
// Version 7d71fe40a50ce14ad12ed6db791a4d0bae0f810e
#![allow(missing_docs)]
@ -269,15 +269,18 @@ pub mod league_v4 {
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LeagueList {
#[serde(rename = "leagueId")]
pub league_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub league_id: Option<String>,
#[serde(rename = "entries")]
pub entries: std::vec::Vec<LeagueItem>,
#[serde(rename = "tier")]
pub tier: crate::consts::Tier,
#[serde(rename = "name")]
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "queue")]
pub queue: crate::consts::QueueType,
#[serde(skip_serializing_if = "Option::is_none")]
pub queue: Option<crate::consts::QueueType>,
}
/// LeagueItem data object.
#[derive(Clone, Debug)]

View File

@ -49,7 +49,9 @@ async_tests! {
leagueexp_get: async {
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())?;
rassert!(!d.is_empty(), "Challenger shouldn't be empty.");
if d.is_empty() {
eprintln!("Off-season, challenger league is empty.");
}
Ok(())
},
champion_mastery_v4: async {

View File

@ -25,8 +25,14 @@ pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(),
.await
.map_err(|e| format!("Failed to get challenger league: {}", e))?;
if QueueType::RANKED_SOLO_5x5 != challenger_league.queue {
return Err(format!("Unexpected `queue`: {}", challenger_league.queue));
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());