From e01d9805c6a9d4c26f5f06a8077440c75b5a9ac9 Mon Sep 17 00:00:00 2001 From: nite Date: Sat, 5 Apr 2025 03:37:00 +1100 Subject: [PATCH] README --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2a75bf2..e5a7a88 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,61 @@ # go-igdb -a go library to access IGDB API +A Go client library for the IGDB (Internet Game Database) API v4. This library provides a simple and efficient way to interact with IGDB's protobuf-based API. -## Usage +## Features + +- Full support for IGDB API v4 +- Protobuf-based communication for better performance +- Automatic token management for Twitch authentication +- Built-in retry mechanism for failed requests +- Optional Cloudflare bypass support via FlareSolverr +- All endpoints are supported + +## Installation + +```bash +go get github.com/bestnite/go-igdb +``` + +## Quick Start ```go -g := igdb.New("clientID", "clientSecret") -game, err := g.GetGameByID(325594) +// Create a new IGDB client +client := igdb.New("your-client-id", "your-client-secret") + +// Get a game by ID +game, err := client.GetGameByID(1942) +if err != nil { + log.Fatal(err) +} +fmt.Printf("Game: %s\n", game.Name) + +// Search games with custom query +games, err := client.GetGames("search \"Zelda\"; fields name,rating,release_dates.*;") if err != nil { log.Fatal(err) } -fmt.Println(game.Name) ``` + +## Advanced Usage + +### Query Format + +The library uses IGDB's query syntax. For example: + +```go +// Get games released in 2023 +games, err := client.GetGames("where release_dates.y = 2023; fields name,rating;") + +// Get specific fields for a company +companies, err := client.GetCompanies("where id = 1234; fields name,description,country;") +``` + +## Requirements + +- Go 1.24 or higher +- IGDB/Twitch API credentials (Client ID and Client Secret) + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request.