Git Product home page Git Product logo

chess-web-api's Introduction

hello! here's a little about me:

i really like music 🎧

inspired by natemoo-re

i was a frontend intern at chess.com β™ŸοΈ

luckily being good at chess wasn't a pre-req to the job

i'm a vue.js fanboy, but i do some other stuff too πŸ”¨

chess-web-api's People

Contributors

alewis729 avatar andyruwruw avatar coejoder avatar dependabot[bot] avatar shreyas-girjapure avatar vjuneja 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  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  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  avatar  avatar  avatar  avatar

chess-web-api's Issues

Setting callbackParameters in dispatch function throws error

Hi! πŸ‘‹

Firstly, thanks for your work on this project I love it! πŸ™‚

Unfortunately I had to patch the module for the dispatch() function, more concretely having callback function params would not work.
To replicate: Running the code in the example of dispatch doesn't work and gives off an unhandled promise rejection error. Which is tied to the way sortParameters is called.

Here is the diff that solved my problem:

diff --git a/node_modules/chess-web-api/src/queue/index.js b/node_modules/chess-web-api/src/queue/index.js
index aaf838e..9217bb4 100644
--- a/node_modules/chess-web-api/src/queue/index.js
+++ b/node_modules/chess-web-api/src/queue/index.js
@@ -27,7 +27,7 @@ function dispatch(method, callback, parameters, options, callbackParameters, pri
   }
 
   const [_parameters, _options, _callbackParameters, _priority] = sortParameters(
-    ['array', 'object', 'function', 'number'],
+    ['array', 'object', 'array', 'number'],
     [parameters, options, callbackParameters, priority],
   );
 

This issue body was partially generated by patch-package.

Types(cript) support

Do you mind having tyepscript support? I could submit a PR with the types definitions.

Support Import Usage for Vite

chess-web-api version:

^1.1.2

Steps to reproduce

This package must be used with require instead of import

Expected behavior

I'd like to be able to use this with import since Vite is ESM only

getGameByID only works with live games

chess-web-api version:

latest

Steps to reproduce

Call getGameByID and get the result

Expected behavior

The getGameByID returns a live game

Actual behavior

The getGameByID should have returned a daily game instead.
Since the IDs for live-chess and daily-chess can overlap, I suggest dividing this method in getLiveGameByID and getDailyGameByID.

This is your code, I believe you can change /callback/live/game/${id} to /callback/daily/game/${id} to get the desired output.

// line 178, endpoint/games.js
const apiRequest = WebApiRequest.builder()
    .withHost(UNDOCUMENTED_API_HOST)
    .withPath(`/callback/live/game/${id}`)
    .withQueryParameters(_options)
    .withHeaders(_headers)
    .build();

Spelling Error in Readme "Priority Queue" Section

chess-web-api version:

Steps to reproduce

  1. Open Readme file.
  2. Search for string 'inicialize'.
  3. 2 occurrences can be found 'inicialize' and 'inicialized'.

Expected behavior

Spelling should have been "initialize" or "initialized".

Actual behavior

Now it is "inicialized" and "inicialize".

This is really a small change , Posted in contribution to make the documentation error-free and awsomeπŸ’―

Missing rounds from tournaments

I saw That this is how you get the games of a round from a tournament-
https://api.chess.com/pub/tournament/early-titled-tuesday-blitz-july-11-2023-4158385/11/1When I checked it on a couple of titled tuesdays games It founds just the last round (11) and not the rounds before.

Also in the tournament describer it shows that this is only round that exists-
url- https://api.chess.com/pub/tournament/early-titled-tuesday-blitz-july-11-2023-4158385

result- "rounds":["https://api.chess.com/pub/tournament/early-titled-tuesday-blitz-july-11-2023-4158385/11"]

I would be happy to get some help, thanks a lot.

[Bounty] getGameByID()

Requirements:

  1. Add a new endpoint which fetches game details for a given Game ID. You can use something like https://www.chess.com/callback/live/game/6508402266 to fetch the initial details
  2. The movesList entity should be converted to PGN using the explanation in #10
  3. The return value should be formatted as JSON, and should include as much of the information available or at the least include all the properties of Chess.com's official game endpoint
  4. Include a new test using the live API

Example return value

{
      "white": "string", // URL of the white player's profile
      "black": "string", // URL of the black player's profile
      "url": "string", // URL of this game
      "fen": "string", // current FEN
      "pgn": "string", // current PGN
      "turn": "black", // player to move
      "move_by": 1501765498, // timestamp of when the next move must be made
                             // this is "0" if the player-to-move is on vacation
      "draw_offer": "black", // (optional) player who has made a draw offer
      "last_activity": 1509810789, // timestamp of the last activity on the game
      "start_time": 1254438881, // timestamp of the game start (Daily Chess only)
      "time_control": "string", // PGN-compliant time control
      "time_class": "string", // time-per-move grouping, used for ratings
      "rules": "string", // game variant information (e.g., "chess960")      
      "tournament": "string", //URL pointing to tournament (if available),  
      "match": "string" //URL pointing to team match (if available)
}

[Feature Request] - getGameByID

Howdy maintainers. Great library you've created here!

I'm wondering how I can add a getGameByID(). For example take https://www.chess.com/live/game/6508402266, get the id 6508402266, and fetch the pgn.

After searching through the chess.com API docs, it doesn't seem there is an easy way to do this without parsing through the user's history, which is not ideal. Wondering if you have any tips on how to achieve this

I can help make a PR to implement if necessary.

The closest I've gotten is using the (undocumented) api https://www.chess.com/callback/live/game/6508402266, but this doesn't return the pgn, and instead some encrypted string moveList: "mC0Kgv5QfHQBvBKBHt7MegZRdv6Evw90nDMNtAYQiq!TltXHAiRJCKEmfeTZbl0Fw2Fe2?Z9?..."

Thank you!

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.