mirror of
https://github.com/bestnite/go-igdb.git
synced 2025-04-19 22:25:54 +08:00
u
This commit is contained in:
parent
7f5a09098a
commit
d550f859a7
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*test.go
|
*test.go
|
||||||
test/
|
test/
|
||||||
|
.vscode/
|
||||||
|
107
README.md
107
README.md
@ -1,15 +1,15 @@
|
|||||||
# go-igdb
|
# go-igdb
|
||||||
|
|
||||||
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.
|
A Go client library for the IGDB (Internet Game Database) API v4. This library provides a convenient way to interact with IGDB's protobuf-based API endpoints.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Full support for IGDB API v4
|
- Full support for IGDB API v4 endpoints
|
||||||
- Protobuf-based communication for better performance
|
- Protobuf-based communication for efficient data transfer
|
||||||
|
- Rate limiting support
|
||||||
- Automatic token management for Twitch authentication
|
- Automatic token management for Twitch authentication
|
||||||
- Built-in retry mechanism for failed requests
|
- Retry mechanism for failed requests
|
||||||
- Optional Cloudflare bypass support via FlareSolverr
|
- Optional FlareSolverr integration for handling Cloudflare protection
|
||||||
- All endpoints are supported
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -20,41 +20,94 @@ go get github.com/bestnite/go-igdb
|
|||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Create a new IGDB client
|
package main
|
||||||
client := igdb.New("your-client-id", "your-client-secret")
|
|
||||||
|
|
||||||
// Get a game by ID
|
import (
|
||||||
game, err := client.GetGameByID(1942)
|
"log"
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
"github.com/bestnite/go-igdb"
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test1(c *igdb.Client) {
|
||||||
|
game, err := igdb.GetItemByID[pb.Game](1942, c.Games.Query)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
log.Printf("Name of game %d: %s\n", 1942, game.Name)
|
||||||
}
|
}
|
||||||
fmt.Printf("Game: %s\n", game.Name)
|
|
||||||
|
|
||||||
// Search games with custom query
|
func Test2(c *igdb.Client) {
|
||||||
games, err := client.GetGames("search \"Zelda\"; fields name,rating,release_dates.*;")
|
games, err := igdb.GetItemsByIDs[pb.Game]([]uint64{119171, 119133}, c.Games.Query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
log.Printf("Names of games %d and %d: %s and %s\n", 119171, 119133, games[0].Name, games[1].Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test3(c *igdb.Client) {
|
||||||
|
total, err := igdb.GetItemsLength[pb.Game](c.Games.Query)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
log.Printf("Total number of games: %d\n", total)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test4(c *igdb.Client) {
|
||||||
|
games, err := igdb.GetItemsPagniated[pb.Game](0, 10, c.Games.Query)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
log.Printf("Names of ids 0 to 10 games:\n")
|
||||||
|
for _, game := range games {
|
||||||
|
log.Println(game.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test5(c *igdb.Client) {
|
||||||
|
game, err := igdb.AssertSingle[pb.Game](c.Games.Query("fields name,rating; sort rating desc; limit 1;"))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("failed to get game: %s", err)
|
||||||
|
}
|
||||||
|
log.Printf("Name of first game with highest rating: %s\n", game.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test6(c *igdb.Client) {
|
||||||
|
games, err := igdb.AssertSlice[pb.Game](c.Games.Query("fields *; where rating > 70; limit 10;"))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
log.Printf("Names of games with rating > 70 limit 10:\n")
|
||||||
|
for _, game := range games {
|
||||||
|
log.Println(game.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
client := igdb.New("your-client-id", "your-client-secret")
|
||||||
|
Test1(client)
|
||||||
|
Test2(client)
|
||||||
|
Test3(client)
|
||||||
|
Test4(client)
|
||||||
|
Test5(client)
|
||||||
|
Test6(client)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Advanced Usage
|
## Advanced Usage
|
||||||
|
|
||||||
### Query Format
|
### Using with FlareSolverr
|
||||||
|
|
||||||
The library uses IGDB's query syntax. For example:
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Get games released in 2023
|
import "github.com/bestnite/go-flaresolverr"
|
||||||
games, err := client.GetGames("where release_dates.y = 2023; fields name,rating;")
|
|
||||||
|
|
||||||
// Get specific fields for a company
|
flaresolverr := flaresolverr.New("http://localhost:8191")
|
||||||
companies, err := client.GetCompanies("where id = 1234; fields name,description,country;")
|
client := igdb.NewWithFlaresolverr("your-client-id", "your-client-secret", flaresolverr)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Requirements
|
### Rate Limiting
|
||||||
|
|
||||||
- Go 1.24 or higher
|
The client automatically handles rate limiting with a default of 4 requests per second. This helps prevent hitting IGDB's rate limits.
|
||||||
- IGDB/Twitch API credentials (Client ID and Client Secret)
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
41
assert.go
Normal file
41
assert.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package igdb
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func AssertSingle[T any](data any, err error) (*T, error) {
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if data == nil {
|
||||||
|
return nil, fmt.Errorf("data is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
datas, ok := data.([]*T)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("failed to convert to []*T")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(datas) == 0 {
|
||||||
|
return nil, fmt.Errorf("no results")
|
||||||
|
}
|
||||||
|
|
||||||
|
return datas[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func AssertSlice[T any](data any, err error) ([]*T, error) {
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if data == nil {
|
||||||
|
return nil, fmt.Errorf("data is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
datas, ok := data.([]*T)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("failed to convert to []*T")
|
||||||
|
}
|
||||||
|
|
||||||
|
return datas, nil
|
||||||
|
}
|
197
client.go
Normal file
197
client.go
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
package igdb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/bestnite/go-flaresolverr"
|
||||||
|
"github.com/bestnite/go-igdb/endpoint"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
clientID string
|
||||||
|
token *twitchToken
|
||||||
|
flaresolverr *flaresolverr.Flaresolverr
|
||||||
|
limiter *rateLimiter
|
||||||
|
|
||||||
|
EntityEndpoints map[endpoint.EndpointName]endpoint.EntityEndpoint
|
||||||
|
|
||||||
|
AgeRatingCategories *endpoint.AgeRatingCategories
|
||||||
|
AgeRatingContentDescriptions *endpoint.AgeRatingContentDescriptions
|
||||||
|
AgeRatingContentDescriptionsV2 *endpoint.AgeRatingContentDescriptionsV2
|
||||||
|
AgeRatingOrganizations *endpoint.AgeRatingOrganizations
|
||||||
|
AgeRatings *endpoint.AgeRatings
|
||||||
|
AlternativeNames *endpoint.AlternativeNames
|
||||||
|
Artworks *endpoint.Artworks
|
||||||
|
CharacterGenders *endpoint.CharacterGenders
|
||||||
|
CharacterMugShots *endpoint.CharacterMugShots
|
||||||
|
Characters *endpoint.Characters
|
||||||
|
CharacterSpecies *endpoint.CharacterSpecies
|
||||||
|
CollectionMemberships *endpoint.CollectionMemberships
|
||||||
|
CollectionMembershipTypes *endpoint.CollectionMembershipTypes
|
||||||
|
CollectionRelations *endpoint.CollectionRelations
|
||||||
|
CollectionRelationTypes *endpoint.CollectionRelationTypes
|
||||||
|
Collections *endpoint.Collections
|
||||||
|
CollectionTypes *endpoint.CollectionTypes
|
||||||
|
Companies *endpoint.Companies
|
||||||
|
CompanyLogos *endpoint.CompanyLogos
|
||||||
|
CompanyStatuses *endpoint.CompanyStatuses
|
||||||
|
CompanyWebsites *endpoint.CompanyWebsites
|
||||||
|
Covers *endpoint.Covers
|
||||||
|
DateFormats *endpoint.DateFormats
|
||||||
|
EventLogos *endpoint.EventLogos
|
||||||
|
EventNetworks *endpoint.EventNetworks
|
||||||
|
Events *endpoint.Events
|
||||||
|
ExternalGames *endpoint.ExternalGames
|
||||||
|
ExternalGameSources *endpoint.ExternalGameSources
|
||||||
|
Franchises *endpoint.Franchises
|
||||||
|
GameEngineLogos *endpoint.GameEngineLogos
|
||||||
|
GameEngines *endpoint.GameEngines
|
||||||
|
GameLocalizations *endpoint.GameLocalizations
|
||||||
|
GameModes *endpoint.GameModes
|
||||||
|
GameReleaseFormats *endpoint.GameReleaseFormats
|
||||||
|
Games *endpoint.Games
|
||||||
|
GameStatuses *endpoint.GameStatuses
|
||||||
|
GameTimeToBeats *endpoint.GameTimeToBeats
|
||||||
|
GameTypes *endpoint.GameTypes
|
||||||
|
GameVersionFeatures *endpoint.GameVersionFeatures
|
||||||
|
GameVersionFeatureValues *endpoint.GameVersionFeatureValues
|
||||||
|
GameVersions *endpoint.GameVersions
|
||||||
|
GameVideos *endpoint.GameVideos
|
||||||
|
Genres *endpoint.Genres
|
||||||
|
InvolvedCompanies *endpoint.InvolvedCompanies
|
||||||
|
Keywords *endpoint.Keywords
|
||||||
|
Languages *endpoint.Languages
|
||||||
|
LanguageSupports *endpoint.LanguageSupports
|
||||||
|
LanguageSupportTypes *endpoint.LanguageSupportTypes
|
||||||
|
MultiplayerModes *endpoint.MultiplayerModes
|
||||||
|
NetworkTypes *endpoint.NetworkTypes
|
||||||
|
PlatformFamilies *endpoint.PlatformFamilies
|
||||||
|
PlatformLogos *endpoint.PlatformLogos
|
||||||
|
Platforms *endpoint.Platforms
|
||||||
|
PlatformTypes *endpoint.PlatformTypes
|
||||||
|
PlatformVersionCompanies *endpoint.PlatformVersionCompanies
|
||||||
|
PlatformVersionReleaseDates *endpoint.PlatformVersionReleaseDates
|
||||||
|
PlatformVersions *endpoint.PlatformVersions
|
||||||
|
PlatformWebsites *endpoint.PlatformWebsites
|
||||||
|
PlayerPerspectives *endpoint.PlayerPerspectives
|
||||||
|
PopularityPrimitives *endpoint.PopularityPrimitives
|
||||||
|
PopularityTypes *endpoint.PopularityTypes
|
||||||
|
Regions *endpoint.Regions
|
||||||
|
ReleaseDateRegions *endpoint.ReleaseDateRegions
|
||||||
|
ReleaseDates *endpoint.ReleaseDates
|
||||||
|
ReleaseDateStatuses *endpoint.ReleaseDateStatuses
|
||||||
|
Screenshots *endpoint.Screenshots
|
||||||
|
Search *endpoint.Search
|
||||||
|
Themes *endpoint.Themes
|
||||||
|
Webhooks *endpoint.Webhooks
|
||||||
|
Websites *endpoint.Websites
|
||||||
|
WebsiteTypes *endpoint.WebsiteTypes
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(clientID, clientSecret string) *Client {
|
||||||
|
c := &Client{
|
||||||
|
clientID: clientID,
|
||||||
|
limiter: newRateLimiter(4),
|
||||||
|
token: NewTwitchToken(clientID, clientSecret),
|
||||||
|
flaresolverr: nil,
|
||||||
|
EntityEndpoints: make(map[endpoint.EndpointName]endpoint.EntityEndpoint),
|
||||||
|
}
|
||||||
|
|
||||||
|
registerAllEndpoints(c)
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *Client {
|
||||||
|
c := New(clientID, clientSecret)
|
||||||
|
c.flaresolverr = f
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Client) Request(URL string, dataBody any) (*resty.Response, error) {
|
||||||
|
g.limiter.wait()
|
||||||
|
|
||||||
|
t, err := g.token.getToken()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to get twitch token: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := request().SetBody(dataBody).SetHeaders(map[string]string{
|
||||||
|
"Client-ID": g.clientID,
|
||||||
|
"Authorization": "Bearer " + t,
|
||||||
|
"User-Agent": "",
|
||||||
|
"Content-Type": "text/plain",
|
||||||
|
}).Post(URL)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to request: %s: %w", URL, err)
|
||||||
|
}
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetItemsPagniated[T any](offset, limit int, f func(string) ([]*T, error)) ([]*T, error) {
|
||||||
|
query := fmt.Sprintf("offset %d; limit %d; f *; sort id asc;", offset, limit)
|
||||||
|
items, err := f(query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetItemsLength[T any](f func(string) ([]*T, error)) (uint64, error) {
|
||||||
|
query := "fields id; sort id desc; limit 1;"
|
||||||
|
items, err := f(query)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(items) == 0 {
|
||||||
|
return 0, fmt.Errorf("no results: %s", query)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Iid interface {
|
||||||
|
GetId() uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
item, ok := any(items[0]).(Iid)
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
return 0, fmt.Errorf("failed to convert")
|
||||||
|
}
|
||||||
|
|
||||||
|
return item.GetId(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetItemByID[T any](id uint64, f func(string) ([]*T, error)) (*T, error) {
|
||||||
|
query := fmt.Sprintf("where id = %d; fields *;", id)
|
||||||
|
items, err := f(query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(items) == 0 {
|
||||||
|
return nil, fmt.Errorf("no results: %s", query)
|
||||||
|
}
|
||||||
|
|
||||||
|
return items[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetItemsByIDs[T any](ids []uint64, f func(string) ([]*T, error)) ([]*T, error) {
|
||||||
|
idStrSlice := make([]string, len(ids))
|
||||||
|
for i, id := range ids {
|
||||||
|
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||||
|
|
||||||
|
items, err := f(idStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return items, nil
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,12 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAgeRatingCategories(query string) ([]*pb.AgeRatingCategory, error) {
|
type AgeRatingCategories struct {
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_categories.pb", query)
|
BaseEndpoint
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *AgeRatingCategories) Query(query string) ([]*pb.AgeRatingCategory, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/age_rating_categories.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,12 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAgeRatingContentDescriptions(query string) ([]*pb.AgeRatingContentDescription, error) {
|
type AgeRatingContentDescriptions struct {
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_content_descriptions.pb", query)
|
BaseEndpoint
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *AgeRatingContentDescriptions) Query(query string) ([]*pb.AgeRatingContentDescription, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/age_rating_content_descriptions.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,12 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAgeRatingContentDescriptionsV2(query string) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
type AgeRatingContentDescriptionsV2 struct {
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_content_descriptions_v2.pb", query)
|
BaseEndpoint
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *AgeRatingContentDescriptionsV2) Query(query string) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/age_rating_content_descriptions_v2.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAgeRatingOrganizations(query string) ([]*pb.AgeRatingOrganization, error) {
|
type AgeRatingOrganizations struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_organizations.pb", query)
|
|
||||||
|
func (a *AgeRatingOrganizations) Query(query string) ([]*pb.AgeRatingOrganization, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/age_rating_organizations.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAgeRatings(query string) ([]*pb.AgeRating, error) {
|
type AgeRatings struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/age_ratings.pb", query)
|
|
||||||
|
func (a *AgeRatings) Query(query string) ([]*pb.AgeRating, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/age_ratings.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetAlternativeNames(query string) ([]*pb.AlternativeName, error) {
|
type AlternativeNames struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/alternative_names.pb", query)
|
|
||||||
|
func (a *AlternativeNames) Query(query string) ([]*pb.AlternativeName, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/alternative_names.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetArtworks(query string) ([]*pb.Artwork, error) {
|
type Artworks struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/artworks.pb", query)
|
|
||||||
|
func (a *Artworks) Query(query string) ([]*pb.Artwork, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/artworks.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
38
endpoint/base.go
Normal file
38
endpoint/base.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package endpoint
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BaseEndpoint struct {
|
||||||
|
request func(URL string, dataBody any) (*resty.Response, error)
|
||||||
|
endpointName EndpointName
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewBaseEndpoint(request func(URL string, dataBody any) (*resty.Response, error), endpointName EndpointName) *BaseEndpoint {
|
||||||
|
return &BaseEndpoint{
|
||||||
|
request: request,
|
||||||
|
endpointName: endpointName,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseEndpoint) GetEndpointName() EndpointName {
|
||||||
|
return b.endpointName
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseEndpoint) Query(query string) (any, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseEndpoint) QueryAny(query string) (any, error) {
|
||||||
|
return b.Query(query)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Endpoint interface {
|
||||||
|
GetEndpointName() EndpointName
|
||||||
|
}
|
||||||
|
|
||||||
|
type EntityEndpoint interface {
|
||||||
|
QueryAny(query string) (any, error)
|
||||||
|
GetEndpointName() EndpointName
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCharacterGenders(query string) ([]*pb.CharacterGender, error) {
|
type CharacterGenders struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/character_genders.pb", query)
|
|
||||||
|
func (a *CharacterGenders) Query(query string) ([]*pb.CharacterGender, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/character_genders.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCharacterMugShots(query string) ([]*pb.CharacterMugShot, error) {
|
type CharacterMugShots struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/character_mug_shots.pb", query)
|
|
||||||
|
func (a *CharacterMugShots) Query(query string) ([]*pb.CharacterMugShot, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/character_mug_shots.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCharacterSpecies(query string) ([]*pb.CharacterSpecie, error) {
|
type CharacterSpecies struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/character_species.pb", query)
|
|
||||||
|
func (a *CharacterSpecies) Query(query string) ([]*pb.CharacterSpecie, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/character_species.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCharacters(query string) ([]*pb.Character, error) {
|
type Characters struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/characters.pb", query)
|
|
||||||
|
func (a *Characters) Query(query string) ([]*pb.Character, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/characters.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCollectionMembershipTypes(query string) ([]*pb.CollectionMembershipType, error) {
|
type CollectionMembershipTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/collection_membership_types.pb", query)
|
|
||||||
|
func (a *CollectionMembershipTypes) Query(query string) ([]*pb.CollectionMembershipType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/collection_membership_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCollectionMemberships(query string) ([]*pb.CollectionMembership, error) {
|
type CollectionMemberships struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/collection_memberships.pb", query)
|
|
||||||
|
func (a *CollectionMemberships) Query(query string) ([]*pb.CollectionMembership, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/collection_memberships.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelationType, error) {
|
type CollectionRelationTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/collection_relation_types.pb", query)
|
|
||||||
|
func (a *CollectionRelationTypes) Query(query string) ([]*pb.CollectionRelationType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/collection_relation_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCollectionRelations(query string) ([]*pb.CollectionRelation, error) {
|
type CollectionRelations struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/collection_relations.pb", query)
|
|
||||||
|
func (a *CollectionRelations) Query(query string) ([]*pb.CollectionRelation, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/collection_relations.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCollectionTypes(query string) ([]*pb.CollectionType, error) {
|
type CollectionTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/collection_types.pb", query)
|
|
||||||
|
func (a *CollectionTypes) Query(query string) ([]*pb.CollectionType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/collection_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCollections(query string) ([]*pb.Collection, error) {
|
type Collections struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/collections.pb", query)
|
|
||||||
|
func (a *Collections) Query(query string) ([]*pb.Collection, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/collections.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@ -9,8 +9,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCompanies(query string) ([]*pb.Company, error) {
|
type Companies struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/companies.pb", query)
|
|
||||||
|
func (a *Companies) Query(query string) ([]*pb.Company, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/companies.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCompanyLogos(query string) ([]*pb.CompanyLogo, error) {
|
type CompanyLogos struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/company_logos.pb", query)
|
|
||||||
|
func (a *CompanyLogos) Query(query string) ([]*pb.CompanyLogo, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/company_logos.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCompanyStatuses(query string) ([]*pb.CompanyStatus, error) {
|
type CompanyStatuses struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/company_statuses.pb", query)
|
|
||||||
|
func (a *CompanyStatuses) Query(query string) ([]*pb.CompanyStatus, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/company_statuses.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCompanyWebsites(query string) ([]*pb.CompanyWebsite, error) {
|
type CompanyWebsites struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/company_websites.pb", query)
|
|
||||||
|
func (a *CompanyWebsites) Query(query string) ([]*pb.CompanyWebsite, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/company_websites.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetCovers(query string) ([]*pb.Cover, error) {
|
type Covers struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/covers.pb", query)
|
|
||||||
|
func (a *Covers) Query(query string) ([]*pb.Cover, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/covers.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetDateFormats(query string) ([]*pb.DateFormat, error) {
|
type DateFormats struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/date_formats.pb", query)
|
|
||||||
|
func (a *DateFormats) Query(query string) ([]*pb.DateFormat, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/date_formats.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,151 +0,0 @@
|
|||||||
package endpoint
|
|
||||||
|
|
||||||
type Endpoint string
|
|
||||||
|
|
||||||
var (
|
|
||||||
AgeRatingCategories Endpoint = "age_rating_categories"
|
|
||||||
AgeRatingContentDescriptions Endpoint = "age_rating_content_descriptions"
|
|
||||||
AgeRatingContentDescriptionsV2 Endpoint = "age_rating_content_descriptions_v2"
|
|
||||||
AgeRatingOrganizations Endpoint = "age_rating_organizations"
|
|
||||||
AgeRatings Endpoint = "age_ratings"
|
|
||||||
AlternativeNames Endpoint = "alternative_names"
|
|
||||||
Artworks Endpoint = "artworks"
|
|
||||||
CharacterGenders Endpoint = "character_genders"
|
|
||||||
CharacterMugShots Endpoint = "character_mug_shots"
|
|
||||||
Characters Endpoint = "characters"
|
|
||||||
CharacterSpecies Endpoint = "character_species"
|
|
||||||
CollectionMemberships Endpoint = "collection_memberships"
|
|
||||||
CollectionMembershipTypes Endpoint = "collection_membership_types"
|
|
||||||
CollectionRelations Endpoint = "collection_relations"
|
|
||||||
CollectionRelationTypes Endpoint = "collection_relation_types"
|
|
||||||
Collections Endpoint = "collections"
|
|
||||||
CollectionTypes Endpoint = "collection_types"
|
|
||||||
Companies Endpoint = "companies"
|
|
||||||
CompanyLogos Endpoint = "company_logos"
|
|
||||||
CompanyStatuses Endpoint = "company_statuses"
|
|
||||||
CompanyWebsites Endpoint = "company_websites"
|
|
||||||
Covers Endpoint = "covers"
|
|
||||||
DateFormats Endpoint = "date_formats"
|
|
||||||
EventLogos Endpoint = "event_logos"
|
|
||||||
EventNetworks Endpoint = "event_networks"
|
|
||||||
Events Endpoint = "events"
|
|
||||||
ExternalGames Endpoint = "external_games"
|
|
||||||
ExternalGameSources Endpoint = "external_game_sources"
|
|
||||||
Franchises Endpoint = "franchises"
|
|
||||||
GameEngineLogos Endpoint = "game_engine_logos"
|
|
||||||
GameEngines Endpoint = "game_engines"
|
|
||||||
GameLocalizations Endpoint = "game_localizations"
|
|
||||||
GameModes Endpoint = "game_modes"
|
|
||||||
GameReleaseFormats Endpoint = "game_release_formats"
|
|
||||||
Games Endpoint = "games"
|
|
||||||
GameStatuses Endpoint = "game_statuses"
|
|
||||||
GameTimeToBeats Endpoint = "game_time_to_beats"
|
|
||||||
GameTypes Endpoint = "game_types"
|
|
||||||
GameVersionFeatures Endpoint = "game_version_features"
|
|
||||||
GameVersionFeatureValues Endpoint = "game_version_feature_values"
|
|
||||||
GameVersions Endpoint = "game_versions"
|
|
||||||
GameVideos Endpoint = "game_videos"
|
|
||||||
Genres Endpoint = "genres"
|
|
||||||
InvolvedCompanies Endpoint = "involved_companies"
|
|
||||||
Keywords Endpoint = "keywords"
|
|
||||||
Languages Endpoint = "languages"
|
|
||||||
LanguageSupports Endpoint = "language_supports"
|
|
||||||
LanguageSupportTypes Endpoint = "language_support_types"
|
|
||||||
MultiplayerModes Endpoint = "multiplayer_modes"
|
|
||||||
NetworkTypes Endpoint = "network_types"
|
|
||||||
PlatformFamilies Endpoint = "platform_families"
|
|
||||||
PlatformLogos Endpoint = "platform_logos"
|
|
||||||
Platforms Endpoint = "platforms"
|
|
||||||
PlatformTypes Endpoint = "platform_types"
|
|
||||||
PlatformVersionCompanies Endpoint = "platform_version_companies"
|
|
||||||
PlatformVersionReleaseDates Endpoint = "platform_version_release_dates"
|
|
||||||
PlatformVersions Endpoint = "platform_versions"
|
|
||||||
PlatformWebsites Endpoint = "platform_websites"
|
|
||||||
PlayerPerspectives Endpoint = "player_perspectives"
|
|
||||||
PopularityPrimitives Endpoint = "popularity_primitives"
|
|
||||||
PopularityTypes Endpoint = "popularity_types"
|
|
||||||
Regions Endpoint = "regions"
|
|
||||||
ReleaseDateRegions Endpoint = "release_date_regions"
|
|
||||||
ReleaseDates Endpoint = "release_dates"
|
|
||||||
ReleaseDateStatuses Endpoint = "release_date_statuses"
|
|
||||||
Screenshots Endpoint = "screenshots"
|
|
||||||
Search Endpoint = "search"
|
|
||||||
Themes Endpoint = "themes"
|
|
||||||
Webhooks Endpoint = "webhooks"
|
|
||||||
Websites Endpoint = "websites"
|
|
||||||
WebsiteTypes Endpoint = "website_types"
|
|
||||||
)
|
|
||||||
|
|
||||||
var AllEndpoints = []Endpoint{
|
|
||||||
AgeRatingCategories,
|
|
||||||
AgeRatingContentDescriptions,
|
|
||||||
AgeRatingContentDescriptionsV2,
|
|
||||||
AgeRatingOrganizations,
|
|
||||||
AgeRatings,
|
|
||||||
AlternativeNames,
|
|
||||||
Artworks,
|
|
||||||
CharacterGenders,
|
|
||||||
CharacterMugShots,
|
|
||||||
Characters,
|
|
||||||
CharacterSpecies,
|
|
||||||
CollectionMemberships,
|
|
||||||
CollectionMembershipTypes,
|
|
||||||
CollectionRelations,
|
|
||||||
CollectionRelationTypes,
|
|
||||||
Collections,
|
|
||||||
CollectionTypes,
|
|
||||||
Companies,
|
|
||||||
CompanyLogos,
|
|
||||||
CompanyStatuses,
|
|
||||||
CompanyWebsites,
|
|
||||||
Covers,
|
|
||||||
DateFormats,
|
|
||||||
EventLogos,
|
|
||||||
EventNetworks,
|
|
||||||
Events,
|
|
||||||
ExternalGames,
|
|
||||||
ExternalGameSources,
|
|
||||||
Franchises,
|
|
||||||
GameEngineLogos,
|
|
||||||
GameEngines,
|
|
||||||
GameLocalizations,
|
|
||||||
GameModes,
|
|
||||||
GameReleaseFormats,
|
|
||||||
Games,
|
|
||||||
GameStatuses,
|
|
||||||
GameTimeToBeats,
|
|
||||||
GameTypes,
|
|
||||||
GameVersionFeatures,
|
|
||||||
GameVersionFeatureValues,
|
|
||||||
GameVersions,
|
|
||||||
GameVideos,
|
|
||||||
Genres,
|
|
||||||
InvolvedCompanies,
|
|
||||||
Keywords,
|
|
||||||
Languages,
|
|
||||||
LanguageSupports,
|
|
||||||
LanguageSupportTypes,
|
|
||||||
MultiplayerModes,
|
|
||||||
NetworkTypes,
|
|
||||||
PlatformFamilies,
|
|
||||||
PlatformLogos,
|
|
||||||
Platforms,
|
|
||||||
PlatformTypes,
|
|
||||||
PlatformVersionCompanies,
|
|
||||||
PlatformVersionReleaseDates,
|
|
||||||
PlatformVersions,
|
|
||||||
PlatformWebsites,
|
|
||||||
PlayerPerspectives,
|
|
||||||
PopularityPrimitives,
|
|
||||||
PopularityTypes,
|
|
||||||
Regions,
|
|
||||||
ReleaseDateRegions,
|
|
||||||
ReleaseDates,
|
|
||||||
ReleaseDateStatuses,
|
|
||||||
Screenshots,
|
|
||||||
Search,
|
|
||||||
Themes,
|
|
||||||
Webhooks,
|
|
||||||
Websites,
|
|
||||||
WebsiteTypes,
|
|
||||||
}
|
|
151
endpoint/endpoint_name.go
Normal file
151
endpoint/endpoint_name.go
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
package endpoint
|
||||||
|
|
||||||
|
type EndpointName string
|
||||||
|
|
||||||
|
var (
|
||||||
|
EPAgeRatingCategories EndpointName = "age_rating_categories"
|
||||||
|
EPAgeRatingContentDescriptions EndpointName = "age_rating_content_descriptions"
|
||||||
|
EPAgeRatingContentDescriptionsV2 EndpointName = "age_rating_content_descriptions_v2"
|
||||||
|
EPAgeRatingOrganizations EndpointName = "age_rating_organizations"
|
||||||
|
EPAgeRatings EndpointName = "age_ratings"
|
||||||
|
EPAlternativeNames EndpointName = "alternative_names"
|
||||||
|
EPArtworks EndpointName = "artworks"
|
||||||
|
EPCharacterGenders EndpointName = "character_genders"
|
||||||
|
EPCharacterMugShots EndpointName = "character_mug_shots"
|
||||||
|
EPCharacters EndpointName = "characters"
|
||||||
|
EPCharacterSpecies EndpointName = "character_species"
|
||||||
|
EPCollectionMemberships EndpointName = "collection_memberships"
|
||||||
|
EPCollectionMembershipTypes EndpointName = "collection_membership_types"
|
||||||
|
EPCollectionRelations EndpointName = "collection_relations"
|
||||||
|
EPCollectionRelationTypes EndpointName = "collection_relation_types"
|
||||||
|
EPCollections EndpointName = "collections"
|
||||||
|
EPCollectionTypes EndpointName = "collection_types"
|
||||||
|
EPCompanies EndpointName = "companies"
|
||||||
|
EPCompanyLogos EndpointName = "company_logos"
|
||||||
|
EPCompanyStatuses EndpointName = "company_statuses"
|
||||||
|
EPCompanyWebsites EndpointName = "company_websites"
|
||||||
|
EPCovers EndpointName = "covers"
|
||||||
|
EPDateFormats EndpointName = "date_formats"
|
||||||
|
EPEventLogos EndpointName = "event_logos"
|
||||||
|
EPEventNetworks EndpointName = "event_networks"
|
||||||
|
EPEvents EndpointName = "events"
|
||||||
|
EPExternalGames EndpointName = "external_games"
|
||||||
|
EPExternalGameSources EndpointName = "external_game_sources"
|
||||||
|
EPFranchises EndpointName = "franchises"
|
||||||
|
EPGameEngineLogos EndpointName = "game_engine_logos"
|
||||||
|
EPGameEngines EndpointName = "game_engines"
|
||||||
|
EPGameLocalizations EndpointName = "game_localizations"
|
||||||
|
EPGameModes EndpointName = "game_modes"
|
||||||
|
EPGameReleaseFormats EndpointName = "game_release_formats"
|
||||||
|
EPGames EndpointName = "games"
|
||||||
|
EPGameStatuses EndpointName = "game_statuses"
|
||||||
|
EPGameTimeToBeats EndpointName = "game_time_to_beats"
|
||||||
|
EPGameTypes EndpointName = "game_types"
|
||||||
|
EPGameVersionFeatures EndpointName = "game_version_features"
|
||||||
|
EPGameVersionFeatureValues EndpointName = "game_version_feature_values"
|
||||||
|
EPGameVersions EndpointName = "game_versions"
|
||||||
|
EPGameVideos EndpointName = "game_videos"
|
||||||
|
EPGenres EndpointName = "genres"
|
||||||
|
EPInvolvedCompanies EndpointName = "involved_companies"
|
||||||
|
EPKeywords EndpointName = "keywords"
|
||||||
|
EPLanguages EndpointName = "languages"
|
||||||
|
EPLanguageSupports EndpointName = "language_supports"
|
||||||
|
EPLanguageSupportTypes EndpointName = "language_support_types"
|
||||||
|
EPMultiplayerModes EndpointName = "multiplayer_modes"
|
||||||
|
EPNetworkTypes EndpointName = "network_types"
|
||||||
|
EPPlatformFamilies EndpointName = "platform_families"
|
||||||
|
EPPlatformLogos EndpointName = "platform_logos"
|
||||||
|
EPPlatforms EndpointName = "platforms"
|
||||||
|
EPPlatformTypes EndpointName = "platform_types"
|
||||||
|
EPPlatformVersionCompanies EndpointName = "platform_version_companies"
|
||||||
|
EPPlatformVersionReleaseDates EndpointName = "platform_version_release_dates"
|
||||||
|
EPPlatformVersions EndpointName = "platform_versions"
|
||||||
|
EPPlatformWebsites EndpointName = "platform_websites"
|
||||||
|
EPPlayerPerspectives EndpointName = "player_perspectives"
|
||||||
|
EPPopularityPrimitives EndpointName = "popularity_primitives"
|
||||||
|
EPPopularityTypes EndpointName = "popularity_types"
|
||||||
|
EPRegions EndpointName = "regions"
|
||||||
|
EPReleaseDateRegions EndpointName = "release_date_regions"
|
||||||
|
EPReleaseDates EndpointName = "release_dates"
|
||||||
|
EPReleaseDateStatuses EndpointName = "release_date_statuses"
|
||||||
|
EPScreenshots EndpointName = "screenshots"
|
||||||
|
EPSearch EndpointName = "search"
|
||||||
|
EPThemes EndpointName = "themes"
|
||||||
|
EPWebhooks EndpointName = "webhooks"
|
||||||
|
EPWebsites EndpointName = "websites"
|
||||||
|
EPWebsiteTypes EndpointName = "website_types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var AllEndpoints = []EndpointName{
|
||||||
|
EPAgeRatingCategories,
|
||||||
|
EPAgeRatingContentDescriptions,
|
||||||
|
EPAgeRatingContentDescriptionsV2,
|
||||||
|
EPAgeRatingOrganizations,
|
||||||
|
EPAgeRatings,
|
||||||
|
EPAlternativeNames,
|
||||||
|
EPArtworks,
|
||||||
|
EPCharacterGenders,
|
||||||
|
EPCharacterMugShots,
|
||||||
|
EPCharacters,
|
||||||
|
EPCharacterSpecies,
|
||||||
|
EPCollectionMemberships,
|
||||||
|
EPCollectionMembershipTypes,
|
||||||
|
EPCollectionRelations,
|
||||||
|
EPCollectionRelationTypes,
|
||||||
|
EPCollections,
|
||||||
|
EPCollectionTypes,
|
||||||
|
EPCompanies,
|
||||||
|
EPCompanyLogos,
|
||||||
|
EPCompanyStatuses,
|
||||||
|
EPCompanyWebsites,
|
||||||
|
EPCovers,
|
||||||
|
EPDateFormats,
|
||||||
|
EPEventLogos,
|
||||||
|
EPEventNetworks,
|
||||||
|
EPEvents,
|
||||||
|
EPExternalGames,
|
||||||
|
EPExternalGameSources,
|
||||||
|
EPFranchises,
|
||||||
|
EPGameEngineLogos,
|
||||||
|
EPGameEngines,
|
||||||
|
EPGameLocalizations,
|
||||||
|
EPGameModes,
|
||||||
|
EPGameReleaseFormats,
|
||||||
|
EPGames,
|
||||||
|
EPGameStatuses,
|
||||||
|
EPGameTimeToBeats,
|
||||||
|
EPGameTypes,
|
||||||
|
EPGameVersionFeatures,
|
||||||
|
EPGameVersionFeatureValues,
|
||||||
|
EPGameVersions,
|
||||||
|
EPGameVideos,
|
||||||
|
EPGenres,
|
||||||
|
EPInvolvedCompanies,
|
||||||
|
EPKeywords,
|
||||||
|
EPLanguages,
|
||||||
|
EPLanguageSupports,
|
||||||
|
EPLanguageSupportTypes,
|
||||||
|
EPMultiplayerModes,
|
||||||
|
EPNetworkTypes,
|
||||||
|
EPPlatformFamilies,
|
||||||
|
EPPlatformLogos,
|
||||||
|
EPPlatforms,
|
||||||
|
EPPlatformTypes,
|
||||||
|
EPPlatformVersionCompanies,
|
||||||
|
EPPlatformVersionReleaseDates,
|
||||||
|
EPPlatformVersions,
|
||||||
|
EPPlatformWebsites,
|
||||||
|
EPPlayerPerspectives,
|
||||||
|
EPPopularityPrimitives,
|
||||||
|
EPPopularityTypes,
|
||||||
|
EPRegions,
|
||||||
|
EPReleaseDateRegions,
|
||||||
|
EPReleaseDates,
|
||||||
|
EPReleaseDateStatuses,
|
||||||
|
EPScreenshots,
|
||||||
|
EPSearch,
|
||||||
|
EPThemes,
|
||||||
|
EPWebhooks,
|
||||||
|
EPWebsites,
|
||||||
|
EPWebsiteTypes,
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetEventLogos(query string) ([]*pb.EventLogo, error) {
|
type EventLogos struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/event_logos.pb", query)
|
|
||||||
|
func (a *EventLogos) Query(query string) ([]*pb.EventLogo, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/event_logos.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetEventNetworks(query string) ([]*pb.EventNetwork, error) {
|
type EventNetworks struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/event_networks.pb", query)
|
|
||||||
|
func (a *EventNetworks) Query(query string) ([]*pb.EventNetwork, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/event_networks.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetEvents(query string) ([]*pb.Event, error) {
|
type Events struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/events.pb", query)
|
|
||||||
|
func (a *Events) Query(query string) ([]*pb.Event, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/events.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetExternalGameSources(query string) ([]*pb.ExternalGameSource, error) {
|
type ExternalGameSources struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/external_game_sources.pb", query)
|
|
||||||
|
func (a *ExternalGameSources) Query(query string) ([]*pb.ExternalGameSource, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/external_game_sources.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetExternalGames(query string) ([]*pb.ExternalGame, error) {
|
type ExternalGames struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/external_games.pb", query)
|
|
||||||
|
func (a *ExternalGames) Query(query string) ([]*pb.ExternalGame, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/external_games.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetFranchises(query string) ([]*pb.Franchise, error) {
|
type Franchises struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/franchises.pb", query)
|
|
||||||
|
func (a *Franchises) Query(query string) ([]*pb.Franchise, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/franchises.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameEngineLogos(query string) ([]*pb.GameEngineLogo, error) {
|
type GameEngineLogos struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_engine_logos.pb", query)
|
|
||||||
|
func (a *GameEngineLogos) Query(query string) ([]*pb.GameEngineLogo, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_engine_logos.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameEngines(query string) ([]*pb.GameEngine, error) {
|
type GameEngines struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_engines.pb", query)
|
|
||||||
|
func (a *GameEngines) Query(query string) ([]*pb.GameEngine, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_engines.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameLocalizations(query string) ([]*pb.GameLocalization, error) {
|
type GameLocalizations struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_localizations.pb", query)
|
|
||||||
|
func (a *GameLocalizations) Query(query string) ([]*pb.GameLocalization, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_localizations.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameModes(query string) ([]*pb.GameMode, error) {
|
type GameModes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_modes.pb", query)
|
|
||||||
|
func (a *GameModes) Query(query string) ([]*pb.GameMode, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_modes.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameReleaseFormats(query string) ([]*pb.GameReleaseFormat, error) {
|
type GameReleaseFormats struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_release_formats.pb", query)
|
|
||||||
|
func (a *GameReleaseFormats) Query(query string) ([]*pb.GameReleaseFormat, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_release_formats.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameStatuses(query string) ([]*pb.GameStatus, error) {
|
type GameStatuses struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_statuses.pb", query)
|
|
||||||
|
func (a *GameStatuses) Query(query string) ([]*pb.GameStatus, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_statuses.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameTimeToBeats(query string) ([]*pb.GameTimeToBeat, error) {
|
type GameTimeToBeats struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_time_to_beats.pb", query)
|
|
||||||
|
func (a *GameTimeToBeats) Query(query string) ([]*pb.GameTimeToBeat, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_time_to_beats.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameTypes(query string) ([]*pb.GameType, error) {
|
type GameTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_types.pb", query)
|
|
||||||
|
func (a *GameTypes) Query(query string) ([]*pb.GameType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameVersionFeatureValues(query string) ([]*pb.GameVersionFeatureValue, error) {
|
type GameVersionFeatureValues struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_version_feature_values.pb", query)
|
|
||||||
|
func (a *GameVersionFeatureValues) Query(query string) ([]*pb.GameVersionFeatureValue, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_version_feature_values.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameVersionFeatures(query string) ([]*pb.GameVersionFeature, error) {
|
type GameVersionFeatures struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_version_features.pb", query)
|
|
||||||
|
func (a *GameVersionFeatures) Query(query string) ([]*pb.GameVersionFeature, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_version_features.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameVersions(query string) ([]*pb.GameVersion, error) {
|
type GameVersions struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_versions.pb", query)
|
|
||||||
|
func (a *GameVersions) Query(query string) ([]*pb.GameVersion, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_versions.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGameVideos(query string) ([]*pb.GameVideo, error) {
|
type GameVideos struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/game_videos.pb", query)
|
|
||||||
|
func (a *GameVideos) Query(query string) ([]*pb.GameVideo, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/game_videos.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
29
endpoint/games.go
Normal file
29
endpoint/games.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package endpoint
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Games struct{ BaseEndpoint }
|
||||||
|
|
||||||
|
func (a *Games) Query(query string) ([]*pb.Game, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/games.pb", query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
data := pb.GameResult{}
|
||||||
|
if err = proto.Unmarshal(resp.Body(), &data); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(data.Games) == 0 {
|
||||||
|
return nil, fmt.Errorf("no results: %s", query)
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.Games, nil
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetGenres(query string) ([]*pb.Genre, error) {
|
type Genres struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/genres.pb", query)
|
|
||||||
|
func (a *Genres) Query(query string) ([]*pb.Genre, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/genres.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetInvolvedCompanies(query string) ([]*pb.InvolvedCompany, error) {
|
type InvolvedCompanies struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/involved_companies.pb", query)
|
|
||||||
|
func (a *InvolvedCompanies) Query(query string) ([]*pb.InvolvedCompany, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/involved_companies.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetKeywords(query string) ([]*pb.Keyword, error) {
|
type Keywords struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/keywords.pb", query)
|
|
||||||
|
func (a *Keywords) Query(query string) ([]*pb.Keyword, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/keywords.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetLanguageSupportTypes(query string) ([]*pb.LanguageSupportType, error) {
|
type LanguageSupportTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/language_support_types.pb", query)
|
|
||||||
|
func (a *LanguageSupportTypes) Query(query string) ([]*pb.LanguageSupportType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/language_support_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetLanguageSupports(query string) ([]*pb.LanguageSupport, error) {
|
type LanguageSupports struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/language_supports.pb", query)
|
|
||||||
|
func (a *LanguageSupports) Query(query string) ([]*pb.LanguageSupport, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/language_supports.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetLanguages(query string) ([]*pb.Language, error) {
|
type Languages struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/languages.pb", query)
|
|
||||||
|
func (a *Languages) Query(query string) ([]*pb.Language, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/languages.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetMultiplayerModes(query string) ([]*pb.MultiplayerMode, error) {
|
type MultiplayerModes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/multiplayer_modes.pb", query)
|
|
||||||
|
func (a *MultiplayerModes) Query(query string) ([]*pb.MultiplayerMode, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/multiplayer_modes.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetNetworkTypes(query string) ([]*pb.NetworkType, error) {
|
type NetworkTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/network_types.pb", query)
|
|
||||||
|
func (a *NetworkTypes) Query(query string) ([]*pb.NetworkType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/network_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformFamilies(query string) ([]*pb.PlatformFamily, error) {
|
type PlatformFamilies struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_families.pb", query)
|
|
||||||
|
func (a *PlatformFamilies) Query(query string) ([]*pb.PlatformFamily, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_families.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformLogos(query string) ([]*pb.PlatformLogo, error) {
|
type PlatformLogos struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_logos.pb", query)
|
|
||||||
|
func (a *PlatformLogos) Query(query string) ([]*pb.PlatformLogo, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_logos.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformTypes(query string) ([]*pb.PlatformType, error) {
|
type PlatformTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_types.pb", query)
|
|
||||||
|
func (a *PlatformTypes) Query(query string) ([]*pb.PlatformType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformVersionCompanies(query string) ([]*pb.PlatformVersionCompany, error) {
|
type PlatformVersionCompanies struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_version_companies.pb", query)
|
|
||||||
|
func (a *PlatformVersionCompanies) Query(query string) ([]*pb.PlatformVersionCompany, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_version_companies.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformVersionReleaseDates(query string) ([]*pb.PlatformVersionReleaseDate, error) {
|
type PlatformVersionReleaseDates struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_version_release_dates.pb", query)
|
|
||||||
|
func (a *PlatformVersionReleaseDates) Query(query string) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_version_release_dates.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformVersions(query string) ([]*pb.PlatformVersion, error) {
|
type PlatformVersions struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_versions.pb", query)
|
|
||||||
|
func (a *PlatformVersions) Query(query string) ([]*pb.PlatformVersion, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_versions.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatformWebsites(query string) ([]*pb.PlatformWebsite, error) {
|
type PlatformWebsites struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platform_websites.pb", query)
|
|
||||||
|
func (a *PlatformWebsites) Query(query string) ([]*pb.PlatformWebsite, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platform_websites.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlatforms(query string) ([]*pb.Platform, error) {
|
type Platforms struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/platforms.pb", query)
|
|
||||||
|
func (a *Platforms) Query(query string) ([]*pb.Platform, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/platforms.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPlayerPerspectives(query string) ([]*pb.PlayerPerspective, error) {
|
type PlayerPerspectives struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/player_perspectives.pb", query)
|
|
||||||
|
func (a *PlayerPerspectives) Query(query string) ([]*pb.PlayerPerspective, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/player_perspectives.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPopularityPrimitives(query string) ([]*pb.PopularityPrimitive, error) {
|
type PopularityPrimitives struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/popularity_primitives.pb", query)
|
|
||||||
|
func (a *PopularityPrimitives) Query(query string) ([]*pb.PopularityPrimitive, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/popularity_primitives.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetPopularityTypes(query string) ([]*pb.PopularityType, error) {
|
type PopularityTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/popularity_types.pb", query)
|
|
||||||
|
func (a *PopularityTypes) Query(query string) ([]*pb.PopularityType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/popularity_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetRegions(query string) ([]*pb.Region, error) {
|
type Regions struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/regions.pb", query)
|
|
||||||
|
func (a *Regions) Query(query string) ([]*pb.Region, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/regions.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetReleaseDateRegions(query string) ([]*pb.ReleaseDateRegion, error) {
|
type ReleaseDateRegions struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/release_date_regions.pb", query)
|
|
||||||
|
func (a *ReleaseDateRegions) Query(query string) ([]*pb.ReleaseDateRegion, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/release_date_regions.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetReleaseDateStatuses(query string) ([]*pb.ReleaseDateStatus, error) {
|
type ReleaseDateStatuses struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/release_date_statuses.pb", query)
|
|
||||||
|
func (a *ReleaseDateStatuses) Query(query string) ([]*pb.ReleaseDateStatus, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/release_date_statuses.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetReleaseDates(query string) ([]*pb.ReleaseDate, error) {
|
type ReleaseDates struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/release_dates.pb", query)
|
|
||||||
|
func (a *ReleaseDates) Query(query string) ([]*pb.ReleaseDate, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/release_dates.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetScreenshots(query string) ([]*pb.Screenshot, error) {
|
type Screenshots struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/screenshots.pb", query)
|
|
||||||
|
func (a *Screenshots) Query(query string) ([]*pb.Screenshot, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/screenshots.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -21,8 +21,13 @@ var webSearchCFCookies struct {
|
|||||||
expires time.Time
|
expires time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) Search(query string) ([]*pb.Search, error) {
|
type Search struct {
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/search.pb", query)
|
BaseEndpoint
|
||||||
|
flaresolverr *flaresolverr.Flaresolverr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Search) Search(query string) ([]*pb.Search, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/search.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
||||||
@ -39,13 +44,20 @@ func (g *Client) Search(query string) ([]*pb.Search, error) {
|
|||||||
return data.Searches, nil
|
return data.Searches, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Client) WebSearchGames(name string) ([]*pb.Game, error) {
|
func (a *Search) getFlaresolverr() (*flaresolverr.Flaresolverr, error) {
|
||||||
|
if a.flaresolverr == nil {
|
||||||
|
return nil, fmt.Errorf("flaresolverr is not initialized")
|
||||||
|
}
|
||||||
|
return a.flaresolverr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Search) WebSearchGameIDs(name string) ([]uint64, error) {
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
params.Add("q", name)
|
params.Add("q", name)
|
||||||
params.Add("utf8", "✓")
|
params.Add("utf8", "✓")
|
||||||
Url := fmt.Sprintf("%s?%s", "https://www.igdb.com/search", params.Encode())
|
Url := fmt.Sprintf("%s?%s", "https://www.igdb.com/search", params.Encode())
|
||||||
|
|
||||||
f, err := g.getFlaresolverr()
|
f, err := a.getFlaresolverr()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get flaresolverr: %w", err)
|
return nil, fmt.Errorf("failed to get flaresolverr: %w", err)
|
||||||
}
|
}
|
||||||
@ -93,5 +105,5 @@ func (g *Client) WebSearchGames(name string) ([]*pb.Game, error) {
|
|||||||
ids[i] = game.Id
|
ids[i] = game.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetItemsByIDs(ids, g.GetGames)
|
return ids, nil
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetThemes(query string) ([]*pb.Theme, error) {
|
type Themes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/themes.pb", query)
|
|
||||||
|
func (a *Themes) Query(query string) ([]*pb.Theme, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/themes.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,19 +1,19 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/bestnite/go-igdb/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) ActiveWebhook(endpoint endpoint.Endpoint, secret, callbackUrl string) error {
|
type Webhooks struct{ BaseEndpoint }
|
||||||
|
|
||||||
|
func (a *Webhooks) Register(endpoint EndpointName, secret, callbackUrl string) error {
|
||||||
dataBody := url.Values{}
|
dataBody := url.Values{}
|
||||||
dataBody.Set("url", callbackUrl)
|
dataBody.Set("url", callbackUrl)
|
||||||
dataBody.Set("secret", secret)
|
dataBody.Set("secret", secret)
|
||||||
dataBody.Set("method", "update")
|
dataBody.Set("method", "update")
|
||||||
resp, err := g.Request(fmt.Sprintf("https://api.igdb.com/v4/%s/webhooks/", endpoint), dataBody.Encode())
|
resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s/webhooks/", endpoint), dataBody.Encode())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to make request: %s: %w", callbackUrl, err)
|
return fmt.Errorf("failed to make request: %s: %w", callbackUrl, err)
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetWebsiteTypes(query string) ([]*pb.WebsiteType, error) {
|
type WebsiteTypes struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/website_types.pb", query)
|
|
||||||
|
func (a *WebsiteTypes) Query(query string) ([]*pb.WebsiteType, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/website_types.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package igdb
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -8,8 +8,10 @@ import (
|
|||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Client) GetWebsites(query string) ([]*pb.Website, error) {
|
type Websites struct{ BaseEndpoint }
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/websites.pb", query)
|
|
||||||
|
func (a *Websites) Query(query string) ([]*pb.Website, error) {
|
||||||
|
resp, err := a.request("https://api.igdb.com/v4/websites.pb", query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
return nil, fmt.Errorf("failed to request: %w", err)
|
||||||
}
|
}
|
55
games.go
55
games.go
@ -1,55 +0,0 @@
|
|||||||
package igdb
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
pb "github.com/bestnite/go-igdb/proto"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (g *Client) GetGames(query string) ([]*pb.Game, error) {
|
|
||||||
resp, err := g.Request("https://api.igdb.com/v4/games.pb", query)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to request: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data := pb.GameResult{}
|
|
||||||
if err = proto.Unmarshal(resp.Body(), &data); err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to unmarshal: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(data.Games) == 0 {
|
|
||||||
return nil, fmt.Errorf("no results: %s", query)
|
|
||||||
}
|
|
||||||
|
|
||||||
return data.Games, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Client) GetParentGameID(id uint64) (uint64, error) {
|
|
||||||
detail, err := GetItemByID(id, g.GetGames)
|
|
||||||
if err != nil {
|
|
||||||
return 0, fmt.Errorf("failed to fetch IGDB app detail for parent: %d: %w", id, err)
|
|
||||||
}
|
|
||||||
hasParent := false
|
|
||||||
if detail.ParentGame != nil && detail.ParentGame.Id != 0 {
|
|
||||||
hasParent = true
|
|
||||||
detail, err = GetItemByID(detail.ParentGame.Id, g.GetGames)
|
|
||||||
if err != nil {
|
|
||||||
return 0, fmt.Errorf("failed to fetch IGDB version parent: %d: %w", detail.VersionParent.Id, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for detail.VersionParent != nil && detail.VersionParent.Id != 0 {
|
|
||||||
hasParent = true
|
|
||||||
detail, err = GetItemByID(detail.VersionParent.Id, g.GetGames)
|
|
||||||
if err != nil {
|
|
||||||
return 0, fmt.Errorf("failed to fetch IGDB version parent: %d: %w", detail.VersionParent.Id, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if hasParent {
|
|
||||||
return detail.Id, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return id, nil
|
|
||||||
}
|
|
96
igdb.go
96
igdb.go
@ -1,96 +0,0 @@
|
|||||||
package igdb
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/bestnite/go-flaresolverr"
|
|
||||||
"github.com/go-resty/resty/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Client struct {
|
|
||||||
clientID string
|
|
||||||
token *twitchToken
|
|
||||||
flaresolverr *flaresolverr.Flaresolverr
|
|
||||||
limiter *rateLimiter
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(clientID, clientSecret string) *Client {
|
|
||||||
return &Client{
|
|
||||||
clientID: clientID,
|
|
||||||
limiter: newRateLimiter(4),
|
|
||||||
token: NewTwitchToken(clientID, clientSecret),
|
|
||||||
flaresolverr: nil,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *Client {
|
|
||||||
return &Client{
|
|
||||||
clientID: clientID,
|
|
||||||
limiter: newRateLimiter(4),
|
|
||||||
token: NewTwitchToken(clientID, clientSecret),
|
|
||||||
flaresolverr: f,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Client) Request(URL string, dataBody any) (*resty.Response, error) {
|
|
||||||
g.limiter.wait()
|
|
||||||
|
|
||||||
t, err := g.token.getToken()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to get twitch token: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := request().SetBody(dataBody).SetHeaders(map[string]string{
|
|
||||||
"Client-ID": g.clientID,
|
|
||||||
"Authorization": "Bearer " + t,
|
|
||||||
"User-Agent": "",
|
|
||||||
"Content-Type": "text/plain",
|
|
||||||
}).Post(URL)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to request: %s: %w", URL, err)
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Client) getFlaresolverr() (*flaresolverr.Flaresolverr, error) {
|
|
||||||
if g.flaresolverr == nil {
|
|
||||||
return nil, fmt.Errorf("flaresolverr is not initialized")
|
|
||||||
}
|
|
||||||
return g.flaresolverr, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetItemByID[T any](id uint64, f func(string) ([]*T, error)) (*T, error) {
|
|
||||||
query := fmt.Sprintf("where id = %d; fields *;", id)
|
|
||||||
items, err := f(query)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return items[0], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetItemsByIDs[T any](ids []uint64, f func(string) ([]*T, error)) ([]*T, error) {
|
|
||||||
idStrSlice := make([]string, len(ids))
|
|
||||||
for i, id := range ids {
|
|
||||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
|
||||||
}
|
|
||||||
|
|
||||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
|
||||||
|
|
||||||
return f(idStr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetItemsPagniated[T any](offset, limit int, f func(string) ([]*T, error)) ([]*T, error) {
|
|
||||||
query := fmt.Sprintf("offset %d; limit %d; f *; sort id asc;", offset, limit)
|
|
||||||
return f(query)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetItemsLength[T any](f func(string) ([]*T, error)) (int, error) {
|
|
||||||
query := "fields id; sort id desc; limit 1;"
|
|
||||||
items, err := f(query)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return len(items), nil
|
|
||||||
}
|
|
358
register_endpoints.go
Normal file
358
register_endpoints.go
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
package igdb
|
||||||
|
|
||||||
|
import "github.com/bestnite/go-igdb/endpoint"
|
||||||
|
|
||||||
|
func registerAllEndpoints(c *Client) {
|
||||||
|
c.AgeRatingCategories = &endpoint.AgeRatingCategories{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPAgeRatingCategories),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPAgeRatingCategories] = c.AgeRatingCategories
|
||||||
|
|
||||||
|
c.AgeRatingContentDescriptions = &endpoint.AgeRatingContentDescriptions{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPAgeRatingContentDescriptions),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPAgeRatingContentDescriptions] = c.AgeRatingContentDescriptions
|
||||||
|
|
||||||
|
c.AgeRatingContentDescriptionsV2 = &endpoint.AgeRatingContentDescriptionsV2{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPAgeRatingContentDescriptionsV2),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPAgeRatingContentDescriptionsV2] = c.AgeRatingContentDescriptionsV2
|
||||||
|
|
||||||
|
c.AgeRatingOrganizations = &endpoint.AgeRatingOrganizations{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPAgeRatingOrganizations),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPAgeRatingOrganizations] = c.AgeRatingOrganizations
|
||||||
|
|
||||||
|
c.AgeRatings = &endpoint.AgeRatings{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPAgeRatings),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPAgeRatings] = c.AgeRatings
|
||||||
|
|
||||||
|
c.AlternativeNames = &endpoint.AlternativeNames{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPAlternativeNames),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPAlternativeNames] = c.AlternativeNames
|
||||||
|
|
||||||
|
c.Artworks = &endpoint.Artworks{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPArtworks),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPArtworks] = c.Artworks
|
||||||
|
|
||||||
|
c.CharacterGenders = &endpoint.CharacterGenders{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCharacterGenders),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCharacterGenders] = c.CharacterGenders
|
||||||
|
|
||||||
|
c.CharacterMugShots = &endpoint.CharacterMugShots{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCharacterMugShots),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCharacterMugShots] = c.CharacterMugShots
|
||||||
|
|
||||||
|
c.Characters = &endpoint.Characters{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCharacters),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCharacters] = c.Characters
|
||||||
|
|
||||||
|
c.CharacterSpecies = &endpoint.CharacterSpecies{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCharacterSpecies),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCharacterSpecies] = c.CharacterSpecies
|
||||||
|
|
||||||
|
c.CollectionMemberships = &endpoint.CollectionMemberships{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCollectionMemberships),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCollectionMemberships] = c.CollectionMemberships
|
||||||
|
|
||||||
|
c.CollectionMembershipTypes = &endpoint.CollectionMembershipTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCollectionMembershipTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCollectionMembershipTypes] = c.CollectionMembershipTypes
|
||||||
|
|
||||||
|
c.CollectionRelations = &endpoint.CollectionRelations{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCollectionRelations),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCollectionRelations] = c.CollectionRelations
|
||||||
|
|
||||||
|
c.CollectionRelationTypes = &endpoint.CollectionRelationTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCollectionRelationTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCollectionRelationTypes] = c.CollectionRelationTypes
|
||||||
|
|
||||||
|
c.Collections = &endpoint.Collections{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCollections),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCollections] = c.Collections
|
||||||
|
|
||||||
|
c.CollectionTypes = &endpoint.CollectionTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCollectionTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCollectionTypes] = c.CollectionTypes
|
||||||
|
|
||||||
|
c.Companies = &endpoint.Companies{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCompanies),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCompanies] = c.Companies
|
||||||
|
|
||||||
|
c.CompanyLogos = &endpoint.CompanyLogos{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCompanyLogos),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCompanyLogos] = c.CompanyLogos
|
||||||
|
|
||||||
|
c.CompanyStatuses = &endpoint.CompanyStatuses{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCompanyStatuses),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCompanyStatuses] = c.CompanyStatuses
|
||||||
|
|
||||||
|
c.CompanyWebsites = &endpoint.CompanyWebsites{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCompanyWebsites),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCompanyWebsites] = c.CompanyWebsites
|
||||||
|
|
||||||
|
c.Covers = &endpoint.Covers{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPCovers),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPCovers] = c.Covers
|
||||||
|
|
||||||
|
c.DateFormats = &endpoint.DateFormats{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPDateFormats),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPDateFormats] = c.DateFormats
|
||||||
|
|
||||||
|
c.EventLogos = &endpoint.EventLogos{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPEventLogos),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPEventLogos] = c.EventLogos
|
||||||
|
|
||||||
|
c.EventNetworks = &endpoint.EventNetworks{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPEventNetworks),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPEventNetworks] = c.EventNetworks
|
||||||
|
|
||||||
|
c.Events = &endpoint.Events{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPEvents),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPEvents] = c.Events
|
||||||
|
|
||||||
|
c.ExternalGames = &endpoint.ExternalGames{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPExternalGames),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPExternalGames] = c.ExternalGames
|
||||||
|
|
||||||
|
c.ExternalGameSources = &endpoint.ExternalGameSources{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPExternalGameSources),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPExternalGameSources] = c.ExternalGameSources
|
||||||
|
|
||||||
|
c.Franchises = &endpoint.Franchises{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPFranchises),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPFranchises] = c.Franchises
|
||||||
|
|
||||||
|
c.GameEngineLogos = &endpoint.GameEngineLogos{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameEngineLogos),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameEngineLogos] = c.GameEngineLogos
|
||||||
|
|
||||||
|
c.GameEngines = &endpoint.GameEngines{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameEngines),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameEngines] = c.GameEngines
|
||||||
|
|
||||||
|
c.GameLocalizations = &endpoint.GameLocalizations{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameLocalizations),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameLocalizations] = c.GameLocalizations
|
||||||
|
|
||||||
|
c.GameModes = &endpoint.GameModes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameModes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameModes] = c.GameModes
|
||||||
|
|
||||||
|
c.GameReleaseFormats = &endpoint.GameReleaseFormats{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameReleaseFormats),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameReleaseFormats] = c.GameReleaseFormats
|
||||||
|
|
||||||
|
c.Games = &endpoint.Games{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGames),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGames] = c.Games
|
||||||
|
|
||||||
|
c.GameStatuses = &endpoint.GameStatuses{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameStatuses),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameStatuses] = c.GameStatuses
|
||||||
|
|
||||||
|
c.GameTimeToBeats = &endpoint.GameTimeToBeats{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameTimeToBeats),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameTimeToBeats] = c.GameTimeToBeats
|
||||||
|
|
||||||
|
c.GameTypes = &endpoint.GameTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameTypes] = c.GameTypes
|
||||||
|
|
||||||
|
c.GameVersionFeatures = &endpoint.GameVersionFeatures{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameVersionFeatures),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameVersionFeatures] = c.GameVersionFeatures
|
||||||
|
|
||||||
|
c.GameVersionFeatureValues = &endpoint.GameVersionFeatureValues{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameVersionFeatureValues),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameVersionFeatureValues] = c.GameVersionFeatureValues
|
||||||
|
|
||||||
|
c.GameVersions = &endpoint.GameVersions{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameVersions),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameVersions] = c.GameVersions
|
||||||
|
|
||||||
|
c.GameVideos = &endpoint.GameVideos{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGameVideos),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGameVideos] = c.GameVideos
|
||||||
|
|
||||||
|
c.Genres = &endpoint.Genres{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPGenres),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPGenres] = c.Genres
|
||||||
|
|
||||||
|
c.InvolvedCompanies = &endpoint.InvolvedCompanies{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPInvolvedCompanies),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPInvolvedCompanies] = c.InvolvedCompanies
|
||||||
|
|
||||||
|
c.Keywords = &endpoint.Keywords{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPKeywords),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPKeywords] = c.Keywords
|
||||||
|
|
||||||
|
c.Languages = &endpoint.Languages{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPLanguages),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPLanguages] = c.Languages
|
||||||
|
|
||||||
|
c.LanguageSupports = &endpoint.LanguageSupports{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPLanguageSupports),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPLanguageSupports] = c.LanguageSupports
|
||||||
|
|
||||||
|
c.LanguageSupportTypes = &endpoint.LanguageSupportTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPLanguageSupportTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPLanguageSupportTypes] = c.LanguageSupportTypes
|
||||||
|
|
||||||
|
c.MultiplayerModes = &endpoint.MultiplayerModes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPMultiplayerModes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPMultiplayerModes] = c.MultiplayerModes
|
||||||
|
|
||||||
|
c.NetworkTypes = &endpoint.NetworkTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPNetworkTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPNetworkTypes] = c.NetworkTypes
|
||||||
|
|
||||||
|
c.PlatformFamilies = &endpoint.PlatformFamilies{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformFamilies),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformFamilies] = c.PlatformFamilies
|
||||||
|
|
||||||
|
c.PlatformLogos = &endpoint.PlatformLogos{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformLogos),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformLogos] = c.PlatformLogos
|
||||||
|
|
||||||
|
c.Platforms = &endpoint.Platforms{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatforms),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatforms] = c.Platforms
|
||||||
|
|
||||||
|
c.PlatformTypes = &endpoint.PlatformTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformTypes] = c.PlatformTypes
|
||||||
|
|
||||||
|
c.PlatformVersionCompanies = &endpoint.PlatformVersionCompanies{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformVersionCompanies),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformVersionCompanies] = c.PlatformVersionCompanies
|
||||||
|
|
||||||
|
c.PlatformVersionReleaseDates = &endpoint.PlatformVersionReleaseDates{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformVersionReleaseDates),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformVersionReleaseDates] = c.PlatformVersionReleaseDates
|
||||||
|
|
||||||
|
c.PlatformVersions = &endpoint.PlatformVersions{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformVersions),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformVersions] = c.PlatformVersions
|
||||||
|
|
||||||
|
c.PlatformWebsites = &endpoint.PlatformWebsites{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlatformWebsites),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlatformWebsites] = c.PlatformWebsites
|
||||||
|
|
||||||
|
c.PlayerPerspectives = &endpoint.PlayerPerspectives{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPlayerPerspectives),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPlayerPerspectives] = c.PlayerPerspectives
|
||||||
|
|
||||||
|
c.PopularityPrimitives = &endpoint.PopularityPrimitives{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPopularityPrimitives),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPopularityPrimitives] = c.PopularityPrimitives
|
||||||
|
|
||||||
|
c.PopularityTypes = &endpoint.PopularityTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPPopularityTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPPopularityTypes] = c.PopularityTypes
|
||||||
|
|
||||||
|
c.Regions = &endpoint.Regions{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPRegions),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPRegions] = c.Regions
|
||||||
|
|
||||||
|
c.ReleaseDateRegions = &endpoint.ReleaseDateRegions{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPReleaseDateRegions),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPReleaseDateRegions] = c.ReleaseDateRegions
|
||||||
|
|
||||||
|
c.ReleaseDates = &endpoint.ReleaseDates{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPReleaseDates),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPReleaseDates] = c.ReleaseDates
|
||||||
|
|
||||||
|
c.ReleaseDateStatuses = &endpoint.ReleaseDateStatuses{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPReleaseDateStatuses),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPReleaseDateStatuses] = c.ReleaseDateStatuses
|
||||||
|
|
||||||
|
c.Screenshots = &endpoint.Screenshots{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPScreenshots),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPScreenshots] = c.Screenshots
|
||||||
|
|
||||||
|
c.Themes = &endpoint.Themes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPThemes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPThemes] = c.Themes
|
||||||
|
|
||||||
|
c.Websites = &endpoint.Websites{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPWebsites),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPWebsites] = c.Websites
|
||||||
|
|
||||||
|
c.WebsiteTypes = &endpoint.WebsiteTypes{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPWebsiteTypes),
|
||||||
|
}
|
||||||
|
c.EntityEndpoints[endpoint.EPWebsiteTypes] = c.WebsiteTypes
|
||||||
|
|
||||||
|
c.Webhooks = &endpoint.Webhooks{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPWebhooks),
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Search = &endpoint.Search{
|
||||||
|
BaseEndpoint: *endpoint.NewBaseEndpoint(c.Request, endpoint.EPSearch),
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user