Class GDClientBuilder


  • public final class GDClientBuilder
    extends Object
    Builds a Geometry Dash client step by step.
    • Field Detail

      • DEFAULT_CACHE_TTL

        public static final java.time.Duration DEFAULT_CACHE_TTL
      • DEFAULT_MAX_CONNECTIONS

        public static final int DEFAULT_MAX_CONNECTIONS
      • DEFAULT_REQUEST_TIMEOUT

        public static final java.time.Duration DEFAULT_REQUEST_TIMEOUT
    • Method Detail

      • withHost

        public GDClientBuilder withHost​(String host)
        Specifies a custom host for the client to send the requests to. This allows the use of AnonymousGDClient for Geometry Dash private servers (GDPS).
        Parameters:
        host - the host address (WITHOUT protocol and WITHOUT trailing slash!)
        Returns:
        this (for method chaining purposes)
        Throws:
        IllegalArgumentException - if host starts with 'http://', ends with '/'
        NullPointerException - if host is null
      • withCacheTtl

        public GDClientBuilder withCacheTtl​(java.time.Duration time)
        Specifies how long a request should stay in cache. Setting 0 as value disables the cache.
        Parameters:
        time - the time to set for the cache ttl
        Returns:
        this (for method chaining purposes)
        Throws:
        IllegalArgumentException - if time is negative
      • withMaxConnections

        public GDClientBuilder withMaxConnections​(int maxConnections)
        Specifies how many connections to the GD servers can be simultaneously open.
        Parameters:
        maxConnections - the number of max connections
        Returns:
        this (for method chaining purposes)
        Throws:
        IllegalArgumentException - if maxConnections is < 1
      • withRequestTimeout

        public GDClientBuilder withRequestTimeout​(java.time.Duration time)
        Specifies a timeout for requests to complete. If a request does not complete in time, a TimeoutException will be propagated for the said request.
        Parameters:
        time - the time to set for the cache ttl
        Returns:
        this (for method chaining purposes)
        Throws:
        IllegalArgumentException - if time is negative