Class CodeforcesClient.Builder

java.lang.Object
com.github.rami_sabbagh.codeforces.api.CodeforcesClient.Builder
Enclosing class:
CodeforcesClient

public static class CodeforcesClient.Builder
extends Object
A CodeforcesClient builder.
  • Method Details

    • language

      public CodeforcesClient.Builder language​(String lang)
      Sets the language for Language-depended fields like names or descriptions.
      Parameters:
      lang - The language to use, can be en or ru.
      Returns:
      This builder.
    • language

      public CodeforcesClient.Builder language()
      Resets to the default language (en).
      Returns:
      This builder.
    • timeout

      public CodeforcesClient.Builder timeout()
      Disables the connect timeout duration for this client.
      Returns:
      This builder.
    • timeout

      public CodeforcesClient.Builder timeout​(Duration timeout)
      Sets the connect timeout duration for this client.
      Parameters:
      timeout - The duration to allow the underlying connection to be established.
      Returns:
      This builder.
    • timeout

      public CodeforcesClient.Builder timeout​(long seconds)
      Sets the connect timeout duration for this client.
      Parameters:
      seconds - The duration to allow the underlying connection to be established in seconds.
      Returns:
      This builder.
    • proxy

      public CodeforcesClient.Builder proxy​(ProxySelector proxySelector)
      Sets a ProxySelector.
      Parameters:
      proxySelector - The proxySelector.
      Returns:
      This builder.
    • proxy

      public CodeforcesClient.Builder proxy()
      Resets to the default proxy selector.
      Returns:
      This builder.
    • authorization

      public CodeforcesClient.Builder authorization​(String apiKey, String apiSecret)
      Sets the requests authorization for this client. All methods can be requested anonymously. This way only public data will be accessible via API. To access data, private for some user (e.g. hacks during the contest), The API key can be generated on https://codeforces.com/settings/api page.
      Parameters:
      apiKey - The authorization apiKey, can be null for no authorization.
      apiSecret - The authorization apiSecret, must be null when apiKey is, and vice versa.
      Returns:
      This builder.
    • authorization

      public CodeforcesClient.Builder authorization()
      Disables the requests authorization for this client.
      Returns:
      This builder.
    • build

      public CodeforcesClient build()
      Returns a new CodeforcesClient built from the current state of the builder.
      Returns:
      a new CodeforcesClient.