Class 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 a 404 Not Found or a 500 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 Detail

      • getUserByAccountId

        public reactor.core.publisher.Mono<GDUser> getUserByAccountId​(long accountId)
        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)
      • searchUser

        public reactor.core.publisher.Mono<GDUser> searchUser​(String searchQuery)
        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

        public reactor.core.publisher.Mono<GDLevel> getLevelById​(long levelId)
        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.
      • getDailyLevel

        public reactor.core.publisher.Mono<GDTimelyLevel> 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

        public reactor.core.publisher.Mono<GDTimelyLevel> 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 query
        filters - the search filters
        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!).
      • getLevelsByUser

        public reactor.core.publisher.Mono<GDPaginator<GDLevel>> getLevelsByUser​(GDUser user,
                                                                                 int page)
        Gets levels uploaded by a specific user in Geometry Dash.
        Parameters:
        user - the user
        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!).
      • 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 filters
        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!).
      • 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 filters
        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!).
      • browseFeaturedLevels

        public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseFeaturedLevels​(int page)
        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

        public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseHallOfFameLevels​(int page)
        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 filters
        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!).
      • 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 filters
        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!).
      • 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 filters
        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!).
      • 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 filters
        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!).
      • browseFollowedLevels

        public reactor.core.publisher.Mono<GDPaginator<GDLevel>> browseFollowedLevels​(LevelSearchFilters filters,
                                                                                      Collection<? extends GDUser> followed,
                                                                                      int page)
        Browse levels in the Followed section of Geometry Dash.
        Parameters:
        filters - the search filters
        followed - the collection containing followed users
        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!).
      • getHost

        public String getHost()
        Gets the host
        Returns:
        String
      • getCacheLifetime

        public long getCacheLifetime()
        Gets the cache lifetime in milliseconds
        Returns:
        long
      • clearCache

        public void clearCache()
        Clears the cache of previous requests.
      • getTotalNumberOfRequestsMade

        public long getTotalNumberOfRequestsMade()
        Gets the total number of requests that this client has made to Geometry Dash servers since the creation of this client. This value is not guaranteed to increase everytime a method such as getUserByAccountId(long) is called, because sometimes the client caches the responses in order to reduce the number of requests and improve performance. For example, 50 successive calls of getUserByAccountId(long) with the same argument is likely to increase this number by only 1 or 2. That's why the returned value should only be used for performance monitoring purposes.
        Returns:
        the total number of requests sent to GD servers during the lifetime of this client.