ConfigCatClient

ConfigCat SDK client.

Types

Link copied to clipboard
object Companion

Companion object of ConfigCatClient.

Properties

Link copied to clipboard
abstract val hooks: Hooks

Gets the Hooks object for subscribing events.

Link copied to clipboard
abstract val isOffline: Boolean

True when the SDK is configured not to initiate HTTP requests, otherwise false.

Functions

Link copied to clipboard
abstract fun clearDefaultUser()

Sets the default user to null.

Link copied to clipboard
abstract fun close()

Closes the client.

Link copied to clipboard
abstract suspend fun forceRefresh(): RefreshResult

Initiates a force refresh on the cached configuration.

Link copied to clipboard
abstract suspend fun getAllKeys(): Collection<String>

Gets a collection of all setting keys.

Link copied to clipboard
abstract suspend fun getAllValueDetails(user: ConfigCatUser? = null): Collection<EvaluationDetails>

Gets the values along with evaluation details of all feature flags and settings.

Link copied to clipboard
abstract suspend fun getAllValues(user: ConfigCatUser? = null): Map<String, Any?>

Gets the values of all feature flags or settings. The user param identifies the caller.

Link copied to clipboard
abstract suspend fun getAnyValue(key: String, defaultValue: Any?, user: ConfigCatUser?): Any?

Gets the value of a feature flag or setting as Any identified by the given key.

Link copied to clipboard
abstract suspend fun getAnyValueDetails(key: String, defaultValue: Any?, user: ConfigCatUser?): EvaluationDetails

Gets the value and evaluation details of a feature flag or setting identified by the given key.

Link copied to clipboard
abstract suspend fun getKeyAndValue(variationId: String): Pair<String, Any>?

Gets the key of a setting and its value identified by the given variationId (analytics).

Link copied to clipboard
inline suspend fun <T> ConfigCatClient.getValue(key: String, defaultValue: T, user: ConfigCatUser? = null): T

Gets the value of a feature flag or setting as T identified by the given key.

Link copied to clipboard
inline suspend fun <T> ConfigCatClient.getValueDetails(key: String, defaultValue: T, user: ConfigCatUser? = null): TypedEvaluationDetails<T>

Gets the value and evaluation details of a feature flag or setting identified by the given key.

Link copied to clipboard
abstract fun isClosed(): Boolean

Get the client closed status.

Link copied to clipboard
abstract fun setDefaultUser(user: ConfigCatUser)

Sets the default user. If no user specified in the following calls getValue, getAnyValue, getAllValues, getValueDetails, getAnyValueDetails, getAllValueDetails the default user value will be used.

Link copied to clipboard
abstract fun setOffline()

Set the client to offline mode. HTTP calls are not allowed.

Link copied to clipboard
abstract fun setOnline()

Configures the SDK to not initiate HTTP requests and work only from its cache.

Link copied to clipboard
abstract suspend fun waitForReady(): CompletableDeferred<ClientCacheState>

Awaits for SDK initialization.