Giter VIP home page Giter VIP logo

chessdotcom's Introduction

ChessDotCom

Go Reference

ChessDotCom is a minimal wrapper for the official Chess.com REST API. Key features:

  • All responses are fully typed.
  • Logical beautification of field names. (e.g. @id becomes ID)
  • Built-in handling of PGN data types.
  • Internal request management to prevent API throttling.
  • ZERO external dependencies!

Overview

This package is designed to be incredibly lightweight and simple to use, mirroring the offering of the official Chess.com API.

Installation

ChessDotCom has been developed and fully tested with Go version 1.19. While it will likely work with other versions, it is not recomended.

Install the package:

go get github.com/A-ndy-git/chessdotcom

Import into your project:

import (
  "github.com/A-ndy-git/chessdotcom"
)

Usage

You probably shouldn't. ChessDotCom is primarily a personal education project. Nevertheless, its simple enough to provide value if you need it.

Create a new client instance, and you are done! Simples!

client := chessdotcom.New()

// Client is instantiated and ready to be used. E.g.
res, err := client.PlayerProfile("magnuscarlsen")
...

Documentation

Automatically created GoDoc docs are available here. High level methods are listed below.

Player

  • Profile - Get additional details about a player in a game
res, err := client.PlayerProfile("erik")
if err != nil {
  // handle error
}

// res ->
  {
    "Avatar": "https://images.chesscomfiles.com/uploads/v1/user/41.5434c4ff.200x200o.5b102889d835.jpeg",
    "PlayerId": 41,
    "ID": "https://api.chess.com/pub/player/erik",
    "URL": "https://www.chess.com/member/erik",
    "Name": "Erik",
    "Username": "erik",
    "Followers": 4340,
    "Country": "https://api.chess.com/pub/country/US",
    "Location": "Bay Area, CA",
    "LastOnline": 1669316678,
    "Joined": 1178556600,
    "Status": "staff",
    "IsStreamer": false,
    "Verified": true
  }

  • Stats - Get ratings, win/loss, and other stats about a player's game play, tactics, lessons and Puzzle Rush score.
client.PlayerStats("magnuscarlsen")

  • Games - Array of Daily Chess games that a player is currently playing.
client.PlayerGames("magnuscarlsen")

  • Game Archive - Array of monthly archives available for this player.
client.PlayerGameArchive("magnuscarlsen")

  • Games to Move - Array of Daily Chess games where it is the player's turn to act.
client.PlayerGamesToMove("magnuscarlsen")

  • Archive PGN - standard multi-game format PGN containing all games for a month.
client.PlayerAchivePGN("magnuscarlsen", "2022", "01")

  • Game Monthly Archive - Array of Live and Daily Chess games that a player has finished.
client.PlayerGameMonthlyArchive("magnuscarlsen", "2022", "01")

  • Clubs - List of clubs the player is a member of, with joined date and last activity date.
client.PlayerClubs("magnuscarlsen")

  • Tournaments - List of tournaments the player is registered, is attending or has attended in the past.
client.PlayerTournaments("magnuscarlsen")

  • Titled Players - List of titled-player usernames.
client.PlayerTitledPlayers()

Club

Tournament

Team Match

Country

Daily Puzzle

Point System Config

chessdotcom's People

Contributors

a-ndy-git avatar

Stargazers

 avatar

Watchers

 avatar

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.