
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:
account, analysis, arena, board, bot, broadcasts, challenges, games, messaging, oauth, puzzles, relations, studies, teams, tv, users, and more.
Apache 2.0 License - See LICENSE for details
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:
account, analysis, arena, board, bot, broadcasts, challenges, games, messaging, oauth, puzzles, relations, studies, teams, tv, users, and more.
Apache 2.0 License - See LICENSE for details