Skip to content

nspu/riot-api-android

Repository files navigation

Riot API for Android Build Status

This project is a wrapper for Riot API. It uses Retrofit and Picasso.

Do not publish your api key, you can use a proxy. Tuto : How to secure your API key using a proxy

Documentation here

Getting starting

To build this project, use ./gradlew assemble. Then put the aar file that can be found in riot-api/build/outputs/aar/riot-api-0.0.1.aar to your lib directory

Example

//datadragon api(no need api key, only static data)
var dataDragonApi: DataDragonApi = DataDragonApi(context) //forced cache
var dataDragonApi: DataDragonApi = DataDragonApi() //auto cache

//riot api (do not publish app with your api key)
val riotApi: RiotApi = RiotApi("api-key", "na1.api.riotgames.com")
var call: Call<ChampionListData> = dataDragon.getChampions() //champions list
var call: Call<ShardStatus> = riotApi.getLoLStatus() //servers status

Doc about Call (Retrofit)

You can pass optional options for riot api

val options = mapOf("Accept-Language" to "en-US,en;q=0.5")
riotApi.matchService.getMatchById(000000000, options)

Image

Get the square image of Aatrox

var bitmap: Bitmap =  dataDragonApi.getChampionSquare("6.24.1", "en_US", "Aatrox.png") //get directly the bitmap
dataDragonApi.getChampionSquare("6.24.1", "en_US","Aatrox.png", callback) //with Callback
dataDragonApi.getChampionSquare("6.24.1", "en_US","Aatrox.png", imageView) //with ImageView

Doc about Callback (Picasso)

You can pass optional options

val options = mapOf("fit" to false, "center-crop" to false, "resize" to  Pair(50, 50))
dataDragonApi.getChampionSquare("Aatrox.png", imageView, options)

Progress

Implementation of all api reference is done.

Todo: Test Tounament-Stub and Tournament

Inspired by spotify-web-api-android

About

A library to use riot api and datadragon with android. It uses Retrofit and Picasso.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages