TibiaKtClient

constructor(client: HttpClient, ownsClient: Boolean)(source)


constructor(baseClient: HttpClient, applyDefaults: Boolean = true, userAgent: String? = null, additionalConfig: HttpClientConfig<*>.() -> Unit = {})(source)

Create a client from a caller-provided HttpClient.

Parameters

baseClient

An existing Ktor client, possibly shared across your app.

applyDefaults

When true, applies this library’s defaults to a derived client

userAgent

Optional User-Agent string. If null, a sensible default is used.

additionalConfig

Extra client configuration applied after the library defaults.

Ownership: this constructor sets ownsClient to false; the caller manages baseClient lifecycle.


constructor(engineFactory: HttpClientEngineFactory<*>, userAgent: String? = null, additionalConfig: HttpClientConfig<*>.() -> Unit = {})(source)

Create a client using a specific engine factory (e.g., OkHttp, CIO, Apache, Darwin).

Parameters

engineFactory

The engine factory to use for building the underlying HttpClient.

userAgent

Optional User-Agent string. If null, a sensible default is used.

additionalConfig

Extra client configuration applied after the library defaults.

Ownership: this constructor builds and owns the underlying client; close will close it.


constructor(engine: HttpClientEngine, userAgent: String? = null, additionalConfig: HttpClientConfig<*>.() -> Unit = {})(source)

Create a client using a specific engine instance.

Use this when you need to share or preconfigure the engine (connection pool, proxy, DNS, etc.) outside of this library.

Parameters

engine

A concrete engine instance to back the HttpClient.

userAgent

Optional User-Agent string. If null, a sensible default is used.

additionalConfig

Extra client configuration applied after the library defaults.

Ownership: this constructor builds and owns the HttpClient, but you still own the engine if it’s reused elsewhere. Closing this client will not automatically close other clients that share the engine.