All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.sornerol.chess.pubapi.client.LeaderboardsClient Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy