|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Riot\API\Version1; |
| 6 | + |
| 7 | +use JsonException; |
| 8 | +use Psr\Http\Client\ClientExceptionInterface; |
| 9 | +use Riot\API\AbstractApi; |
| 10 | +use Riot\DTO\LeaderboardDTO; |
| 11 | +use Riot\Exception as RiotException; |
| 12 | + |
| 13 | +final class LorRanked extends AbstractApi |
| 14 | +{ |
| 15 | + /** |
| 16 | + * @throws JsonException |
| 17 | + * @throws RiotException\BadGatewayException |
| 18 | + * @throws RiotException\BadRequestException |
| 19 | + * @throws RiotException\DataNotFoundException |
| 20 | + * @throws RiotException\ForbiddenException |
| 21 | + * @throws RiotException\GatewayTimeoutException |
| 22 | + * @throws RiotException\InternalServerErrorException |
| 23 | + * @throws RiotException\MethodNotAllowedException |
| 24 | + * @throws RiotException\RateLimitExceededException |
| 25 | + * @throws RiotException\ServiceUnavailableException |
| 26 | + * @throws RiotException\UnauthorizedException |
| 27 | + * @throws RiotException\UnsupportedMediaTypeException |
| 28 | + * @throws ClientExceptionInterface |
| 29 | + */ |
| 30 | + public function getLeaderboards(string $geoRegion): LeaderboardDTO |
| 31 | + { |
| 32 | + $response = $this->riotConnection->get( |
| 33 | + $geoRegion, |
| 34 | + 'lor/ranked/v1/leaderboards', |
| 35 | + ); |
| 36 | + $body = $response->getBody()->getContents(); |
| 37 | + |
| 38 | + return LeaderboardDTO::createFromArray(json_decode($body, true, 512, JSON_THROW_ON_ERROR)); |
| 39 | + } |
| 40 | +} |
0 commit comments