io.github.sornerol.chess.pubapi.client.LeaderboardsClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chesscom-pubapi-wrapper Show documentation
Show all versions of chesscom-pubapi-wrapper Show documentation
A wrapper for Chess.com's PubAPI.
The newest version!
package io.github.sornerol.chess.pubapi.client;
import io.github.sornerol.chess.pubapi.domain.leaderboards.Leaderboards;
import io.github.sornerol.chess.pubapi.exception.ChessComPubApiException;
import java.io.IOException;
/**
* Client for fetching Chess.com leaderboards.
*
* @see Chess.com PubAPI documentation
*/
public class LeaderboardsClient extends PubApiClientBase {
private static final String ENDPOINT_BASE = "https://api.chess.com/pub/leaderboards";
/**
* Fetch information on the top 50 players for daily and live games, tactics, and lessons.
*
* @return {@link Leaderboards} for daily and live games, tactics, and lessons.
* @throws IOException if there is a problem connecting to Chess.com.
* @throws ChessComPubApiException if Chess.com returns a non-success response code.
*/
public Leaderboards getLeaderboards() throws IOException, ChessComPubApiException {
return getRequest(ENDPOINT_BASE, Leaderboards.class);
}
}