Skip to content

Instantly share code, notes, and snippets.

@taycaldwell
Last active February 21, 2016 20:22
Show Gist options
  • Save taycaldwell/19e2a8235dbdd0caee3c to your computer and use it in GitHub Desktop.
Save taycaldwell/19e2a8235dbdd0caee3c to your computer and use it in GitHub Desktop.
import net.rithms.riot.api.ApiConfig;
import net.rithms.riot.api.RiotApi;
import net.rithms.riot.api.RiotApiException;
import net.rithms.riot.api.endpoints.stats.dto.AggregatedStats;
import net.rithms.riot.api.endpoints.stats.dto.RankedStats;
import net.rithms.riot.constant.Region;
/**
* This is a simple example using the RiotApi to request summoner information for a few given summoner names
*/
public class RankedWinsAndLosses {
public static void main(String[] args) throws RiotApiException {
RiotApi api = new RiotApi("YOUR-API-KEY-HERE");
RankedStats rankedStats = api.getRankedStats(Region.EUW, 33481164);
// We can either get stats for a certain champion (by ID), or use 0 to get combined stats for all champions
AggregatedStats allChampionsStats = rankedStats.getChampions().get(0).getStats();
int wins = allChampionsStats.getTotalSessionsWon();
int losses = allChampionsStats.getTotalSessionsLost();
System.out.println("Wins: " + wins);
System.out.println("Losses: " + losses);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment