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 Summary
Modifier and Type Method Description CodeforcesClient.Builder
authorization()
Disables the requests authorization for this client.CodeforcesClient.Builder
authorization(String apiKey, String apiSecret)
Sets the requests authorization for this client.CodeforcesClient
build()
Returns a new CodeforcesClient built from the current state of the builder.CodeforcesClient.Builder
language()
Resets to the default language (en).CodeforcesClient.Builder
language(String lang)
Sets the language for Language-depended fields like names or descriptions.CodeforcesClient.Builder
proxy()
Resets to the default proxy selector.CodeforcesClient.Builder
proxy(ProxySelector proxySelector)
Sets a ProxySelector.CodeforcesClient.Builder
timeout()
Disables the connect timeout duration for this client.CodeforcesClient.Builder
timeout(long seconds)
Sets the connect timeout duration for this client.CodeforcesClient.Builder
timeout(Duration timeout)
Sets the connect timeout duration for this client.
-
Method Details
-
language
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
Resets to the default language (en).- Returns:
- This builder.
-
timeout
Disables the connect timeout duration for this client.- Returns:
- This builder.
-
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
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
Sets a ProxySelector.- Parameters:
proxySelector
- The proxySelector.- Returns:
- This builder.
-
proxy
Resets to the default proxy selector.- Returns:
- This builder.
-
authorization
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
Disables the requests authorization for this client.- Returns:
- This builder.
-
build
Returns a new CodeforcesClient built from the current state of the builder.- Returns:
- a new CodeforcesClient.
-