Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated getMatch and getMatches to pass an accountId in the query #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions php-riot-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions testing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -46,4 +47,4 @@
echo "Error: " . $e->getMessage();
};

?>
?>