Skip to content

Kotlin Configuration

val client = FlagsClient.builder()
.auth(Auth(
projectId = "your-project-id",
agentId = "your-agent-id",
environmentId = "your-environment-id"
))
.baseUrl("https://custom-api.flags.gg")
.maxRetries(5)
.failureThreshold(10)
.resetTimeout(Duration.ofMinutes(5))
.withMemoryCache()
.build()
MethodDefaultDescription
auth(Auth)Required. Authentication credentials
baseUrl(String)https://api.flags.ggCustom API endpoint
maxRetries(Int)3Max retry attempts
failureThreshold(Int)3Circuit breaker failure threshold
resetTimeout(Duration)10 secondsCircuit breaker reset timeout
withMemoryCache()SQLiteUse in-memory cache
withSQLiteCache(String)flags.dbCustom SQLite path
httpClient(HttpClient)Custom Ktor HTTP client
val client = FlagsClient.NewClient(
WithAuth(auth),
WithBaseURL("https://custom-api.flags.gg"),
WithMaxRetries(5),
WithMemory(),
WithSQLite("custom.db"),
WithHttpClient(customClient),
)
MethodReturnsDescription
isEnabled(String)BooleanCheck if a flag is enabled
flag(String)FlagGet a flag object
getAllFlags()List<FeatureFlag>Get all flags
close()UnitClose the client and release resources
MethodReturnsDescription
Is(String)FlagResultGet a flag result
FlagResult.Enabled()BooleanCheck if enabled

Always close the client when done to release HTTP connections:

client.close()