BaseOkHttpClientBuilder

abstract class BaseOkHttpClientBuilder<T>

A base class for building an OkHttpClient with configurable options.

@param T The type of client to be built.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Set a default API key to be supplied in every request as the "apikey" header. @param apikey The API key.

Link copied to clipboard
abstract fun build(): T

Build the client of type T.

Link copied to clipboard

Set the connect timeout value in milliseconds to be used while creating the HttpClient.

Link copied to clipboard

Enable or disable SSL verification in the client. @param enableSsl Flag to turn on/off SSL verification in the client.

Link copied to clipboard

This function should be implemented by subclasses to provide the default user agent suffix. The suffix will be used to construct the default user agent string. @return The default user agent suffix.

Link copied to clipboard
fun getHttpClient(): OkHttpClient

Get the configured OkHttpClient instance. If a custom client is not set, it builds a new client. @return The OkHttpClient instance.

Link copied to clipboard

Set the keystore password to be used while creating the SSL factory.

Link copied to clipboard

Set the path to the keystore to be used while creating the SSL factory. @param keystorePath The path to the keystore.

Link copied to clipboard

Set the read timeout value in milliseconds to be used while creating the HttpClient.

Link copied to clipboard

Set SSL configuration using a provided SSLConfig object.

Link copied to clipboard
fun sslFactory(factory: SSLFactory): BaseOkHttpClientBuilder<T>

Set a custom SSL factory to be used with the default HttpClient. @param factory The custom SSL factory.

Link copied to clipboard

Enable or disable SSL hostname verification. @param enable Flag to enable or disable SSL hostname verification.

Link copied to clipboard

Set the truststore password to be used while creating the SSL factory.

Link copied to clipboard

Set the path to the truststore to be used while creating the SSL factory.

Link copied to clipboard

Set the base URL of the target HTTP service. @param url The base URL of the target HTTP service.

Link copied to clipboard

Set the user agent to be supplied in each request. @param userAgent The user agent string.