Skip to content

Commit

Permalink
fix(api): fix match v5 endpoint URLs and data types (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolejska-daniel committed May 20, 2021
1 parent a8c28ae commit 21b83da
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/LeagueAPI/LeagueAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,11 @@ public function getMatchTimeline( $match_id )
* @cli-name get-ids-by-puuid
* @cli-namespace match
*
* @param int $match_id
* @param string $puuid
* @param int|null $start
* @param int|null $count
*
* @return int[]
* @return string[]
*
* @throws SettingsException
* @throws RequestException
Expand All @@ -1345,16 +1347,14 @@ public function getMatchIdsByPUUID(string $puuid, int $start = null, int $count

$continent_region = $this->platforms->getContinentRegion($this->getSetting(self::SET_REGION));

$resultPromise = $this->setEndpoint("/lol/match/" . self::RESOURCE_MATCH_VERSION . "/matches/by-puuid/{$puuid}")
->setResource(self::RESOURCE_MATCH, "/matches/by-puuid/%s")
$resultPromise = $this->setEndpoint("/lol/match/" . self::RESOURCE_MATCH_VERSION . "/matches/by-puuid/{$puuid}/ids")
->setResource(self::RESOURCE_MATCH, "/matches/by-puuid/%s/ids")
->addQuery("start", $start)
->addQuery("count", $count)
->makeCall($continent_region);

return $this->resolveOrEnqueuePromise($resultPromise, function(array $result) {
return $result
? array_map(function ($i) { return (int)$i; }, $result)
: [];
return $result ?? [];
});
}

Expand All @@ -1364,7 +1364,7 @@ public function getMatchIdsByPUUID(string $puuid, int $start = null, int $count
* @cli-name get
* @cli-namespace match
*
* @param int $match_id
* @param string $match_id
*
* @return Objects\MatchDto
*
Expand All @@ -1376,12 +1376,12 @@ public function getMatchIdsByPUUID(string $puuid, int $start = null, int $count
*
* @link https://developer.riotgames.com/apis#match-v5/GET_getMatch
*/
public function getMatch(int $match_id)
public function getMatch(string $match_id)
{
$continent_region = $this->platforms->getContinentRegion($this->getSetting(self::SET_REGION));

$resultPromise = $this->setEndpoint("/lol/match/" . self::RESOURCE_MATCH_VERSION . "/matches/{$match_id}")
->setResource(self::RESOURCE_MATCH, "/matches/%i")
->setResource(self::RESOURCE_MATCH, "/matches/%s")
->makeCall($continent_region);

return $this->resolveOrEnqueuePromise($resultPromise, function(array $result) {
Expand All @@ -1390,12 +1390,12 @@ public function getMatch(int $match_id)
}

/**
* Retrieve matchlsit by account ID.
* Retrieve match timeline by match ID.
*
* @cli-name get-timeline
* @cli-namespace match
*
* @param int $match_id
* @param string $match_id
*
* @return Objects\MatchTimelineDto
*
Expand All @@ -1407,12 +1407,12 @@ public function getMatch(int $match_id)
*
* @link https://developer.riotgames.com/apis#match-v5/GET_getTimeline
*/
public function getTimeline(int $match_id)
public function getTimeline(string $match_id)
{
$continent_region = $this->platforms->getContinentRegion($this->getSetting(self::SET_REGION));

$resultPromise = $this->setEndpoint("/lol/match/" . self::RESOURCE_MATCH_VERSION . "/matches/{$match_id}/timeline")
->setResource(self::RESOURCE_MATCH, "/matches/%i/timeline")
->setResource(self::RESOURCE_MATCH, "/matches/%s/timeline")
->makeCall($continent_region);

return $this->resolveOrEnqueuePromise($resultPromise, function(array $result) {
Expand Down

0 comments on commit 21b83da

Please sign in to comment.