Package com.vonage.client
Class HttpConfig.Builder
java.lang.Object
com.vonage.client.HttpConfig.Builder
- Enclosing class:
HttpConfig
Builder for configuring the base URI and timeout of the client.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapiBaseUri(String apiBaseUri) Replaces the URI used in "api" endpoints.apiEuBaseUri(String apiEuBaseUri) Replaces the base URI used in "api-eu" endpoints.appendUserAgent(String userAgent) Appends a custom string to the defaultUser-Agentheader.Replaces the base URI used in all requests with the specified parameter.Replaces the base URI used in all requests with the specified parameter.build()Builds the HttpConfig.Sets the proxy to use for requests.Sets the proxy to use for requests.regionalUriGetter(Function<ApiRegion, String> uriGetter) Sets a function to get the base URI for a given region.restBaseUri(String restBaseUri) Replaces the base URI used in "rest" endpoints.timeoutMillis(int timeoutMillis) Sets the socket timeout for requests.videoBaseUri(String videoBaseUri) Replaces the base URI used in "video" endpoints.
-
Constructor Details
-
Builder
Deprecated.Will be made private in the next major version.Constructor.
-
-
Method Details
-
timeoutMillis
Sets the socket timeout for requests. By default, this is one minute (60000 ms).
Note that this timeout applies to both the connection and socket; therefore, it defines the maximum time for each stage of the request. For example, if set to 30 seconds, then establishing a connection may take 29 seconds and receiving a response may take 29 seconds without timing out (therefore a total of 58 seconds for the request).- Parameters:
timeoutMillis- The timeout in milliseconds.- Returns:
- This builder.
- Since:
- 7.8.0
-
proxy
Sets the proxy to use for requests. This will route requests through the specified URL.- Parameters:
proxy- The proxy URI to use as a string.- Returns:
- This builder.
- Throws:
IllegalArgumentException- If the proxy URI is invalid.- Since:
- 8.15.0
-
proxy
Sets the proxy to use for requests. This will route requests through the specified URL.- Parameters:
proxy- The proxy URI to use.- Returns:
- This builder.
- Since:
- 8.15.0
-
apiBaseUri
Replaces the URI used in "api" endpoints.- Parameters:
apiBaseUri- The base uri to use.- Returns:
- This builder.
-
restBaseUri
Replaces the base URI used in "rest" endpoints.- Parameters:
restBaseUri- The base uri to use.- Returns:
- This builder.
-
apiEuBaseUri
Replaces the base URI used in "api-eu" endpoints.- Parameters:
apiEuBaseUri- The base URI to use.- Returns:
- This builder.
-
videoBaseUri
Replaces the base URI used in "video" endpoints.- Parameters:
videoBaseUri- The base URI to use.- Returns:
- This builder.
- Since:
- 8.0.0
-
baseUri
Replaces the base URI used in all requests with the specified parameter.- Parameters:
baseUri- The base URI to use.- Returns:
- This builder.
-
baseUri
Replaces the base URI used in all requests with the specified parameter.- Parameters:
baseUri- The base URI to use.- Returns:
- This builder.
- Since:
- 8.9.0
-
regionalUriGetter
Sets a function to get the base URI for a given region.- Parameters:
uriGetter- The function which takes as input a region and returns a base URI as a string.- Returns:
- This builder.
- Since:
- 8.11.0
-
appendUserAgent
Appends a custom string to the defaultUser-Agentheader. This is mainly used for derivatives of the SDK, or to distinguish particular users / use cases.- Parameters:
userAgent- The user agent string to append to the existing one. Must be less than 128 characters.- Returns:
- This builder.
- Since:
- 8.11.0
-
build
Builds the HttpConfig.- Returns:
- A new HttpConfig object from the stored builder options.
-