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

This commit is contained in:
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)]
@ -403,9 +406,9 @@ pub mod lol_challenges_v1 {
}
/// State data object.
/// # Description
/// DISABLED - not visible and not calculated,<br>
/// HIDDEN - not visible, but calculated,<br>
/// ENABLED - visible and calculated,<br>
/// DISABLED - not visible and not calculated,<br>
/// HIDDEN - not visible, but calculated,<br>
/// ENABLED - visible and calculated,<br>
/// ARCHIVED - visible, but not calculated
///
/// Note: This struct is automatically generated
@ -416,7 +419,7 @@ pub mod lol_challenges_v1 {
}
/// Tracking data object.
/// # Description
/// LIFETIME - stats are incremented without reset,<br>
/// LIFETIME - stats are incremented without reset,<br>
/// SEASON - stats are accumulated by season and reset at the beginning of new season
///
/// Note: This struct is automatically generated
@ -439,15 +442,15 @@ pub mod lol_challenges_v1 {
}
/// Level data object.
/// # Description
/// 0 NONE,<br>
/// 1 IRON,<br>
/// 2 BRONZE,<br>
/// 3 SILVER,<br>
/// 4 GOLD,<br>
/// 5 PLATINUM,<br>
/// 6 DIAMOND,<br>
/// 7 MASTER,<br>
/// 8 GRANDMASTER,<br>
/// 0 NONE,<br>
/// 1 IRON,<br>
/// 2 BRONZE,<br>
/// 3 SILVER,<br>
/// 4 GOLD,<br>
/// 5 PLATINUM,<br>
/// 6 DIAMOND,<br>
/// 7 MASTER,<br>
/// 8 GRANDMASTER,<br>
/// 9 CHALLENGER
///
/// Note: This struct is automatically generated
@ -1840,7 +1843,7 @@ pub mod match_v5 {
pub real_timestamp: Option<i64>,
#[serde(rename = "timestamp")]
pub timestamp: i32,
/// Timeline event type.<br>
/// Timeline event type.<br>
/// (Known legal values: ASCENDED_EVENT, BUILDING_KILL, CAPTURE_POINT, CHAMPION_KILL, CHAMPION_SPECIAL_KILL, CHAMPION_TRANSFORM, DRAGON_SOUL_GIVEN, ELITE_MONSTER_KILL, GAME_END, ITEM_DESTROYED, ITEM_PURCHASED, ITEM_SOLD, ITEM_UNDO, LEVEL_UP, PAUSE_END, PAUSE_START, SKILL_LEVEL_UP, TURRET_PLATE_DESTROYED, WARD_KILL, WARD_PLACED)
#[serde(rename = "type")]
pub r#type: String,
@ -2313,7 +2316,7 @@ pub mod spectator_v4 {
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct FeaturedGameInfo {
/// The game mode<br>
/// The game mode<br>
/// (Legal values: CLASSIC, ODIN, ARAM, TUTORIAL, ONEFORALL, ASCENSION, FIRSTBLOOD, KINGPORO)
#[serde(rename = "gameMode")]
pub game_mode: crate::consts::GameMode,
@ -2323,7 +2326,7 @@ pub mod spectator_v4 {
/// The ID of the map
#[serde(rename = "mapId")]
pub map_id: crate::consts::Map,
/// The game type<br>
/// The game type<br>
/// (Legal values: CUSTOM_GAME, MATCHED_GAME, TUTORIAL_GAME)
#[serde(rename = "gameType")]
pub game_type: crate::consts::GameType,
@ -2502,7 +2505,7 @@ pub mod tft_league_v1 {
pub summoner_name: String,
#[serde(rename = "queueType")]
pub queue_type: crate::consts::QueueType,
/// Only included for the RANKED_TFT_TURBO queueType.<br>
/// Only included for the RANKED_TFT_TURBO queueType.<br>
/// (Legal values: ORANGE, PURPLE, BLUE, GREEN, GRAY)
#[serde(rename = "ratedTier")]
#[serde(skip_serializing_if = "Option::is_none")]
@ -2890,15 +2893,15 @@ pub mod tournament_stub_v4 {
/// 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>
/// 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>
/// 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>
/// The spectator type of the game.<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
@ -2931,7 +2934,7 @@ pub mod tournament_stub_v4 {
#[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>
/// 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: crate::consts::TournamentRegion,
@ -2975,15 +2978,15 @@ pub mod tournament_v4 {
/// 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>
/// 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>
/// 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>
/// The spectator type of the game.<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
@ -3023,7 +3026,7 @@ pub mod tournament_v4 {
/// The tournament code's ID.
#[serde(rename = "id")]
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)
#[serde(rename = "region")]
pub region: String,
@ -3043,15 +3046,15 @@ pub mod tournament_v4 {
#[serde(rename = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_summoner_ids: Option<std::vec::Vec<String>>,
/// The pick type<br>
/// The pick type<br>
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
#[serde(rename = "pickType")]
pub pick_type: String,
/// The map type<br>
/// The map type<br>
/// (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
#[serde(rename = "mapType")]
pub map_type: String,
/// The spectator type<br>
/// The spectator type<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
@ -3084,7 +3087,7 @@ pub mod tournament_v4 {
#[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>
/// 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: crate::consts::TournamentRegion,

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());