Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.robrua.orianna.api.dto.StaticDataAPI Maven / Gradle / Ivy
package com.robrua.orianna.api.dto;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import com.google.gson.reflect.TypeToken;
import com.robrua.orianna.type.api.ParamsBuilder;
import com.robrua.orianna.type.dto.staticdata.Champion;
import com.robrua.orianna.type.dto.staticdata.ChampionList;
import com.robrua.orianna.type.dto.staticdata.Item;
import com.robrua.orianna.type.dto.staticdata.ItemList;
import com.robrua.orianna.type.dto.staticdata.LanguageStrings;
import com.robrua.orianna.type.dto.staticdata.MapData;
import com.robrua.orianna.type.dto.staticdata.Mastery;
import com.robrua.orianna.type.dto.staticdata.MasteryList;
import com.robrua.orianna.type.dto.staticdata.Realm;
import com.robrua.orianna.type.dto.staticdata.Rune;
import com.robrua.orianna.type.dto.staticdata.RuneList;
import com.robrua.orianna.type.dto.staticdata.SummonerSpell;
import com.robrua.orianna.type.dto.staticdata.SummonerSpellList;
public abstract class StaticDataAPI {
/**
* @param ID
* the champion's ID
* @return the champion
* @see Riot
* API Specification
*/
public static Champion getChampion(final long ID) {
if(ID == 0) {
return null;
}
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/champion/" + ID;
final Map params = new ParamsBuilder().add("champData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), Champion.class);
}
/**
* @return the list all of champions
* @see Riot
* API Specification
*/
public static ChampionList getChampions() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/champion";
final Map params = new ParamsBuilder().add("champData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), ChampionList.class);
}
/**
* @param ID
* the item's ID
* @return the item
* @see Riot
* API Specification
*/
public static Item getItem(final long ID) {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/item/" + ID;
final Map params = new ParamsBuilder().add("itemData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), Item.class);
}
/**
* @return the list of all items
* @see Riot
* API Specification
*/
public static ItemList getItems() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/item";
final Map params = new ParamsBuilder().add("itemListData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), ItemList.class);
}
/**
* @return the languages
* @see Riot
* API Specification
*/
public static List getLanguages() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/languages";
final Type type = new TypeToken>() {}.getType();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, null, true), type);
}
/**
* @return the language strings
* @see Riot
* API Specification
*/
public static LanguageStrings getLanguageStrings() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/language-strings";
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, null, true), LanguageStrings.class);
}
/**
* @return the map information
* @see Riot
* API Specification
*/
public static MapData getMapInformation() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/map";
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, null, true), MapData.class);
}
/**
* @return the list of all masteries
* @see Riot
* API Specification
*/
public static MasteryList getMasteries() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/mastery";
final Map params = new ParamsBuilder().add("masteryListData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), MasteryList.class);
}
/**
* @param ID
* the mastery's ID
* @return the mastery
* @see Riot
* API Specification
*/
public static Mastery getMastery(final long ID) {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/mastery/" + ID;
final Map params = new ParamsBuilder().add("masteryData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), Mastery.class);
}
/**
* @return the realm
* @see Riot
* API Specification
*/
public static Realm getRealm() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/realm";
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, null, true), Realm.class);
}
/**
* @param ID
* the rune's ID
* @return the rune
* @see Riot
* API Specification
*/
public static Rune getRune(final long ID) {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/rune/" + ID;
final Map params = new ParamsBuilder().add("runeData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), Rune.class);
}
/**
* @return the list of all runes
* @see Riot
* API Specification
*/
public static RuneList getRunes() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/rune";
final Map params = new ParamsBuilder().add("runeListData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), RuneList.class);
}
/**
* @param ID
* the summoner spell's ID
* @return the summoner spell
* @see Riot
* API Specification
*/
public static SummonerSpell getSummonerSpell(final long ID) {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/summoner-spell/" + ID;
final Map params = new ParamsBuilder().add("spellData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), SummonerSpell.class);
}
/**
* @return the list of all summoner spells
* @see Riot
* API Specification
*/
public static SummonerSpellList getSummonerSpells() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/summoner-spell";
final Map params = new ParamsBuilder().add("spellData", "all").build();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, true), SummonerSpellList.class);
}
/**
* @return the versions
* @see Riot
* API Specification
*/
public static List getVersions() {
final String request = BaseRiotAPI.API_VERSIONS.get("static-data") + "/versions";
final Type type = new TypeToken>() {}.getType();
return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, null, true), type);
}
}