Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Lichess Kotlin Multiplatform Client

Maven Central

Clean, type-safe Kotlin SDK for the Lichess API. Supports Android, iOS, JVM, Linux, and JS.

Installation

dependencies {
    implementation("io.github.viplearner:lichess-kmp-client:0.1.1-alpha")
}

Usage

Anonymous Access

val client = LichessClient.anonymous()
val tvGames = client.tv.getCurrentTvGames()
client.close()

With Authentication

val client = LichessClient.withToken("lip_yourAccessToken")

client.games.listUserGames("username").onSuccess { games ->
    games.collect { game -> println(game.id) }
}

client.close()

Streaming

client.bot.streamEvent().onSuccess { flow ->
    flow.collect { event -> 
        println("Event: $event") 
    }
}

OAuth with Auto-Refresh

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)

Available Services

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.

Documentation

License

Apache 2.0 License - See LICENSE for details

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages