From d2656a40dea47a8d93733645d0f1f02c443d321c Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Fri, 10 Jul 2020 01:56:41 -0700 Subject: [PATCH] Regen for Valorant APIs & Lillia --- src/consts/champion.rs | 3 + src/endpoints.rs | 92 ++++++++++- src/meta.rs | 5 +- src/models.rs | 351 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 447 insertions(+), 4 deletions(-) diff --git a/src/consts/champion.rs b/src/consts/champion.rs index 84a83f9..31da2ba 100644 --- a/src/consts/champion.rs +++ b/src/consts/champion.rs @@ -156,6 +156,8 @@ pub enum Champion { #[strum(to_string="Lee Sin", serialize="LeeSin")] LeeSin = 64, /// Leona (`Leona`, 89). #[strum(to_string="Leona", serialize="Leona")] Leona = 89, + /// Lillia (`Lillia`, 876). + #[strum(to_string="Lillia", serialize="Lillia")] Lillia = 876, /// Lissandra (`Lissandra`, 127). #[strum(to_string="Lissandra", serialize="Lissandra")] Lissandra = 127, /// Lucian (`Lucian`, 236). @@ -416,6 +418,7 @@ impl Champion { Self::LeBlanc => "Leblanc", Self::LeeSin => "LeeSin", Self::Leona => "Leona", + Self::Lillia => "Lillia", Self::Lissandra => "Lissandra", Self::Lucian => "Lucian", Self::Lulu => "Lulu", diff --git a/src/endpoints.rs b/src/endpoints.rs index f006e9a..f891aed 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version ef6be1735b0bc180c8f32dd2ba538793fdbe8ce6 +// Version af29e140a03aabbd77664b926746eecaae877d2b //! Automatically generated endpoint handles. @@ -167,6 +167,24 @@ impl RiotApi { pub fn tournament_v4(&self) -> TournamentV4 { TournamentV4 { base: self } } + /// Returns a handle for accessing [ValContentV1](crate::endpoints::ValContentV1) endpoints. + /// # Riot Developer API Reference + /// `val-content-v1` + /// + /// Note: this method is automatically generated. + #[inline] + pub fn val_content_v1(&self) -> ValContentV1 { + ValContentV1 { base: self } + } + /// Returns a handle for accessing [ValMatchV1](crate::endpoints::ValMatchV1) endpoints. + /// # Riot Developer API Reference + /// `val-match-v1` + /// + /// Note: this method is automatically generated. + #[inline] + pub fn val_match_v1(&self) -> ValMatchV1 { + ValMatchV1 { base: self } + } } /// ChampionMasteryV4 endpoints handle, accessed by calling [`champion_mastery_v4()`](crate::RiotApi::champion_mastery_v4) on a [`RiotApi`](crate::RiotApi) instance. @@ -605,7 +623,7 @@ impl<'a> MatchV4<'a> { /// `match-v4.getMatchlist` /// /// Note: this method is automatically generated. - pub fn get_matchlist(&self, region: Region, encrypted_account_id: &str, begin_time: Option, begin_index: Option, champion: Option>, end_time: Option, end_index: Option, queue: Option>, season: Option>) + pub fn get_matchlist(&self, region: Region, encrypted_account_id: &str, begin_time: Option, begin_index: Option, champion: Option<&[crate::consts::Champion]>, end_time: Option, end_index: Option, queue: Option<&[crate::consts::Queue]>, season: Option<&[crate::consts::Season]>) -> impl Future>> + 'a { let mut query_params = Serializer::new(String::new()); @@ -1062,3 +1080,73 @@ impl<'a> TournamentV4<'a> { } } + +/// ValContentV1 endpoints handle, accessed by calling [`val_content_v1()`](crate::RiotApi::val_content_v1) on a [`RiotApi`](crate::RiotApi) instance. +/// # Riot Developer API Reference +/// `val-content-v1` +/// +/// Note: this struct is automatically generated. +pub struct ValContentV1<'a> { + base: &'a RiotApi, +} +impl<'a> ValContentV1<'a> { + /// Get content optionally filtered by locale + /// # Parameters + /// * `region` - Region to query. + /// * `locale` (optional) + /// # Riot Developer API Reference + /// `val-content-v1.getContent` + /// + /// Note: this method is automatically generated. + pub fn get_content(&self, region: Region, locale: Option<&str>) + -> impl Future> + 'a + { + let mut query_params = Serializer::new(String::new()); + if let Some(locale) = locale { query_params.append_pair("locale", locale); }; + let query_string = query_params.finish(); + let path_string = "/val/content/v1/contents".to_owned(); + self.base.get::("val-content-v1.getContent", region.into(), path_string, Some(query_string)) + } + +} + +/// ValMatchV1 endpoints handle, accessed by calling [`val_match_v1()`](crate::RiotApi::val_match_v1) on a [`RiotApi`](crate::RiotApi) instance. +/// # Riot Developer API Reference +/// `val-match-v1` +/// +/// Note: this struct is automatically generated. +pub struct ValMatchV1<'a> { + base: &'a RiotApi, +} +impl<'a> ValMatchV1<'a> { + /// Get match by id + /// # Parameters + /// * `region` - Region to query. + /// * `matchId` + /// # Riot Developer API Reference + /// `val-match-v1.getMatch` + /// + /// Note: this method is automatically generated. + pub fn get_match(&self, region: Region, match_id: &str) + -> impl Future> + 'a + { + let path_string = format!("/val/match/v1/matches/{}", match_id); + self.base.get::("val-match-v1.getMatch", region.into(), path_string, None) + } + + /// Get matchlist for games played by puuid + /// # Parameters + /// * `region` - Region to query. + /// * `puuid` + /// # Riot Developer API Reference + /// `val-match-v1.getMatchlist` + /// + /// Note: this method is automatically generated. + pub fn get_matchlist(&self, region: Region, puuid: &str) + -> impl Future> + 'a + { + let path_string = format!("/val/match/v1/matchlists/by-puuid/{}", puuid); + self.base.get::("val-match-v1.getMatchlist", region.into(), path_string, None) + } + +} diff --git a/src/meta.rs b/src/meta.rs index 30c170e..92422e0 100644 --- a/src/meta.rs +++ b/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version ef6be1735b0bc180c8f32dd2ba538793fdbe8ce6 +// Version af29e140a03aabbd77664b926746eecaae877d2b //! Metadata about the Riot API and Riven. //! @@ -65,6 +65,9 @@ lazy_static! { map.insert("/lol/tournament-stub/v4/lobby-events/by-code/{tournamentCode}", "tournament-stub-v4.getLobbyEventsByCode"); map.insert("/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.getTournamentCode"); map.insert("/lol/tournament/v4/lobby-events/by-code/{tournamentCode}", "tournament-v4.getLobbyEventsByCode"); + map.insert("/val/content/v1/contents", "val-content-v1.getContent"); + map.insert("/val/match/v1/matches/{matchId}", "val-match-v1.getMatch"); + map.insert("/val/match/v1/matchlists/by-puuid/{puuid}", "val-match-v1.getMatchlist"); map }; } diff --git a/src/models.rs b/src/models.rs index 27fce96..c1c8104 100644 --- a/src/models.rs +++ b/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version ef6be1735b0bc180c8f32dd2ba538793fdbe8ce6 +// Version af29e140a03aabbd77664b926746eecaae877d2b //! Data transfer structs. //! @@ -1783,3 +1783,352 @@ pub mod tournament_v4 { pub name: Option, } } + +/// Data structs used by [`ValContentV1`](crate::endpoints::ValContentV1). +/// +/// Note: this module is automatically generated. +#[allow(dead_code)] +pub mod val_content_v1 { + /// Content data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Content { + #[serde(rename = "version")] + pub version: String, + #[serde(rename = "characters")] + pub characters: std::vec::Vec, + #[serde(rename = "maps")] + pub maps: std::vec::Vec, + #[serde(rename = "chromas")] + pub chromas: std::vec::Vec, + #[serde(rename = "skins")] + pub skins: std::vec::Vec, + #[serde(rename = "skinLevels")] + pub skin_levels: std::vec::Vec, + #[serde(rename = "equips")] + pub equips: std::vec::Vec, + #[serde(rename = "gameModes")] + pub game_modes: std::vec::Vec, + #[serde(rename = "sprays")] + pub sprays: std::vec::Vec, + #[serde(rename = "sprayLevels")] + pub spray_levels: std::vec::Vec, + #[serde(rename = "charms")] + pub charms: std::vec::Vec, + #[serde(rename = "charmLevels")] + pub charm_levels: std::vec::Vec, + #[serde(rename = "playerCards")] + pub player_cards: std::vec::Vec, + #[serde(rename = "playerTitles")] + pub player_titles: std::vec::Vec, + } + /// ContentItem data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct ContentItem { + #[serde(rename = "name")] + pub name: String, + /// This field is excluded from the response when a locale is set + #[serde(rename = "localizedNames")] + pub localized_names: Option, + #[serde(rename = "assetName")] + pub asset_name: String, + } + /// LocalizedNames data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct LocalizedNames { + #[serde(rename = "ar-AE")] + pub ar_ae: String, + #[serde(rename = "de-DE")] + pub de_de: String, + #[serde(rename = "en-GB")] + pub en_gb: String, + #[serde(rename = "en-US")] + pub en_us: String, + #[serde(rename = "es-ES")] + pub es_es: String, + #[serde(rename = "es-MX")] + pub es_mx: String, + #[serde(rename = "fr-FR")] + pub fr_fr: String, + #[serde(rename = "id-ID")] + pub id_id: String, + #[serde(rename = "it-IT")] + pub it_it: String, + #[serde(rename = "ja-JP")] + pub ja_jp: String, + #[serde(rename = "ko-KR")] + pub ko_kr: String, + #[serde(rename = "pl-PL")] + pub pl_pl: String, + #[serde(rename = "pt-BR")] + pub pt_br: String, + #[serde(rename = "ru-RU")] + pub ru_ru: String, + #[serde(rename = "th-TH")] + pub th_th: String, + #[serde(rename = "tr-TR")] + pub tr_tr: String, + #[serde(rename = "vi-VN")] + pub vi_vn: String, + #[serde(rename = "zh-CN")] + pub zh_cn: String, + #[serde(rename = "zh-TW")] + pub zh_tw: String, + } +} + +/// Data structs used by [`ValMatchV1`](crate::endpoints::ValMatchV1). +/// +/// Note: this module is automatically generated. +#[allow(dead_code)] +pub mod val_match_v1 { + /// Match data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Match { + #[serde(rename = "matchInfo")] + pub match_info: std::vec::Vec, + #[serde(rename = "players")] + pub players: std::vec::Vec, + #[serde(rename = "teams")] + pub teams: std::vec::Vec, + #[serde(rename = "roundResults")] + pub round_results: std::vec::Vec, + } + /// MatchInfo data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct MatchInfo { + #[serde(rename = "matchId")] + pub match_id: String, + #[serde(rename = "mapId")] + pub map_id: String, + #[serde(rename = "gameLengthMillis")] + pub game_length_millis: i32, + #[serde(rename = "gameStartMillis")] + pub game_start_millis: i64, + #[serde(rename = "provisioningFlowId")] + pub provisioning_flow_id: String, + #[serde(rename = "isCompleted")] + pub is_completed: bool, + #[serde(rename = "customGameName")] + pub custom_game_name: String, + #[serde(rename = "queueId")] + pub queue_id: String, + #[serde(rename = "gameMode")] + pub game_mode: String, + #[serde(rename = "isRanked")] + pub is_ranked: bool, + #[serde(rename = "seasonId")] + pub season_id: String, + } + /// Player data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Player { + #[serde(rename = "puuid")] + pub puuid: String, + #[serde(rename = "teamId")] + pub team_id: String, + #[serde(rename = "partyId")] + pub party_id: String, + #[serde(rename = "characterId")] + pub character_id: String, + #[serde(rename = "stats")] + pub stats: PlayerStats, + #[serde(rename = "competitiveTier")] + pub competitive_tier: i32, + #[serde(rename = "playerCard")] + pub player_card: String, + #[serde(rename = "playerTitle")] + pub player_title: String, + } + /// PlayerStats data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct PlayerStats { + #[serde(rename = "puuid")] + pub puuid: String, + #[serde(rename = "kills")] + pub kills: std::vec::Vec, + #[serde(rename = "damage")] + pub damage: std::vec::Vec, + #[serde(rename = "score")] + pub score: i32, + #[serde(rename = "economy")] + pub economy: Economy, + #[serde(rename = "ability")] + pub ability: Ability, + } + /// Kill data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Kill { + #[serde(rename = "gameTime")] + pub game_time: i32, + #[serde(rename = "roundTime")] + pub round_time: i32, + /// PUUID + #[serde(rename = "killer")] + pub killer: String, + /// PUUID + #[serde(rename = "victim")] + pub victim: String, + #[serde(rename = "victimLocation")] + pub victim_location: Location, + /// List of PUUIDs + #[serde(rename = "assistants")] + pub assistants: std::vec::Vec, + #[serde(rename = "playerLocations")] + pub player_locations: std::vec::Vec, + #[serde(rename = "finishingDamage")] + pub finishing_damage: FinishingDamage, + } + /// Location data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Location { + #[serde(rename = "x")] + pub x: i32, + #[serde(rename = "y")] + pub y: i32, + } + /// PlayerLocations data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct PlayerLocations { + #[serde(rename = "puuid")] + pub puuid: String, + #[serde(rename = "viewRadians")] + pub view_radians: f32, + #[serde(rename = "location")] + pub location: Location, + } + /// FinishingDamage data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct FinishingDamage { + #[serde(rename = "damageType")] + pub damage_type: String, + #[serde(rename = "damageItem")] + pub damage_item: String, + #[serde(rename = "isSecondaryFireMode")] + pub is_secondary_fire_mode: bool, + } + /// Damage data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Damage { + /// PUUID + #[serde(rename = "receiver")] + pub receiver: String, + #[serde(rename = "damage")] + pub damage: i32, + #[serde(rename = "legshots")] + pub legshots: i32, + #[serde(rename = "bodyshots")] + pub bodyshots: i32, + #[serde(rename = "headshots")] + pub headshots: i32, + } + /// Economy data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Economy { + #[serde(rename = "loadoutValue")] + pub loadout_value: i32, + #[serde(rename = "weapon")] + pub weapon: String, + #[serde(rename = "armor")] + pub armor: String, + #[serde(rename = "remaining")] + pub remaining: i32, + #[serde(rename = "spent")] + pub spent: i32, + } + /// Ability data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Ability { + #[serde(rename = "grenadeEffects")] + pub grenade_effects: String, + #[serde(rename = "ability1Effects")] + pub ability1_effects: String, + #[serde(rename = "ability2Effects")] + pub ability2_effects: String, + #[serde(rename = "ultimateEffects")] + pub ultimate_effects: String, + } + /// Team data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Team { + #[serde(rename = "teamId")] + pub team_id: String, + #[serde(rename = "won")] + pub won: bool, + #[serde(rename = "roundsPlayed")] + pub rounds_played: i32, + #[serde(rename = "roundsWon")] + pub rounds_won: i32, + } + /// RoundResult data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct RoundResult { + #[serde(rename = "roundNum")] + pub round_num: i32, + #[serde(rename = "roundResult")] + pub round_result: String, + #[serde(rename = "roundCeremony")] + pub round_ceremony: String, + #[serde(rename = "winningTeam")] + pub winning_team: String, + /// PUUID of player + #[serde(rename = "bombPlanter")] + pub bomb_planter: String, + /// PUUID of player + #[serde(rename = "bombDefuser")] + pub bomb_defuser: String, + #[serde(rename = "plantRoundTime")] + pub plant_round_time: i32, + #[serde(rename = "plantPlayerLocations")] + pub plant_player_locations: std::vec::Vec, + #[serde(rename = "plantLocation")] + pub plant_location: Location, + #[serde(rename = "plantSite")] + pub plant_site: String, + #[serde(rename = "defuseRoundTime")] + pub defuse_round_time: i32, + #[serde(rename = "defusePlayerLocations")] + pub defuse_player_locations: std::vec::Vec, + #[serde(rename = "defuseLocation")] + pub defuse_location: Location, + #[serde(rename = "playerStats")] + pub player_stats: std::vec::Vec, + #[serde(rename = "roundResultCode")] + pub round_result_code: String, + } + /// Matchlist data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct Matchlist { + #[serde(rename = "puuid")] + pub puuid: String, + #[serde(rename = "history")] + pub history: std::vec::Vec, + } + /// MatchReference data object. + #[derive(Debug)] + #[derive(serde::Serialize, serde::Deserialize)] + pub struct MatchReference { + #[serde(rename = "matchId")] + pub match_id: String, + #[serde(rename = "gameStartTime")] + pub game_start_time: i64, + #[serde(rename = "teamId")] + pub team_id: String, + } +}