-
Notifications
You must be signed in to change notification settings - Fork 7
Home
Welcome to the challonge-java wiki. For information on a certain topic, use the sidebar on the right.
The aim of this project is to provide an easy way of accessing the CHALLONGE! API through Java. This project provides three main components - core, serializers and rest. Serializers are used to map the JSON data received from the API to Java Objects and vice versa while the rest module performs the actual network requests. Both are used together in the core module which exposes an entry point for easy usage. Check the respective pages for further information. Right now only few implementations of the rest and serializers module are available - more may follow in the future.
This page also features a small example on how to get started. In oder to use challonge-java you must generate an API key in your Challonge developer settings. In order to run this example you will need to add dependencies for the Retrofit RestClient and Gson Serializer.
implementation group: 'at.stefangeyer.challonge.serializer', name: 'gson', version: '2.0'
implementation group: 'at.stefangeyer.challonge.rest', name: 'retrofit', version: '2.0'
The following code will create a double elimination tournament:
Credentials credentials = new Credentials(USERNAME, API_KEY);
Serializer serializer = new GsonSerializer();
RestClient restClient = new RetrofitRestClient();
Challonge challonge = new Challonge(credentials, serializer, restClient);
TournamentQuery query = TournamentQuery.builder().name("My new tournament").url("mytournamenturl")
.tournamentType(TournamentType.DOUBLE_ELIMINATION).build();
Tournament result = challonge.createTournament(query);