use of no.stelar7.api.l4j8.pojo.staticdata.realm.Realm in project L4J8 by stelar7.
the class StaticTest method testRealms.
@Test
public void testRealms() {
DataCall.setCacheProvider(new FileSystemCacheProvider());
DataCall.setLogLevel(LogLevel.DEBUG);
Realm data = api.getRealm(Platform.EUW1);
}
use of no.stelar7.api.l4j8.pojo.staticdata.realm.Realm in project L4J8 by stelar7.
the class StaticAPI method getRealm.
public Realm getRealm(Platform server) {
DataCallBuilder builder = new DataCallBuilder().withEndpoint(URLEndpoint.V3_STATIC_REALMS).withURLData(Constants.URL_PARAM_DATA_BY_ID, String.valueOf(true)).withPlatform(server);
Optional chl = DataCall.getCacheProvider().get(URLEndpoint.V3_STATIC_REALMS, server);
if (chl.isPresent()) {
return (Realm) chl.get();
}
try {
Realm list = (Realm) builder.build();
DataCall.getCacheProvider().store(URLEndpoint.V3_STATIC_REALMS, list, server);
return list;
} catch (ClassCastException e) {
return null;
}
}
use of no.stelar7.api.l4j8.pojo.staticdata.realm.Realm in project L4J8 by stelar7.
the class ImageAPI method buildImageURL.
private String buildImageURL(@Nullable String version, String path, String file, @Nullable Platform rreg) {
Platform region = rreg;
if (region == null) {
region = Platform.EUW1;
}
Realm realm = StaticAPI.getInstance().getRealm(region);
String cdn = realm.getCDN();
String versionString = version != null ? version : realm.getV();
String preReplace = cdn + Constants.SEPARATOR + versionString + Constants.SEPARATOR + path + Constants.SEPARATOR + file;
return preReplace.replace(" ", "%20");
}
Aggregations