Class ImageKitOkHttpClient.Builder
-
- All Implemented Interfaces:
public final class ImageKitOkHttpClient.BuilderA builder for ImageKitOkHttpClient.
-
-
Method Summary
Modifier and Type Method Description final ImageKitOkHttpClient.BuilderdispatcherExecutorService(ExecutorService dispatcherExecutorService)The executor service to use for running HTTP requests. final ImageKitOkHttpClient.BuilderdispatcherExecutorService(Optional<ExecutorService> dispatcherExecutorService)Alias for calling Builder.dispatcherExecutorService with dispatcherExecutorService.orElse(null).final ImageKitOkHttpClient.Builderproxy(Proxy proxy)final ImageKitOkHttpClient.Builderproxy(Optional<Proxy> proxy)Alias for calling Builder.proxy with proxy.orElse(null).final ImageKitOkHttpClient.BuilderproxyAuthenticator(ProxyAuthenticator proxyAuthenticator)Provides credentials when an HTTP proxy responds with 407 Proxy Authentication Required.final ImageKitOkHttpClient.BuilderproxyAuthenticator(Optional<ProxyAuthenticator> proxyAuthenticator)Alias for calling Builder.proxyAuthenticator with proxyAuthenticator.orElse(null).final ImageKitOkHttpClient.BuildermaxIdleConnections(Integer maxIdleConnections)The maximum number of idle connections kept by the underlying OkHttp connection pool. final ImageKitOkHttpClient.BuildermaxIdleConnections(Integer maxIdleConnections)Alias for Builder.maxIdleConnections. final ImageKitOkHttpClient.BuildermaxIdleConnections(Optional<Integer> maxIdleConnections)Alias for calling Builder.maxIdleConnections with maxIdleConnections.orElse(null).final ImageKitOkHttpClient.BuilderkeepAliveDuration(Duration keepAliveDuration)The keep-alive duration for idle connections in the underlying OkHttp connection pool. final ImageKitOkHttpClient.BuilderkeepAliveDuration(Optional<Duration> keepAliveDuration)Alias for calling Builder.keepAliveDuration with keepAliveDuration.orElse(null).final ImageKitOkHttpClient.BuildersslSocketFactory(SSLSocketFactory sslSocketFactory)The socket factory used to secure HTTPS connections. final ImageKitOkHttpClient.BuildersslSocketFactory(Optional<SSLSocketFactory> sslSocketFactory)Alias for calling Builder.sslSocketFactory with sslSocketFactory.orElse(null).final ImageKitOkHttpClient.BuildertrustManager(X509TrustManager trustManager)The trust manager used to secure HTTPS connections. final ImageKitOkHttpClient.BuildertrustManager(Optional<X509TrustManager> trustManager)Alias for calling Builder.trustManager with trustManager.orElse(null).final ImageKitOkHttpClient.BuilderhostnameVerifier(HostnameVerifier hostnameVerifier)The verifier used to confirm that response certificates apply to requested hostnames for HTTPS connections. final ImageKitOkHttpClient.BuilderhostnameVerifier(Optional<HostnameVerifier> hostnameVerifier)Alias for calling Builder.hostnameVerifier with hostnameVerifier.orElse(null).final ImageKitOkHttpClient.BuildercheckJacksonVersionCompatibility(Boolean checkJacksonVersionCompatibility)Whether to throw an exception if any of the Jackson versions detected at runtime are incompatible with the SDK's minimum supported Jackson version (2.13.4). final ImageKitOkHttpClient.BuilderjsonMapper(JsonMapper jsonMapper)The Jackson JSON mapper to use for serializing and deserializing JSON. final ImageKitOkHttpClient.Buildersleeper(Sleeper sleeper)The interface to use for delaying execution, like during retries. final ImageKitOkHttpClient.Builderclock(Clock clock)The clock to use for operations that require timing, like retries. final ImageKitOkHttpClient.BuilderbaseUrl(String baseUrl)The base URL to use for every request. final ImageKitOkHttpClient.BuilderbaseUrl(Optional<String> baseUrl)Alias for calling Builder.baseUrl with baseUrl.orElse(null).final ImageKitOkHttpClient.BuilderresponseValidation(Boolean responseValidation)Whether to call validateon every response before returning it.final ImageKitOkHttpClient.Buildertimeout(Timeout timeout)Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding retries. final ImageKitOkHttpClient.Buildertimeout(Duration timeout)Sets the maximum time allowed for a complete HTTP call, not including retries. final ImageKitOkHttpClient.BuildermaxRetries(Integer maxRetries)The maximum number of times to retry failed requests, with a short exponential backoff between requests. final ImageKitOkHttpClient.BuilderlogLevel(LogLevel logLevel)The level at which to log request and response information. final ImageKitOkHttpClient.BuilderprivateKey(String privateKey)Your ImageKit private API key (starts with private_).final ImageKitOkHttpClient.Builderpassword(String password)ImageKit uses your API key as username and ignores the password. final ImageKitOkHttpClient.Builderpassword(Optional<String> password)Alias for calling Builder.password with password.orElse(null).final ImageKitOkHttpClient.BuilderwebhookSecret(String webhookSecret)Your ImageKit webhook secret for verifying webhook signatures (starts with whsec_).final ImageKitOkHttpClient.BuilderwebhookSecret(Optional<String> webhookSecret)Alias for calling Builder.webhookSecret with webhookSecret.orElse(null).final ImageKitOkHttpClient.Builderheaders(Headers headers)final ImageKitOkHttpClient.Builderheaders(Map<String, Iterable<String>> headers)final ImageKitOkHttpClient.BuilderputHeader(String name, String value)final ImageKitOkHttpClient.BuilderputHeaders(String name, Iterable<String> values)final ImageKitOkHttpClient.BuilderputAllHeaders(Headers headers)final ImageKitOkHttpClient.BuilderputAllHeaders(Map<String, Iterable<String>> headers)final ImageKitOkHttpClient.BuilderreplaceHeaders(String name, String value)final ImageKitOkHttpClient.BuilderreplaceHeaders(String name, Iterable<String> values)final ImageKitOkHttpClient.BuilderreplaceAllHeaders(Headers headers)final ImageKitOkHttpClient.BuilderreplaceAllHeaders(Map<String, Iterable<String>> headers)final ImageKitOkHttpClient.BuilderremoveHeaders(String name)final ImageKitOkHttpClient.BuilderremoveAllHeaders(Set<String> names)final ImageKitOkHttpClient.BuilderqueryParams(QueryParams queryParams)final ImageKitOkHttpClient.BuilderqueryParams(Map<String, Iterable<String>> queryParams)final ImageKitOkHttpClient.BuilderputQueryParam(String key, String value)final ImageKitOkHttpClient.BuilderputQueryParams(String key, Iterable<String> values)final ImageKitOkHttpClient.BuilderputAllQueryParams(QueryParams queryParams)final ImageKitOkHttpClient.BuilderputAllQueryParams(Map<String, Iterable<String>> queryParams)final ImageKitOkHttpClient.BuilderreplaceQueryParams(String key, String value)final ImageKitOkHttpClient.BuilderreplaceQueryParams(String key, Iterable<String> values)final ImageKitOkHttpClient.BuilderreplaceAllQueryParams(QueryParams queryParams)final ImageKitOkHttpClient.BuilderreplaceAllQueryParams(Map<String, Iterable<String>> queryParams)final ImageKitOkHttpClient.BuilderremoveQueryParams(String key)final ImageKitOkHttpClient.BuilderremoveAllQueryParams(Set<String> keys)final ImageKitOkHttpClient.BuilderfromEnv()Updates configuration using system properties and environment variables. final ImageKitClientbuild()Returns an immutable instance of ImageKitClient. -
-
Method Detail
-
dispatcherExecutorService
final ImageKitOkHttpClient.Builder dispatcherExecutorService(ExecutorService dispatcherExecutorService)
The executor service to use for running HTTP requests.
Defaults to OkHttp's default executor service.
This class takes ownership of the executor service and shuts it down when closed.
-
dispatcherExecutorService
final ImageKitOkHttpClient.Builder dispatcherExecutorService(Optional<ExecutorService> dispatcherExecutorService)
Alias for calling Builder.dispatcherExecutorService with
dispatcherExecutorService.orElse(null).
-
proxy
final ImageKitOkHttpClient.Builder proxy(Proxy proxy)
-
proxy
final ImageKitOkHttpClient.Builder proxy(Optional<Proxy> proxy)
Alias for calling Builder.proxy with
proxy.orElse(null).
-
proxyAuthenticator
final ImageKitOkHttpClient.Builder proxyAuthenticator(ProxyAuthenticator proxyAuthenticator)
Provides credentials when an HTTP proxy responds with
407 Proxy Authentication Required.
-
proxyAuthenticator
final ImageKitOkHttpClient.Builder proxyAuthenticator(Optional<ProxyAuthenticator> proxyAuthenticator)
Alias for calling Builder.proxyAuthenticator with
proxyAuthenticator.orElse(null).
-
maxIdleConnections
final ImageKitOkHttpClient.Builder maxIdleConnections(Integer maxIdleConnections)
The maximum number of idle connections kept by the underlying OkHttp connection pool.
If this is set, then keepAliveDuration must also be set.
If unset, then OkHttp's default is used.
-
maxIdleConnections
final ImageKitOkHttpClient.Builder maxIdleConnections(Integer maxIdleConnections)
Alias for Builder.maxIdleConnections.
This unboxed primitive overload exists for backwards compatibility.
-
maxIdleConnections
final ImageKitOkHttpClient.Builder maxIdleConnections(Optional<Integer> maxIdleConnections)
Alias for calling Builder.maxIdleConnections with
maxIdleConnections.orElse(null).
-
keepAliveDuration
final ImageKitOkHttpClient.Builder keepAliveDuration(Duration keepAliveDuration)
The keep-alive duration for idle connections in the underlying OkHttp connection pool.
If this is set, then maxIdleConnections must also be set.
If unset, then OkHttp's default is used.
-
keepAliveDuration
final ImageKitOkHttpClient.Builder keepAliveDuration(Optional<Duration> keepAliveDuration)
Alias for calling Builder.keepAliveDuration with
keepAliveDuration.orElse(null).
-
sslSocketFactory
final ImageKitOkHttpClient.Builder sslSocketFactory(SSLSocketFactory sslSocketFactory)
The socket factory used to secure HTTPS connections.
If this is set, then trustManager must also be set.
If unset, then the system default is used. Most applications should not call this method, and instead use the system default. The default include special optimizations that can be lost if the implementation is modified.
-
sslSocketFactory
final ImageKitOkHttpClient.Builder sslSocketFactory(Optional<SSLSocketFactory> sslSocketFactory)
Alias for calling Builder.sslSocketFactory with
sslSocketFactory.orElse(null).
-
trustManager
final ImageKitOkHttpClient.Builder trustManager(X509TrustManager trustManager)
The trust manager used to secure HTTPS connections.
If this is set, then sslSocketFactory must also be set.
If unset, then the system default is used. Most applications should not call this method, and instead use the system default. The default include special optimizations that can be lost if the implementation is modified.
-
trustManager
final ImageKitOkHttpClient.Builder trustManager(Optional<X509TrustManager> trustManager)
Alias for calling Builder.trustManager with
trustManager.orElse(null).
-
hostnameVerifier
final ImageKitOkHttpClient.Builder hostnameVerifier(HostnameVerifier hostnameVerifier)
The verifier used to confirm that response certificates apply to requested hostnames for HTTPS connections.
If unset, then a default hostname verifier is used.
-
hostnameVerifier
final ImageKitOkHttpClient.Builder hostnameVerifier(Optional<HostnameVerifier> hostnameVerifier)
Alias for calling Builder.hostnameVerifier with
hostnameVerifier.orElse(null).
-
checkJacksonVersionCompatibility
final ImageKitOkHttpClient.Builder checkJacksonVersionCompatibility(Boolean checkJacksonVersionCompatibility)
Whether to throw an exception if any of the Jackson versions detected at runtime are incompatible with the SDK's minimum supported Jackson version (2.13.4).
Defaults to true. Use extreme caution when disabling this option. There is no guarantee that the SDK will work correctly when using an incompatible Jackson version.
-
jsonMapper
final ImageKitOkHttpClient.Builder jsonMapper(JsonMapper jsonMapper)
The Jackson JSON mapper to use for serializing and deserializing JSON.
Defaults to io.imagekit.core.jsonMapper. The default is usually sufficient and rarely needs to be overridden.
-
sleeper
final ImageKitOkHttpClient.Builder sleeper(Sleeper sleeper)
The interface to use for delaying execution, like during retries.
This is primarily useful for using fake delays in tests.
Defaults to real execution delays.
This class takes ownership of the sleeper and closes it when closed.
-
clock
final ImageKitOkHttpClient.Builder clock(Clock clock)
The clock to use for operations that require timing, like retries.
This is primarily useful for using a fake clock in tests.
Defaults to Clock.systemUTC.
-
baseUrl
final ImageKitOkHttpClient.Builder baseUrl(String baseUrl)
The base URL to use for every request.
Defaults to the production environment:
https://api.imagekit.io.
-
baseUrl
final ImageKitOkHttpClient.Builder baseUrl(Optional<String> baseUrl)
Alias for calling Builder.baseUrl with
baseUrl.orElse(null).
-
responseValidation
final ImageKitOkHttpClient.Builder responseValidation(Boolean responseValidation)
Whether to call
validateon every response before returning it.Setting this to
trueis not forwards compatible with new types from the API for existing fields.Defaults to false, which means the shape of the response will not be validated upfront. Instead, validation will only occur for the parts of the response that are accessed.
-
timeout
final ImageKitOkHttpClient.Builder timeout(Timeout timeout)
Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding retries.
Defaults to Timeout.default.
-
timeout
final ImageKitOkHttpClient.Builder timeout(Duration timeout)
Sets the maximum time allowed for a complete HTTP call, not including retries.
See Timeout.request for more details.
For fine-grained control, pass a Timeout object.
-
maxRetries
final ImageKitOkHttpClient.Builder maxRetries(Integer maxRetries)
The maximum number of times to retry failed requests, with a short exponential backoff between requests.
Only the following error types are retried:
Connection errors (for example, due to a network connectivity problem)
408 Request Timeout
409 Conflict
429 Rate Limit
5xx Internal
The API may also explicitly instruct the SDK to retry or not retry a request.
Defaults to 2.
-
logLevel
final ImageKitOkHttpClient.Builder logLevel(LogLevel logLevel)
The level at which to log request and response information.
fromEnv will set the level from environment variables. See LogLevel.fromEnv.
Defaults to LogLevel.fromEnv.
-
privateKey
final ImageKitOkHttpClient.Builder privateKey(String privateKey)
Your ImageKit private API key (starts with
private_). You can find this in the ImageKit dashboard.
-
password
final ImageKitOkHttpClient.Builder password(String password)
ImageKit uses your API key as username and ignores the password. The SDK sets a dummy value. You can ignore this field.
Defaults to
"do_not_set".
-
password
final ImageKitOkHttpClient.Builder password(Optional<String> password)
Alias for calling Builder.password with
password.orElse(null).
-
webhookSecret
final ImageKitOkHttpClient.Builder webhookSecret(String webhookSecret)
Your ImageKit webhook secret for verifying webhook signatures (starts with
whsec_). You can find this in the ImageKit dashboard. Only required if you are using webhooks.
-
webhookSecret
final ImageKitOkHttpClient.Builder webhookSecret(Optional<String> webhookSecret)
Alias for calling Builder.webhookSecret with
webhookSecret.orElse(null).
-
headers
final ImageKitOkHttpClient.Builder headers(Headers headers)
-
putHeader
final ImageKitOkHttpClient.Builder putHeader(String name, String value)
-
putHeaders
final ImageKitOkHttpClient.Builder putHeaders(String name, Iterable<String> values)
-
putAllHeaders
final ImageKitOkHttpClient.Builder putAllHeaders(Headers headers)
-
putAllHeaders
final ImageKitOkHttpClient.Builder putAllHeaders(Map<String, Iterable<String>> headers)
-
replaceHeaders
final ImageKitOkHttpClient.Builder replaceHeaders(String name, String value)
-
replaceHeaders
final ImageKitOkHttpClient.Builder replaceHeaders(String name, Iterable<String> values)
-
replaceAllHeaders
final ImageKitOkHttpClient.Builder replaceAllHeaders(Headers headers)
-
replaceAllHeaders
final ImageKitOkHttpClient.Builder replaceAllHeaders(Map<String, Iterable<String>> headers)
-
removeHeaders
final ImageKitOkHttpClient.Builder removeHeaders(String name)
-
removeAllHeaders
final ImageKitOkHttpClient.Builder removeAllHeaders(Set<String> names)
-
queryParams
final ImageKitOkHttpClient.Builder queryParams(QueryParams queryParams)
-
queryParams
final ImageKitOkHttpClient.Builder queryParams(Map<String, Iterable<String>> queryParams)
-
putQueryParam
final ImageKitOkHttpClient.Builder putQueryParam(String key, String value)
-
putQueryParams
final ImageKitOkHttpClient.Builder putQueryParams(String key, Iterable<String> values)
-
putAllQueryParams
final ImageKitOkHttpClient.Builder putAllQueryParams(QueryParams queryParams)
-
putAllQueryParams
final ImageKitOkHttpClient.Builder putAllQueryParams(Map<String, Iterable<String>> queryParams)
-
replaceQueryParams
final ImageKitOkHttpClient.Builder replaceQueryParams(String key, String value)
-
replaceQueryParams
final ImageKitOkHttpClient.Builder replaceQueryParams(String key, Iterable<String> values)
-
replaceAllQueryParams
final ImageKitOkHttpClient.Builder replaceAllQueryParams(QueryParams queryParams)
-
replaceAllQueryParams
final ImageKitOkHttpClient.Builder replaceAllQueryParams(Map<String, Iterable<String>> queryParams)
-
removeQueryParams
final ImageKitOkHttpClient.Builder removeQueryParams(String key)
-
removeAllQueryParams
final ImageKitOkHttpClient.Builder removeAllQueryParams(Set<String> keys)
-
fromEnv
final ImageKitOkHttpClient.Builder fromEnv()
Updates configuration using system properties and environment variables.
-
build
final ImageKitClient build()
Returns an immutable instance of ImageKitClient.
Further updates to this Builder will not mutate the returned instance.
-
-
-
-