Package com.github.alex1304.jdash.client
Class AnonymousGDClient
java.lang.Object
com.github.alex1304.jdash.client.AnonymousGDClient
public final class AnonymousGDClient extends Object
An HTTP client specifically designed to make anonymous requests to Geometry
Dash servers. To create an instance of this class, use
GDClientBuilder.buildAnonymous()
.
Unless mentionned otherwise on the said methods, all methods which return
type is a Mono
may emit one of the following errors if the underlying
request fails:
BadResponseException
- happens when the Geometry Dash server returns an HTTP error (like a404 Not Found
or a500 Internal Server Error
for instance)MissingAccessException
- certainly the most common error. Happens when nothing is found (e.g a level search gave no results), or when access to the resource is denied (e.g trying to fetch a user profile with an authenticated client, and the user has blocked the account that the client is logged on). Unfortunately there is no way to distinguish those two situations due to how the Geometry Dash API is designed. For those who are familiar with the raw Geometry Dash API, this is when the server returns-1
.CorruptedResponseContentException
- happens when the Geometry Dash server returns a response that cannot be parsed to the desired object. This should rarely happen in normal conditions, but it may be more frequent when you use JDash on a Geometry Dash private server.
-
Method Summary
Modifier and Type Method Description reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseAwardedLevels(LevelSearchFilters filters, int page)
Browse levels in the Awarded section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseFeaturedLevels(int page)
Browse levels in the Featured section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseFollowedIds(LevelSearchFilters filters, Collection<? extends Long> followedAccountIDs, int page)
Browse levels in the Followed section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseFollowedLevels(LevelSearchFilters filters, Collection<? extends GDUser> followed, int page)
Deprecated.This requires that all GDUser instances must have been fetched beforehand, while account IDs are technically sufficient to perform this request.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseHallOfFameLevels(int page)
Browse levels in the Hall of Fame section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseMagicLevels(LevelSearchFilters filters, int page)
Browse levels in the Magic section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseMostDownloadedLevels(LevelSearchFilters filters, int page)
Browse levels in the Most Downloaded section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseMostLikedLevels(LevelSearchFilters filters, int page)
Browse levels in the Most Liked section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseRecentLevels(LevelSearchFilters filters, int page)
Browse levels in the Recent section of Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
browseTrendingLevels(LevelSearchFilters filters, int page)
Browse levels in the Trending section of Geometry Dash.void
clearCache()
Clears the cache of previous requests.Duration
getCacheTtl()
Gets the time to live of a cache entry in milliseconds.reactor.core.publisher.Mono<GDTimelyLevel>
getDailyLevel()
Gets the current Daily Level on Geometry Dash.String
getHost()
Gets the host.reactor.core.publisher.Mono<GDLevel>
getLevelById(long levelId)
Gets a Geometry Dash level from its ID.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
getLevelsByUser(GDUser user, int page)
Gets levels uploaded by a specific user in Geometry Dash.int
getMaxConnections()
Deprecated.limiting max connections is no longer supported.Duration
getRequestTimeout()
Gets the maximum time in milliseconds to wait if a request takes too long to complete.reactor.core.publisher.Mono<GDSong>
getSongById(long songId)
Gets information on a custom song from its ID.reactor.core.publisher.Mono<GDUser>
getUserByAccountId(long accountId)
Gets a Geometry Dash user from their accountIDreactor.core.publisher.Mono<GDUserProfileData>
getUserDataFromProfile(long accountId)
Gets data from a user provided by their profile.reactor.core.publisher.Mono<GDUserSearchData>
getUserDataFromSearch(String searchQuery)
Gets data from a user provided by the Search user feature.reactor.core.publisher.Mono<GDTimelyLevel>
getWeeklyDemon()
Gets the current Weekly Demon on Geometry Dash.reactor.core.publisher.Mono<GDPaginator<GDLevel>>
searchLevels(String query, LevelSearchFilters filters, int page)
Search for levels in Geometry Dash.reactor.core.publisher.Mono<GDUser>
searchUser(String searchQuery)
Submits a search query and returns the corresponding user.
-
Method Details
-
getUserByAccountId
Gets a Geometry Dash user from their accountID- Parameters:
accountId
- the ID of the user's Geometry Dash account- Returns:
- a Mono emitting the requested user, or an error if something goes
wrong (user not found, user has blocked the account that this client
is logged on, etc). If the user profile is found but was unable to retrieve
search result data for that user, a
UserSearchDataNotFoundException
will be emitted.
-
searchUser
Submits a search query and returns the corresponding user.- Parameters:
searchQuery
- the user to search for- Returns:
- a Mono emitting the user found, or an error if not found.
-
getLevelById
Gets a Geometry Dash level from its ID.- Parameters:
levelId
- the ID of the level to get- Returns:
- a Mono emitting the level with the corresponding ID, or an error if not found or something went wrong.
-
getSongById
Gets information on a custom song from its ID.- Parameters:
songId
- the ID of the song- Returns:
- a Mono emitting the song info, or an error if not found or something
went wrong. If the song is not allowed for use in Geometry Dash, the
error
SongNotAllowedForUseException
will be emitted.
-
getDailyLevel
Gets the current Daily Level on Geometry Dash.- Returns:
- a Mono emitting the Daily level, or an error if not found or
something went wrong. If no Daily level is available, the error
NoTimelyAvailableException
is emitted.
-
getWeeklyDemon
Gets the current Weekly Demon on Geometry Dash.- Returns:
- a Mono emitting the Weekly demon, or an error if not found or
something went wrong. If no Weekly demon is available, the error
NoTimelyAvailableException
is emitted.
-
searchLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> searchLevels(String query, LevelSearchFilters filters, int page)Search for levels in Geometry Dash.- Parameters:
query
- the search queryfilters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
getLevelsByUser
Gets levels uploaded by a specific user in Geometry Dash.- Parameters:
user
- the userpage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseAwardedLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseAwardedLevels(LevelSearchFilters filters, int page)Browse levels in the Awarded section of Geometry Dash.- Parameters:
filters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseRecentLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseRecentLevels(LevelSearchFilters filters, int page)Browse levels in the Recent section of Geometry Dash.- Parameters:
filters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseFeaturedLevels
Browse levels in the Featured section of Geometry Dash.- Parameters:
page
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseHallOfFameLevels
Browse levels in the Hall of Fame section of Geometry Dash.- Parameters:
page
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseMostDownloadedLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseMostDownloadedLevels(LevelSearchFilters filters, int page)Browse levels in the Most Downloaded section of Geometry Dash.- Parameters:
filters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseMostLikedLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseMostLikedLevels(LevelSearchFilters filters, int page)Browse levels in the Most Liked section of Geometry Dash.- Parameters:
filters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseTrendingLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseTrendingLevels(LevelSearchFilters filters, int page)Browse levels in the Trending section of Geometry Dash.- Parameters:
filters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseMagicLevels
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseMagicLevels(LevelSearchFilters filters, int page)Browse levels in the Magic section of Geometry Dash.- Parameters:
filters
- the search filterspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseFollowedLevels
@Deprecated public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseFollowedLevels(LevelSearchFilters filters, Collection<? extends GDUser> followed, int page)Deprecated.This requires that all GDUser instances must have been fetched beforehand, while account IDs are technically sufficient to perform this request. Please use browseFollowedIds(...) instead.Browse levels in the Followed section of Geometry Dash.- Parameters:
filters
- the search filtersfollowed
- the collection containing the instances of followed userspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
browseFollowedIds
public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseFollowedIds(LevelSearchFilters filters, Collection<? extends Long> followedAccountIDs, int page)Browse levels in the Followed section of Geometry Dash.- Parameters:
filters
- the search filtersfollowedAccountIDs
- the collection containing the account IDs of followed userspage
- the page number- Returns:
- a Mono emitting a paginator containing all levels found. Note that if no levels are found, it will emit an error instead of just an empty paginator. This is because the Geometry Dash API returns the same response when the search produces no results and when an actual error occurs while processing the request (blame RobTop for that!).
-
getUserDataFromProfile
Gets data from a user provided by their profile. UnlikegetUserByAccountId(long)
, this doesn't include some data that is only obtainable by usinggetUserDataFromSearch(String)
- Parameters:
accountId
- the account ID of the user to fetch- Returns:
- a Mono emitting the data found
-
getUserDataFromSearch
Gets data from a user provided by the Search user feature. The data gotten from there might be inaccurate and severely outdated, that's why it is preferred to usegetUserDataFromProfile(long)
in order to fetch stats.- Parameters:
searchQuery
- the search query- Returns:
- a Mono emitting the data found
-
getHost
Gets the host.- Returns:
- String
-
getCacheTtl
Gets the time to live of a cache entry in milliseconds.- Returns:
- long
-
getMaxConnections
Deprecated.limiting max connections is no longer supported. This method will always return -1Gets the maximum number of simultaneous connections.- Returns:
- int
-
getRequestTimeout
Gets the maximum time in milliseconds to wait if a request takes too long to complete.- Returns:
- long
-
clearCache
public void clearCache()Clears the cache of previous requests.
-