Giter Site home page Giter Site logo

chariot's People

Contributors

tors42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chariot's Issues

Android support

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!

How do you handle nd-json streams? e.g. gamesByIds

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.

Looking for a method to get my ongoing games

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.

No option for unlimited time control

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.

Missing clock information in StreamGameEvent.Full

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.

enum constant chariot.model.Enums.VariantName.fromPosition missing

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;
    }
});

Missing validation logic

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:

  • The ArenaBuilder::conditionMinRating method should only accept values within the range of 1000 to 2600 ELO, with a step of 100.
  • The ArenaBuilder::name method should only accept strings with a length between 2 and 30 characters.
  • The ArenaBuilder::conditionMinRatedGames should only accept one of the following values: {0, 5, 10, 15, 20, 30, 40, 50, 75, 100, 150, 200}.
  • ...
    In some cases, the method's documentation provides information about the expected value range or specific values, while in others, there is no indication. It can be counterproductive to have to meticulously refer to both the documentation and the SDK to ensure we're using the API correctly.

I have a few questions regarding this:

  • Was this lack of validation intentionally left as-is, and if so, would you like me to help ensure consistency by submitting a pull request?
  • If this lack of validation was not intentional, would you like me to submit a pull request that simply adds range validations and enums to these methods? This way, any deviation from the specified ranges or values would result in an early compile-time error.

(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. ๐Ÿ’ฏ )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.