LeagueJS
LeagueJS copied to clipboard
(RIOT API changes) New Matchlist parameters - integrate range splitting with background requests
Watch how https://discussion.developer.riotgames.com/questions/3155/why-pagination-is-a-problem.html evolves.
Currently there is a new enforced pagination on the matchlist endpoint that might cause requests to fail bc they
a) ~have a too high range (>=100) for their beginIndex/endIndex~ done in https://github.com/Colorfulstan/LeagueJS/commit/d97c533a7b63e5577ed85b85858ef6b93544035a b) have a too high range (> 1week) for their startTime/endTime
If a higher range is given, the Endpoint methods should ideally split the ranges and execute the neccessary requests in the background I think
limit per matchlist response was upped to 100 https://discussion.developer.riotgames.com/articles/3241/update-on-matchlist-and-recent-endpoints.html
- [x] check and split beginIndex - endIndex (batches of 100)
- [x] check and split beginTime - endTime (1 week intervals)
- [x] if only beginIndex given: set endIndex +100
- [x] if only endIndex given: set beginIndex -100
- [ ] if only beginTime given: set endTime +1week
- [ ] if only endTime given: set beginTime -1week
There might be value in a method that returns an observable, but since the batches need to be requested in series anyway (du to missing filtered totalGames indication on the API) for now it will just return a Promise that resolves in a combined array of MatchReferences
Some things like setting endINdex to beginIndex + 100 were changed on the endpoint, so check what actually still is needed before implementing