1.0.2 • Published 8 years ago

lichess-api v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

lichess-api Build Status npm version Known Vulnerabilities

:trophy: A NodeJS wrapper for the Lichess API

Installation

Using npm:

$ npm install --save lichess-api

If you don't have or don't want to use npm:

$ cd ~/.node_modules
$ git clone git://github.com/gmontalvoriv/lichess-api.git

Test

$ make test

Usage Examples

Fetch one user

const lichess = require('lichess-api');

lichess.user('thibault', function (err, user) {
  console.log(user);
}

Fetch many users

lichess.user({ team: 'coders' }, function (err, users) {
  console.log(users);
}

Fetch user games

lichess.user.games('thibault', { with_analysis: 1 }, function (err, games) {
  console.log(games);
}

Fetch one game by ID

lichess.game('hXI0wVeZ', function (err, game) {
  console.log(game);
}

Fetch one game PGN by ID

lichess.game.export('hXI0wVeZ', function (err, pgn) {
  console.log(pgn.pgn_url);
}

Methods

Note: All parameters are optional

user

Fetch one or multiple users.

.user(options, callback)

Parameters:

NameDescriptionType
teamfilter users by teamString
nbmaximum number of users to returnInteger

user.games

Fetch user games.

.user.games(username, options, callback)

Parameters:

NameDescriptionType
nbmaximum number of games to return per pageInteger
pagefor paginationIntegerNo
with_analysisinclude deep analysis data in the resultInteger
with_movesinclude a list of PGN movesInteger
with_openinginclude opening informationInteger
with_movetimesinclude move time informationInteger
ratedfilter rated or casual gamesInteger

game

Fetch one game by ID.

.game(game_id, options, callback)

Parameters:

NameDescriptionType
with_analysisinclude deep analysis data in the resultInteger
with_movesinclude a list of PGN movesInteger
with_openinginclude opening informationInteger
with_movetimesinclude move time informationInteger
with_fensinclude a list of FEN statesInteger

game.export

Fetch one game PGN by ID.

.game.export(game_id, callback)

License

MIT © Gabriel Montalvo

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago