Search in sources :

Example 1 with PlatformData

use of no.stelar7.api.r4j.pojo.lol.status.PlatformData in project L4J8 by stelar7.

the class StatusAPI method getShardStatus.

public PlatformData getShardStatus(RuneterraShard server) {
    DataCallBuilder builder = new DataCallBuilder().withEndpoint(URLEndpoint.V1_STATUS_LOR).withPlatform(server);
    Map<String, Object> data = new TreeMap<>();
    data.put("platform", server);
    Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V1_STATUS_LOR, data);
    if (chl.isPresent()) {
        return (PlatformData) chl.get();
    }
    try {
        PlatformData list = (PlatformData) builder.build();
        data.put("value", list);
        DataCall.getCacheProvider().store(URLEndpoint.V1_STATUS_LOR, data);
        return list;
    } catch (ClassCastException e) {
        return null;
    }
}
Also used : PlatformData(no.stelar7.api.r4j.pojo.lol.status.PlatformData)

Example 2 with PlatformData

use of no.stelar7.api.r4j.pojo.lol.status.PlatformData in project L4J8 by stelar7.

the class StatusAPI method getShardStatus.

public PlatformData getShardStatus(LeagueShard server) {
    DataCallBuilder builder = new DataCallBuilder().withEndpoint(URLEndpoint.V4_STATUS_LOL).withPlatform(server);
    Map<String, Object> data = new TreeMap<>();
    data.put("platform", server);
    Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V4_STATUS_LOL, data);
    if (chl.isPresent()) {
        return (PlatformData) chl.get();
    }
    try {
        PlatformData list = (PlatformData) builder.build();
        data.put("value", list);
        DataCall.getCacheProvider().store(URLEndpoint.V4_STATUS_LOL, data);
        return list;
    } catch (ClassCastException e) {
        return null;
    }
}
Also used : PlatformData(no.stelar7.api.r4j.pojo.lol.status.PlatformData)

Example 3 with PlatformData

use of no.stelar7.api.r4j.pojo.lol.status.PlatformData in project L4J8 by stelar7.

the class StatusAPI method getShardStatus.

public PlatformData getShardStatus(ValorantShard server) {
    DataCallBuilder builder = new DataCallBuilder().withEndpoint(URLEndpoint.V1_STATUS_VAL).withPlatform(server);
    Map<String, Object> data = new TreeMap<>();
    data.put("platform", server);
    Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.V1_STATUS_VAL, data);
    if (chl.isPresent()) {
        return (PlatformData) chl.get();
    }
    try {
        PlatformData list = (PlatformData) builder.build();
        data.put("value", list);
        DataCall.getCacheProvider().store(URLEndpoint.V1_STATUS_VAL, data);
        return list;
    } catch (ClassCastException e) {
        return null;
    }
}
Also used : PlatformData(no.stelar7.api.r4j.pojo.lol.status.PlatformData)

Example 4 with PlatformData

use of no.stelar7.api.r4j.pojo.lol.status.PlatformData in project L4J8 by stelar7.

the class StatusTest method testStatus.

@Test
public void testStatus() {
    PlatformData shardStatus = api.getShardStatus(LeagueShard.EUW1);
    PlatformData shardStatus1 = api.getShardStatus(RuneterraShard.EUROPE);
    PlatformData shardStatus2 = api.getShardStatus(ValorantShard.EU);
}
Also used : PlatformData(no.stelar7.api.r4j.pojo.lol.status.PlatformData) Test(org.junit.jupiter.api.Test)

Aggregations

PlatformData (no.stelar7.api.r4j.pojo.lol.status.PlatformData)4 Test (org.junit.jupiter.api.Test)1