Search in sources :

Example 26 with Match

use of no.stelar7.api.l4j8.pojo.match.Match in project L4J8 by stelar7.

the class VALRankedAPI method getLeaderboard.

public Leaderboard getLeaderboard(ValorantShard platform, String actId, int startIndex, int size) {
    DataCallBuilder builder = new DataCallBuilder().withURLParameter(Constants.ACT_ID_PLACEHOLDER, actId).withQueryParameter(Constants.STARTINDEX_PLACEHOLDER_DATA, String.valueOf(startIndex)).withQueryParameter(Constants.SIZE_PLACEHOLDER_DATA, String.valueOf(size)).withHeader(Constants.X_RIOT_TOKEN_HEADER_KEY, DataCall.getCredentials().getVALAPIKey()).withEndpoint(URLEndpoint.V1_VAL_LEADERBOARD_BY_ACT).withPlatform(platform);
    Map<String, Object> data = new TreeMap<>();
    data.put("platform", platform);
    data.put("actId", actId);
    data.put("startIndex", startIndex);
    data.put("size", size);
    Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V1_VAL_LEADERBOARD_BY_ACT, data);
    if (chl.isPresent()) {
        return (Leaderboard) chl.get();
    }
    try {
        Leaderboard match = (Leaderboard) builder.build();
        data.put("value", match);
        DataCall.getCacheProvider().store(URLEndpoint.V1_VAL_LEADERBOARD_BY_ACT, data);
        return match;
    } catch (ClassCastException e) {
        return null;
    }
}
Also used : Leaderboard(no.stelar7.api.r4j.pojo.val.ranked.Leaderboard)

Example 27 with Match

use of no.stelar7.api.l4j8.pojo.match.Match in project L4J8 by stelar7.

the class MatchBuilder method getMatchRAW.

public GAMHSMatch getMatchRAW() {
    if (this.id.isEmpty() || this.platform == RegionShard.UNKNOWN) {
        return null;
    }
    DataCallBuilder builder = new DataCallBuilder().withURLParameter(Constants.MATCH_ID_PLACEHOLDER, this.id).withEndpoint(URLEndpoint.V5_MATCH).withPlatform(this.platform);
    Map<String, Object> data = new TreeMap<>();
    data.put("platform", this.platform);
    data.put("gameid", this.id);
    Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V5_MATCH, data);
    if (chl.isPresent()) {
        return (GAMHSMatch) chl.get();
    }
    Object matchObj = builder.build();
    if (matchObj instanceof Pair) {
        return null;
    }
    GAMHSMatch match = (GAMHSMatch) matchObj;
    data.put("value", match);
    DataCall.getCacheProvider().store(URLEndpoint.V5_MATCH, data);
    return match;
}
Also used : GAMHSMatch(no.stelar7.api.r4j.pojo.shared.GAMHSMatch) Pair(no.stelar7.api.r4j.basic.utils.Pair)

Example 28 with Match

use of no.stelar7.api.l4j8.pojo.match.Match in project L4J8 by stelar7.

the class LORMatchAPI method getMatchRAW.

public GAMHSMatch getMatchRAW(RuneterraShard platform, String gameId) {
    DataCallBuilder builder = new DataCallBuilder().withURLParameter(Constants.MATCH_ID_PLACEHOLDER, gameId).withHeader(Constants.X_RIOT_TOKEN_HEADER_KEY, DataCall.getCredentials().getTFTAPIKey()).withEndpoint(URLEndpoint.V1_LOR_MATCH).withPlatform(platform);
    Map<String, Object> data = new TreeMap<>();
    data.put("platform", platform);
    data.put("gameid", gameId);
    Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V1_LOR_MATCH, data);
    if (chl.isPresent()) {
        return (GAMHSMatch) chl.get();
    }
    try {
        GAMHSMatch match = (GAMHSMatch) builder.build();
        data.put("value", match);
        DataCall.getCacheProvider().store(URLEndpoint.V1_LOR_MATCH, data);
        return match;
    } catch (ClassCastException e) {
        return null;
    }
}
Also used : GAMHSMatch(no.stelar7.api.r4j.pojo.shared.GAMHSMatch)

Aggregations

Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)8 R4J (no.stelar7.api.r4j.impl.R4J)7 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)6 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)6 MatchListBuilder (no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)5 java.util (java.util)4 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)4 FileSystemCacheProvider (no.stelar7.api.r4j.basic.cache.impl.FileSystemCacheProvider)4 SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)4 VALMatchAPI (no.stelar7.api.r4j.impl.val.VALMatchAPI)4 java.awt (java.awt)3 AffineTransform (java.awt.geom.AffineTransform)3 java.awt.image (java.awt.image)3 java.io (java.io)3 URL (java.net.URL)3 List (java.util.List)3 Predicate (java.util.function.Predicate)3 IntStream (java.util.stream.IntStream)3 ImageIO (javax.imageio.ImageIO)3 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3