Regen for new endpoints, nullable lol-status-v4 fields

This commit is contained in:
Mingwei Samuel 2022-09-21 01:42:39 -07:00
parent f3f34b6ff5
commit 998eb4ec46
4 changed files with 162 additions and 8 deletions

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 648c5b93c3144e7094749547bb91481778c8dc08
// Version dae26e2703c82eb19447d1b27f1209801cb83beb
//! Automatically generated endpoint handles.
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
@ -197,6 +197,15 @@ impl RiotApi {
pub fn tft_match_v1(&self) -> TftMatchV1 {
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.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>
@ -402,6 +411,27 @@ impl<'a> ChampionMasteryV4<'a> {
future
}
/// Get specified number of top champion mastery entries sorted by number of champion points descending.
/// # Parameters
/// * `route` - Route to query.
/// * `encrypted_summoner_id` (required, in path) - Summoner ID associated with the player
/// * `count` (optional, in query) - Number of entries to retrieve, defaults to 3
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#champion-mastery-v4/GET_getTopChampionMasteries" target="_blank">`champion-mastery-v4.getTopChampionMasteries`</a>
///
/// Note: this method is automatically generated.
pub fn get_top_champion_masteries(&self, route: PlatformRoute, encrypted_summoner_id: &str, count: Option<i32>)
-> impl Future<Output = Result<Vec<champion_mastery_v4::ChampionMastery>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/champion-mastery/v4/champion-masteries/by-summoner/{}/top", encrypted_summoner_id));
let mut request = request; if let Some(count) = count { request = request.query(&[ ("count", count) ]); }
let future = self.base.execute_val::<Vec<champion_mastery_v4::ChampionMastery>>("champion-mastery-v4.getTopChampionMasteries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("champion-mastery-v4.getTopChampionMasteries"));
future
}
/// Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
/// # Parameters
/// * `route` - Route to query.
@ -1551,6 +1581,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.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tft-summoner-v1" target="_blank">`tft-summoner-v1`</a>

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 648c5b93c3144e7094749547bb91481778c8dc08
// Version dae26e2703c82eb19447d1b27f1209801cb83beb
//! Metadata about the Riot API and Riven.
//!
@ -15,13 +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); 75] = [
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 77] = [
(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-summoner/{encryptedSummonerId}", "champion-mastery-v4.getAllChampionMasteries"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/by-champion/{championId}", "champion-mastery-v4.getChampionMastery"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}/top", "champion-mastery-v4.getTopChampionMasteries"),
(reqwest::Method::GET, "/lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerId}", "champion-mastery-v4.getChampionMasteryScore"),
(reqwest::Method::GET, "/lol/platform/v3/champion-rotations", "champion-v3.getChampionInfo"),
(reqwest::Method::GET, "/lol/clash/v1/players/by-summoner/{summonerId}", "clash-v1.getPlayersBySummoner"),
@ -70,6 +71,7 @@ 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/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/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-name/{summonerName}", "tft-summoner-v1.getBySummonerName"),
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-puuid/{encryptedPUUID}", "tft-summoner-v1.getByPUUID"),

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 648c5b93c3144e7094749547bb91481778c8dc08
// Version dae26e2703c82eb19447d1b27f1209801cb83beb
#![allow(missing_docs)]
@ -639,10 +639,12 @@ pub mod lol_status_v4 {
pub id: i32,
/// (Legal values: scheduled, in_progress, complete)
#[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)
#[serde(rename = "incident_severity")]
pub incident_severity: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub incident_severity: Option<String>,
#[serde(rename = "titles")]
pub titles: std::vec::Vec<Content>,
#[serde(rename = "updates")]
@ -650,9 +652,11 @@ pub mod lol_status_v4 {
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "archive_at")]
pub archive_at: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub archive_at: Option<String>,
#[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)
#[serde(rename = "platforms")]
pub platforms: std::vec::Vec<String>,
@ -2631,6 +2635,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).
///
/// Note: this module is automatically generated.

View file

@ -164,5 +164,12 @@ async_tests!{
assert!(team.is_none());
Ok(())
},
status: async {
let p = RIOT_API.lol_status_v4().get_platform_data(PlatformRoute::NA1);
let status = p.await.map_err(|e| e.to_string())?;
println!("{:?}", status);
Ok(())
},
}
}