Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

riot-api-java-v3.8.0

Compare
Choose a tag to compare
@taycaldwell taycaldwell released this 11 Dec 04:07
· 308 commits to master since this release

Tournaments API

Support for the recently released Tournaments API has been added

New Methods

The following new methods have been added:

tournament-provider-v1


POST /tournament/public/v1/provider
  • createProvider(Region region, String callbackUrl)

POST /tournament/public/v1/tournament
  • createTournament(String tournamentName, int providerId)

POST /tournament/public/v1/code
  • createTournamentCodes(int tournamentId, int count, int teamSize, TournamentMap mapType, PickType pickType, SpectatorType spectatorType, String metaData, long... allowedSummonerIds)

GET /tournament/public/v1/code/{tournamentCode}
  • getTournamentCode(String tournamentCode)

GET /tournament/public/v1/lobby/events/by-code/{tournamentCode}
  • getLobbyEventsByTournament(String tournamentCode)

PUT /tournament/public/v1/code/{tournamentCode}
  • updateTournamentCode(String tournamentCode, TournamentMap mapType, PickType pickType, SpectatorType spectatorType, long... allowedSummonerIds)

match-v2.2


GET /api/lol/{region}/v2.2/match/by-tournament/{tournamentCode}/ids
  • getMatchesByTournament(Region region, String tournamentCode)

GET /api/lol/{region}/v2.2/match/for-tournament/{matchId}
  • getMatchForTournament(Region region, long matchId, String tournamentCode)

Example Usage

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());
    }
}

Output

TournamentCode: NA0418f-13ea0635-63d0-4d55-aaf2-849763e7c6e3
Lobby Name: cf74243d-5e5c-49ef-96d5-427995179de1