use of no.stelar7.api.r4j.pojo.shared.GAMHSMatch in project L4J8 by stelar7.
the class TimelineBuilder method getTimelineRAW.
public GAMHSMatch getTimelineRAW() {
if (this.id.isEmpty() || this.platform == RegionShard.UNKNOWN) {
return null;
}
DataCallBuilder builder = new DataCallBuilder().withURLParameter(Constants.MATCH_ID_PLACEHOLDER, this.id).withEndpoint(URLEndpoint.V5_TIMELINE).withPlatform(this.platform);
Map<String, Object> data = new TreeMap<>();
data.put("platform", platform);
data.put("matchId", this.id);
Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V5_TIMELINE, data);
if (chl.isPresent()) {
return (GAMHSMatch) chl.get();
}
try {
GAMHSMatch timeline = (GAMHSMatch) builder.build();
data.put("value", timeline);
DataCall.getCacheProvider().store(URLEndpoint.V5_TIMELINE, data);
return timeline;
} catch (ClassCastException e) {
return null;
}
}
use of no.stelar7.api.r4j.pojo.shared.GAMHSMatch in project L4J8 by stelar7.
the class TFTMatchAPI method getMatchRAW.
public GAMHSMatch getMatchRAW(RegionShard 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_TFT_MATCH).withPlatform(platform);
Map<String, Object> data = new TreeMap<>();
data.put("platform", platform);
data.put("gameid", gameId);
Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V1_TFT_MATCH, data);
if (chl.isPresent()) {
return (GAMHSMatch) chl.get();
}
try {
GAMHSMatch match = (GAMHSMatch) builder.build();
data.put("value", match);
DataCall.getCacheProvider().store(URLEndpoint.V1_TFT_MATCH, data);
return match;
} catch (ClassCastException e) {
return null;
}
}
use of no.stelar7.api.r4j.pojo.shared.GAMHSMatch 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.r4j.pojo.shared.GAMHSMatch 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