-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(java): Introduce ConfigurationOverride class
- Loading branch information
1 parent
2602c5b
commit 05ed244
Showing
60 changed files
with
694 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
src/main/java/dev/openfga/sdk/api/client/ConfigurationOverride.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/* | ||
* OpenFGA | ||
* A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. | ||
* | ||
* The version of the OpenAPI document: 0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package dev.openfga.sdk.api.client; | ||
|
||
import java.net.http.HttpClient; | ||
import java.net.http.HttpConnectTimeoutException; | ||
import java.net.http.HttpRequest; | ||
import java.time.Duration; | ||
|
||
/** | ||
* Configuration overrides for an api client. Values are initialized to null, and any values unset are intended to fall | ||
* through to the values of a {@link Configuration}. | ||
* <p> | ||
* More details on intended usage of this class can be found in the documentation of the {@link Configuration#override(ConfigurationOverride)} method. | ||
*/ | ||
public class ConfigurationOverride implements BaseConfiguration { | ||
private String apiUrl; | ||
private String userAgent; | ||
private Duration readTimeout; | ||
private Duration connectTimeout; | ||
|
||
public ConfigurationOverride() { | ||
this.apiUrl = null; | ||
this.userAgent = null; | ||
this.readTimeout = null; | ||
this.connectTimeout = null; | ||
} | ||
|
||
/** | ||
* Set the API URL for the http client. | ||
* | ||
* @param apiUrl The URL. | ||
* @return This object. | ||
*/ | ||
public BaseConfiguration apiUrl(String apiUrl) { | ||
this.apiUrl = apiUrl; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get the API URL that was set. | ||
* | ||
* @return The url. | ||
*/ | ||
@Override | ||
public String getApiUrl() { | ||
return apiUrl; | ||
} | ||
|
||
/** | ||
* Set the user agent. | ||
* | ||
* @param userAgent The user agent. | ||
* @return This object. | ||
*/ | ||
public BaseConfiguration userAgent(String userAgent) { | ||
this.userAgent = userAgent; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get the user agent. | ||
* | ||
* @return The user agent. | ||
*/ | ||
@Override | ||
public String getUserAgent() { | ||
return userAgent; | ||
} | ||
|
||
/** | ||
* Set the read timeout for the http client. | ||
* | ||
* <p>This is the value used by default for each request, though it can be | ||
* overridden on a per-request basis with a request interceptor.</p> | ||
* | ||
* @param readTimeout The read timeout used by default by the http client. | ||
* Setting this value to null resets the timeout to an | ||
* effectively infinite value. | ||
* @return This object. | ||
*/ | ||
public BaseConfiguration readTimeout(Duration readTimeout) { | ||
this.readTimeout = readTimeout; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get the read timeout that was set. | ||
* | ||
* @return The read timeout, or null if no timeout was set. Null represents | ||
* an infinite wait time. | ||
*/ | ||
@Override | ||
public Duration getReadTimeout() { | ||
return readTimeout; | ||
} | ||
|
||
/** | ||
* Sets the connect timeout (in milliseconds) for the http client. | ||
* | ||
* <p> In the case where a new connection needs to be established, if | ||
* the connection cannot be established within the given {@code | ||
* duration}, then {@link HttpClient#send(HttpRequest, BodyHandler) | ||
* HttpClient::send} throws an {@link HttpConnectTimeoutException}, or | ||
* {@link HttpClient#sendAsync(HttpRequest, BodyHandler) | ||
* HttpClient::sendAsync} completes exceptionally with an | ||
* {@code HttpConnectTimeoutException}. If a new connection does not | ||
* need to be established, for example if a connection can be reused | ||
* from a previous request, then this timeout duration has no effect. | ||
* | ||
* @param connectTimeout connection timeout in milliseconds | ||
* @return This object. | ||
*/ | ||
public BaseConfiguration connectTimeout(Duration connectTimeout) { | ||
this.connectTimeout = connectTimeout; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get connection timeout (in milliseconds). | ||
* | ||
* @return Timeout in milliseconds | ||
*/ | ||
@Override | ||
public Duration getConnectTimeout() { | ||
return connectTimeout; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.