Package com.treescrub.spedran
Class Spedran
- java.lang.Object
-
- com.treescrub.spedran.Spedran
-
public class Spedran extends Object
The main Spedran API.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearApiKey()Clears the current API key.static DeleteRunRequestdeleteRun(String runId)Gets aDeleteRunRequestbuilder to delete aRun.static voiddisableCache()Disable request caching.static voidenableCache()Enable request caching.static CompletableFuture<Category>getCategory(String id)Gets theCategorythat corresponds to the providedidasynchronously.static CategoryRecordsRequestgetCategoryRecords(String categoryId)Gets aCategoryRecordsRequestbuilder to request the records for the specifiedCategory.static CategoryVariablesRequestgetCategoryVariables(String categoryId)Gets aCategoryVariablesRequestbuilder to request all the variables for the specifiedCategory.static CompletableFuture<Developer>getDeveloper(String id)Gets theDeveloperthat corresponds to the providedidasynchronously.static DevelopersRequestgetDevelopers()Gets aDevelopersRequestbuilder to request allDevelopers.static CompletableFuture<Engine>getEngine(String id)Gets theEnginethat corresponds to the providedidasynchronously.static EnginesRequestgetEngines()Gets aEnginesRequestbuilder to request allEngines.static CompletableFuture<Game>getGame(String id)Gets theGamethat corresponds to the providedidasynchronously.static GameCategoriesRequestgetGameCategories(String gameId)Gets aGameCategoriesRequestbuilder to request the categories for the specifiedGame.static GameLevelsRequestgetGameLevels(String gameId)Gets aGameLevelsRequestbuilder to request the levels for the specifiedGame.static GameRecordsRequestgetGameRecords(String gameId)Gets aGameRecordsRequestbuilder to request the records for the specifiedGame.static GameRomhacksRequestgetGameRomhacks(String gameId)Gets aGameRomhacksRequestbuilder to request the romhacks of the specifiedGame.static GamesRequestgetGames()Gets aGamesRequestbuilder to request allGames matching the specified criteria.static CompletableFuture<Gametype>getGametype(String id)Gets theGametypethat corresponds to the providedidasynchronously.static GametypesRequestgetGametypes()Gets aGametypesRequestbuilder to request allGametypes.static GameVariablesRequestgetGameVariables(String gameId)static CompletableFuture<Genre>getGenre(String id)Gets theGenrethat corresponds to the providedidasynchronously.static GenresRequestgetGenres()Gets aGenresRequestbuilder to request allGenres.static CompletableFuture<Guest>getGuest(String name)Gets theGuestthat corresponds to the providednameasynchronously.static LeaderboardRequestgetLeaderboard(Game game, Category category)Gets aLeaderboardRequestbuilder to request a specificLeaderboard.static LeaderboardRequestgetLeaderboard(Game game, Category category, Level level)Gets aLeaderboardRequestbuilder to request a specificLeaderboard.static LeaderboardRequestgetLeaderboard(String gameId, String categoryId)Gets aLeaderboardRequestbuilder to request a specificLeaderboard.static LeaderboardRequestgetLeaderboard(String gameId, String categoryId, String levelId)Gets aLeaderboardRequestbuilder to request a specificLeaderboard.static CompletableFuture<Level>getLevel(String id)Gets theLevelthat corresponds to the providedidasynchronously.static LevelCategoriesRequestgetLevelCategories(String levelId)Gets aLevelCategoriesRequestbuilder to request all applicable categories for the specifiedLevel.static LevelRecordsRequestgetLevelRecords(String levelId)Gets aLevelRecordsRequestbuilder to request the records for the specifiedLevel.static LevelVariablesRequestgetLevelVariables(String levelId)Gets aLevelVariablesRequestbuilder to request all the variables for the specifiedLevel.static AllSeriesRequestgetMultipleSeries()Gets aAllSeriesRequestbuilder to request allSeriess.static CompletableFuture<List<Notification>>getNotifications()Gets all of theNotifications for the currently authenticated user.static CompletableFuture<Platform>getPlatform(String id)Gets thePlatformthat corresponds to the providedidasynchronously.static PlatformsRequestgetPlatforms()Gets aPlatformsRequestbuilder to request allPlatforms.static CompletableFuture<User>getProfile()Gets theUserthat owns the current API key.static CompletableFuture<Publisher>getPublisher(String id)Gets thePublisherthat corresponds to the providedidasynchronously.static PublishersRequestgetPublishers()Gets aPublishersRequestbuilder to request allPublishers.static CompletableFuture<Region>getRegion(String id)Gets theRegionthat corresponds to the providedidasynchronously.static RegionsRequestgetRegions()Gets aRegionsRequestbuilder to request allRegions.static CompletableFuture<Run>getRun(String id)Gets theRunthat corresponds to the providedidasynchronously.static RunsRequestgetRuns()Gets aRunsRequestbuilder to request allRuns matching the specified criteria.static SeriesGamesRequestgetSeriesGames(String seriesId)Gets aSeriesGamesRequestbuilder to request the games in the specifiedSeries.static CompletableFuture<Series>getSingleSeries(String id)Gets theSeriesthat corresponds to the providedidasynchronously.static CompletableFuture<User>getUser(String id)Gets theUserthat corresponds to the providedidasynchronously.static UserPBsRequestgetUserPBs(String userId)Gets aUserPBsRequestbuilder to request the personal best runs for the specifiedUser.static UsersRequestgetUsers()Gets aUsersRequestbuilder to request allUsers matching the specified criteria.static CompletableFuture<Variable>getVariable(String id)Gets theVariablethat corresponds to the providedidasynchronously.static voidremoveApiKey()Identical toclearApiKey()static voidsetApiKey(String key)Sets the current API key.static voidsetBackoffValues(double base, long reduceDelay, double constant)Sets the values for exponential backoff.static voidsetCacheTimeLimit(long newTimeLimit)Sets the maximum time that entries are considered valid in the request cache.static RunPlayersRequestsetRunPlayers(String runId)Gets aRunPlayersRequestbuilder to change the players in aRun.static RunStatusRequestsetRunStatus(String runId)Gets aRunStatusRequestbuilder to change theRun's verification status.static voidshutDown()Shuts down all work threads, allowing the application to exit.static SubmitRunRequestsubmitRun()Gets aSubmitRunRequestbuilder to submit a run to SRC.
-
-
-
Method Detail
-
setApiKey
public static void setApiKey(String key)
Sets the current API key. The API key is not set if it isnullor blank.- Parameters:
key- SRC API key
-
removeApiKey
public static void removeApiKey()
Identical toclearApiKey()
-
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 asbase^count * constantwherecountis the current rate limit count.- Parameters:
base- the exponent basereduceDelay- the minimum time in milliseconds before the rate can be increased after hitting a rate limitconstant- a constant factor to multiply the backoff time by
-
getGame
public static CompletableFuture<Game> getGame(String id)
Gets theGamethat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the game to get. can be the game's abbreviation as well- Returns:
- a
CompletableFutureof aGame
-
getGameCategories
public static GameCategoriesRequest getGameCategories(String gameId)
Gets aGameCategoriesRequestbuilder to request the categories for the specifiedGame.- Parameters:
gameId- the ID of the game to get theCategorys for- Returns:
- a
GameCategoriesRequestbuilder
-
getGameLevels
public static GameLevelsRequest getGameLevels(String gameId)
Gets aGameLevelsRequestbuilder to request the levels for the specifiedGame.- Parameters:
gameId- the ID of the game to get theLevels for- Returns:
- a
GameLevelsRequestbuilder
-
getGameRecords
public static GameRecordsRequest getGameRecords(String gameId)
Gets aGameRecordsRequestbuilder to request the records for the specifiedGame.- Parameters:
gameId- the ID of theGameto get theLeaderboards for- Returns:
- a
GameRecordsRequestbuilder
-
getGameRomhacks
public static GameRomhacksRequest getGameRomhacks(String gameId)
Gets aGameRomhacksRequestbuilder to request the romhacks of the specifiedGame.- Parameters:
gameId- the ID of theGameto get the derivedGames for- Returns:
- a
GameRomhacksRequestbuilder
-
getGameVariables
public static GameVariablesRequest getGameVariables(String gameId)
- Parameters:
gameId- the ID of theGameto get theVariables for- Returns:
- a
GameVariablesRequestbuilder
-
getGames
public static GamesRequest getGames()
Gets aGamesRequestbuilder to request allGames matching the specified criteria.- Returns:
- a
GamesRequestbuilder
-
getRun
public static CompletableFuture<Run> getRun(String id)
Gets theRunthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the run to get- Returns:
- a
CompletableFutureof aRun
-
deleteRun
public static DeleteRunRequest deleteRun(String runId)
Gets aDeleteRunRequestbuilder to delete aRun.- Parameters:
runId- the ID of the run to delete- Returns:
- a
DeleteRunRequestbuilder
-
setRunPlayers
public static RunPlayersRequest setRunPlayers(String runId)
Gets aRunPlayersRequestbuilder to change the players in aRun.- Parameters:
runId- the ID of the run to set the players for- Returns:
- a
RunPlayersRequestbuilder
-
submitRun
public static SubmitRunRequest submitRun()
Gets aSubmitRunRequestbuilder to submit a run to SRC.- Returns:
- a
SubmitRunRequestbuilder
-
setRunStatus
public static RunStatusRequest setRunStatus(String runId)
Gets aRunStatusRequestbuilder to change theRun's verification status.- Parameters:
runId- the ID of the run to set the status of- Returns:
- a
RunStatusRequestbuilder
-
getRuns
public static RunsRequest getRuns()
Gets aRunsRequestbuilder to request allRuns matching the specified criteria.- Returns:
- a
RunsRequestbuilder
-
getCategory
public static CompletableFuture<Category> getCategory(String id)
Gets theCategorythat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the category to get- Returns:
- a
CompletableFutureof aCategory
-
getCategoryRecords
public static CategoryRecordsRequest getCategoryRecords(String categoryId)
Gets aCategoryRecordsRequestbuilder to request the records for the specifiedCategory.- Parameters:
categoryId- the ID of theCategoryto get theLeaderboards for- Returns:
- a
CategoryRecordsRequestbuilder
-
getCategoryVariables
public static CategoryVariablesRequest getCategoryVariables(String categoryId)
Gets aCategoryVariablesRequestbuilder to request all the variables for the specifiedCategory.- Parameters:
categoryId- the ID of theCategoryto get theVariables for- Returns:
- a
CategoryVariablesRequestbuilder
-
getLevel
public static CompletableFuture<Level> getLevel(String id)
Gets theLevelthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the level to get- Returns:
- a
CompletableFutureof aLevel
-
getLevelCategories
public static LevelCategoriesRequest getLevelCategories(String levelId)
Gets aLevelCategoriesRequestbuilder to request all applicable categories for the specifiedLevel.- Parameters:
levelId- the ID of theLevelto get theCategorys for- Returns:
- a
LevelCategoriesRequestbuilder
-
getLevelRecords
public static LevelRecordsRequest getLevelRecords(String levelId)
Gets aLevelRecordsRequestbuilder to request the records for the specifiedLevel.- Parameters:
levelId- the ID of theLevelto get theLeaderboards for- Returns:
- a
LevelRecordsRequestbuilder
-
getLevelVariables
public static LevelVariablesRequest getLevelVariables(String levelId)
Gets aLevelVariablesRequestbuilder to request all the variables for the specifiedLevel.- Parameters:
levelId- the ID of theLevelto get theVariables for- Returns:
- a
LevelVariablesRequestbuilder
-
getVariable
public static CompletableFuture<Variable> getVariable(String id)
Gets theVariablethat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the variable to get- Returns:
- a
CompletableFutureof aVariable
-
getProfile
public static CompletableFuture<User> getProfile()
Gets theUserthat owns the current API key.- Returns:
- a
CompletableFutureof the current authenticatedUser - See Also:
setApiKey(String)
-
getNotifications
public static CompletableFuture<List<Notification>> getNotifications()
Gets all of theNotifications for the currently authenticated user.- Returns:
- a
CompletableFuturewith aListof notifications - See Also:
setApiKey(String)
-
getUser
public static CompletableFuture<User> getUser(String id)
Gets theUserthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the user to get- Returns:
- a
CompletableFutureof aUser
-
getUsers
public static UsersRequest getUsers()
Gets aUsersRequestbuilder to request allUsers matching the specified criteria.- Returns:
- a
UsersRequestbuilder
-
getUserPBs
public static UserPBsRequest getUserPBs(String userId)
Gets aUserPBsRequestbuilder to request the personal best runs for the specifiedUser.- Parameters:
userId- the ID of theUserto get theLeaderboardRuns for- Returns:
- a
UserPBsRequestbuilder
-
getGuest
public static CompletableFuture<Guest> getGuest(String name)
Gets theGuestthat corresponds to the providednameasynchronously.- Parameters:
name- the name of the guest to get- Returns:
- a
CompletableFutureof aGuest
-
getGenre
public static CompletableFuture<Genre> getGenre(String id)
Gets theGenrethat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the genre to get- Returns:
- a
CompletableFutureof aGenre
-
getGenres
public static GenresRequest getGenres()
Gets aGenresRequestbuilder to request allGenres.- Returns:
- a
GenresRequestbuilder
-
getEngine
public static CompletableFuture<Engine> getEngine(String id)
Gets theEnginethat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the engine to get- Returns:
- a
CompletableFutureof aEngine
-
getEngines
public static EnginesRequest getEngines()
Gets aEnginesRequestbuilder to request allEngines.- Returns:
- a
EnginesRequestbuilder
-
getGametype
public static CompletableFuture<Gametype> getGametype(String id)
Gets theGametypethat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the gametype to get- Returns:
- a
CompletableFutureof aGametype
-
getGametypes
public static GametypesRequest getGametypes()
Gets aGametypesRequestbuilder to request allGametypes.- Returns:
- a
GametypesRequestbuilder
-
getDeveloper
public static CompletableFuture<Developer> getDeveloper(String id)
Gets theDeveloperthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the developer to get- Returns:
- a
CompletableFutureof aDeveloper
-
getDevelopers
public static DevelopersRequest getDevelopers()
Gets aDevelopersRequestbuilder to request allDevelopers.- Returns:
- a
DevelopersRequestbuilder
-
getRegion
public static CompletableFuture<Region> getRegion(String id)
Gets theRegionthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the region to get- Returns:
- a
CompletableFutureof aRegion
-
getRegions
public static RegionsRequest getRegions()
Gets aRegionsRequestbuilder to request allRegions.- Returns:
- a
RegionsRequestbuilder
-
getSingleSeries
public static CompletableFuture<Series> getSingleSeries(String id)
Gets theSeriesthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the region to get- Returns:
- a
CompletableFutureof aSeries
-
getSeriesGames
public static SeriesGamesRequest getSeriesGames(String seriesId)
Gets aSeriesGamesRequestbuilder to request the games in the specifiedSeries.- Parameters:
seriesId- the ID of theSeriesto get theGames that belong to the series- Returns:
- a
SeriesGamesRequestbuilder
-
getMultipleSeries
public static AllSeriesRequest getMultipleSeries()
Gets aAllSeriesRequestbuilder to request allSeriess.- Returns:
- a
AllSeriesRequestbuilder
-
getPlatform
public static CompletableFuture<Platform> getPlatform(String id)
Gets thePlatformthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the platform to get- Returns:
- a
CompletableFutureof aPlatform
-
getPlatforms
public static PlatformsRequest getPlatforms()
Gets aPlatformsRequestbuilder to request allPlatforms.- Returns:
- a
PlatformsRequestbuilder
-
getPublisher
public static CompletableFuture<Publisher> getPublisher(String id)
Gets thePublisherthat corresponds to the providedidasynchronously.- Parameters:
id- the ID of the publisher to get- Returns:
- a
CompletableFutureof aPublisher
-
getPublishers
public static PublishersRequest getPublishers()
Gets aPublishersRequestbuilder to request allPublishers.- Returns:
- a
PublishersRequestbuilder
-
getLeaderboard
public static LeaderboardRequest getLeaderboard(String gameId, String categoryId, String levelId)
Gets aLeaderboardRequestbuilder to request a specificLeaderboard.- Parameters:
gameId- game ID to filter the leaderboard bycategoryId- category ID to filter the leaderboard bylevelId- level ID to filter the leaderboard by- Returns:
- a
LeaderboardRequestbuilder
-
getLeaderboard
public static LeaderboardRequest getLeaderboard(String gameId, String categoryId)
Gets aLeaderboardRequestbuilder to request a specificLeaderboard.- Parameters:
gameId- game ID to filter the leaderboard bycategoryId- category ID to filter the leaderboard by- Returns:
- a
LeaderboardRequestbuilder
-
getLeaderboard
public static LeaderboardRequest getLeaderboard(Game game, Category category, Level level)
Gets aLeaderboardRequestbuilder to request a specificLeaderboard.- Parameters:
game- game to filter the leaderboard bycategory- category to filter the leaderboard bylevel- level to filter the leaderboard by- Returns:
- a
LeaderboardRequestbuilder
-
getLeaderboard
public static LeaderboardRequest getLeaderboard(Game game, Category category)
Gets aLeaderboardRequestbuilder to request a specificLeaderboard.- Parameters:
game- game to filter the leaderboard bycategory- category to filter the leaderboard by- Returns:
- a
LeaderboardRequestbuilder
-
-