Regen, add tests for new optional fields

https://github.com/MingweiSamuel/riotapi-schema/pull/22
pull/23/head
Mingwei Samuel 2020-10-01 06:13:14 +00:00
parent 8f0bd8dbe7
commit 5be2884eb4
5 changed files with 93 additions and 43 deletions

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e9fad555098e217edc088cc4b1ecc6fe095ba6cb
// Version c3b3f5733c36c6f30546aa9ed598c05d39c670be
//! Automatically generated endpoint handles.
@ -1216,4 +1216,21 @@ impl<'a> ValMatchV1<'a> {
self.base.get::<val_match_v1::Matchlist>("val-match-v1.getMatchlist", region.into(), path_string, None)
}
/// Get recent matches
/// ## Implementation Notes
/// Returns a list of match ids that have completed in the last 10 minutes. NA/LATAM/BR share a match history deployment. As such, recent matches will return a combined list of matches from those three regions. Requests are load balanced so you may see some inconsistencies as matches are added/removed from the list.
/// # Parameters
/// * `region` - Region to query.
/// * `queue`
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#val-match-v1/GET_getRecent" target="_blank">`val-match-v1.getRecent`</a>
///
/// Note: this method is automatically generated.
pub fn get_recent(&self, region: Region, queue: &str)
-> impl Future<Output = Result<val_match_v1::RecentMatches>> + 'a
{
let path_string = format!("/val/match/v1/recent-matches/by-queue/{}", queue);
self.base.get::<val_match_v1::RecentMatches>("val-match-v1.getRecent", region.into(), path_string, None)
}
}

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e9fad555098e217edc088cc4b1ecc6fe095ba6cb
// Version c3b3f5733c36c6f30546aa9ed598c05d39c670be
//! Metadata about the Riot API and Riven.
//!
@ -71,6 +71,7 @@ lazy_static! {
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.insert("/val/match/v1/recent-matches/by-queue/{queue}", "val-match-v1.getRecent");
map
};
}

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e9fad555098e217edc088cc4b1ecc6fe095ba6cb
// Version c3b3f5733c36c6f30546aa9ed598c05d39c670be
//! Data transfer structs.
//!
@ -365,25 +365,25 @@ pub mod lol_status_v3 {
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Service {
#[serde(rename = "incidents")]
pub incidents: std::vec::Vec<Incident>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "slug")]
pub slug: String,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "incidents")]
pub incidents: std::vec::Vec<Incident>,
}
/// Incident data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Incident {
#[serde(rename = "id")]
pub id: i64,
#[serde(rename = "active")]
pub active: bool,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "id")]
pub id: i64,
#[serde(rename = "updates")]
pub updates: std::vec::Vec<Message>,
}
@ -391,31 +391,33 @@ pub mod lol_status_v3 {
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Message {
#[serde(rename = "severity")]
pub severity: String,
#[serde(rename = "updated_at")]
pub updated_at: String,
#[serde(rename = "author")]
pub author: String,
#[serde(rename = "translations")]
pub translations: std::vec::Vec<Translation>,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "author")]
pub author: String,
#[serde(rename = "heading")]
pub heading: String,
#[serde(rename = "content")]
pub content: String,
#[serde(rename = "severity")]
pub severity: String,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "updated_at")]
pub updated_at: String,
#[serde(rename = "translations")]
pub translations: std::vec::Vec<Translation>,
}
/// Translation data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Translation {
#[serde(rename = "updated_at")]
pub updated_at: String,
#[serde(rename = "locale")]
pub locale: String,
#[serde(rename = "content")]
pub content: String,
#[serde(rename = "heading")]
pub heading: String,
}
}
@ -614,7 +616,7 @@ pub mod match_v4 {
pub team_id: crate::consts::Team,
/// Participant timeline data.
#[serde(rename = "timeline")]
pub timeline: ParticipantTimeline,
pub timeline: Option<ParticipantTimeline>,
/// First Summoner Spell id.
#[serde(rename = "spell1Id")]
pub spell1_id: i32,
@ -677,7 +679,7 @@ pub mod match_v4 {
#[serde(rename = "magicDamageDealtToChampions")]
pub magic_damage_dealt_to_champions: i64,
#[serde(rename = "wardsKilled")]
pub wards_killed: i32,
pub wards_killed: Option<i32>,
#[serde(rename = "pentaKills")]
pub penta_kills: i32,
#[serde(rename = "damageSelfMitigated")]
@ -711,7 +713,7 @@ pub mod match_v4 {
#[serde(rename = "physicalDamageDealtToChampions")]
pub physical_damage_dealt_to_champions: i64,
#[serde(rename = "neutralMinionsKilledTeamJungle")]
pub neutral_minions_killed_team_jungle: i32,
pub neutral_minions_killed_team_jungle: Option<i32>,
#[serde(rename = "totalMinionsKilled")]
pub total_minions_killed: i32,
#[serde(rename = "firstInhibitorAssist")]
@ -771,7 +773,7 @@ pub mod match_v4 {
#[serde(rename = "trueDamageDealtToChampions")]
pub true_damage_dealt_to_champions: i64,
#[serde(rename = "neutralMinionsKilledEnemyJungle")]
pub neutral_minions_killed_enemy_jungle: i32,
pub neutral_minions_killed_enemy_jungle: Option<i32>,
#[serde(rename = "doubleKills")]
pub double_kills: i32,
#[serde(rename = "trueDamageDealt")]
@ -884,13 +886,13 @@ pub mod match_v4 {
/// Secondary rune path
#[serde(rename = "perkSubStyle")]
pub perk_sub_style: Option<i32>,
/// First stat rune.
/// Stat rune
#[serde(rename = "statPerk0")]
pub stat_perk0: Option<i32>,
/// Second stat rune.
/// Stat rune
#[serde(rename = "statPerk1")]
pub stat_perk1: Option<i32>,
/// Third stat rune.
/// Stat rune
#[serde(rename = "statPerk2")]
pub stat_perk2: Option<i32>,
}
@ -960,7 +962,7 @@ pub mod match_v4 {
#[serde(rename = "gameId")]
pub game_id: i64,
#[serde(rename = "role")]
pub role: String,
pub role: Option<String>,
#[serde(rename = "season")]
pub season: i32,
#[serde(rename = "platformId")]
@ -970,7 +972,7 @@ pub mod match_v4 {
#[serde(rename = "queue")]
pub queue: crate::consts::Queue,
#[serde(rename = "lane")]
pub lane: String,
pub lane: Option<String>,
#[serde(rename = "timestamp")]
pub timestamp: i64,
}
@ -1874,8 +1876,13 @@ pub mod val_content_v1 {
/// This field is excluded from the response when a locale is set
#[serde(rename = "localizedNames")]
pub localized_names: Option<LocalizedNames>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "assetName")]
pub asset_name: String,
/// This field is only included for maps and game modes. These values are used in the match response.
#[serde(rename = "assetPath")]
pub asset_path: String,
}
/// LocalizedNames data object.
#[derive(Debug)]
@ -2115,14 +2122,10 @@ pub mod val_match_v1 {
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Kill {
#[serde(rename = "gameTime")]
pub game_time: Option<i32>,
#[serde(rename = "roundTime")]
pub round_time: Option<i32>,
#[serde(rename = "timeSinceGameStartMillis")]
pub time_since_game_start_millis: Option<i32>,
pub time_since_game_start_millis: i32,
#[serde(rename = "timeSinceRoundStartMillis")]
pub time_since_round_start_millis: Option<i32>,
pub time_since_round_start_millis: i32,
/// PUUID
#[serde(rename = "killer")]
pub killer: String,
@ -2214,4 +2217,14 @@ pub mod val_match_v1 {
#[serde(rename = "teamId")]
pub team_id: String,
}
/// RecentMatches data object.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct RecentMatches {
#[serde(rename = "currentTime")]
pub current_time: i64,
/// A list of recent match ids.
#[serde(rename = "matchIds")]
pub match_ids: std::vec::Vec<String>,
}
}

0
test.bash Normal file → Executable file
View File

View File

@ -45,6 +45,17 @@ async_tests!{
rassert!(!d.is_empty(), "Challenger shouldn't be empty.");
Ok(())
},
matchlist_get: async {
let sp = RIOT_API.summoner_v4().get_by_summoner_name(Region::NA, "haha yes");
let s = sp.await.map_err(|e| e.to_string())?.ok_or("Failed to get \"haha yes\"".to_owned())?;
let mp = RIOT_API.match_v4().get_matchlist(Region::NA, &s.account_id, None, Some(2500), None, None, Some(2600), None, None);
let m = mp.await.map_err(|e| e.to_string())?.ok_or("Failed to get matchlist".to_owned())?;
rassert!(m.matches.len() > 0, "Matchlist should not be empty");
Ok(())
},
match_get: async {
let p = RIOT_API.match_v4().get_match(Region::NA, 3190191338);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Match not found.".to_owned())?;
@ -57,23 +68,24 @@ async_tests!{
rassert!(!m.participants.is_empty(), "Match should have participants.");
Ok(())
},
match_gettimeline: async {
let p = RIOT_API.match_v4().get_match_timeline(Region::NA, 3190191338);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Match timeline not found.".to_owned())?;
rassert!(!m.frames.is_empty(), "Match timeline should have frames.");
match_get_odyssey: async {
let p = RIOT_API.match_v4().get_match(Region::NA, 2881976826);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Match not found.".to_owned())?;
rassert!(!m.participants.is_empty(), "Match should have participants.");
Ok(())
},
// match_get_old: async {
// let p = RIOT_API.match_v4().get_match(Region::NA, 2632789562);
// let m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get match.".to_owned())?;
// Ok(())
// },
match_get_aram: async {
let p = RIOT_API.match_v4().get_match(Region::NA, 2961635718);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get match.".to_owned())?;
rassert!(!m.participants.is_empty(), "Match should have participants.");
Ok(())
},
match_get_aram2: async {
let p = RIOT_API.match_v4().get_match(Region::NA, 3596184782);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Match not found.".to_owned())?;
rassert!(!m.participants.is_empty(), "Match should have participants.");
Ok(())
},
match_get_urf900: async {
let p = RIOT_API.match_v4().get_match(Region::NA, 2963663381);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get match.".to_owned())?;
@ -98,6 +110,13 @@ async_tests!{
rassert!(!m.participants.is_empty(), "Match should have participants.");
Ok(())
},
match_gettimeline: async {
let p = RIOT_API.match_v4().get_match_timeline(Region::NA, 3190191338);
let m = p.await.map_err(|e| e.to_string())?.ok_or("Match timeline not found.".to_owned())?;
rassert!(!m.frames.is_empty(), "Match timeline should have frames.");
Ok(())
},
// Commented out, requires special API key.
// // LOR
// lor_ranked_get_leaderboards: async {