Class Spedran


  • public class Spedran
    extends Object
    The main Spedran API.
    • Method Detail

      • setApiKey

        public static void setApiKey​(String key)
        Sets the current API key. The API key is not set if it is null or blank.
        Parameters:
        key - SRC API key
      • removeApiKey

        public static void removeApiKey()
        Identical to clearApiKey()
      • clearApiKey

        public static void clearApiKey()
        Clears the current API key.
      • shutDown

        public static void shutDown()
        Shuts down all work threads, allowing the application to exit.
      • enableCache

        public static void enableCache()
        Enable request caching.
      • disableCache

        public static void disableCache()
        Disable request caching.
      • setCacheTimeLimit

        public static void setCacheTimeLimit​(long newTimeLimit)
        Sets the maximum time that entries are considered valid in the request cache.
        Parameters:
        newTimeLimit - the new time limit in milliseconds
      • setBackoffValues

        public static void setBackoffValues​(double base,
                                            long reduceDelay,
                                            double constant)
        Sets the values for exponential backoff.
        The backoff time is calculated as base^count * constant where count is the current rate limit count.
        Parameters:
        base - the exponent base
        reduceDelay - the minimum time in milliseconds before the rate can be increased after hitting a rate limit
        constant - a constant factor to multiply the backoff time by
      • getGame

        public static CompletableFuture<Game> getGame​(String id)
        Gets the Game that corresponds to the provided id asynchronously.
        Parameters:
        id - the ID of the game to get. can be the game's abbreviation as well
        Returns:
        a CompletableFuture of a Game
      • getGameLevels

        public static GameLevelsRequest getGameLevels​(String gameId)
        Gets a GameLevelsRequest builder to request the levels for the specified Game.
        Parameters:
        gameId - the ID of the game to get the Levels for
        Returns:
        a GameLevelsRequest builder
      • getGameRomhacks

        public static GameRomhacksRequest getGameRomhacks​(String gameId)
        Gets a GameRomhacksRequest builder to request the romhacks of the specified Game.
        Parameters:
        gameId - the ID of the Game to get the derived Games for
        Returns:
        a GameRomhacksRequest builder
      • getGames

        public static GamesRequest getGames()
        Gets a GamesRequest builder to request all Games matching the specified criteria.
        Returns:
        a GamesRequest builder
      • deleteRun

        public static DeleteRunRequest deleteRun​(String runId)
        Gets a DeleteRunRequest builder to delete a Run.
        Parameters:
        runId - the ID of the run to delete
        Returns:
        a DeleteRunRequest builder
      • setRunPlayers

        public static RunPlayersRequest setRunPlayers​(String runId)
        Gets a RunPlayersRequest builder to change the players in a Run.
        Parameters:
        runId - the ID of the run to set the players for
        Returns:
        a RunPlayersRequest builder
      • setRunStatus

        public static RunStatusRequest setRunStatus​(String runId)
        Gets a RunStatusRequest builder to change the Run's verification status.
        Parameters:
        runId - the ID of the run to set the status of
        Returns:
        a RunStatusRequest builder
      • getRuns

        public static RunsRequest getRuns()
        Gets a RunsRequest builder to request all Runs matching the specified criteria.
        Returns:
        a RunsRequest builder
      • getUsers

        public static UsersRequest getUsers()
        Gets a UsersRequest builder to request all Users matching the specified criteria.
        Returns:
        a UsersRequest builder
      • getUserPBs

        public static UserPBsRequest getUserPBs​(String userId)
        Gets a UserPBsRequest builder to request the personal best runs for the specified User.
        Parameters:
        userId - the ID of the User to get the LeaderboardRuns for
        Returns:
        a UserPBsRequest builder
      • getSeriesGames

        public static SeriesGamesRequest getSeriesGames​(String seriesId)
        Gets a SeriesGamesRequest builder to request the games in the specified Series.
        Parameters:
        seriesId - the ID of the Series to get the Games that belong to the series
        Returns:
        a SeriesGamesRequest builder
      • getLeaderboard

        public static LeaderboardRequest getLeaderboard​(String gameId,
                                                        String categoryId,
                                                        String levelId)
        Gets a LeaderboardRequest builder to request a specific Leaderboard.
        Parameters:
        gameId - game ID to filter the leaderboard by
        categoryId - category ID to filter the leaderboard by
        levelId - level ID to filter the leaderboard by
        Returns:
        a LeaderboardRequest builder
      • getLeaderboard

        public static LeaderboardRequest getLeaderboard​(String gameId,
                                                        String categoryId)
        Gets a LeaderboardRequest builder to request a specific Leaderboard.
        Parameters:
        gameId - game ID to filter the leaderboard by
        categoryId - category ID to filter the leaderboard by
        Returns:
        a LeaderboardRequest builder
      • getLeaderboard

        public static LeaderboardRequest getLeaderboard​(Game game,
                                                        Category category,
                                                        Level level)
        Gets a LeaderboardRequest builder to request a specific Leaderboard.
        Parameters:
        game - game to filter the leaderboard by
        category - category to filter the leaderboard by
        level - level to filter the leaderboard by
        Returns:
        a LeaderboardRequest builder
      • getLeaderboard

        public static LeaderboardRequest getLeaderboard​(Game game,
                                                        Category category)
        Gets a LeaderboardRequest builder to request a specific Leaderboard.
        Parameters:
        game - game to filter the leaderboard by
        category - category to filter the leaderboard by
        Returns:
        a LeaderboardRequest builder