
com.elypia.elypiai.twitch.StreamPaginator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twitch Show documentation
Show all versions of twitch Show documentation
Wrappers for many APIs available online from various services.
The newest version!
package com.elypia.elypiai.twitch;
import com.elypia.elypiai.restutils.RestAction;
import com.elypia.elypiai.restutils.impl.IRestPaginator;
import retrofit2.Call;
import java.io.IOException;
import java.util.List;
public class StreamPaginator implements IRestPaginator {
private Twitch twitch;
private TwitchQuery query;
private int limit;
private String cursor;
public StreamPaginator(Twitch twitch, TwitchQuery query, int limit) {
this.twitch = twitch;
this.query = query;
this.limit = limit;
}
@Override
public List next() throws IOException {
Call streamers = twitch.getService().getStreams(
query.getUserIds(),
query.getUsernames(),
query.getGames(),
limit,
cursor
);
StreamPage page = new RestAction<>(streamers).complete();
List streams = page.getStreamers();
cursor = page.getCursor();
return !streams.isEmpty() ? streams : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy