diff --git a/php-riot-api.php b/php-riot-api.php index 9349acc..5c9bcf8 100644 --- a/php-riot-api.php +++ b/php-riot-api.php @@ -147,8 +147,12 @@ public function getStatic($call, $id = null, $params = null) { //New to my knowledge. Returns match details. //Now that timeline is a separated call, when includedTimeline is true, two calls are done at the same time. //Data is then processed to match the old structure, with timeline data included in the match data - public function getMatch($matchId, $includeTimeline = true) { + //UPDATE : you can now pass an accountId to know which participant is the player, even in normale game + public function getMatch($matchId, $accountId = false, $includeTimeline = true) { $call = self::API_URL_MATCH_3 . 'matches/' . $matchId; + + if($accountId) + $call .= "?forAccountId=" . $accountId; if(!$includeTimeline) return $this->request($call); @@ -314,12 +318,17 @@ public function getRunes($id){ } //Gets data of matches, given array of id. - public function getMatches($ids, $includeTimeline = true){ + //UPDATE : you can now pass an accountId to know which participant is the player, even in normale game + public function getMatches($ids, $accountId = false, $includeTimeline = true){ $calls=array(); foreach($ids as $matchId){ $call = self::API_URL_MATCH_3 . 'matches/' . $matchId; + + if($accountId) + $call .= "?forAccountId=" . $accountId; + $calls["match-".$matchId] = $call; if($includeTimeline) diff --git a/testing.php b/testing.php index 664e33c..0473d55 100644 --- a/testing.php +++ b/testing.php @@ -16,8 +16,9 @@ // $api->setPlatform("na1"); // $r = $api->getStatic("champions", 1, "locale=fr_FR&tags=image&tags=spells"); // $api->setPlatform("euw1"); -// $r = $api->getMatch(2898677684); -// $r = $api->getMatch(2898677684,false); +// $r = $api->getMatch(3256751043); +// $r = $api->getMatch(3256751043,27695644); +// $r = $api->getMatch(3256751043,false,false); // $r = $api->getTimeline(2898677684); // $r = $api->getMatchList(27695644); // $params = array( @@ -46,4 +47,4 @@ echo "Error: " . $e->getMessage(); }; -?> \ No newline at end of file +?>