https://github.com/attron/chessdotcom-go
chess.com api wrapper for go
https://github.com/attron/chessdotcom-go
api chess chessdotcom go golang lightweight wrapper wrapper-api
Last synced: about 1 year ago
JSON representation
chess.com api wrapper for go
- Host: GitHub
- URL: https://github.com/attron/chessdotcom-go
- Owner: ATTron
- License: mit
- Created: 2021-12-28T06:54:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-31T02:52:50.000Z (over 4 years ago)
- Last Synced: 2025-02-13T03:23:25.514Z (over 1 year ago)
- Topics: api, chess, chessdotcom, go, golang, lightweight, wrapper, wrapper-api
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chessdotcom-go
An unofficial, simple, lighweight API wrapper for chess.com written in go
## Usage
*Complete Documentation can be found at https://pkg.go.dev/github.com/ATTron/chessdotcom-go*
```bash
go get -u "github.com/ATTron/chessdotcom-go"
```
### If you just need the JSON string
```
import chess "github.com/ATTron/chessdotcom-go"
. . .
const username = 'hikaru'
func main() {
userStats := chess.GetUserStats(username)
fmt.Println(userStats)
}
```
### If you want to use the JSON in a meaningful way in go I **highly** recommend using [gjson](https://github.com/tidwall/gjson)
```
import (
chess "github.com/ATTron/chessdotcom-go"
"github.com/tidwall/gjson"
)
. . .
const username = "hikaru"
func main() {
userStats := chess.GetUserStats(username)
blitz := gjson.Get(userStats, "chess_blitz")
fmt.Println(blitz.String())
rapid := gjson.Get(userStats, "chess_rapid.record")
fmt.Println(rapid.String())
}
```