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;
}
}
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;
}
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;
}
}
Aggregations