All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.robrua.orianna.api.dto.ChampionAPI Maven / Gradle / Ivy

There is a newer version: 2.4.5
Show newest version
package com.robrua.orianna.api.dto;

import java.util.Map;

import com.robrua.orianna.type.api.ParamsBuilder;
import com.robrua.orianna.type.dto.champion.Champion;
import com.robrua.orianna.type.dto.champion.ChampionList;

public abstract class ChampionAPI {
    /**
     * @param ID
     *            the ID of the champion to look up
     * @return the champion
     * @see Riot
     *      API Specification
     */
    public static Champion getChampionStatus(final long ID) {
        final String request = BaseRiotAPI.API_VERSIONS.get("champion") + "/champion/" + ID;
        return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, null, false), Champion.class);
    }

    /**
     * @param freeToPlay
     *            whether to only return free champions
     * @return all champions
     * @see Riot
     *      API Specification
     */
    public static ChampionList getChampionStatuses(final boolean freeToPlay) {
        final String request = BaseRiotAPI.API_VERSIONS.get("champion") + "/champion";
        final Map params = new ParamsBuilder().add("freeToPlay", freeToPlay).build();
        return BaseRiotAPI.GSON.fromJson(BaseRiotAPI.get(request, params, false), ChampionList.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy