tors42 / chariot Goto Github PK
View Code? Open in Web Editor NEWJava client for the Lichess API
License: MIT License
Java client for the Lichess API
License: MIT License
Hello!
I was considering creating a Lichess-based toy project in Android and your library would be super useful and pretty much ready to use for interfacing to Lichess APIs ๐
There's a small issue preventing me from doing that though, the compiled jar available via maven uses bytecode for Java 17, while android supports only libraries compiled for Java 11 and below, at the moment.
Would you consider distributing the jar compiled for Java 11? Or in case providing an alternate artifact for Android, in case ๐ค
Thanks for your work!
Hi,
my plan is to create a game stream and add games to it as I create them via the challenge()
call.
I am having difficulties with understanding on how I should proceed with this. The stream creation call gameInfosByGameIds
returns a Many<T>
object which I can only really transfer to a Java Stream.
Now my understanding is that JavaStreams are 'lazy', so only executed when 'closed'.
How can I then handle new objects immediately after they are added to the stream via a seperate Thread and how do I handle the GameInfo updates of an already added game?
I expected something where I can pass a callback function that always executes as soon as the ndjson stream updates on lichess but I am open to any solution that gives me GameInfo updates.
Hello again,
as the title says I am looking for a method to get my ongoing games. The Lichess API has the endpoint https://lichess.org/api/account/playing
which gives you a list of your current games and I am looking for exactly that in the Java Client. I have found the method client.games().ongoingGames()
, but this seems not to work.
ClientAuth client = Client.auth(token);
client.games().ongoingGames().stream().forEach(System.out::println);
The code above outputs just NowPlaying[fullId=null, gameId=null, fen=null, color=null, lastMove=null, speed=null, perf=null, rated=false, isMyTurn=false, variant=null, opponent=null]
every single time, wether I am playing a game or not. If this is indeed the method I am looking for, I would appreciate a fix. Else I would be very grateful for a hint to the right direction!
Thanks in advance.
Just wondering if an unlimited time control when creating challenges is going to be implemented in the future? Unless it already has been and I've missed something.
Hello,
I was playing around with your client a bit (huge thanks btw) as I stumbled about the following bug:
ClientAuth client = Client.auth(token);
Stream<StreamEvent> events = client.bot().streamEvents().stream();
events.forEach(event ->
{
switch(event.type())
{
case challenge:
client.bot().acceptChallenge(event.id());
break;
case gameStart:
Stream<StreamGameEvent> gameEvents = client.bot().streamGameState(event.id()).stream();
gameEvents.forEach(gameEvent ->
{
switch (gameEvent.type())
{
case gameFull:
StreamGameEvent.Full fullGame = (StreamGameEvent.Full) gameEvent;
System.out.println(fullGame.clock());
default:
break;
}
});
break;
default:
break;
}
});
This piece of code should accept any challenges and print out the clock information, but the output for a 1.5+3 standard match is Clock[limit=null, increment=3000]
. Furthermore it seems that the limit value of the clock is always null
, regardless of the chosen time in the challenge.
I think it's just about adding ultrabullet in here? Don't think it was intentionally left out.
Hello,
the enum is missing a value for the fromPosition gamemode. The following code throws an error while trying to challenge a fromPosition match:
ClientAuth client = Client.auth(token);
Stream<StreamEvent> events = client.bot().streamEvents().stream();
events.forEach(event ->
{
switch(event.type())
{
case challenge:
ChallengeEvent challenge = (ChallengeEvent) event;
System.out.println(challenge.challenge().variant());
break;
default:
break;
}
});
If I wanted to use this library with another lichess-clone, can I configure it to use that endpoint?
Hi,
I've noticed that there is a lack of range and value validation on certain method arguments whithin the SDK. This absence of validation can lead to field validation errors during runtime when we unintentionally send incorrect requests (that aren't regarded as bad requests until reaching lichess API). Here are some examples:
I have a few questions regarding this:
(PS: I'm a fan of your work ! As a Junior Backend Developer, I find it really interesting to see the new java features used in actual projects. ๐ฏ )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.