mirror of
https://github.com/bestnite/go-igdb.git
synced 2025-04-19 23:35:54 +08:00
README
This commit is contained in:
parent
76a3e977ba
commit
e01d9805c6
57
README.md
57
README.md
@ -1,14 +1,61 @@
|
|||||||
# go-igdb
|
# 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
|
```go
|
||||||
g := igdb.New("clientID", "clientSecret")
|
// Create a new IGDB client
|
||||||
game, err := g.GetGameByID(325594)
|
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 {
|
if err != nil {
|
||||||
log.Fatal(err)
|
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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user