GoGeek is a lightweight, easy-to-use Go module designed to streamline interactions with the BoardGameGeek API (XML API2).
- 🔄 Simple Request Handling: GoGeek abstracts the BGG API request process, allowing you to focus on utilising the data rather than managing HTTP requests.
- 📄 Data Parsing: Automatically converts XML responses from the BGG API into Go structs, so you can work with structured data effortlessly.
⚠️ Error Handling: Robust error handling for common issues like network errors, rate limiting, and unexpected response formats ensures smooth integration.
To setup GoGeek, use the following go get
command:
go get github.com/kkjdaniel/gogeek
Getting started with GoGeek is easy. Here’s a quick example to fetch details about a specific board game:
package main
import (
"fmt"
"log"
"github.com/kkjdaniel/gogeek/thing"
)
func main() {
// Catan
game, err := thing.Query([]int{9})
if err != nil {
log.Fatal(err)
}
catan := game.Items[0]
fmt.Printf("Name: %s\nYear Published: %d\nRating: %.2f\n", catan.Name[0].Value, catan.YearPublished.Value, catan.Statistics.AverageRating)
}
For the full documentation please see the GoDoc here.
Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub to help improve GoGeek.