Search in sources :

Example 11 with SpectatorBuilder

use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.

the class CurrentGameTest method testCurrentGame.

@Test
public void testCurrentGame() {
    final R4J r4J = new R4J(SecretFile.CREDS);
    SpectatorBuilder sb = new SpectatorBuilder().withPlatform(LeagueShard.EUW1);
    // Get a game in progess
    final List<SpectatorGameInfo> game = sb.getFeaturedGames();
    // Get a summoner from that game
    final String name = game.get(0).getParticipants().get(0).getSummonerName();
    final Summoner sum = new SummonerBuilder().withPlatform(game.get(0).getPlatform()).withName(name).get();
    // Get game info
    final SpectatorGameInfo currentGame = sb.withSummonerId(sum.getSummonerId()).getCurrentGame();
    if (currentGame != null) {
        doAssertions.accept(currentGame);
    }
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SpectatorGameInfo(no.stelar7.api.r4j.pojo.lol.spectator.SpectatorGameInfo) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) R4J(no.stelar7.api.r4j.impl.R4J) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 12 with SpectatorBuilder

use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.

the class TournamentTest method testAllRegistrations.

@Test
@Disabled
public void testAllRegistrations() {
    final ProviderRegistrationParameters params = new ProviderRegistrationParameters(LeagueShard.EUW1, "http://stelar7.no/loltest/provider.php");
    final long providerId = this.api.registerAsProvider(params);
    final TournamentRegistrationParameters trparams = new TournamentRegistrationParameters("THE BEST TOURNAMENT EVER", providerId);
    final long tournamentId = this.api.registerTournament(trparams);
    final int teamSize = 5;
    SpectatorBuilder spectatorBuilder = new SpectatorBuilder().withPlatform(LeagueShard.EUW1);
    final SpectatorGameInfo game = spectatorBuilder.getFeaturedGames().get(0);
    List<String> names = game.getParticipants().stream().map(SpectatorParticipant::getSummonerName).collect(Collectors.toList());
    List<String> ids = new ArrayList<>();
    SummonerBuilder sb = new SummonerBuilder().withPlatform(LeagueShard.EUW1);
    for (String name : names) {
        ids.add(sb.withName(name).get().getSummonerId());
    }
    final TournamentCodeUpdateParameters tcinner = new TournamentCodeUpdateParameters(ids, TournamentMapType.SUMMONERS_RIFT, TournamentPickType.TOURNAMENT_DRAFT, TournamentSpectatorType.ALL);
    final TournamentCodeParameters tcparams = new TournamentCodeParameters(tcinner, "THIS IS METADATA YOOO", teamSize);
    final List<String> codes = this.api.generateTournamentCodes(tcparams, tournamentId, 1);
    final TournamentCodeUpdateParameters tcuparams = new TournamentCodeUpdateParameters(ids, TournamentMapType.TWISTED_TREELINE, TournamentPickType.TOURNAMENT_DRAFT, TournamentSpectatorType.ALL);
    final List<LobbyEvent> events = this.api.getTournamentLobbyInfo(codes.get(0));
    if (!api.isStub()) {
        this.api.updateTournament(codes.get(0), tcuparams);
        final TournamentCode id = this.api.getTournamentInfo(codes.get(0));
        final List<Long> tournamentCodeMatchIds = this.api.getMatchIds(LeagueShard.EUW1, codes.get(0));
        final LOLMatch matchDetail = this.api.getMatchInfo(LeagueShard.EUW1, codes.get(0), tournamentCodeMatchIds.get(0));
    }
}
Also used : SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) LOLMatch(no.stelar7.api.r4j.pojo.lol.match.v5.LOLMatch) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 13 with SpectatorBuilder

use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.

the class SummonerTest method testByPUUID.

@Test
public void testByPUUID() {
    String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
    Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
    Summoner optional = new SummonerBuilder().withPlatform(s.getPlatform()).withPUUID(s.getPUUID()).get();
    doAssertions.accept(optional);
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 14 with SpectatorBuilder

use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.

the class SummonerTest method testByName.

@Test
public void testByName() {
    String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
    Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
    Summoner optional = new SummonerBuilder().withPlatform(s.getPlatform()).withName(s.getNormalizedName()).get();
    doAssertions.accept(optional);
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Example 15 with SpectatorBuilder

use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.

the class SummonerTest method testById.

@Test
public void testById() {
    /*
        Summoner ids have been removed from the spectator endpoint, so this test wont work anymore...
        
        String   id = new SpectatorBuilder().withPlatform(Platform.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerId();
        Summoner s  = new SummonerBuilder().withPlatform(Platform.EUW1).withSummonerId(id).get();
         */
    String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
    Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
    doAssertions.accept(s);
}
Also used : Summoner(no.stelar7.api.r4j.pojo.lol.summoner.Summoner) SummonerBuilder(no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder) SpectatorBuilder(no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)

Aggregations

SpectatorBuilder (no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder)17 SummonerBuilder (no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder)16 Summoner (no.stelar7.api.r4j.pojo.lol.summoner.Summoner)14 SpectatorBuilder (no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)4 ChampionMasteryBuilder (no.stelar7.api.r4j.impl.lol.builders.championmastery.ChampionMasteryBuilder)4 L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 SpectatorGameInfo (no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo)3 R4J (no.stelar7.api.r4j.impl.R4J)3 ChampionMastery (no.stelar7.api.r4j.pojo.lol.championmastery.ChampionMastery)3 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)2 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)2 CacheLifetimeHint (no.stelar7.api.r4j.basic.cache.CacheLifetimeHint)2 LOLMatch (no.stelar7.api.r4j.pojo.lol.match.v5.LOLMatch)2 SpectatorGameInfo (no.stelar7.api.r4j.pojo.lol.spectator.SpectatorGameInfo)2 MatchListBuilder (no.stelar7.api.l4j8.impl.builders.match.MatchListBuilder)1 URLEndpoint (no.stelar7.api.r4j.basic.constants.api.URLEndpoint)1 LeagueBuilder (no.stelar7.api.r4j.impl.lol.builders.league.LeagueBuilder)1 MatchListBuilder (no.stelar7.api.r4j.impl.lol.builders.matchv5.match.MatchListBuilder)1 LeagueEntry (no.stelar7.api.r4j.pojo.lol.league.LeagueEntry)1