mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2024-12-26 10:56:34 +00:00
feat: regen for spectator-v5
This commit is contained in:
parent
136ecc3c05
commit
a33d6835db
4 changed files with 293 additions and 6 deletions
|
@ -8,7 +8,7 @@
|
|||
///////////////////////////////////////////////
|
||||
|
||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||
// Version 48735a0c9d1c521d94a20ff0b0b9dc927ab430ca
|
||||
// Version ba7699aed741222f2431e1f3e4ba42c3ac302510
|
||||
|
||||
//! Automatically generated endpoint handles.
|
||||
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
||||
|
@ -171,6 +171,15 @@ impl RiotApi {
|
|||
pub fn spectator_v4(&self) -> SpectatorV4 {
|
||||
SpectatorV4 { base: self }
|
||||
}
|
||||
/// Returns a handle for accessing [SpectatorV5](crate::endpoints::SpectatorV5) endpoints.
|
||||
/// # Riot Developer API Reference
|
||||
/// <a href="https://developer.riotgames.com/apis#spectator-v5" target="_blank">`spectator-v5`</a>
|
||||
///
|
||||
/// Note: this method is automatically generated.
|
||||
#[inline]
|
||||
pub fn spectator_v5(&self) -> SpectatorV5 {
|
||||
SpectatorV5 { base: self }
|
||||
}
|
||||
/// Returns a handle for accessing [SummonerV4](crate::endpoints::SummonerV4) endpoints.
|
||||
/// # Riot Developer API Reference
|
||||
/// <a href="https://developer.riotgames.com/apis#summoner-v4" target="_blank">`summoner-v4`</a>
|
||||
|
@ -1271,6 +1280,55 @@ impl<'a> SpectatorV4<'a> {
|
|||
|
||||
}
|
||||
|
||||
/// SpectatorV5 endpoints handle, accessed by calling [`spectator_v5()`](crate::RiotApi::spectator_v5) on a [`RiotApi`](crate::RiotApi) instance.
|
||||
/// # Riot Developer API Reference
|
||||
/// <a href="https://developer.riotgames.com/apis#spectator-v5" target="_blank">`spectator-v5`</a>
|
||||
///
|
||||
/// Note: this struct is automatically generated.
|
||||
#[repr(transparent)]
|
||||
pub struct SpectatorV5<'a> {
|
||||
base: &'a RiotApi,
|
||||
}
|
||||
impl<'a> SpectatorV5<'a> {
|
||||
/// Get current game information for the given puuid.
|
||||
/// # Parameters
|
||||
/// * `route` - Route to query.
|
||||
/// * `encrypted_puuid` (required, in path) - The puuid of the summoner.
|
||||
/// # Riot Developer API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v5/GET_getCurrentGameInfoByPuuid" target="_blank">`spectator-v5.getCurrentGameInfoByPuuid`</a>
|
||||
///
|
||||
/// Note: this method is automatically generated.
|
||||
pub fn get_current_game_info_by_puuid(&self, route: PlatformRoute, encrypted_puuid: &str)
|
||||
-> impl Future<Output = Result<Option<spectator_v5::CurrentGameInfo>>> + 'a
|
||||
{
|
||||
let route_str = route.into();
|
||||
let request = self.base.request(Method::GET, route_str, &format!("/lol/spectator/v5/active-games/by-summoner/{}", encrypted_puuid));
|
||||
let future = self.base.execute_opt::<spectator_v5::CurrentGameInfo>("spectator-v5.getCurrentGameInfoByPuuid", route_str, request);
|
||||
#[cfg(feature = "tracing")]
|
||||
let future = future.instrument(tracing::info_span!("spectator-v5.getCurrentGameInfoByPuuid"));
|
||||
future
|
||||
}
|
||||
|
||||
/// Get list of featured games.
|
||||
/// # Parameters
|
||||
/// * `route` - Route to query.
|
||||
/// # Riot Developer API Reference
|
||||
/// <a href="https://developer.riotgames.com/api-methods/#spectator-v5/GET_getFeaturedGames" target="_blank">`spectator-v5.getFeaturedGames`</a>
|
||||
///
|
||||
/// Note: this method is automatically generated.
|
||||
pub fn get_featured_games(&self, route: PlatformRoute)
|
||||
-> impl Future<Output = Result<spectator_v5::FeaturedGames>> + 'a
|
||||
{
|
||||
let route_str = route.into();
|
||||
let request = self.base.request(Method::GET, route_str, "/lol/spectator/v5/featured-games");
|
||||
let future = self.base.execute_val::<spectator_v5::FeaturedGames>("spectator-v5.getFeaturedGames", route_str, request);
|
||||
#[cfg(feature = "tracing")]
|
||||
let future = future.instrument(tracing::info_span!("spectator-v5.getFeaturedGames"));
|
||||
future
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// SummonerV4 endpoints handle, accessed by calling [`summoner_v4()`](crate::RiotApi::summoner_v4) on a [`RiotApi`](crate::RiotApi) instance.
|
||||
/// # Riot Developer API Reference
|
||||
/// <a href="https://developer.riotgames.com/apis#summoner-v4" target="_blank">`summoner-v4`</a>
|
||||
|
|
|
@ -30,8 +30,9 @@
|
|||
//! # Design
|
||||
//!
|
||||
//! * Fast, asynchronous, thread-safe.
|
||||
//! * Automatically retries failed requests.
|
||||
//! * Automatically retries failed requests, configurable.
|
||||
//! * Supports all endpoints, kept up-to-date using [riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).
|
||||
//! * Can compile to Wasm for server-side or browser+proxy use.
|
||||
//!
|
||||
//! # Usage
|
||||
//!
|
||||
|
@ -108,7 +109,10 @@
|
|||
//! 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.
|
||||
//! ### `log` or `tracing`
|
||||
//!
|
||||
//! Riven is additionally able to produce [tracing](https://docs.rs/tracing) spans for requests if the `tracing` feature is enabled.
|
||||
//! By default the `tracing` feature is disabled and Riven instead writes to [`log`](https://docs.rs/log).
|
||||
//!
|
||||
//! ## Docs
|
||||
//!
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
///////////////////////////////////////////////
|
||||
|
||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||
// Version 48735a0c9d1c521d94a20ff0b0b9dc927ab430ca
|
||||
// Version ba7699aed741222f2431e1f3e4ba42c3ac302510
|
||||
|
||||
//! Metadata about the Riot API and Riven.
|
||||
//!
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
/// Metadata for endpoints. Each tuple corresponds to one endpoint and contains
|
||||
/// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID.
|
||||
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 80] = [
|
||||
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 82] = [
|
||||
(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"),
|
||||
|
@ -58,6 +58,8 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 80] = [
|
|||
(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/featured-games", "spectator-v4.getFeaturedGames"),
|
||||
(reqwest::Method::GET, "/lol/spectator/v5/active-games/by-summoner/{encryptedPUUID}", "spectator-v5.getCurrentGameInfoByPuuid"),
|
||||
(reqwest::Method::GET, "/lol/spectator/v5/featured-games", "spectator-v5.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-name/{summonerName}", "summoner-v4.getBySummonerName"),
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
///////////////////////////////////////////////
|
||||
|
||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||
// Version 48735a0c9d1c521d94a20ff0b0b9dc927ab430ca
|
||||
// Version ba7699aed741222f2431e1f3e4ba42c3ac302510
|
||||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
|
@ -2487,6 +2487,229 @@ pub mod spectator_v4 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Data structs used by [`SpectatorV5`](crate::endpoints::SpectatorV5).
|
||||
///
|
||||
/// Note: this module is automatically generated.
|
||||
#[allow(dead_code)]
|
||||
pub mod spectator_v5 {
|
||||
/// CurrentGameInfo data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct CurrentGameInfo {
|
||||
/// The ID of the game
|
||||
#[serde(rename = "gameId")]
|
||||
pub game_id: i64,
|
||||
/// The game type
|
||||
#[serde(rename = "gameType")]
|
||||
pub game_type: crate::consts::GameType,
|
||||
/// The game start time represented in epoch milliseconds
|
||||
#[serde(rename = "gameStartTime")]
|
||||
pub game_start_time: i64,
|
||||
/// The ID of the map
|
||||
#[serde(rename = "mapId")]
|
||||
pub map_id: crate::consts::Map,
|
||||
/// The amount of time in seconds that has passed since the game started
|
||||
#[serde(rename = "gameLength")]
|
||||
pub game_length: i64,
|
||||
/// The ID of the platform on which the game is being played
|
||||
#[serde(rename = "platformId")]
|
||||
pub platform_id: String,
|
||||
/// The game mode
|
||||
#[serde(rename = "gameMode")]
|
||||
pub game_mode: crate::consts::GameMode,
|
||||
/// Banned champion information
|
||||
#[serde(rename = "bannedChampions")]
|
||||
pub banned_champions: std::vec::Vec<BannedChampion>,
|
||||
/// The queue type (queue types are documented on the Game Constants page)
|
||||
#[serde(rename = "gameQueueConfigId")]
|
||||
pub game_queue_config_id: crate::consts::Queue,
|
||||
/// The observer information
|
||||
#[serde(rename = "observers")]
|
||||
pub observers: Observer,
|
||||
/// The participant information
|
||||
#[serde(rename = "participants")]
|
||||
pub participants: std::vec::Vec<CurrentGameParticipant>,
|
||||
}
|
||||
/// BannedChampion data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct BannedChampion {
|
||||
/// The turn during which the champion was banned
|
||||
#[serde(rename = "pickTurn")]
|
||||
pub pick_turn: i32,
|
||||
/// The ID of the banned champion
|
||||
#[serde(rename = "championId")]
|
||||
pub champion_id: crate::consts::Champion,
|
||||
/// The ID of the team that banned the champion
|
||||
#[serde(rename = "teamId")]
|
||||
pub team_id: crate::consts::Team,
|
||||
}
|
||||
/// Observer data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct Observer {
|
||||
/// Key used to decrypt the spectator grid game data for playback
|
||||
#[serde(rename = "encryptionKey")]
|
||||
pub encryption_key: String,
|
||||
}
|
||||
/// CurrentGameParticipant data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct CurrentGameParticipant {
|
||||
/// The ID of the champion played by this participant
|
||||
#[serde(rename = "championId")]
|
||||
pub champion_id: crate::consts::Champion,
|
||||
/// Perks/Runes Reforged Information
|
||||
#[serde(rename = "perks")]
|
||||
pub perks: Perks,
|
||||
/// The ID of the profile icon used by this participant
|
||||
#[serde(rename = "profileIconId")]
|
||||
pub profile_icon_id: i64,
|
||||
/// Flag indicating whether or not this participant is a bot
|
||||
#[serde(rename = "bot")]
|
||||
pub bot: bool,
|
||||
/// The team ID of this participant, indicating the participant's team
|
||||
#[serde(rename = "teamId")]
|
||||
pub team_id: crate::consts::Team,
|
||||
/// The summoner name of this participant
|
||||
#[serde(rename = "summonerName")]
|
||||
pub summoner_name: String,
|
||||
/// The encrypted summoner ID of this participant
|
||||
#[serde(rename = "summonerId")]
|
||||
pub summoner_id: String,
|
||||
/// The encrypted puuid of this participant
|
||||
#[serde(rename = "puuid")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub puuid: Option<String>,
|
||||
/// The ID of the first summoner spell used by this participant
|
||||
#[serde(rename = "spell1Id")]
|
||||
pub spell1_id: i64,
|
||||
/// The ID of the second summoner spell used by this participant
|
||||
#[serde(rename = "spell2Id")]
|
||||
pub spell2_id: i64,
|
||||
/// List of Game Customizations
|
||||
#[serde(rename = "gameCustomizationObjects")]
|
||||
pub game_customization_objects: std::vec::Vec<GameCustomizationObject>,
|
||||
}
|
||||
/// Perks data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct Perks {
|
||||
/// IDs of the perks/runes assigned.
|
||||
#[serde(rename = "perkIds")]
|
||||
pub perk_ids: std::vec::Vec<i64>,
|
||||
/// Primary runes path
|
||||
#[serde(rename = "perkStyle")]
|
||||
pub perk_style: i64,
|
||||
/// Secondary runes path
|
||||
#[serde(rename = "perkSubStyle")]
|
||||
pub perk_sub_style: i64,
|
||||
}
|
||||
/// GameCustomizationObject data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct GameCustomizationObject {
|
||||
/// Category identifier for Game Customization
|
||||
#[serde(rename = "category")]
|
||||
pub category: String,
|
||||
/// Game Customization content
|
||||
#[serde(rename = "content")]
|
||||
pub content: String,
|
||||
}
|
||||
/// FeaturedGames data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct FeaturedGames {
|
||||
/// The list of featured games
|
||||
#[serde(rename = "gameList")]
|
||||
pub game_list: std::vec::Vec<FeaturedGameInfo>,
|
||||
/// The suggested interval to wait before requesting FeaturedGames again
|
||||
#[serde(rename = "clientRefreshInterval")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub client_refresh_interval: Option<i64>,
|
||||
}
|
||||
/// FeaturedGameInfo data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct FeaturedGameInfo {
|
||||
/// The game mode<br>
|
||||
/// (Legal values: CLASSIC, ODIN, ARAM, TUTORIAL, ONEFORALL, ASCENSION, FIRSTBLOOD, KINGPORO)
|
||||
#[serde(rename = "gameMode")]
|
||||
pub game_mode: crate::consts::GameMode,
|
||||
/// The amount of time in seconds that has passed since the game started
|
||||
#[serde(rename = "gameLength")]
|
||||
pub game_length: i64,
|
||||
/// The ID of the map
|
||||
#[serde(rename = "mapId")]
|
||||
pub map_id: crate::consts::Map,
|
||||
/// The game type<br>
|
||||
/// (Legal values: CUSTOM_GAME, MATCHED_GAME, TUTORIAL_GAME)
|
||||
#[serde(rename = "gameType")]
|
||||
pub game_type: crate::consts::GameType,
|
||||
/// Banned champion information
|
||||
#[serde(rename = "bannedChampions")]
|
||||
pub banned_champions: std::vec::Vec<BannedChampion>,
|
||||
/// The ID of the game
|
||||
#[serde(rename = "gameId")]
|
||||
pub game_id: i64,
|
||||
/// The observer information
|
||||
#[serde(rename = "observers")]
|
||||
pub observers: Observer,
|
||||
/// The queue type (queue types are documented on the Game Constants page)
|
||||
#[serde(rename = "gameQueueConfigId")]
|
||||
pub game_queue_config_id: crate::consts::Queue,
|
||||
/// The participant information
|
||||
#[serde(rename = "participants")]
|
||||
pub participants: std::vec::Vec<Participant>,
|
||||
/// The ID of the platform on which the game is being played
|
||||
#[serde(rename = "platformId")]
|
||||
pub platform_id: String,
|
||||
}
|
||||
/// Participant data object.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
|
||||
pub struct Participant {
|
||||
/// Flag indicating whether or not this participant is a bot
|
||||
#[serde(rename = "bot")]
|
||||
pub bot: bool,
|
||||
/// The ID of the second summoner spell used by this participant
|
||||
#[serde(rename = "spell2Id")]
|
||||
pub spell2_id: i64,
|
||||
/// The ID of the profile icon used by this participant
|
||||
#[serde(rename = "profileIconId")]
|
||||
pub profile_icon_id: i64,
|
||||
/// The summoner name of this participant
|
||||
#[serde(rename = "summonerName")]
|
||||
pub summoner_name: String,
|
||||
/// Encrypted summoner ID of this participant
|
||||
#[serde(rename = "summonerId")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub summoner_id: Option<String>,
|
||||
/// Encrypted puuid of this participant
|
||||
#[serde(rename = "puuid")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub puuid: Option<String>,
|
||||
/// The ID of the champion played by this participant
|
||||
#[serde(rename = "championId")]
|
||||
pub champion_id: crate::consts::Champion,
|
||||
/// The team ID of this participant, indicating the participant's team
|
||||
#[serde(rename = "teamId")]
|
||||
pub team_id: crate::consts::Team,
|
||||
/// The ID of the first summoner spell used by this participant
|
||||
#[serde(rename = "spell1Id")]
|
||||
pub spell1_id: i64,
|
||||
}
|
||||
}
|
||||
|
||||
/// Data structs used by [`SummonerV4`](crate::endpoints::SummonerV4).
|
||||
///
|
||||
/// Note: this module is automatically generated.
|
||||
|
|
Loading…
Reference in a new issue