From 33cec4c395476d70eeb76857aab831b701eb922f Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Sat, 30 May 2020 13:33:49 -0700 Subject: [PATCH] Add match-v4 timeline test, regen to fix missing optionals Fixes #10 --- src/endpoints.rs | 2 +- src/models.rs | 50 +++++++++++++++++++++++------------------------ tests/tests_na.rs | 6 ++++++ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/endpoints.rs b/src/endpoints.rs index ded8c7c..4d2c2d5 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version a873e2d3718fc721ef188159557699ab8f6ae7da +// Version 909460d67267a0122544094d93120b50f8d0f5de //! Automatically generated endpoint handles. diff --git a/src/models.rs b/src/models.rs index 82387b6..96791f1 100644 --- a/src/models.rs +++ b/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version a873e2d3718fc721ef188159557699ab8f6ae7da +// Version 909460d67267a0122544094d93120b50f8d0f5de //! Data transfer structs. //! @@ -958,9 +958,9 @@ pub mod match_v4 { #[serde(rename = "minionsKilled")] pub minions_killed: i32, #[serde(rename = "teamScore")] - pub team_score: i32, + pub team_score: Option, #[serde(rename = "dominionScore")] - pub dominion_score: i32, + pub dominion_score: Option, #[serde(rename = "totalGold")] pub total_gold: i32, #[serde(rename = "level")] @@ -970,7 +970,7 @@ pub mod match_v4 { #[serde(rename = "currentGold")] pub current_gold: i32, #[serde(rename = "position")] - pub position: MatchPosition, + pub position: Option, #[serde(rename = "jungleMinionsKilled")] pub jungle_minions_killed: i32, } @@ -988,52 +988,52 @@ pub mod match_v4 { #[derive(serde::Serialize, serde::Deserialize)] pub struct MatchEvent { #[serde(rename = "laneType")] - pub lane_type: String, + pub lane_type: Option, #[serde(rename = "skillSlot")] - pub skill_slot: i32, + pub skill_slot: Option, #[serde(rename = "ascendedType")] - pub ascended_type: String, + pub ascended_type: Option, #[serde(rename = "creatorId")] - pub creator_id: i32, + pub creator_id: Option, #[serde(rename = "afterId")] - pub after_id: i32, + pub after_id: Option, #[serde(rename = "eventType")] - pub event_type: String, + pub event_type: Option, /// (Legal values: CHAMPION_KILL, WARD_PLACED, WARD_KILL, BUILDING_KILL, ELITE_MONSTER_KILL, ITEM_PURCHASED, ITEM_SOLD, ITEM_DESTROYED, ITEM_UNDO, SKILL_LEVEL_UP, ASCENDED_EVENT, CAPTURE_POINT, PORO_KING_SUMMON) #[serde(rename = "type")] pub r#type: String, #[serde(rename = "levelUpType")] - pub level_up_type: String, + pub level_up_type: Option, #[serde(rename = "wardType")] - pub ward_type: String, + pub ward_type: Option, #[serde(rename = "participantId")] - pub participant_id: i32, + pub participant_id: Option, #[serde(rename = "towerType")] - pub tower_type: String, + pub tower_type: Option, #[serde(rename = "itemId")] - pub item_id: i32, + pub item_id: Option, #[serde(rename = "beforeId")] - pub before_id: i32, + pub before_id: Option, #[serde(rename = "pointCaptured")] - pub point_captured: String, + pub point_captured: Option, #[serde(rename = "monsterType")] - pub monster_type: String, + pub monster_type: Option, #[serde(rename = "monsterSubType")] - pub monster_sub_type: String, + pub monster_sub_type: Option, #[serde(rename = "teamId")] - pub team_id: crate::consts::Team, + pub team_id: Option, #[serde(rename = "position")] - pub position: MatchPosition, + pub position: Option, #[serde(rename = "killerId")] - pub killer_id: i32, + pub killer_id: Option, #[serde(rename = "timestamp")] pub timestamp: i64, #[serde(rename = "assistingParticipantIds")] - pub assisting_participant_ids: std::vec::Vec, + pub assisting_participant_ids: Option>, #[serde(rename = "buildingType")] - pub building_type: String, + pub building_type: Option, #[serde(rename = "victimId")] - pub victim_id: i32, + pub victim_id: Option, } } diff --git a/tests/tests_na.rs b/tests/tests_na.rs index b1e1ba6..9b3fcad 100644 --- a/tests/tests_na.rs +++ b/tests/tests_na.rs @@ -51,6 +51,12 @@ 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(()) + }, // 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())?;