lichess-kmp-client
0.1.2-alphaindexedType-safe access to the Lichess API enabling anonymous or token-based usage, streaming event flows, OAuth with auto-refresh, and typed services covering all endpoints.
2
Stars
—
Used by
dependents
—
Health
/ 100
Type-safe access to the Lichess API enabling anonymous or token-based usage, streaming event flows, OAuth with auto-refresh, and typed services covering all endpoints.
Clean, type-safe Kotlin SDK for the Lichess API. Supports Android, iOS, JVM, Linux, and JS.
dependencies {
implementation("io.github.viplearner:lichess-kmp-client:0.1.1-alpha")
}
val client = LichessClient.anonymous()
val tvGames = client.tv.getCurrentTvGames()
client.close()
val client = LichessClient.withToken("lip_yourAccessToken")
client.games.listUserGames("username").onSuccess { games ->
games.collect { game -> println(game.id) }
}
client.close()
client.bot.streamEvent().onSuccess { flow ->
flow.collect { event ->
println("Event: $event")
}
}
val oauthManager = DefaultOAuthManager(
redirectUri = "https://myapp.com/callback",
scopes = listOf("board:play", "puzzle:read"),
onAuthorizationRequired = { authUrl, _ ->
// Direct user to authUrl, return authorization code
getCodeFromCallback()
}
)
val client = LichessClient.withClientIdAndOAuth(oauthManager)
All Lichess API endpoints are exposed through typed services:
, , , , , , , , , , , , , , , , and more.
Apache 2.0 License - See LICENSE for details
accountanalysisarenaboardbotbroadcastschallengesgamesmessagingoauthpuzzlesrelationsstudiesteamstvusersSurfaced from shared tags and platforms — no rankings paid for.