GithubHelp home page GithubHelp logo

christopher-hsieh / riot-api-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taycaldwell/riot-api-java

1.0 1.0 0.0 3.95 MB

Riot Games API Java Library

Home Page: http://taycaldwell.com/riot-api-java/

License: Apache License 2.0

Java 100.00%

riot-api-java's Introduction


JitPack

A simple to use, Riot Games API wrapper for Java. This library makes it easy to gather and use League of Legends data in your apps.

Disclaimer

This product is not endorsed, certified or otherwise approved in any way by Riot Games, Inc. or any of its affiliates.

Requirements

riot-api-java requires Java 7 and the following libraries:

Setup

Download the .jar file, and add it as an external library to your project.

If you are using Eclipse, this can be done by right clicking your project, and selecting:

Build Path -> Configure Build Path -> Libraries -> Add External Jars

and selecting the jar under the Order and Export tab.

This project is also available on Jitpack

Usage

This library can be used strictly according to the Riot API Documentation like so:

import java.util.Map;
import net.rithms.riot.constant.Region;
import net.rithms.riot.dto.Summoner.Summoner;
import net.rithms.riot.api.RiotApi;
import net.rithms.riot.api.RiotApiException;
import com.google.gson*;

public class Example {

	public static void main(String[] args) throws RiotApiException {
		
		RiotApi api = new RiotApi("YOUR-API-KEY-HERE");

		Map<String, Summoner> summoners = api.getSummonersByName(Region.NA, "rithms, tryndamere");
		Summoner summoner = summoners.get("rithms");
		long id = summoner.getId();
		System.out.println(id);
	}

}

Available accessors allow you to accomplish similar tasks in a different way. Below is an example of how to set your region. Because the region was set before a method was called, there is no need to pass in the region parameter. This is great for people that know they will only be working in one region when making multiple requests. The same can be done for the season.

import java.util.Map;
import net.rithms.riot.constant.Region;
import net.rithms.riot.dto.Summoner.Summoner;
import net.rithms.riot.api.RiotApi;
import net.rithms.riot.api.RiotApiException;
import com.google.gson*;

public class Example {

	public static void main(String[] args) throws RiotApiException {
		
		RiotApi api = new RiotApi("YOUR-API-KEY-HERE");
		
		api.setRegion(Region.NA);
		Map<String, Summoner> summoners = api.getSummonersByName("rithms, tryndamere");
		Summoner summoner = summoners.get("rithms");
		long id = summoner.getId();
		System.out.println(id);
	}

}

It is important to be aware of your personal rate limit. Any method call from the RiotAPI is a request that counts towards your rate limit, with exceptions to the accessors/mutators of region, key, and season, as well as any requests regarding static data. The below code makes 2 requests; one request for a summoner, and another for ranked stats of a summoner.

import net.rithms.riot.constant.Region;
import net.rithms.riot.constant.Season;
import net.rithms.riot.dto.Stats.RankedStats;
import net.rithms.riot.api.RiotApi;
import net.rithms.riot.api.RiotApiException;
import com.google.gson*;

public class Example {

	public static void main(String[] args) throws RiotApiException {
		
		RiotApi api = new RiotApi("YOUR-API-KEY-HERE", Region.NA);
		api.setSeason(Season.CURRENT);
		
		RankedStats rankedStats = api.getRankedStats(api.getSummonerByName("rithms").getId());
	}

}

Documentation

The documentation for this library can be found here.

API Versions

The current version of this library supports the following Riot Games API versions:

  • CHAMPION-MASTERY-V3
  • CHAMPION-V3
  • LOL-STATUS-V3
  • MASTERIES-V3
  • RUNES-V3
  • SPECTATOR-V3
  • STATIC-DATA-V3
  • SUMMONER-V3
  • TOURNAMENT-STUB-V3

The current version of this library also supports the following legacy Riot Games API versions while they are still being converted to the new system:

  • game-v1.3 [BR, EUNE, EUW, JP, KR, LAN, LAS, NA, OCE, RU, TR]
  • league-v2.5 [BR, EUNE, EUW, JP, KR, LAN, LAS, NA, OCE, RU, TR]
  • match-v2.2 [BR, EUNE, EUW, JP, KR, LAN, LAS, NA, OCE, RU, TR]
  • matchlist-v2.2 [BR, EUNE, EUW, JP, KR, LAN, LAS, NA, OCE, RU, TR]
  • stats-v1.3 [BR, EUNE, EUW, JP, KR, LAN, LAS, NA, OCE, RU, TR]

Contributing

All contributions are appreciated. If you would like to contribute to this project, please send a pull request.

Contact

Have a suggestion, complaint, or question? Open an issue.

riot-api-java's People

Contributors

brunocf avatar fkunstner avatar friesischscott avatar haakjvork avatar jitpack-io avatar kooner avatar linnun avatar manuvaldes avatar taycaldwell avatar taylorcaldwell avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.