dolejska-daniel / riot-api Goto Github PK
View Code? Open in Web Editor NEWRiot League of Legends & DataDragon API wrappers for PHP7 and PHP8.
License: GNU General Public License v3.0
Riot League of Legends & DataDragon API wrappers for PHP7 and PHP8.
License: GNU General Public License v3.0
In the wiki, on the LeagueAPI::StaticData endpoints page, the example code doesn't work.
Steps to reproduce the behavior:
Update the code blocks to use "LeagueAPI::" instead of "RiotAPI::" and the code works perfectly.
I just downloaded this library today, thank you very much for it! I am migrating my old league stats app and this seems like a solid option for a wrapper. So far it works flawlessly!
The author of this library should consider adding a Paypal donation button at the bottom of project if he/she isn't rich yet and they should also add their Twitter handle in case anyone wants to network (not necessarily ask questions).
This is my first time using Composer - I am receiving this error at the end of composer update:
Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated.
Describe the bug
Composer install error
Screenshots
root@vps-01:/var/www/api-riot/riot-api# composer require dolejska-daniel/riot-api
Using version ^3.0 for dolejska-daniel/riot-api
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installation failed, reverting ./composer.json to its original content.
[ErrorException]
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] []...
Server (please complete the following information):
root@vps-01:/var/www/api-riot/riot-api# php -v
PHP 7.3.4-1+ubuntu16.04.1+deb.sury.org+3 (cli) (built: Apr 10 2019 10:50:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.4-1+ubuntu16.04.1+deb.sury.org+3, Copyright (c) 1999-2018, by Zend Technologies
root@vps-01:/var/www/api-riot/riot-api#
Tests need to be updated/reworked.
Now I'm gonna start being a pain ;)
First error I encountered:
[2017-06-28 04:55:25] local.ERROR: ErrorException: A non well formed numeric value encountered in /Users/kyle/Code/app/vendor/dolejska-daniel/riot-api/src/RiotAPI/Definitions/RateLimitStorage.php:86
Second:
[2017-06-28 05:12:02] local.ERROR: ErrorException: Undefined index: expires in /Users/kyle/Code/app/vendor/dolejska-daniel/riot-api/src/RiotAPI/Definitions/RateLimitStorage.php:48
My API object:
$this->api = new RiotAPI([
RiotAPI::SET_KEY => config('services.riot.key'),
RiotAPI::SET_REGION => $this->getRegion(),
RiotAPI::SET_CACHE_PROVIDER => IlluminateCacheProvider::class,
RiotAPI::SET_CACHE_CALLS => true,
RiotAPI::SET_CACHE_CALLS_LENGTH => 60,
RiotAPI::SET_CACHE_RATELIMIT => true,
RiotAPI::SET_RATELIMITS => [
config('services.riot.key') => [
IRateLimitControl::INTERVAL_10S => 1500,
IRateLimitControl::INTERVAL_10M => 90000,
IRateLimitControl::INTERVAL_1H => 540000,
],
],
]);
And because I'm using Laravel, I made an Illuminate cache provider: https://gist.github.com/xKairu/ede67698327fb722aea5e14bbd21fc68
The cache provider seems to work, as getting a stored object just after its set to $this->cache works.
Setting SET_CACHE_RATELIMIT to false results in this, and I have to remove all cache-related options to fix it:
[2017-06-28 05:14:29] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function setLimits() on null in /Users/kyle/Code/app/vendor/dolejska-daniel/riot-api/src/RiotAPI/RiotAPI.php:348
Describe the bug
Access var in LeagueItemDto
class. Please change $summonerId
and $summonerName
to public
in RiotAPI.
namespace RiotAPI\LeagueAPI\Objects;
class LeagueItemDto extends ApiObject {
/** @var string $summonerId */
public $summonerId;
/** @var string $summonerName */
public $summonerName;
}
I offer myself as a contributor for this proyect , it's genial
Regards!
$games = $this->parseCollection($this->getMatchlistByAccount($user, [440, 420], null, null, null, null, null, $total)->matches);
$details = new Collection();
$games->each(function ($game) use ($details) {
$details->push(
$this->getMatch($game->gameId)
);
});
return $details;
RESULT:
ErrorException (E_NOTICE)
Undefined offset: -1
Hi there,
please help, if I use this :
$api = new RiotAPI([ RiotAPI::SET_STATICDATA_LINKING => true,]);
show me this always http://take.ms/Cct3C problem with rate limit :/
Describe the bug
In \RiotAPI\LeagueAPI\Objects\ChampionMasteryDto::$championId
the typing is float
, but champion Ids are integer
s. This is problematic because PHP does not support floating numbers for keys as arrays and you might get a warning in your IDE.
To Reproduce
Steps to reproduce the behavior:
Not relevant.
Hi again,
is there any more info about DataDragon API ? implementation, maybe some example ?
Thank you.
Hello
There is another problem with the tournament codes ENDPOINT, lines 2743 and 2744, could you fix that?
if (empty($parameters->allowedSummonerIds))
throw new RequestParameterException('List of participants (allowedSummonerIds) may not be empty. If you wish to allow anyone, fill it with 0, 1, 2, 3, etc.');
This is just not true as I understand it, the array can just be empty no? What does it even mean to fill it with 0,1,2...?
Best regards
Description
Rate limit is not honored.
To Reproduce
Steps to reproduce the behavior:
LeagueAPI::SET_CACHE_RATELIMIT => true
as instructed by wikiExpected behavior
who knows? maybe set limit exceed action.
Describe the bug
Hi,
I'm getting error 400 on creating Tournament Provider on v4
To Reproduce
Main code
use RiotAPI\LeagueAPI\Objects\ProviderRegistrationParameters;
$riot = new LeagueAPI([
LeagueAPI::SET_KEY => config('riot.key'),
LeagueAPI::SET_TOURNAMENT_KEY => config('riot.key'),
LeagueAPI::SET_REGION => Region::BRASIL,
LeagueAPI::SET_CACHE_RATELIMIT => config('riot.rate_limit_control_enabled'),
LeagueAPI::SET_CACHE_PROVIDER => RiotRedisProvider::class,
LeagueAPI::SET_CACHE_CALLS => config('riot.cache_enabled')
]);
$parameters = new ProviderRegistrationParameters([
'region' => 'br',
'url' => 'https://myproject.com/riot/callback',
]);
$riot->createTournamentProvider($parameters);
Expected behavior
Tournament Provider created
Server (please complete the following information):
Additional context
I'm using Laravel.
Describe the bug
LeagueAPI::getStaticChampion not working without version.
To Reproduce
Steps to reproduce the behavior:
$api = new LeagueAPI([ LeagueAPI::SET_KEY => 'MY_KEY', LeagueAPI::SET_REGION => Region::EUROPE_EAST ]); $api->getStaticChampion(203, false, 'en_US');
Argument 1 passed to RiotAPI\LeagueAPI\Objects\ApiObject::__construct() must be of the type array, boolean given, called in /var/www/thekingeagle/public/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php on line 1809
Expected behavior
The function should return the same result as the:
$api->getStaticChampion(203, false, 'en_US', '9.3.1');
This result contains data about Kinder champion
Server:
Additional context
After small investigation, I found that there is a validation for version parameter:
File: RiotAPI\DataDragonAPI\DataDragonAPI::getStaticDataFileUrl
If we do not specify the version for getStaticChampion method, then the version in getStaticDataFileUrl will be null (default method parameter).
We can't just remove this validation because the URL will be generated wrong:
https://ddragon.leagueoflegends.com/cdn//data/en_US/champion.json#by-key
The correct URL will be:
https://ddragon.leagueoflegends.com/cdn/9.3.1/data/en_US/champion.json#by-key
LeagueApi.php
1559 lines
To change positions -> entries
$resultPromise = $this->setEndpoint("/lol/league/" . self::RESOURCE_LEAGUE_VERSION . "/positions/by-summoner/{$encrypted_summoner_id}")
->setResource(self::RESOURCE_LEAGUE, "/positions/by-summoner/%s")
->makeCall();
$resultPromise = $this->setEndpoint("/lol/league/" . self::RESOURCE_LEAGUE_VERSION . "/entries/by-summoner/{$encrypted_summoner_id}")
->setResource(self::RESOURCE_LEAGUE, "/entries/by-summoner/%s")
->makeCall();
it works
hi, i wanted to know if you will implemente some database template to this api to save the data?
Hey, I'm looking for a library to replace leaguewrap for v3 coming up, and this one looks nice. I just have one issue so far:
with leaguewrap, I can do $matches = $api->game()->recent($summoner)
, and it'll give me the stats for those matches on $matches[0]->stats
.
With this, I would need to pull in the recent match list, then make a request to pull in the MatchDto for each match, then each match I need to pull in 10 ParticipantDto objects, then for each of those, I need a ParticipantStatsDto object, and even then, I have no way of checking which ParticipantDto object is the one for the user I'm actually requesting. At the moment, I can't even pull in the MatchDto objects before hitting my rate limit, let alone a potential 421 (i think) requests for data that I need up front.
Is this a limitation of the v3 API, or just the library? Maybe I'm just reading it all wrong.
Thanks.
Currently, we are making good use of this api.
However, I want to use multiple API keys because of limitations of API use.
So I checked the cache in the cache folder and it seems that each key has its own cache.
If I try to use multiple API keys, will LIMIT work well with each change in key value?
The RiotAPI::getMatch()
method (and probably some more) requires an int
as parameter - however match id's have become larger than PHP's maximum (32 bit) int value.
Possible Solution: You should remove the type hint for this method.
Hi @dolejska-daniel,
I didn't find anything on Wiki that we have to use RiotAPI::SET_TOURNAMENT_KEY to use Tournament's API. I passed hours debugging the package to discovery that I have to use the SET_TOURNAMENT_KEY.
So, please, can you add something on Wiki to help others here: https://github.com/dolejska-daniel/riot-api/wiki/LeagueAPI:-Resources-and-endpoints#tournament---tournament-stub-, please?
Thank you.
Is your feature request related to a problem? Please describe.
I'm trying to process hundreds of requests on the background but synchronous functions are limiting the process. It would be nice to have async request support.
Describe the bug
When I try to get static champion data error occurs.
To Reproduce
Steps to reproduce the behavior:
$api = new LeagueAPI([ LeagueAPI::SET_KEY => 'MY_KEY', LeagueAPI::SET_REGION => Region::EUROPE_EAST, ]); $api->getStaticChampion(61);
Argument 1 passed to RiotAPI\LeagueAPI\Objects\ApiObject::__construct() must be of the type array, boolean given, called in /var/www/thekingeagle/public/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php on line 1809
Server:
Hi @dolejska-daniel,
There is a new update on v4. Here what's is new:
https://www.riotgames.com/en/DevRel/riot-api-update-190417
The Deprecation date of the methods is June 17th.
Describe the bug
Cant do the request properly
To Reproduce
Steps to reproduce the behavior:
use the functions with arguments
Solution:
Add a '?' at the end of the setressource argument string exemple "setResource(self::RESOURCE_MATCH, "/matchlists/by-account/%i?")"
Hello, I am trying to use this API with my new Laravel 5.5 project and how to use this API without writting it in every page? I need to declare only region where I need it.
Describe the bug
Ever since v3.0.2 getMatchlistByAccount
doesn't accept arrays when the documentation lists the fields as int|array
.
The fields are:
$queue
$season
$champion
The method returns the following error:
LeagueAPI: Request is invalid. Bad request - Query parameter 'season' must be numeric
The match list endpoint should be able to retrieve data for multiple queues/seasons/champions.
To Reproduce
Steps to reproduce the behavior:
LeagueAPI
getMatchlistByAccount
and set one of the affected fields as an array of integersExpected behavior
Should return a match list with the supplied filters applied.
Screenshots
Not relevant
Server (please complete the following information):
Additional context
Seems like a constraint was placed on the fields and it no longer accepts arrays.
Hi,
I was reading your docs and here: https://github.com/dolejska-daniel/riot-api/wiki/LeagueAPI:-Resources-and-endpoints#tournament---tournament-stub-
I saw this phrase:
Only these functions are available in interim mode
I think, the correct way is:
"Only these functions are not available in interim mode". Because, we only have access to Tournament API with a production key.
Am I correct?
Best regards.
Hi @dolejska-daniel ,
do you already have plans on implementing the new v4
Riot API ? Since I use your library on a daily basis it would be great to see if it still was compatible with the new coming version for the API.
Thanks for your great work!
Describe the bug
PHP Notice: Undefined index: status in /Users/user/projects/calol/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php on line 1142
To Reproduce
Steps to reproduce the behavior:
$api->getSummonerByName('Decolip');
Server (please complete the following information):
Describe the bug
So we are in the middle of porting our system to V4 and we encountered an issue with the caching mechanism.
After upgrading to v3.0.2 when ever SET_CACHE_RATELIMIT
is set to true
i get the following error
<br />
<b>Fatal error</b>: Uncaught TypeError: Argument 4 passed to RiotAPI\LeagueAPI\Definitions\RateLimitControl::`registerLimits() must be of the type string or null, array given, called in /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php on line 607 and defined in /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/Definitions/RateLimitControl.php:72
Stack trace:
#0 /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php(607): RiotAPI\LeagueAPI\Definitions\RateLimitControl->registerLimits('[redacted]...', 'euw', '1416:summoner/s...', Array, Array)
#1 /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php(1231): RiotAPI\LeagueAPI\LeagueAPI->RiotAPI\LeagueAPI\{closure}(Object(RiotAPI\LeagueAPI\LeagueAPI), 'https://euw1.ap...', 'ed56e305f3d5a59...', '/var/www/[redacted]...')
#2 /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php(1071): RiotAPI\LeagueAPI\LeagueAPI->_afterCall('https://euw1.ap...', 'ed56e305f3d5a59...', ' in <b>/var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php</b> on line <b>1100</b><br />
(I redacted info that shouldn't be here :))
To Reproduce
Steps to reproduce the behavior:
SET_CACHE_RATELIMIT
set to true
(We are using a custom redis ICacheprovider implementation but from my tests the failure occurs before it even reaches that point)Expected behavior
The library should return the relevant data.
Screenshots
Not relevant
Server (please complete the following information):
Additional context
After playing around with the code I found out that the headers are returned in a weird format.
here is the result from var_dump straight from the call function before the ICacheProvider is even contacted (This is ran with an empty cache so that everything is returned from Riot API).
array(10) {
["Content-Type"]=>
array(1) {
[0]=>
string(30) "application/json;charset=utf-8"
}
["Date"]=>
array(1) {
[0]=>
string(30) "Sun, 13 Jan 2019 18:18:07 GMT"
}
["Vary"]=>
array(1) {
[0]=>
string(15) "Accept-Encoding"
}
["X-App-Rate-Limit"]=>
array(1) {
[0]=>
string(16) "500:10,30000:600"
}
["X-App-Rate-Limit-Count"]=>
array(1) {
[0]=>
string(10) "1:10,5:600"
}
["X-Method-Rate-Limit"]=>
array(1) {
[0]=>
string(7) "2000:60"
}
["X-Method-Rate-Limit-Count"]=>
array(1) {
[0]=>
string(4) "2:60"
}
["X-Riot-Edge-Trace-Id"]=>
array(1) {
[0]=>
string(36) "14c2268a-8cda-4ab2-9f00-bda3c6e4d46b"
}
["Content-Length"]=>
array(1) {
[0]=>
string(3) "298"
}
["Connection"]=>
array(1) {
[0]=>
string(10) "keep-alive"
}
}
Notice how instead of a clear string its a nested array and registerLimits
expects the headers to be strings and not arrays.
Is your feature request related to a problem? Please describe.
The Riot Developers announced that v3 API will be deprecated soon.
Describe the solution you'd like
Today, they made available the endpoints from the new API version, v4. In the link below, there are the endpoints that needed to be implemented:
Describe the bug
I created a homepage which is using your riot-api framework. As I created a cup within my CMS I created a tournamentId and a providerId. An object "TournamentCodeParameters" is created with related parameters. But the response is at any time:
LeagueAPI: Request is invalid. Bad request - The request entity had the following errors:[teamSize must be greater than or equal to 1 (was 0), spectatorType may not be null (was null), mapType may not be null (was null), pickType may not be null (was null)]
My TournamentCodeParameters object looks like:
RiotAPI\LeagueAPI\Objects\TournamentCodeParameters Object
(
[spectatorType] => LOBBYONLY
[teamSize] => 1
[pickType] => TOURNAMENT_DRAFT
[allowedSummonerIds] =>
[mapType] => SUMMONERS_RIFT
[metadata] =>
[_data:protected] => Array
(
[spectatorType] => LOBBYONLY
[teamSize] => 1
[pickType] => TOURNAMENT_DRAFT
[mapType] => SUMMONERS_RIFT
)
[_extension:protected] =>
)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I receive a list of codes when I am using the stub methods.
Server (please complete the following information):
Please pardon my noobness,
I was reading this closed bug and trying to grasp how to do rate limits and caching calls but I'm just completely lost.
Do I need to make my own cache provider class that connects to my database and then uploads / retrieves the data from there? Should I follow this to set it up? Should I just copy/pasta xKairu's ICacheProvider?
I'm about to implement the next level to my app which will make 10-20 requests for the match data and I neither want to go over the rate limit nor do I want to continually ask Riot for the information when I could just as easily store it into a SQL database or where ever.
Hi Daniel,
are you planning to add new endpoint for static Data API ?
Thank you.
Please help. I have xampp and composer installed on my computer. I run composer require dolejska-daniel/riot-api
in the shell and then i upload the new folder "vendor" and two composer files to my website. Is that all?
Describe the bug
I'm getting this error on a implementation of a custom cache provider:
'RiotAPI\LeagueAPI\LeagueAPI::RiotAPI\LeagueAPI{closure}(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "RiotAPI\Definitions\RateLimitControl" of the object you are trying to operate on was loaded before unserialize() gets called or provide an autoloader to load the class definition'
To Reproduce
Steps to reproduce the behavior:
Main code
use RiotAPI\LeagueAPI\Definitions\Region;
use RiotAPI\LeagueAPI\LeagueAPI;
$riot = new LeagueAPI([
LeagueAPI::SET_KEY => config('riot.key'),
LeagueAPI::SET_TOURNAMENT_KEY => config('riot.key'),
LeagueAPI::SET_REGION => Region::BRASIL,
LeagueAPI::SET_CACHE_RATELIMIT => config('riot.rate_limit_control_enabled'),
LeagueAPI::SET_CACHE_PROVIDER => RiotRedisProvider::class,
LeagueAPI::SET_CACHE_CALLS => config('riot.cache_enabled')
]);
return $riot->getSummonerByName('Just Sieg');
RiotRedisProvider
use Illuminate\Support\Facades\Cache;
use RiotAPI\LeagueAPI\Definitions\ICacheProvider;
class RiotRedisProvider implements ICacheProvider
{
/**
* Loads data stored in cache memory.
*
* @param string $name
* @return mixed
*/
public function load(string $name)
{
return Cache::get($name);
}
/**
* Saves data to cache memory.
*
* @param string $name
* @param $data
* @param int $length
*
* @return bool
*/
public function save(string $name, $data, int $length): bool
{
Cache::put($name, $data, $length);
return true;
}
/**
* Checks whether or not is saved in cache.
*
* @param string $name
*
* @return bool
*/
public function isSaved(string $name): bool
{
return Cache::has($name);
}
}
Expected behavior
Execute correctly the request
Screenshots
https://drive.google.com/file/d/1IYMXGJsbeNfx7CJB7ScVbIiYtn-C-h2k/view?usp=sharing
Server (please complete the following information):
Additional context
I'm using Laravel.
Describe the bug
empty response from getLeaguePositionsForSummoner
causing the following error:
<br />
<b>Fatal error</b>: Uncaught TypeError: Argument 1 passed to RiotAPI\LeagueAPI\LeagueAPI::RiotAPI\LeagueAPI\{closure}() must be of the type array, null given, called in /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php on line 987 and defined in /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php:1558
Stack trace:
#0 /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php(987): RiotAPI\LeagueAPI\LeagueAPI->RiotAPI\LeagueAPI\{closure}(NULL)
#1 /var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php(1564): RiotAPI\LeagueAPI\LeagueAPI->resolveOrEnqueuePromise(Object(GuzzleHttp\Promise\Promise), Object(Closure))
#2 /var/www/[redacted]/public_html/api/v1/rank/get.php(12): RiotAPI\LeagueAPI\LeagueAPI->getLeaguePositionsForSummoner('TXsHzGHq4CIqswg...')
#3 {main}
thrown in <b>/var/www/[redacted]/vendor/dolejska-daniel/riot-api/src/LeagueAPI/LeagueAPI.php</b> on line <b>1558</b><br />
To Reproduce
Steps to reproduce the behavior:
LeagueAPI
getLeaguePositionsForSummoner
to unranked summonerExpected behavior
The library should return an empty response.
Screenshots
Not relevant
Server (please complete the following information):
Is your feature request related to a problem? Please describe.
Since StaticData endpoint was deprecated the data fetches were moved from the RiotAPI
to DataDragonAPI
- but it only provides us with the raw data which then can be used to initialize provided classes.
Describe the solution you'd like
With RiotAPI $api;
, call to $api->getStaticChampions(...);
will result in calling DataDragonAPI::getStaticChampions(...);
and using received data to initialize related class return new StaticData\StaticChampionListDto(...);
.
I do not know whether or not are the class properties 1:1 with resulting data keys from DataDragonAPI. There might be some class property changes required.
How i am supposed too create one autoload.php
since i am a begginer on php
Describe the bug
Hi,
I'm getting error 500 - 'LeagueAPI: Internal server error occured.', I get the json from the library and put on developer.riotgames.com and I was able to create a tournament code there.
To Reproduce
$riot = new LeagueAPI([
LeagueAPI::SET_KEY => config('riot.key'),
LeagueAPI::SET_TOURNAMENT_KEY => config('riot.key'),
LeagueAPI::SET_REGION => Region::BRASIL,
LeagueAPI::SET_CACHE_RATELIMIT => config('riot.rate_limit_control_enabled'),
LeagueAPI::SET_CACHE_PROVIDER => RiotRedisProvider::class,
LeagueAPI::SET_CACHE_CALLS => config('riot.cache_enabled')
]);
$parameters = new TournamentCodeParameters([
'allowedSummonerIds' => $participants,
'mapType' => $map_type,
'pickType' => $pick_type,
'spectatorType' => $spectator_type,
'teamSize' => $team_size,
]);
// Create Tournament Codes
$riot->createTournamentCodes($tournament_id, $count, $parameters);
Json
{"spectatorType":"ALL","teamSize":5,"pickType":"ALL_RANDOM","allowedSummonerIds":["auAmS-X5zAMH5k134GQEDEcDm4xS4_FvXQiOsCZqzhBZ","4Zv2cxrEsizFTML7uX8pf2Qrl0K6wJgjm5QtFNWZmUxP","ZASDToK0rkg_vL3sYrbwQfJQRHL1VwR9RUsJtrnBRJV4rw","4s2JJ6AzLcCDNBbKTPIk3q-GsXqlXp3hPBWwx_FS6QCz","4cUcAL4VcNYPuTlfagWTf_FhB79hdG4y4fIJ6AP-pogwCw","vWpDNUD6lNg-0ssn3XPy3noLlzrL6X7FORifn4clRYosXw","t9i22GkvWi0IEdvizq9z5A6A53yceix2WcM8hGBk7Wcsbw","l-gMBkOU12gyyxo_RWF5We6Oa8zlozxhLHSreDO5K7MBesM","bPXvFD_La1BexRzXjDXsbq_lW6jmUyENPnur0TJqrzmtXg","B_v1VzFeKXef-h0ehJLpz4gDokyCTGuwLFgc8EgjMzQZ-Q"],"mapType":"SUMMONERS_RIFT","metadata":null}
Expected behavior
Create Tournament codes
Server (please complete the following information):
Additional context
I'm using Laravel
The class \RiotAPI\Objects\CurrentGameParticipant
changed around patch 7.24.1
, and since there was no release yet, I am creating this issue.
teamId
-> no change requiredspell1Id
-> no change requiredspell2Id
-> no change requiredchampionId
-> no change requiredprofileIconId
-> no change requiredsummonerName
-> no change requiredbot
-> no change requiredsummonerId
-> no change requiredperks
-> is an array that has perkIds = array()
, perkStyle = int
, perkSubStyle = int
runes
-> should be removedmasteries
-> should be removedIf I have time I might open a new PR.
Hi,
I wanted to know if it's possible to export the current usage statistics (Rate Limit Tokens) so that I can export them to prometheus.
Is there a build in function for fetching the current usage statistics?
Hey quick question about the DDragon functions
I have gotten myself a MatchDTO using your library and am trying to show the champion icons, however now I only have a champion ID from the bans (as an example). How do I go about finding the champion name the best way?
Something like this but be really nice, but doesn't work as it seems to only take the champion_name and not the champion_id
DataDragonAPI::getChampionIcon($match->teams[1]->bans[0]->championId)
Any ideas?
DataDragonAPI calls template:
$result = false;
try
{
// Fetch StaticData from JSON files
$result = DataDragonAPI::FUNCTION_NAME(...$PARAMETERS);
if (!$result) throw new ServerException("StaticData failed to be loaded.");
$this->result_data = $result;
}
catch (DataDragonExceptions\SettingsException $ex)
{
throw new SettingsException("DataDragon API was not initialized properly! StaticData endpoints cannot be used.");
}
catch (DataDragonExceptions\ArgumentException $ex)
{
throw new RequestException($ex->getMessage(), $ex->getCode());
}
finally
{
// Parse array and create instances
return new ApiObject($result, $this);
}
Should be refactored to "kind of" match up with normal API calls:
$this->setEndpoint("/lol/league/" . self::RESOURCE_LEAGUE_VERSION . "/grandmasterleagues/by-queue/{$game_queue_type}")
->setResource(self::RESOURCE_LEAGUE, "/grandmasterleagues/by-queue/%s")
->makeCall();
return new Objects\LeagueListDto($this->getResult(), $this);
Hello I am using the v4 Tournament Code endpoint to generate tourney codes for a tournament and I receive the following error when trying to request tournament codes:
Fatal error: Uncaught RiotAPI\LeagueAPI\Exceptions\RequestParameterException: List of participants (allowedSummonerIds) may not be empty. If you wish to allow anyone, fill it with 0, 1, 2, 3, etc. in vendor\dolejska-daniel\riot-api\src\LeagueAPI\LeagueAPI.php on line 2744
First off all I don't quite understand the error, what am I supposed to fill in in order to allow all users? Second, if I fill the array with 0 - 9 I receive an Error from Riot stating that '0 cannot be decrypted', this is because the Riot API tries to decrypt the userids sent, so that error message makes even less sense.
Is there a good way to allow all users to use the tourney code using this API?
I'm newbie on RIOT API, just got your beautiful work and started to work with it, thank you very much.
About Data Dragon, seems Riot cut off static api, now API returns "Request: Forbidden. (Forbidden)" messages for most Data Dragon calls.
Will you be able to update soon?
I'd like to get the full address of the static files.
The code:
$this->version = '9.10.1';
DataDragonAPI::initByVersion($this->version);
$static_spell = DataDragonAPI::getStaticSummonerSpellByKey($id);
$result['image'] = DataDragonAPI::getSpellIconUrl($static_spell['id']);;
$result['name'] = $static_spell['name'];
The result when using version 3.0.10:
{
"message": "Summoner spell with given key was not found.",
"exception": "RiotAPI\\DataDragonAPI\\Exceptions\\ArgumentException",
"file": "/projects/project_name/vendor/dolejska-daniel/riot-api/src/DataDragonAPI/DataDragonAPI.php",
"line": 1478,
"trace": [
{
"file": "/projects/project_name/vendor/dolejska-daniel/riot-api/src/DataDragonAPI/DataDragonAPI.php",
"line": 1494,
"function": "getStaticSummonerSpell",
"class": "RiotAPI\\DataDragonAPI\\DataDragonAPI",
"type": "::"
},
{
"file": "/projects/project_name/app/Http/Controllers/Api/Riot.php",
"line": 52,
"function": "getStaticSummonerSpellByKey",
"class": "RiotAPI\\DataDragonAPI\\DataDragonAPI",
"type": "::"
},
{
"function": "Item",
"class": "App\\Http\\Controllers\\Api\\Riot",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
"line": 54,
"function": "call_user_func_array"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
"line": 45,
"function": "callAction",
"class": "Illuminate\\Routing\\Controller",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 212,
"function": "dispatch",
"class": "Illuminate\\Routing\\ControllerDispatcher",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 169,
"function": "runController",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 658,
"function": "run",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
"line": 41,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 57,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\ThrottleRequests",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 102,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 660,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 635,
"function": "runRouteWithinStack",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 601,
"function": "runRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 590,
"function": "dispatchToRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 176,
"function": "dispatch",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\\Foundation\\Http\\{closure}",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/projects/project_name/vendor/fideloper/proxy/src/TrustProxies.php",
"line": 56,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Fideloper\\Proxy\\TrustProxies",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 30,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 30,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
"line": 46,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 149,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 102,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 151,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/projects/project_name/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 116,
"function": "sendRequestThroughRouter",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/projects/project_name/public/index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/projects/project_name/server.php",
"line": 21,
"function": "require_once"
}
]
}
I downgraded it to version 3.0.7 and it's working properly.
Game ID for example: 2544947953
$api = new RiotAPI([
RiotAPI::SET_KEY => config('services.riot.key'),
RiotAPI::SET_REGION => Region::NORTH_AMERICA,
]);
$summoner = $api->getSummonerByName('tking295');
$matches = $api->getRecentMatchlistByAccount($summoner->accountId)->matches;
$match = $api->getMatch($matches[0]->gameId);
dd($match);
And as you can see, all the player
objects are null, so I can't check the accountId with my current Summoner object. https://gist.github.com/xKairu/e53df42f8bfbe798f79036f3f591c955
At first I thought this might be because of a live game, but lolking has no problem viewing this match and it was 8 hours ago. Is this normal with the new API?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.