Riot Games API Java Library
This version adds support for the new league endpoints and deprecates old ones, that will soon no longer be supported by the Riot Api.
Moving to Riot Api v4
This new release adds support for the new Riot Api v4 endpoints. Please note that many of the Riot Api v4 endpoint calls are incompatible to the old v3 calls. Most notably, all summonerId
s and accountId
s are now Strings and unique for each application.
Also there is now a new puuid
field to summoners which isn't used much just yet, but will play a significant role for future Riot Api endpoints.
There are also a number of changes to leagues with the new field position
, and a couple new endpoints.
Please refer to the official Riot Api and their announcements and documentation for further information on these changes.
Custom rate limit handling
You can now use your own RateLimitHandler to use custom rate limiting logic that suits your needs. By default the DefaultRateLimitHandler
is used which works exactly like the built-in rate limit logic before this update. If you did not explicitly use setRespectRateLimits(false)
, no change should be required.
If you previously used the option setRespectRateLimits(false)
to disable the built-in rate limiting logic, you can now use the option setRateLimitHandler(null)
to achieve the same results. The option setRespectRateLimits()
has been removed.
Examples on how to create a custom RateLimitHandler will come soon.
Other changes
Riot Games retired the v1/v2 API endpoints in favor of their new v3 API endpoints, so we needed to come up with a major update to support all those changes.
Highlights of version 4.0.0 include:
Due to the nature of Riot's API changes, most API methods are now incompatible with the previous ones. However, we tried to implement the wrapper methods as close as possible to the official documentation, and included javadoc for all methods, so hopefully you will get along well with these changes.
If you have trouble upgrading your project to riot-api-java 4.0.0, please refer to the included examples. If you still have trouble, feel free to open an issue.
The following new methods (and their overloaded equivalents) have been added: getChampionMastery(PlatformId platformId, long summonerId, long championId) getChampionMasteries(PlatformId platformId, long summonerId) getChampionMasteryScore(PlatformId platformId, long summonerId) getTopChampionMasteries(PlatformId platformId, long summonerId, int count)
The javadoc has recently been overhauled. You can check it out here.
Support for the recently released Tournaments API has been added
The following new methods have been added:
import java.util.List;
import constant.*;
import main.java.riotapi.*;
import dto.Tournament.TournamentCode;
public class LeagueApp {
public static void main(String[] args) throws RiotApiException {
RiotApi api = new RiotApi("<API-KEY-HERE>", "<TOURNAMENT-KEY-HERE>", Region.NA);
// Create a tournament provider for the NA region, and provide a callback URL to which tournament game results in this region will be posted.
int providerId = api.createProvider(Region.NA, "https://example.com");
// Create a tournament under this provider named "Test Tournament".
int tournamentId = api.createTournament("Test Tournament", providerId);
/* Create a tournament code for a lobby with the following settings:
- Team Size: 5
- Map Type: Summoner's Rift
- Pick Type: Blind Pick
- Spectator Type: All
*/
String tournamentCode = api.createTournamentCode(tournamentId, 5, TournamentMap.SUMMONERS_RIFT, PickType.BLIND_PICK, SpectatorType.ALL);
System.out.println("TournamentCode: " + tournamentCode);
// Get data for the tournament code and print the lobby name
TournamentCode tournamentCodeData = api.getTournamentCode(tournamentCode);
System.out.println("Lobby Name: " + tournamentCodeData.getLobbyName());
}
}
TournamentCode: NA0418f-13ea0635-63d0-4d55-aaf2-849763e7c6e3
Lobby Name: cf74243d-5e5c-49ef-96d5-427995179de1
The following methods have been added -