mirror of
https://github.com/bestnite/go-igdb.git
synced 2025-04-20 03:05:54 +08:00
Compare commits
No commits in common. "35c27b28a335248033dee99e3bdd41b9c5855ec1" and "e01d9805c6a9d4c26f5f06a8077440c75b5a9ac9" have entirely different histories.
35c27b28a3
...
e01d9805c6
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetAgeRatingCategories(query string) ([]*pb.AgeRatingCategory, error) {
|
||||
func (g *igdb) GetAgeRatingCategories(query string) ([]*pb.AgeRatingCategory, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_categories.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetAgeRatingCategories(query string) ([]*pb.AgeRatingCategory,
|
||||
return data.Ageratingcategories, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoryByID(id uint64) (*pb.AgeRatingCategory, error) {
|
||||
func (g *igdb) GetAgeRatingCategoryByID(id uint64) (*pb.AgeRatingCategory, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingCategories, err := g.GetAgeRatingCategories(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetAgeRatingCategoryByID(id uint64) (*pb.AgeRatingCategory, err
|
||||
return ageRatingCategories[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoriesByIDs(ids []uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
func (g *igdb) GetAgeRatingCategoriesByIDs(ids []uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetAgeRatingCategoriesByIDs(ids []uint64) ([]*pb.AgeRatingCateg
|
||||
return g.GetAgeRatingCategories(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoriesByOrganizationID(id uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
func (g *igdb) GetAgeRatingCategoriesByOrganizationID(id uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
query := fmt.Sprintf(`where organization = %d; fields *;`, id)
|
||||
return g.GetAgeRatingCategories(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoriesByOrganizationIDs(ids []uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
func (g *igdb) GetAgeRatingCategoriesByOrganizationIDs(ids []uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetAgeRatingCategoriesByOrganizationIDs(ids []uint64) ([]*pb.Ag
|
||||
return g.GetAgeRatingCategories(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoriesLength() (int, error) {
|
||||
func (g *igdb) GetAgeRatingCategoriesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingCategories, err := g.GetAgeRatingCategories(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptions(query string) ([]*pb.AgeRatingContentDescription, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptions(query string) ([]*pb.AgeRatingContentDescription, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_content_descriptions.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetAgeRatingContentDescriptions(query string) ([]*pb.AgeRatingC
|
||||
return data.Ageratingcontentdescriptions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionByID(id uint64) (*pb.AgeRatingContentDescription, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionByID(id uint64) (*pb.AgeRatingContentDescription, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptions(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetAgeRatingContentDescriptionByID(id uint64) (*pb.AgeRatingCon
|
||||
return ageRatingContentDescriptions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsByIDs(ids []uint64) ([]*pb.AgeRatingContentDescription, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsByIDs(ids []uint64) ([]*pb.AgeRatingContentDescription, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetAgeRatingContentDescriptionsByIDs(ids []uint64) ([]*pb.AgeRa
|
||||
return g.GetAgeRatingContentDescriptions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsLength() (int, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptions(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2(query string) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsV2(query string) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_content_descriptions_v2.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetAgeRatingContentDescriptionsV2(query string) ([]*pb.AgeRatin
|
||||
return data.Ageratingcontentdescriptionsv2, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionV2ByID(id uint64) (*pb.AgeRatingContentDescriptionV2, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionV2ByID(id uint64) (*pb.AgeRatingContentDescriptionV2, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptionsV2(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetAgeRatingContentDescriptionV2ByID(id uint64) (*pb.AgeRatingC
|
||||
return ageRatingContentDescriptions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2ByIDs(ids []uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsV2ByIDs(ids []uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetAgeRatingContentDescriptionsV2ByIDs(ids []uint64) ([]*pb.Age
|
||||
return g.GetAgeRatingContentDescriptionsV2(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2ByOrganizationID(id uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsV2ByOrganizationID(id uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
query := fmt.Sprintf(`where organization = %d; fields *;`, id)
|
||||
return g.GetAgeRatingContentDescriptionsV2(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2ByOrganizationIDs(ids []uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsV2ByOrganizationIDs(ids []uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetAgeRatingContentDescriptionsV2ByOrganizationIDs(ids []uint64
|
||||
return g.GetAgeRatingContentDescriptionsV2(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2Length() (int, error) {
|
||||
func (g *igdb) GetAgeRatingContentDescriptionsV2Length() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptionsV2(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizations(query string) ([]*pb.AgeRatingOrganization, error) {
|
||||
func (g *igdb) GetAgeRatingOrganizations(query string) ([]*pb.AgeRatingOrganization, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/age_rating_organizations.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetAgeRatingOrganizations(query string) ([]*pb.AgeRatingOrganiz
|
||||
return data.Ageratingorganizations, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizationByID(id uint64) (*pb.AgeRatingOrganization, error) {
|
||||
func (g *igdb) GetAgeRatingOrganizationByID(id uint64) (*pb.AgeRatingOrganization, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingOrganizations, err := g.GetAgeRatingOrganizations(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetAgeRatingOrganizationByID(id uint64) (*pb.AgeRatingOrganizat
|
||||
return ageRatingOrganizations[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizationsByIDs(ids []uint64) ([]*pb.AgeRatingOrganization, error) {
|
||||
func (g *igdb) GetAgeRatingOrganizationsByIDs(ids []uint64) ([]*pb.AgeRatingOrganization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetAgeRatingOrganizationsByIDs(ids []uint64) ([]*pb.AgeRatingOr
|
||||
return g.GetAgeRatingOrganizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizationsLength() (int, error) {
|
||||
func (g *igdb) GetAgeRatingOrganizationsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingOrganizations, err := g.GetAgeRatingOrganizations(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetAgeRatings(query string) ([]*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatings(query string) ([]*pb.AgeRating, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/age_ratings.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetAgeRatings(query string) ([]*pb.AgeRating, error) {
|
||||
return data.Ageratings, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingByID(id uint64) (*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatingByID(id uint64) (*pb.AgeRating, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatings, err := g.GetAgeRatings(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetAgeRatingByID(id uint64) (*pb.AgeRating, error) {
|
||||
return ageRatings[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsByIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatingsByIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetAgeRatingsByIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
return g.GetAgeRatings(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsByOrganizationID(id uint64) ([]*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatingsByOrganizationID(id uint64) ([]*pb.AgeRating, error) {
|
||||
query := fmt.Sprintf(`where organization = %d; fields *;`, id)
|
||||
return g.GetAgeRatings(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsByOrganizationIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatingsByOrganizationIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetAgeRatingsByOrganizationIDs(ids []uint64) ([]*pb.AgeRating,
|
||||
return g.GetAgeRatings(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsByAgeRatingCategoryID(id uint64) ([]*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatingsByAgeRatingCategoryID(id uint64) ([]*pb.AgeRating, error) {
|
||||
query := fmt.Sprintf(`where rating_category = %d; fields *;`, id)
|
||||
return g.GetAgeRatings(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsByAgeRatingCategoryIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
func (g *igdb) GetAgeRatingsByAgeRatingCategoryIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetAgeRatingsByAgeRatingCategoryIDs(ids []uint64) ([]*pb.AgeRat
|
||||
return g.GetAgeRatings(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsLength() (int, error) {
|
||||
func (g *igdb) GetAgeRatingsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatings, err := g.GetAgeRatings(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetAlternativeNames(query string) ([]*pb.AlternativeName, error) {
|
||||
func (g *igdb) GetAlternativeNames(query string) ([]*pb.AlternativeName, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/alternative_names.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetAlternativeNames(query string) ([]*pb.AlternativeName, error
|
||||
return data.Alternativenames, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNameByID(id uint64) (*pb.AlternativeName, error) {
|
||||
func (g *igdb) GetAlternativeNameByID(id uint64) (*pb.AlternativeName, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
alternativeNames, err := g.GetAlternativeNames(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetAlternativeNameByID(id uint64) (*pb.AlternativeName, error)
|
||||
return alternativeNames[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNamesByIDs(ids []uint64) ([]*pb.AlternativeName, error) {
|
||||
func (g *igdb) GetAlternativeNamesByIDs(ids []uint64) ([]*pb.AlternativeName, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetAlternativeNamesByIDs(ids []uint64) ([]*pb.AlternativeName,
|
||||
return g.GetAlternativeNames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNamesByGameID(id uint64) ([]*pb.AlternativeName, error) {
|
||||
func (g *igdb) GetAlternativeNamesByGameID(id uint64) ([]*pb.AlternativeName, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetAlternativeNames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNamesByGameIDs(ids []uint64) ([]*pb.AlternativeName, error) {
|
||||
func (g *igdb) GetAlternativeNamesByGameIDs(ids []uint64) ([]*pb.AlternativeName, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetAlternativeNamesByGameIDs(ids []uint64) ([]*pb.AlternativeNa
|
||||
return g.GetAlternativeNames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNamesLength() (int, error) {
|
||||
func (g *igdb) GetAlternativeNamesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
alternativeNames, err := g.GetAlternativeNames(query)
|
||||
if err != nil {
|
||||
|
14
artworks.go
14
artworks.go
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetArtworks(query string) ([]*pb.Artwork, error) {
|
||||
func (g *igdb) GetArtworks(query string) ([]*pb.Artwork, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/artworks.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetArtworks(query string) ([]*pb.Artwork, error) {
|
||||
return data.Artworks, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworkByID(id uint64) (*pb.Artwork, error) {
|
||||
func (g *igdb) GetArtworkByID(id uint64) (*pb.Artwork, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
artworks, err := g.GetArtworks(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetArtworkByID(id uint64) (*pb.Artwork, error) {
|
||||
return artworks[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworksByIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
func (g *igdb) GetArtworksByIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +47,12 @@ func (g *Client) GetArtworksByIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
return g.GetArtworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworksByGameID(id uint64) ([]*pb.Artwork, error) {
|
||||
func (g *igdb) GetArtworksByGameID(id uint64) ([]*pb.Artwork, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetArtworks(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworksByGameIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
func (g *igdb) GetArtworksByGameIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +63,7 @@ func (g *Client) GetArtworksByGameIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
return g.GetArtworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworksLength() (int, error) {
|
||||
func (g *igdb) GetArtworksLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
artworks, err := g.GetArtworks(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCharacterGenders(query string) ([]*pb.CharacterGender, error) {
|
||||
func (g *igdb) GetCharacterGenders(query string) ([]*pb.CharacterGender, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/character_genders.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCharacterGenders(query string) ([]*pb.CharacterGender, error
|
||||
return data.Charactergenders, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterGenderByID(id uint64) (*pb.CharacterGender, error) {
|
||||
func (g *igdb) GetCharacterGenderByID(id uint64) (*pb.CharacterGender, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characterGenders, err := g.GetCharacterGenders(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCharacterGenderByID(id uint64) (*pb.CharacterGender, error)
|
||||
return characterGenders[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterGendersByIDs(ids []uint64) ([]*pb.CharacterGender, error) {
|
||||
func (g *igdb) GetCharacterGendersByIDs(ids []uint64) ([]*pb.CharacterGender, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetCharacterGendersByIDs(ids []uint64) ([]*pb.CharacterGender,
|
||||
return g.GetCharacterGenders(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterGendersLength() (int, error) {
|
||||
func (g *igdb) GetCharacterGendersLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characterGenders, err := g.GetCharacterGenders(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCharacterMugShots(query string) ([]*pb.CharacterMugShot, error) {
|
||||
func (g *igdb) GetCharacterMugShots(query string) ([]*pb.CharacterMugShot, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/character_mug_shots.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCharacterMugShots(query string) ([]*pb.CharacterMugShot, err
|
||||
return data.Charactermugshots, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterMugShotByID(id uint64) (*pb.CharacterMugShot, error) {
|
||||
func (g *igdb) GetCharacterMugShotByID(id uint64) (*pb.CharacterMugShot, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characterMugShots, err := g.GetCharacterMugShots(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCharacterMugShotByID(id uint64) (*pb.CharacterMugShot, error
|
||||
return characterMugShots[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterMugShotsByIDs(ids []uint64) ([]*pb.CharacterMugShot, error) {
|
||||
func (g *igdb) GetCharacterMugShotsByIDs(ids []uint64) ([]*pb.CharacterMugShot, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetCharacterMugShotsByIDs(ids []uint64) ([]*pb.CharacterMugShot
|
||||
return g.GetCharacterMugShots(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterMugShotsLength() (int, error) {
|
||||
func (g *igdb) GetCharacterMugShotsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characterMugShots, err := g.GetCharacterMugShots(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCharacterSpecies(query string) ([]*pb.CharacterSpecie, error) {
|
||||
func (g *igdb) GetCharacterSpecies(query string) ([]*pb.CharacterSpecie, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/character_species.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCharacterSpecies(query string) ([]*pb.CharacterSpecie, error
|
||||
return data.Characterspecies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterSpecieByID(id uint64) (*pb.CharacterSpecie, error) {
|
||||
func (g *igdb) GetCharacterSpecieByID(id uint64) (*pb.CharacterSpecie, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characterSpecies, err := g.GetCharacterSpecies(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCharacterSpecieByID(id uint64) (*pb.CharacterSpecie, error)
|
||||
return characterSpecies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterSpeciesByIDs(ids []uint64) ([]*pb.CharacterSpecie, error) {
|
||||
func (g *igdb) GetCharacterSpeciesByIDs(ids []uint64) ([]*pb.CharacterSpecie, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetCharacterSpeciesByIDs(ids []uint64) ([]*pb.CharacterSpecie,
|
||||
return g.GetCharacterSpecies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterSpeciesLength() (int, error) {
|
||||
func (g *igdb) GetCharacterSpeciesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characterSpecies, err := g.GetCharacterSpecies(query)
|
||||
if err != nil {
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCharacters(query string) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharacters(query string) ([]*pb.Character, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/characters.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetCharacters(query string) ([]*pb.Character, error) {
|
||||
return data.Characters, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterByID(id uint64) (*pb.Character, error) {
|
||||
func (g *igdb) GetCharacterByID(id uint64) (*pb.Character, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characters, err := g.GetCharacters(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetCharacterByID(id uint64) (*pb.Character, error) {
|
||||
return characters[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +47,12 @@ func (g *Client) GetCharactersByIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByCharacterGenderID(id uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByCharacterGenderID(id uint64) ([]*pb.Character, error) {
|
||||
query := fmt.Sprintf(`where character_gender = %d; fields *;`, id)
|
||||
return g.GetCharacters(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByCharacterGenderIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByCharacterGenderIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +63,12 @@ func (g *Client) GetCharactersByCharacterGenderIDs(ids []uint64) ([]*pb.Characte
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByCharacterSpecieID(id uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByCharacterSpecieID(id uint64) ([]*pb.Character, error) {
|
||||
query := fmt.Sprintf(`where character_species = %d; fields *;`, id)
|
||||
return g.GetCharacters(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByCharacterSpecieIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByCharacterSpecieIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +79,12 @@ func (g *Client) GetCharactersByCharacterSpecieIDs(ids []uint64) ([]*pb.Characte
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByMugShotID(id uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByMugShotID(id uint64) ([]*pb.Character, error) {
|
||||
query := fmt.Sprintf(`where mug_shot = %d; fields *;`, id)
|
||||
return g.GetCharacters(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByMugShotIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
func (g *igdb) GetCharactersByMugShotIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,7 +95,7 @@ func (g *Client) GetCharactersByMugShotIDs(ids []uint64) ([]*pb.Character, error
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersLength() (int, error) {
|
||||
func (g *igdb) GetCharactersLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characters, err := g.GetCharacters(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypes(query string) ([]*pb.CollectionMembershipType, error) {
|
||||
func (g *igdb) GetCollectionMembershipTypes(query string) ([]*pb.CollectionMembershipType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/collection_membership_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCollectionMembershipTypes(query string) ([]*pb.CollectionMem
|
||||
return data.Collectionmembershiptypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypeByID(id uint64) (*pb.CollectionMembershipType, error) {
|
||||
func (g *igdb) GetCollectionMembershipTypeByID(id uint64) (*pb.CollectionMembershipType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionMembershipTypes, err := g.GetCollectionMembershipTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCollectionMembershipTypeByID(id uint64) (*pb.CollectionMembe
|
||||
return collectionMembershipTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypesByIDs(ids []uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
func (g *igdb) GetCollectionMembershipTypesByIDs(ids []uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetCollectionMembershipTypesByIDs(ids []uint64) ([]*pb.Collecti
|
||||
return g.GetCollectionMembershipTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypesByAllowedCollectionTypeID(id uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
func (g *igdb) GetCollectionMembershipTypesByAllowedCollectionTypeID(id uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
query := fmt.Sprintf(`where allowed_collection_type = %d; fields *;`, id)
|
||||
return g.GetCollectionMembershipTypes(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypesByAllowedCollectionTypeIDs(ids []uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
func (g *igdb) GetCollectionMembershipTypesByAllowedCollectionTypeIDs(ids []uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetCollectionMembershipTypesByAllowedCollectionTypeIDs(ids []ui
|
||||
return g.GetCollectionMembershipTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypesLength() (int, error) {
|
||||
func (g *igdb) GetCollectionMembershipTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionMembershipTypes, err := g.GetCollectionMembershipTypes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCollectionMemberships(query string) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMemberships(query string) ([]*pb.CollectionMembership, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/collection_memberships.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCollectionMemberships(query string) ([]*pb.CollectionMembers
|
||||
return data.Collectionmemberships, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipByID(id uint64) (*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipByID(id uint64) (*pb.CollectionMembership, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionMemberships, err := g.GetCollectionMemberships(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCollectionMembershipByID(id uint64) (*pb.CollectionMembershi
|
||||
return collectionMemberships[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipsByIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetCollectionMembershipsByIDs(ids []uint64) ([]*pb.CollectionMe
|
||||
return g.GetCollectionMemberships(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByGameID(id uint64) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipsByGameID(id uint64) ([]*pb.CollectionMembership, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetCollectionMemberships(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByGameIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipsByGameIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,17 +62,17 @@ func (g *Client) GetCollectionMembershipsByGameIDs(ids []uint64) ([]*pb.Collecti
|
||||
return g.GetCollectionMemberships(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByCollectionID(id uint64) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipsByCollectionID(id uint64) ([]*pb.CollectionMembership, error) {
|
||||
query := fmt.Sprintf(`where collection = %d; fields *;`, id)
|
||||
return g.GetCollectionMemberships(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByCollectionMembershipTypeID(id uint64) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipsByCollectionMembershipTypeID(id uint64) ([]*pb.CollectionMembership, error) {
|
||||
query := fmt.Sprintf(`where type = %d; fields *;`, id)
|
||||
return g.GetCollectionMemberships(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByCollectionMembershipTypeIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
func (g *igdb) GetCollectionMembershipsByCollectionMembershipTypeIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -84,7 +83,7 @@ func (g *Client) GetCollectionMembershipsByCollectionMembershipTypeIDs(ids []uin
|
||||
return g.GetCollectionMemberships(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsLength() (int, error) {
|
||||
func (g *igdb) GetCollectionMembershipsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionMemberships, err := g.GetCollectionMemberships(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelationType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/collection_relation_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelat
|
||||
return data.Collectionrelationtypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypeByID(id uint64) (*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypeByID(id uint64) (*pb.CollectionRelationType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionRelationTypes, err := g.GetCollectionRelationTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCollectionRelationTypeByID(id uint64) (*pb.CollectionRelatio
|
||||
return collectionRelationTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesByIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypesByIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetCollectionRelationTypesByIDs(ids []uint64) ([]*pb.Collection
|
||||
return g.GetCollectionRelationTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesByAllowedChildTypeID(id uint64) ([]*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypesByAllowedChildTypeID(id uint64) ([]*pb.CollectionRelationType, error) {
|
||||
query := fmt.Sprintf(`where allowed_child_type = %d; fields *;`, id)
|
||||
return g.GetCollectionRelationTypes(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesByAllowedChildTypeIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypesByAllowedChildTypeIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetCollectionRelationTypesByAllowedChildTypeIDs(ids []uint64) (
|
||||
return g.GetCollectionRelationTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesByAllowedParentTypeID(id uint64) ([]*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypesByAllowedParentTypeID(id uint64) ([]*pb.CollectionRelationType, error) {
|
||||
query := fmt.Sprintf(`where allowed_parent_type = %d; fields *;`, id)
|
||||
return g.GetCollectionRelationTypes(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesByAllowedParentTypeIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
func (g *igdb) GetCollectionRelationTypesByAllowedParentTypeIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetCollectionRelationTypesByAllowedParentTypeIDs(ids []uint64)
|
||||
return g.GetCollectionRelationTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesLength() (int, error) {
|
||||
func (g *igdb) GetCollectionRelationTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionRelationTypes, err := g.GetCollectionRelationTypes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCollectionRelations(query string) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelations(query string) ([]*pb.CollectionRelation, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/collection_relations.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCollectionRelations(query string) ([]*pb.CollectionRelation,
|
||||
return data.Collectionrelations, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationByID(id uint64) (*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationByID(id uint64) (*pb.CollectionRelation, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionRelations, err := g.GetCollectionRelations(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCollectionRelationByID(id uint64) (*pb.CollectionRelation, e
|
||||
return collectionRelations[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetCollectionRelationsByIDs(ids []uint64) ([]*pb.CollectionRela
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByChildCollectionID(id uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByChildCollectionID(id uint64) ([]*pb.CollectionRelation, error) {
|
||||
query := fmt.Sprintf(`where child_collection = %d; fields *;`, id)
|
||||
return g.GetCollectionRelations(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByChildCollectionIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByChildCollectionIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetCollectionRelationsByChildCollectionIDs(ids []uint64) ([]*pb
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByParentCollectionID(id uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByParentCollectionID(id uint64) ([]*pb.CollectionRelation, error) {
|
||||
query := fmt.Sprintf(`where parent_collection = %d; fields *;`, id)
|
||||
return g.GetCollectionRelations(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByParentCollectionIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByParentCollectionIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +78,12 @@ func (g *Client) GetCollectionRelationsByParentCollectionIDs(ids []uint64) ([]*p
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByCollectionRelationTypeID(id uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByCollectionRelationTypeID(id uint64) ([]*pb.CollectionRelation, error) {
|
||||
query := fmt.Sprintf(`where type = %d; fields *;`, id)
|
||||
return g.GetCollectionRelations(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByCollectionRelationTypeIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
func (g *igdb) GetCollectionRelationsByCollectionRelationTypeIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,7 +94,7 @@ func (g *Client) GetCollectionRelationsByCollectionRelationTypeIDs(ids []uint64)
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsLength() (int, error) {
|
||||
func (g *igdb) GetCollectionRelationsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionRelations, err := g.GetCollectionRelations(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCollectionTypes(query string) ([]*pb.CollectionType, error) {
|
||||
func (g *igdb) GetCollectionTypes(query string) ([]*pb.CollectionType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/collection_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCollectionTypes(query string) ([]*pb.CollectionType, error)
|
||||
return data.Collectiontypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionTypeByID(id uint64) (*pb.CollectionType, error) {
|
||||
func (g *igdb) GetCollectionTypeByID(id uint64) (*pb.CollectionType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionTypes, err := g.GetCollectionTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCollectionTypeByID(id uint64) (*pb.CollectionType, error) {
|
||||
return collectionTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionTypesByIDs(ids []uint64) ([]*pb.CollectionType, error) {
|
||||
func (g *igdb) GetCollectionTypesByIDs(ids []uint64) ([]*pb.CollectionType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetCollectionTypesByIDs(ids []uint64) ([]*pb.CollectionType, er
|
||||
return g.GetCollectionTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionTypesLength() (int, error) {
|
||||
func (g *igdb) GetCollectionTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionTypes, err := g.GetCollectionTypes(query)
|
||||
if err != nil {
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCollections(query string) ([]*pb.Collection, error) {
|
||||
func (g *igdb) GetCollections(query string) ([]*pb.Collection, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/collections.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetCollections(query string) ([]*pb.Collection, error) {
|
||||
return data.Collections, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionByID(id uint64) (*pb.Collection, error) {
|
||||
func (g *igdb) GetCollectionByID(id uint64) (*pb.Collection, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collections, err := g.GetCollections(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetCollectionByID(id uint64) (*pb.Collection, error) {
|
||||
return collections[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionsByIDs(ids []uint64) ([]*pb.Collection, error) {
|
||||
func (g *igdb) GetCollectionsByIDs(ids []uint64) ([]*pb.Collection, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +47,12 @@ func (g *Client) GetCollectionsByIDs(ids []uint64) ([]*pb.Collection, error) {
|
||||
return g.GetCollections(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionsByCollectionTypeID(id uint64) ([]*pb.Collection, error) {
|
||||
func (g *igdb) GetCollectionsByCollectionTypeID(id uint64) ([]*pb.Collection, error) {
|
||||
query := fmt.Sprintf(`where collection_type = %d; fields *;`, id)
|
||||
return g.GetCollections(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionsByCollectionTypeIDs(ids []uint64) ([]*pb.Collection, error) {
|
||||
func (g *igdb) GetCollectionsByCollectionTypeIDs(ids []uint64) ([]*pb.Collection, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +63,7 @@ func (g *Client) GetCollectionsByCollectionTypeIDs(ids []uint64) ([]*pb.Collecti
|
||||
return g.GetCollections(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionsLength() (int, error) {
|
||||
func (g *igdb) GetCollectionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collections, err := g.GetCollections(query)
|
||||
if err != nil {
|
||||
|
34
companies.go
34
companies.go
@ -5,12 +5,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCompanies(query string) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanies(query string) ([]*pb.Company, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/companies.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -28,7 +28,7 @@ func (g *Client) GetCompanies(query string) ([]*pb.Company, error) {
|
||||
return data.Companies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByID(id uint64) (*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByID(id uint64) (*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companys, err := g.GetCompanies(query)
|
||||
if err != nil {
|
||||
@ -37,7 +37,7 @@ func (g *Client) GetCompanyByID(id uint64) (*pb.Company, error) {
|
||||
return companys[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -48,12 +48,12 @@ func (g *Client) GetCompanyByIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByChangeDateFormatID(id uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByChangeDateFormatID(id uint64) ([]*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where change_date_format = %d; fields *;`, id)
|
||||
return g.GetCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByChangeDateFormatsIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByChangeDateFormatsIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -64,12 +64,12 @@ func (g *Client) GetCompanyByChangeDateFormatsIDs(ids []uint64) ([]*pb.Company,
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByChangedCompanyID(id uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByChangedCompanyID(id uint64) ([]*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where changed_company_id = %d; fields *;`, id)
|
||||
return g.GetCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByChangedCompanyIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByChangedCompanyIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -80,12 +80,12 @@ func (g *Client) GetCompanyByChangedCompanyIDs(ids []uint64) ([]*pb.Company, err
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByLogoID(id uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByLogoID(id uint64) ([]*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where logo = %d; fields *;`, id)
|
||||
return g.GetCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByLogoIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByLogoIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -96,12 +96,12 @@ func (g *Client) GetCompanyByLogoIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByParentID(id uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByParentID(id uint64) ([]*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where parent = %d; fields *;`, id)
|
||||
return g.GetCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByParentIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByParentIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -112,12 +112,12 @@ func (g *Client) GetCompanyByParentIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByStartDateFormatID(id uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByStartDateFormatID(id uint64) ([]*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where start_date_format = %d; fields *;`, id)
|
||||
return g.GetCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByStartDateFormatsIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByStartDateFormatsIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -128,12 +128,12 @@ func (g *Client) GetCompanyByStartDateFormatsIDs(ids []uint64) ([]*pb.Company, e
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByStatusID(id uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByStatusID(id uint64) ([]*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where status = %d; fields *;`, id)
|
||||
return g.GetCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByStatusIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
func (g *igdb) GetCompanyByStatusIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -144,7 +144,7 @@ func (g *Client) GetCompanyByStatusIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompaniesLength() (int, error) {
|
||||
func (g *igdb) GetCompaniesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companies, err := g.GetCompanies(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCompanyLogos(query string) ([]*pb.CompanyLogo, error) {
|
||||
func (g *igdb) GetCompanyLogos(query string) ([]*pb.CompanyLogo, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/company_logos.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCompanyLogos(query string) ([]*pb.CompanyLogo, error) {
|
||||
return data.Companylogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyLogoByID(id uint64) (*pb.CompanyLogo, error) {
|
||||
func (g *igdb) GetCompanyLogoByID(id uint64) (*pb.CompanyLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companyLogos, err := g.GetCompanyLogos(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCompanyLogoByID(id uint64) (*pb.CompanyLogo, error) {
|
||||
return companyLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyLogosByIDs(ids []uint64) ([]*pb.CompanyLogo, error) {
|
||||
func (g *igdb) GetCompanyLogosByIDs(ids []uint64) ([]*pb.CompanyLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetCompanyLogosByIDs(ids []uint64) ([]*pb.CompanyLogo, error) {
|
||||
return g.GetCompanyLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyLogosLength() (int, error) {
|
||||
func (g *igdb) GetCompanyLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companyLogos, err := g.GetCompanyLogos(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCompanyStatuses(query string) ([]*pb.CompanyStatus, error) {
|
||||
func (g *igdb) GetCompanyStatuses(query string) ([]*pb.CompanyStatus, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/company_statuses.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCompanyStatuses(query string) ([]*pb.CompanyStatus, error) {
|
||||
return data.Companystatuses, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyStatusByID(id uint64) (*pb.CompanyStatus, error) {
|
||||
func (g *igdb) GetCompanyStatusByID(id uint64) (*pb.CompanyStatus, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companyStatuses, err := g.GetCompanyStatuses(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCompanyStatusByID(id uint64) (*pb.CompanyStatus, error) {
|
||||
return companyStatuses[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyStatusesByIDs(ids []uint64) ([]*pb.CompanyStatus, error) {
|
||||
func (g *igdb) GetCompanyStatusesByIDs(ids []uint64) ([]*pb.CompanyStatus, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetCompanyStatusesByIDs(ids []uint64) ([]*pb.CompanyStatus, err
|
||||
return g.GetCompanyStatuses(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyStatusesLength() (int, error) {
|
||||
func (g *igdb) GetCompanyStatusesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companyStatuses, err := g.GetCompanyStatuses(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCompanyWebsites(query string) ([]*pb.CompanyWebsite, error) {
|
||||
func (g *igdb) GetCompanyWebsites(query string) ([]*pb.CompanyWebsite, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/company_websites.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCompanyWebsites(query string) ([]*pb.CompanyWebsite, error)
|
||||
return data.Companywebsites, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsiteByID(id uint64) (*pb.CompanyWebsite, error) {
|
||||
func (g *igdb) GetCompanyWebsiteByID(id uint64) (*pb.CompanyWebsite, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companyWebsites, err := g.GetCompanyWebsites(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCompanyWebsiteByID(id uint64) (*pb.CompanyWebsite, error) {
|
||||
return companyWebsites[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsitesByIDs(ids []uint64) ([]*pb.CompanyWebsite, error) {
|
||||
func (g *igdb) GetCompanyWebsitesByIDs(ids []uint64) ([]*pb.CompanyWebsite, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetCompanyWebsitesByIDs(ids []uint64) ([]*pb.CompanyWebsite, er
|
||||
return g.GetCompanyWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsitesByTypeID(id uint64) ([]*pb.CompanyWebsite, error) {
|
||||
func (g *igdb) GetCompanyWebsitesByTypeID(id uint64) ([]*pb.CompanyWebsite, error) {
|
||||
query := fmt.Sprintf(`where type = %d; fields *;`, id)
|
||||
return g.GetCompanyWebsites(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsitesByTypeIDs(ids []uint64) ([]*pb.CompanyWebsite, error) {
|
||||
func (g *igdb) GetCompanyWebsitesByTypeIDs(ids []uint64) ([]*pb.CompanyWebsite, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetCompanyWebsitesByTypeIDs(ids []uint64) ([]*pb.CompanyWebsite
|
||||
return g.GetCompanyWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsitesLength() (int, error) {
|
||||
func (g *igdb) GetCompanyWebsitesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companyWebsites, err := g.GetCompanyWebsites(query)
|
||||
if err != nil {
|
||||
|
19
covers.go
19
covers.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetCovers(query string) ([]*pb.Cover, error) {
|
||||
func (g *igdb) GetCovers(query string) ([]*pb.Cover, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/covers.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetCovers(query string) ([]*pb.Cover, error) {
|
||||
return data.Covers, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCoverByID(id uint64) (*pb.Cover, error) {
|
||||
func (g *igdb) GetCoverByID(id uint64) (*pb.Cover, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
covers, err := g.GetCovers(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetCoverByID(id uint64) (*pb.Cover, error) {
|
||||
return covers[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversByIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
func (g *igdb) GetCoversByIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetCoversByIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
return g.GetCovers(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversByGameID(id uint64) ([]*pb.Cover, error) {
|
||||
func (g *igdb) GetCoversByGameID(id uint64) ([]*pb.Cover, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetCovers(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversByGameIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
func (g *igdb) GetCoversByGameIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetCoversByGameIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
return g.GetCovers(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversByGameLocalizationID(id uint64) ([]*pb.Cover, error) {
|
||||
func (g *igdb) GetCoversByGameLocalizationID(id uint64) ([]*pb.Cover, error) {
|
||||
query := fmt.Sprintf(`where game_localization = %d; fields *;`, id)
|
||||
return g.GetCovers(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversByGameLocalizationIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
func (g *igdb) GetCoversByGameLocalizationIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetCoversByGameLocalizationIDs(ids []uint64) ([]*pb.Cover, erro
|
||||
return g.GetCovers(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversLength() (int, error) {
|
||||
func (g *igdb) GetCoversLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
covers, err := g.GetCovers(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetDateFormats(query string) ([]*pb.DateFormat, error) {
|
||||
func (g *igdb) GetDateFormats(query string) ([]*pb.DateFormat, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/date_formats.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetDateFormats(query string) ([]*pb.DateFormat, error) {
|
||||
return data.Dateformats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatByID(id uint64) (*pb.DateFormat, error) {
|
||||
func (g *igdb) GetDateFormatByID(id uint64) (*pb.DateFormat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
dateFormats, err := g.GetDateFormats(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetDateFormatByID(id uint64) (*pb.DateFormat, error) {
|
||||
return dateFormats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatsByIDs(ids []uint64) ([]*pb.DateFormat, error) {
|
||||
func (g *igdb) GetDateFormatsByIDs(ids []uint64) ([]*pb.DateFormat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetDateFormatsByIDs(ids []uint64) ([]*pb.DateFormat, error) {
|
||||
return g.GetDateFormats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatsLength() (int, error) {
|
||||
func (g *igdb) GetDateFormatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
dateFormats, err := g.GetDateFormats(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetEventLogos(query string) ([]*pb.EventLogo, error) {
|
||||
func (g *igdb) GetEventLogos(query string) ([]*pb.EventLogo, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/event_logos.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetEventLogos(query string) ([]*pb.EventLogo, error) {
|
||||
return data.Eventlogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogoByID(id uint64) (*pb.EventLogo, error) {
|
||||
func (g *igdb) GetEventLogoByID(id uint64) (*pb.EventLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
eventLogos, err := g.GetEventLogos(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetEventLogoByID(id uint64) (*pb.EventLogo, error) {
|
||||
return eventLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogosByIDs(ids []uint64) ([]*pb.EventLogo, error) {
|
||||
func (g *igdb) GetEventLogosByIDs(ids []uint64) ([]*pb.EventLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetEventLogosByIDs(ids []uint64) ([]*pb.EventLogo, error) {
|
||||
return g.GetEventLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogosByEventID(id uint64) ([]*pb.EventLogo, error) {
|
||||
func (g *igdb) GetEventLogosByEventID(id uint64) ([]*pb.EventLogo, error) {
|
||||
query := fmt.Sprintf(`where event = %d; fields *;`, id)
|
||||
return g.GetEventLogos(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogosByEventIDs(ids []uint64) ([]*pb.EventLogo, error) {
|
||||
func (g *igdb) GetEventLogosByEventIDs(ids []uint64) ([]*pb.EventLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetEventLogosByEventIDs(ids []uint64) ([]*pb.EventLogo, error)
|
||||
return g.GetEventLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogosLength() (int, error) {
|
||||
func (g *igdb) GetEventLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
eventLogos, err := g.GetEventLogos(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetEventNetworks(query string) ([]*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworks(query string) ([]*pb.EventNetwork, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/event_networks.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetEventNetworks(query string) ([]*pb.EventNetwork, error) {
|
||||
return data.Eventnetworks, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworkByID(id uint64) (*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworkByID(id uint64) (*pb.EventNetwork, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
eventNetworks, err := g.GetEventNetworks(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetEventNetworkByID(id uint64) (*pb.EventNetwork, error) {
|
||||
return eventNetworks[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksByIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworksByIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetEventNetworksByIDs(ids []uint64) ([]*pb.EventNetwork, error)
|
||||
return g.GetEventNetworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksByEventID(id uint64) ([]*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworksByEventID(id uint64) ([]*pb.EventNetwork, error) {
|
||||
query := fmt.Sprintf(`where event = %d; fields *;`, id)
|
||||
return g.GetEventNetworks(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksByEventIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworksByEventIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetEventNetworksByEventIDs(ids []uint64) ([]*pb.EventNetwork, e
|
||||
return g.GetEventNetworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksByNetworkTypeID(id uint64) ([]*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworksByNetworkTypeID(id uint64) ([]*pb.EventNetwork, error) {
|
||||
query := fmt.Sprintf(`where network_type = %d; fields *;`, id)
|
||||
return g.GetEventNetworks(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksByNetworkTypeIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
func (g *igdb) GetEventNetworksByNetworkTypeIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetEventNetworksByNetworkTypeIDs(ids []uint64) ([]*pb.EventNetw
|
||||
return g.GetEventNetworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksLength() (int, error) {
|
||||
func (g *igdb) GetEventNetworksLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
eventNetworks, err := g.GetEventNetworks(query)
|
||||
if err != nil {
|
||||
|
14
events.go
14
events.go
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetEvents(query string) ([]*pb.Event, error) {
|
||||
func (g *igdb) GetEvents(query string) ([]*pb.Event, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/events.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetEvents(query string) ([]*pb.Event, error) {
|
||||
return data.Events, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventByID(id uint64) (*pb.Event, error) {
|
||||
func (g *igdb) GetEventByID(id uint64) (*pb.Event, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
events, err := g.GetEvents(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetEventByID(id uint64) (*pb.Event, error) {
|
||||
return events[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventsByIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
func (g *igdb) GetEventsByIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +47,12 @@ func (g *Client) GetEventsByIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
return g.GetEvents(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventsByEventLogoID(id uint64) ([]*pb.Event, error) {
|
||||
func (g *igdb) GetEventsByEventLogoID(id uint64) ([]*pb.Event, error) {
|
||||
query := fmt.Sprintf(`where event_logo = %d; fields *;`, id)
|
||||
return g.GetEvents(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventsByEventLogoIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
func (g *igdb) GetEventsByEventLogoIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +63,7 @@ func (g *Client) GetEventsByEventLogoIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
return g.GetEvents(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventsLength() (int, error) {
|
||||
func (g *igdb) GetEventsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
events, err := g.GetEvents(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetExternalGameSources(query string) ([]*pb.ExternalGameSource, error) {
|
||||
func (g *igdb) GetExternalGameSources(query string) ([]*pb.ExternalGameSource, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/external_game_sources.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetExternalGameSources(query string) ([]*pb.ExternalGameSource,
|
||||
return data.Externalgamesources, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameSourceByID(id uint64) (*pb.ExternalGameSource, error) {
|
||||
func (g *igdb) GetExternalGameSourceByID(id uint64) (*pb.ExternalGameSource, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
externalGameSources, err := g.GetExternalGameSources(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetExternalGameSourceByID(id uint64) (*pb.ExternalGameSource, e
|
||||
return externalGameSources[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameSourcesByIDs(ids []uint64) ([]*pb.ExternalGameSource, error) {
|
||||
func (g *igdb) GetExternalGameSourcesByIDs(ids []uint64) ([]*pb.ExternalGameSource, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetExternalGameSourcesByIDs(ids []uint64) ([]*pb.ExternalGameSo
|
||||
return g.GetExternalGameSources(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameSourcesLength() (int, error) {
|
||||
func (g *igdb) GetExternalGameSourcesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
externalGameSources, err := g.GetExternalGameSources(query)
|
||||
if err != nil {
|
||||
|
@ -2,15 +2,14 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetExternalGames(query string) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGames(query string) ([]*pb.ExternalGame, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/external_games.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -28,7 +27,7 @@ func (g *Client) GetExternalGames(query string) ([]*pb.ExternalGame, error) {
|
||||
return data.Externalgames, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameByID(id uint64) (*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGameByID(id uint64) (*pb.ExternalGame, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
externalGames, err := g.GetExternalGames(query)
|
||||
if err != nil {
|
||||
@ -37,7 +36,7 @@ func (g *Client) GetExternalGameByID(id uint64) (*pb.ExternalGame, error) {
|
||||
return externalGames[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -48,7 +47,7 @@ func (g *Client) GetExternalGamesByIDs(ids []uint64) ([]*pb.ExternalGame, error)
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameIDBySteamAppID(id uint64) (uint64, error) {
|
||||
func (g *igdb) GetGameIDBySteamAppID(id uint64) (uint64, error) {
|
||||
query := fmt.Sprintf(`where game_type.id = 0 & uid = "%d"; fields game;`, id)
|
||||
externalGames, err := g.GetExternalGames(query)
|
||||
if err != nil {
|
||||
@ -57,7 +56,7 @@ func (g *Client) GetGameIDBySteamAppID(id uint64) (uint64, error) {
|
||||
return externalGames[0].Game.Id, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetSteamIDByGameID(id uint64) (uint64, error) {
|
||||
func (g *igdb) GetSteamIDByGameID(id uint64) (uint64, error) {
|
||||
query := fmt.Sprintf(`where game = %v & game_type.id = 0; fields *;`, id)
|
||||
externalGames, err := g.GetExternalGames(query)
|
||||
if err != nil {
|
||||
@ -66,17 +65,17 @@ func (g *Client) GetSteamIDByGameID(id uint64) (uint64, error) {
|
||||
return strconv.ParseUint(externalGames[0].Uid, 10, 64)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByGameID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByGameID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetExternalGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByExternalGameSourceID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByExternalGameSourceID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
query := fmt.Sprintf(`where external_game_source = %d; fields *;`, id)
|
||||
return g.GetExternalGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByExternalGameSourceIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByExternalGameSourceIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -87,12 +86,12 @@ func (g *Client) GetExternalGamesByExternalGameSourceIDs(ids []uint64) ([]*pb.Ex
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByGameReleaseFormatID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByGameReleaseFormatID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
query := fmt.Sprintf(`where game_release_format = %d; fields *;`, id)
|
||||
return g.GetExternalGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByGameReleaseFormatIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByGameReleaseFormatIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -103,12 +102,12 @@ func (g *Client) GetExternalGamesByGameReleaseFormatIDs(ids []uint64) ([]*pb.Ext
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByPlatformVersionID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByPlatformVersionID(id uint64) ([]*pb.ExternalGame, error) {
|
||||
query := fmt.Sprintf(`where platform_version = %d; fields *;`, id)
|
||||
return g.GetExternalGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByPlatformVersionIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
func (g *igdb) GetExternalGamesByPlatformVersionIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -119,7 +118,7 @@ func (g *Client) GetExternalGamesByPlatformVersionIDs(ids []uint64) ([]*pb.Exter
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesLength() (int, error) {
|
||||
func (g *igdb) GetExternalGamesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
externalGames, err := g.GetExternalGames(query)
|
||||
if err != nil {
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetFranchises(query string) ([]*pb.Franchise, error) {
|
||||
func (g *igdb) GetFranchises(query string) ([]*pb.Franchise, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/franchises.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetFranchises(query string) ([]*pb.Franchise, error) {
|
||||
return data.Franchises, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetFranchiseByID(id uint64) (*pb.Franchise, error) {
|
||||
func (g *igdb) GetFranchiseByID(id uint64) (*pb.Franchise, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
franchises, err := g.GetFranchises(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetFranchiseByID(id uint64) (*pb.Franchise, error) {
|
||||
return franchises[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetFranchisesByIDs(ids []uint64) ([]*pb.Franchise, error) {
|
||||
func (g *igdb) GetFranchisesByIDs(ids []uint64) ([]*pb.Franchise, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +47,7 @@ func (g *Client) GetFranchisesByIDs(ids []uint64) ([]*pb.Franchise, error) {
|
||||
return g.GetFranchises(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetFranchisesLength() (int, error) {
|
||||
func (g *igdb) GetFranchisesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
franchises, err := g.GetFranchises(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameEngineLogos(query string) ([]*pb.GameEngineLogo, error) {
|
||||
func (g *igdb) GetGameEngineLogos(query string) ([]*pb.GameEngineLogo, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_engine_logos.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameEngineLogos(query string) ([]*pb.GameEngineLogo, error)
|
||||
return data.Gameenginelogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineLogoByID(id uint64) (*pb.GameEngineLogo, error) {
|
||||
func (g *igdb) GetGameEngineLogoByID(id uint64) (*pb.GameEngineLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameEngineLogos, err := g.GetGameEngineLogos(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameEngineLogoByID(id uint64) (*pb.GameEngineLogo, error) {
|
||||
return gameEngineLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineLogosByIDs(ids []uint64) ([]*pb.GameEngineLogo, error) {
|
||||
func (g *igdb) GetGameEngineLogosByIDs(ids []uint64) ([]*pb.GameEngineLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGameEngineLogosByIDs(ids []uint64) ([]*pb.GameEngineLogo, er
|
||||
return g.GetGameEngineLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineLogosLength() (int, error) {
|
||||
func (g *igdb) GetGameEngineLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameEngineLogos, err := g.GetGameEngineLogos(query)
|
||||
if err != nil {
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameEngines(query string) ([]*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEngines(query string) ([]*pb.GameEngine, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_engines.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetGameEngines(query string) ([]*pb.GameEngine, error) {
|
||||
return data.Gameengines, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineByID(id uint64) (*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEngineByID(id uint64) (*pb.GameEngine, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameEngines, err := g.GetGameEngines(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetGameEngineByID(id uint64) (*pb.GameEngine, error) {
|
||||
return gameEngines[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesByIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEnginesByIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +47,12 @@ func (g *Client) GetGameEnginesByIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
return g.GetGameEngines(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesByGameID(id uint64) ([]*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEnginesByGameID(id uint64) ([]*pb.GameEngine, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetGameEngines(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesByGameIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEnginesByGameIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +63,12 @@ func (g *Client) GetGameEnginesByGameIDs(ids []uint64) ([]*pb.GameEngine, error)
|
||||
return g.GetGameEngines(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesByLogoID(id uint64) ([]*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEnginesByLogoID(id uint64) ([]*pb.GameEngine, error) {
|
||||
query := fmt.Sprintf(`where logo = %d; fields *;`, id)
|
||||
return g.GetGameEngines(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesByLogoIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
func (g *igdb) GetGameEnginesByLogoIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +79,7 @@ func (g *Client) GetGameEnginesByLogoIDs(ids []uint64) ([]*pb.GameEngine, error)
|
||||
return g.GetGameEngines(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesLength() (int, error) {
|
||||
func (g *igdb) GetGameEnginesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameEngines, err := g.GetGameEngines(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameLocalizations(query string) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizations(query string) ([]*pb.GameLocalization, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_localizations.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameLocalizations(query string) ([]*pb.GameLocalization, err
|
||||
return data.Gamelocalizations, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationByID(id uint64) (*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationByID(id uint64) (*pb.GameLocalization, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameLocalizations, err := g.GetGameLocalizations(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameLocalizationByID(id uint64) (*pb.GameLocalization, error
|
||||
return gameLocalizations[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetGameLocalizationsByIDs(ids []uint64) ([]*pb.GameLocalization
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByGameID(id uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByGameID(id uint64) ([]*pb.GameLocalization, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetGameLocalizations(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByGameIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByGameIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetGameLocalizationsByGameIDs(ids []uint64) ([]*pb.GameLocaliza
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByCoverID(id uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByCoverID(id uint64) ([]*pb.GameLocalization, error) {
|
||||
query := fmt.Sprintf(`where cover = %d; fields *;`, id)
|
||||
return g.GetGameLocalizations(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByCoverIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByCoverIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +78,12 @@ func (g *Client) GetGameLocalizationsByCoverIDs(ids []uint64) ([]*pb.GameLocaliz
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByRegionID(id uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByRegionID(id uint64) ([]*pb.GameLocalization, error) {
|
||||
query := fmt.Sprintf(`where region = %d; fields *;`, id)
|
||||
return g.GetGameLocalizations(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByRegionIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
func (g *igdb) GetGameLocalizationsByRegionIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,7 +94,7 @@ func (g *Client) GetGameLocalizationsByRegionIDs(ids []uint64) ([]*pb.GameLocali
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsLength() (int, error) {
|
||||
func (g *igdb) GetGameLocalizationsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameLocalizations, err := g.GetGameLocalizations(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameModes(query string) ([]*pb.GameMode, error) {
|
||||
func (g *igdb) GetGameModes(query string) ([]*pb.GameMode, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_modes.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameModes(query string) ([]*pb.GameMode, error) {
|
||||
return data.Gamemodes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameModeByID(id uint64) (*pb.GameMode, error) {
|
||||
func (g *igdb) GetGameModeByID(id uint64) (*pb.GameMode, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameModes, err := g.GetGameModes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameModeByID(id uint64) (*pb.GameMode, error) {
|
||||
return gameModes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameModesByIDs(ids []uint64) ([]*pb.GameMode, error) {
|
||||
func (g *igdb) GetGameModesByIDs(ids []uint64) ([]*pb.GameMode, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGameModesByIDs(ids []uint64) ([]*pb.GameMode, error) {
|
||||
return g.GetGameModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameModesLength() (int, error) {
|
||||
func (g *igdb) GetGameModesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameModes, err := g.GetGameModes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameReleaseFormats(query string) ([]*pb.GameReleaseFormat, error) {
|
||||
func (g *igdb) GetGameReleaseFormats(query string) ([]*pb.GameReleaseFormat, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_release_formats.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameReleaseFormats(query string) ([]*pb.GameReleaseFormat, e
|
||||
return data.Gamereleaseformats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameReleaseFormatByID(id uint64) (*pb.GameReleaseFormat, error) {
|
||||
func (g *igdb) GetGameReleaseFormatByID(id uint64) (*pb.GameReleaseFormat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameReleaseFormats, err := g.GetGameReleaseFormats(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameReleaseFormatByID(id uint64) (*pb.GameReleaseFormat, err
|
||||
return gameReleaseFormats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameReleaseFormatsByIDs(ids []uint64) ([]*pb.GameReleaseFormat, error) {
|
||||
func (g *igdb) GetGameReleaseFormatsByIDs(ids []uint64) ([]*pb.GameReleaseFormat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGameReleaseFormatsByIDs(ids []uint64) ([]*pb.GameReleaseForm
|
||||
return g.GetGameReleaseFormats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameReleaseFormatsLength() (int, error) {
|
||||
func (g *igdb) GetGameReleaseFormatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameReleaseFormats, err := g.GetGameReleaseFormats(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameStatuses(query string) ([]*pb.GameStatus, error) {
|
||||
func (g *igdb) GetGameStatuses(query string) ([]*pb.GameStatus, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_statuses.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameStatuses(query string) ([]*pb.GameStatus, error) {
|
||||
return data.Gamestatuses, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameStatusByID(id uint64) (*pb.GameStatus, error) {
|
||||
func (g *igdb) GetGameStatusByID(id uint64) (*pb.GameStatus, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameStatuses, err := g.GetGameStatuses(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameStatusByID(id uint64) (*pb.GameStatus, error) {
|
||||
return gameStatuses[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameStatusesByIDs(ids []uint64) ([]*pb.GameStatus, error) {
|
||||
func (g *igdb) GetGameStatusesByIDs(ids []uint64) ([]*pb.GameStatus, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGameStatusesByIDs(ids []uint64) ([]*pb.GameStatus, error) {
|
||||
return g.GetGameStatuses(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameStatusesLength() (int, error) {
|
||||
func (g *igdb) GetGameStatusesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameStatuses, err := g.GetGameStatuses(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameTimeToBeats(query string) ([]*pb.GameTimeToBeat, error) {
|
||||
func (g *igdb) GetGameTimeToBeats(query string) ([]*pb.GameTimeToBeat, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_time_to_beats.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameTimeToBeats(query string) ([]*pb.GameTimeToBeat, error)
|
||||
return data.Gametimetobeats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatByID(id uint64) (*pb.GameTimeToBeat, error) {
|
||||
func (g *igdb) GetGameTimeToBeatByID(id uint64) (*pb.GameTimeToBeat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameTimeToBeats, err := g.GetGameTimeToBeats(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameTimeToBeatByID(id uint64) (*pb.GameTimeToBeat, error) {
|
||||
return gameTimeToBeats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatsByIDs(ids []uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
func (g *igdb) GetGameTimeToBeatsByIDs(ids []uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetGameTimeToBeatsByIDs(ids []uint64) ([]*pb.GameTimeToBeat, er
|
||||
return g.GetGameTimeToBeats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatsByGameID(id uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
func (g *igdb) GetGameTimeToBeatsByGameID(id uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetGameTimeToBeats(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatsByGameIDs(ids []uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
func (g *igdb) GetGameTimeToBeatsByGameIDs(ids []uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetGameTimeToBeatsByGameIDs(ids []uint64) ([]*pb.GameTimeToBeat
|
||||
return g.GetGameTimeToBeats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatsLength() (int, error) {
|
||||
func (g *igdb) GetGameTimeToBeatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameTimeToBeats, err := g.GetGameTimeToBeats(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameTypes(query string) ([]*pb.GameType, error) {
|
||||
func (g *igdb) GetGameTypes(query string) ([]*pb.GameType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameTypes(query string) ([]*pb.GameType, error) {
|
||||
return data.Gametypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTypeByID(id uint64) (*pb.GameType, error) {
|
||||
func (g *igdb) GetGameTypeByID(id uint64) (*pb.GameType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameTypes, err := g.GetGameTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameTypeByID(id uint64) (*pb.GameType, error) {
|
||||
return gameTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTypesByIDs(ids []uint64) ([]*pb.GameType, error) {
|
||||
func (g *igdb) GetGameTypesByIDs(ids []uint64) ([]*pb.GameType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGameTypesByIDs(ids []uint64) ([]*pb.GameType, error) {
|
||||
return g.GetGameTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTypesLength() (int, error) {
|
||||
func (g *igdb) GetGameTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameTypes, err := g.GetGameTypes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValues(query string) ([]*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValues(query string) ([]*pb.GameVersionFeatureValue, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_version_feature_values.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameVersionFeatureValues(query string) ([]*pb.GameVersionFea
|
||||
return data.Gameversionfeaturevalues, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValueByID(id uint64) (*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValueByID(id uint64) (*pb.GameVersionFeatureValue, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVersionFeatureValues, err := g.GetGameVersionFeatureValues(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameVersionFeatureValueByID(id uint64) (*pb.GameVersionFeatu
|
||||
return gameVersionFeatureValues[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesByIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValuesByIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetGameVersionFeatureValuesByIDs(ids []uint64) ([]*pb.GameVersi
|
||||
return g.GetGameVersionFeatureValues(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesByGameID(id uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValuesByGameID(id uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetGameVersionFeatureValues(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesByGameIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValuesByGameIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetGameVersionFeatureValuesByGameIDs(ids []uint64) ([]*pb.GameV
|
||||
return g.GetGameVersionFeatureValues(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesByGameVersionFeatureID(id uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValuesByGameVersionFeatureID(id uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
query := fmt.Sprintf(`where game_version_feature = %d; fields *;`, id)
|
||||
return g.GetGameVersionFeatureValues(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesByGameVersionFeatureIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValuesByGameVersionFeatureIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetGameVersionFeatureValuesByGameVersionFeatureIDs(ids []uint64
|
||||
return g.GetGameVersionFeatureValues(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesLength() (int, error) {
|
||||
func (g *igdb) GetGameVersionFeatureValuesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVersionFeatureValues, err := g.GetGameVersionFeatureValues(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameVersionFeatures(query string) ([]*pb.GameVersionFeature, error) {
|
||||
func (g *igdb) GetGameVersionFeatures(query string) ([]*pb.GameVersionFeature, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_version_features.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameVersionFeatures(query string) ([]*pb.GameVersionFeature,
|
||||
return data.Gameversionfeatures, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureByID(id uint64) (*pb.GameVersionFeature, error) {
|
||||
func (g *igdb) GetGameVersionFeatureByID(id uint64) (*pb.GameVersionFeature, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVersionFeatures, err := g.GetGameVersionFeatures(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameVersionFeatureByID(id uint64) (*pb.GameVersionFeature, e
|
||||
return gameVersionFeatures[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeaturesByIDs(ids []uint64) ([]*pb.GameVersionFeature, error) {
|
||||
func (g *igdb) GetGameVersionFeaturesByIDs(ids []uint64) ([]*pb.GameVersionFeature, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGameVersionFeaturesByIDs(ids []uint64) ([]*pb.GameVersionFea
|
||||
return g.GetGameVersionFeatures(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeaturesLength() (int, error) {
|
||||
func (g *igdb) GetGameVersionFeaturesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVersionFeatures, err := g.GetGameVersionFeatures(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameVersions(query string) ([]*pb.GameVersion, error) {
|
||||
func (g *igdb) GetGameVersions(query string) ([]*pb.GameVersion, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_versions.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameVersions(query string) ([]*pb.GameVersion, error) {
|
||||
return data.Gameversions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionByID(id uint64) (*pb.GameVersion, error) {
|
||||
func (g *igdb) GetGameVersionByID(id uint64) (*pb.GameVersion, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVersions, err := g.GetGameVersions(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameVersionByID(id uint64) (*pb.GameVersion, error) {
|
||||
return gameVersions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionsByIDs(ids []uint64) ([]*pb.GameVersion, error) {
|
||||
func (g *igdb) GetGameVersionsByIDs(ids []uint64) ([]*pb.GameVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetGameVersionsByIDs(ids []uint64) ([]*pb.GameVersion, error) {
|
||||
return g.GetGameVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionsByGameID(id uint64) ([]*pb.GameVersion, error) {
|
||||
func (g *igdb) GetGameVersionsByGameID(id uint64) ([]*pb.GameVersion, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetGameVersions(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionsByGameIDs(ids []uint64) ([]*pb.GameVersion, error) {
|
||||
func (g *igdb) GetGameVersionsByGameIDs(ids []uint64) ([]*pb.GameVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetGameVersionsByGameIDs(ids []uint64) ([]*pb.GameVersion, erro
|
||||
return g.GetGameVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionsLength() (int, error) {
|
||||
func (g *igdb) GetGameVersionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVersions, err := g.GetGameVersions(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGameVideos(query string) ([]*pb.GameVideo, error) {
|
||||
func (g *igdb) GetGameVideos(query string) ([]*pb.GameVideo, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/game_videos.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGameVideos(query string) ([]*pb.GameVideo, error) {
|
||||
return data.Gamevideos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideoByID(id uint64) (*pb.GameVideo, error) {
|
||||
func (g *igdb) GetGameVideoByID(id uint64) (*pb.GameVideo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVideos, err := g.GetGameVideos(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGameVideoByID(id uint64) (*pb.GameVideo, error) {
|
||||
return gameVideos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideosByIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
func (g *igdb) GetGameVideosByIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetGameVideosByIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
return g.GetGameVideos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideosByGameID(id uint64) ([]*pb.GameVideo, error) {
|
||||
func (g *igdb) GetGameVideosByGameID(id uint64) ([]*pb.GameVideo, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetGameVideos(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideosByGameIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
func (g *igdb) GetGameVideosByGameIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetGameVideosByGameIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
return g.GetGameVideos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideosLength() (int, error) {
|
||||
func (g *igdb) GetGameVideosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVideos, err := g.GetGameVideos(query)
|
||||
if err != nil {
|
||||
|
38
games.go
38
games.go
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGames(query string) ([]*pb.Game, error) {
|
||||
func (g *igdb) 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)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetGames(query string) ([]*pb.Game, error) {
|
||||
return data.Games, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByID(id uint64) (*pb.Game, error) {
|
||||
func (g *igdb) GetGameByID(id uint64) (*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
games, err := g.GetGames(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetGameByID(id uint64) (*pb.Game, error) {
|
||||
return games[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +47,12 @@ func (g *Client) GetGameByIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByCollectionID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByCollectionID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where collection = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByCollectionIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByCollectionIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +63,12 @@ func (g *Client) GetGamesByCollectionIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByCoverID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByCoverID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where cover = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByCoverIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByCoverIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +79,12 @@ func (g *Client) GetGamesByCoverIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByFranchiseID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByFranchiseID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where franchise = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByFranchiseIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByFranchiseIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,12 +95,12 @@ func (g *Client) GetGamesByFranchiseIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByGameStatusID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByGameStatusID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where game_status = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByGameStatusIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByGameStatusIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -111,12 +111,12 @@ func (g *Client) GetGamesByGameStatusIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByGameTypeID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByGameTypeID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where game_type = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByGameTypeIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByGameTypeIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -127,12 +127,12 @@ func (g *Client) GetGamesByGameTypeIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByParentGameID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByParentGameID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where parent_game = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByParentGameIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByParentGameIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -143,12 +143,12 @@ func (g *Client) GetGamesByParentGameIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByVersionParentGameID(id uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGameByVersionParentGameID(id uint64) ([]*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where version_parent = %d; fields *;`, id)
|
||||
return g.GetGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesByVersionParentGameIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
func (g *igdb) GetGamesByVersionParentGameIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -159,7 +159,7 @@ func (g *Client) GetGamesByVersionParentGameIDs(ids []uint64) ([]*pb.Game, error
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesLength() (int, error) {
|
||||
func (g *igdb) GetGamesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
games, err := g.GetGames(query)
|
||||
if err != nil {
|
||||
|
11
genres.go
11
genres.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetGenres(query string) ([]*pb.Genre, error) {
|
||||
func (g *igdb) GetGenres(query string) ([]*pb.Genre, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/genres.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetGenres(query string) ([]*pb.Genre, error) {
|
||||
return data.Genres, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGenreByID(id uint64) (*pb.Genre, error) {
|
||||
func (g *igdb) GetGenreByID(id uint64) (*pb.Genre, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
genres, err := g.GetGenres(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetGenreByID(id uint64) (*pb.Genre, error) {
|
||||
return genres[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGenresByIDs(ids []uint64) ([]*pb.Genre, error) {
|
||||
func (g *igdb) GetGenresByIDs(ids []uint64) ([]*pb.Genre, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetGenresByIDs(ids []uint64) ([]*pb.Genre, error) {
|
||||
return g.GetGenres(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGenresLength() (int, error) {
|
||||
func (g *igdb) GetGenresLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
genres, err := g.GetGenres(query)
|
||||
if err != nil {
|
||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/bestnite/go-igdb
|
||||
module github/bestnite/go-igdb
|
||||
|
||||
go 1.24.1
|
||||
|
||||
|
19
igdb.go
19
igdb.go
@ -7,34 +7,29 @@ import (
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
type igdb struct {
|
||||
clientID string
|
||||
token *twitchToken
|
||||
flaresolverr *flaresolverr.Flaresolverr
|
||||
limiter *rateLimiter
|
||||
}
|
||||
|
||||
func New(clientID, clientSecret string) *Client {
|
||||
return &Client{
|
||||
func New(clientID, clientSecret string) *igdb {
|
||||
return &igdb{
|
||||
clientID: clientID,
|
||||
limiter: newRateLimiter(4),
|
||||
token: NewTwitchToken(clientID, clientSecret),
|
||||
flaresolverr: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *Client {
|
||||
return &Client{
|
||||
func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *igdb {
|
||||
return &igdb{
|
||||
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()
|
||||
|
||||
func (g *igdb) Request(URL string, dataBody any) (*resty.Response, error) {
|
||||
t, err := g.token.getToken()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get twitch token: %w", err)
|
||||
@ -53,7 +48,7 @@ func (g *Client) Request(URL string, dataBody any) (*resty.Response, error) {
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (g *Client) getFlaresolverr() (*flaresolverr.Flaresolverr, error) {
|
||||
func (g *igdb) getFlaresolverr() (*flaresolverr.Flaresolverr, error) {
|
||||
if g.flaresolverr == nil {
|
||||
return nil, fmt.Errorf("flaresolverr is not initialized")
|
||||
}
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetInvolvedCompanies(query string) ([]*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompanies(query string) ([]*pb.InvolvedCompany, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/involved_companies.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetInvolvedCompanies(query string) ([]*pb.InvolvedCompany, erro
|
||||
return data.Involvedcompanies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompanyByID(id uint64) (*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompanyByID(id uint64) (*pb.InvolvedCompany, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
involvedCompanies, err := g.GetInvolvedCompanies(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetInvolvedCompanyByID(id uint64) (*pb.InvolvedCompany, error)
|
||||
return involvedCompanies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesByIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompaniesByIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetInvolvedCompaniesByIDs(ids []uint64) ([]*pb.InvolvedCompany,
|
||||
return g.GetInvolvedCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesByGameID(id uint64) ([]*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompaniesByGameID(id uint64) ([]*pb.InvolvedCompany, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetInvolvedCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesByGameIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompaniesByGameIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetInvolvedCompaniesByGameIDs(ids []uint64) ([]*pb.InvolvedComp
|
||||
return g.GetInvolvedCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesByCompanyID(id uint64) ([]*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompaniesByCompanyID(id uint64) ([]*pb.InvolvedCompany, error) {
|
||||
query := fmt.Sprintf(`where company = %d; fields *;`, id)
|
||||
return g.GetInvolvedCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesByCompanyIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
func (g *igdb) GetInvolvedCompaniesByCompanyIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetInvolvedCompaniesByCompanyIDs(ids []uint64) ([]*pb.InvolvedC
|
||||
return g.GetInvolvedCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesLength() (int, error) {
|
||||
func (g *igdb) GetInvolvedCompaniesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
involvedCompanies, err := g.GetInvolvedCompanies(query)
|
||||
if err != nil {
|
||||
|
11
keywords.go
11
keywords.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetKeywords(query string) ([]*pb.Keyword, error) {
|
||||
func (g *igdb) GetKeywords(query string) ([]*pb.Keyword, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/keywords.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetKeywords(query string) ([]*pb.Keyword, error) {
|
||||
return data.Keywords, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetKeywordByID(id uint64) (*pb.Keyword, error) {
|
||||
func (g *igdb) GetKeywordByID(id uint64) (*pb.Keyword, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
keywords, err := g.GetKeywords(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetKeywordByID(id uint64) (*pb.Keyword, error) {
|
||||
return keywords[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetKeywordsByIDs(ids []uint64) ([]*pb.Keyword, error) {
|
||||
func (g *igdb) GetKeywordsByIDs(ids []uint64) ([]*pb.Keyword, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetKeywordsByIDs(ids []uint64) ([]*pb.Keyword, error) {
|
||||
return g.GetKeywords(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetKeywordsLength() (int, error) {
|
||||
func (g *igdb) GetKeywordsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
keywords, err := g.GetKeywords(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetLanguageSupportTypes(query string) ([]*pb.LanguageSupportType, error) {
|
||||
func (g *igdb) GetLanguageSupportTypes(query string) ([]*pb.LanguageSupportType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/language_support_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetLanguageSupportTypes(query string) ([]*pb.LanguageSupportTyp
|
||||
return data.Languagesupporttypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportTypeByID(id uint64) (*pb.LanguageSupportType, error) {
|
||||
func (g *igdb) GetLanguageSupportTypeByID(id uint64) (*pb.LanguageSupportType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
languageSupportTypes, err := g.GetLanguageSupportTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetLanguageSupportTypeByID(id uint64) (*pb.LanguageSupportType,
|
||||
return languageSupportTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportTypesByIDs(ids []uint64) ([]*pb.LanguageSupportType, error) {
|
||||
func (g *igdb) GetLanguageSupportTypesByIDs(ids []uint64) ([]*pb.LanguageSupportType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetLanguageSupportTypesByIDs(ids []uint64) ([]*pb.LanguageSuppo
|
||||
return g.GetLanguageSupportTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportTypesLength() (int, error) {
|
||||
func (g *igdb) GetLanguageSupportTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
languageSupportTypes, err := g.GetLanguageSupportTypes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetLanguageSupports(query string) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupports(query string) ([]*pb.LanguageSupport, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/language_supports.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetLanguageSupports(query string) ([]*pb.LanguageSupport, error
|
||||
return data.Languagesupports, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportByID(id uint64) (*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportByID(id uint64) (*pb.LanguageSupport, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
languageSupports, err := g.GetLanguageSupports(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetLanguageSupportByID(id uint64) (*pb.LanguageSupport, error)
|
||||
return languageSupports[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetLanguageSupportsByIDs(ids []uint64) ([]*pb.LanguageSupport,
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByGameID(id uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByGameID(id uint64) ([]*pb.LanguageSupport, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetLanguageSupports(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByGameIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByGameIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetLanguageSupportsByGameIDs(ids []uint64) ([]*pb.LanguageSuppo
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByLanguageID(id uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByLanguageID(id uint64) ([]*pb.LanguageSupport, error) {
|
||||
query := fmt.Sprintf(`where language = %d; fields *;`, id)
|
||||
return g.GetLanguageSupports(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByLanguageIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByLanguageIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +78,12 @@ func (g *Client) GetLanguageSupportsByLanguageIDs(ids []uint64) ([]*pb.LanguageS
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByLanguageSupportTypeID(id uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByLanguageSupportTypeID(id uint64) ([]*pb.LanguageSupport, error) {
|
||||
query := fmt.Sprintf(`where language_support_type = %d; fields *;`, id)
|
||||
return g.GetLanguageSupports(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByLanguageSupportTypeIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
func (g *igdb) GetLanguageSupportsByLanguageSupportTypeIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,7 +94,7 @@ func (g *Client) GetLanguageSupportsByLanguageSupportTypeIDs(ids []uint64) ([]*p
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsLength() (int, error) {
|
||||
func (g *igdb) GetLanguageSupportsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
languageSupports, err := g.GetLanguageSupports(query)
|
||||
if err != nil {
|
||||
|
11
languages.go
11
languages.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetLanguages(query string) ([]*pb.Language, error) {
|
||||
func (g *igdb) GetLanguages(query string) ([]*pb.Language, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/languages.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetLanguages(query string) ([]*pb.Language, error) {
|
||||
return data.Languages, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageByID(id uint64) (*pb.Language, error) {
|
||||
func (g *igdb) GetLanguageByID(id uint64) (*pb.Language, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
languages, err := g.GetLanguages(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetLanguageByID(id uint64) (*pb.Language, error) {
|
||||
return languages[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguagesByIDs(ids []uint64) ([]*pb.Language, error) {
|
||||
func (g *igdb) GetLanguagesByIDs(ids []uint64) ([]*pb.Language, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetLanguagesByIDs(ids []uint64) ([]*pb.Language, error) {
|
||||
return g.GetLanguages(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguagesLength() (int, error) {
|
||||
func (g *igdb) GetLanguagesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
languages, err := g.GetLanguages(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetMultiplayerModes(query string) ([]*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModes(query string) ([]*pb.MultiplayerMode, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/multiplayer_modes.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetMultiplayerModes(query string) ([]*pb.MultiplayerMode, error
|
||||
return data.Multiplayermodes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModeByID(id uint64) (*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModeByID(id uint64) (*pb.MultiplayerMode, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
multiplayerModes, err := g.GetMultiplayerModes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetMultiplayerModeByID(id uint64) (*pb.MultiplayerMode, error)
|
||||
return multiplayerModes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesByIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModesByIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetMultiplayerModesByIDs(ids []uint64) ([]*pb.MultiplayerMode,
|
||||
return g.GetMultiplayerModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesByGameID(id uint64) ([]*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModesByGameID(id uint64) ([]*pb.MultiplayerMode, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetMultiplayerModes(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesByGameIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModesByGameIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetMultiplayerModesByGameIDs(ids []uint64) ([]*pb.MultiplayerMo
|
||||
return g.GetMultiplayerModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesByPlatformID(id uint64) ([]*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModesByPlatformID(id uint64) ([]*pb.MultiplayerMode, error) {
|
||||
query := fmt.Sprintf(`where platform = %d; fields *;`, id)
|
||||
return g.GetMultiplayerModes(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesByPlatformIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
func (g *igdb) GetMultiplayerModesByPlatformIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetMultiplayerModesByPlatformIDs(ids []uint64) ([]*pb.Multiplay
|
||||
return g.GetMultiplayerModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesLength() (int, error) {
|
||||
func (g *igdb) GetMultiplayerModesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
multiplayerModes, err := g.GetMultiplayerModes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetNetworkTypes(query string) ([]*pb.NetworkType, error) {
|
||||
func (g *igdb) GetNetworkTypes(query string) ([]*pb.NetworkType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/network_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetNetworkTypes(query string) ([]*pb.NetworkType, error) {
|
||||
return data.Networktypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetNetworkTypeByID(id uint64) (*pb.NetworkType, error) {
|
||||
func (g *igdb) GetNetworkTypeByID(id uint64) (*pb.NetworkType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
networkTypes, err := g.GetNetworkTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetNetworkTypeByID(id uint64) (*pb.NetworkType, error) {
|
||||
return networkTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetNetworkTypesByIDs(ids []uint64) ([]*pb.NetworkType, error) {
|
||||
func (g *igdb) GetNetworkTypesByIDs(ids []uint64) ([]*pb.NetworkType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetNetworkTypesByIDs(ids []uint64) ([]*pb.NetworkType, error) {
|
||||
return g.GetNetworkTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetNetworkTypesLength() (int, error) {
|
||||
func (g *igdb) GetNetworkTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
networkTypes, err := g.GetNetworkTypes(query)
|
||||
if err != nil {
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (g *Client) GetParentGameID(id uint64) (uint64, error) {
|
||||
func (g *igdb) GetParentGameID(id uint64) (uint64, error) {
|
||||
detail, err := g.GetGameByID(id)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to fetch IGDB app detail for parent: %d: %w", id, err)
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformFamilies(query string) ([]*pb.PlatformFamily, error) {
|
||||
func (g *igdb) GetPlatformFamilies(query string) ([]*pb.PlatformFamily, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_families.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlatformFamilies(query string) ([]*pb.PlatformFamily, error)
|
||||
return data.Platformfamilies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformFamilyByID(id uint64) (*pb.PlatformFamily, error) {
|
||||
func (g *igdb) GetPlatformFamilyByID(id uint64) (*pb.PlatformFamily, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformFamilies, err := g.GetPlatformFamilies(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlatformFamilyByID(id uint64) (*pb.PlatformFamily, error) {
|
||||
return platformFamilies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformFamiliesByIDs(ids []uint64) ([]*pb.PlatformFamily, error) {
|
||||
func (g *igdb) GetPlatformFamiliesByIDs(ids []uint64) ([]*pb.PlatformFamily, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetPlatformFamiliesByIDs(ids []uint64) ([]*pb.PlatformFamily, e
|
||||
return g.GetPlatformFamilies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformFamiliesLength() (int, error) {
|
||||
func (g *igdb) GetPlatformFamiliesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformFamilies, err := g.GetPlatformFamilies(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformLogos(query string) ([]*pb.PlatformLogo, error) {
|
||||
func (g *igdb) GetPlatformLogos(query string) ([]*pb.PlatformLogo, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_logos.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlatformLogos(query string) ([]*pb.PlatformLogo, error) {
|
||||
return data.Platformlogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformLogoByID(id uint64) (*pb.PlatformLogo, error) {
|
||||
func (g *igdb) GetPlatformLogoByID(id uint64) (*pb.PlatformLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformLogos, err := g.GetPlatformLogos(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlatformLogoByID(id uint64) (*pb.PlatformLogo, error) {
|
||||
return platformLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformLogosByIDs(ids []uint64) ([]*pb.PlatformLogo, error) {
|
||||
func (g *igdb) GetPlatformLogosByIDs(ids []uint64) ([]*pb.PlatformLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetPlatformLogosByIDs(ids []uint64) ([]*pb.PlatformLogo, error)
|
||||
return g.GetPlatformLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformLogosLength() (int, error) {
|
||||
func (g *igdb) GetPlatformLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformLogos, err := g.GetPlatformLogos(query)
|
||||
if err != nil {
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformTypes(query string) ([]*pb.PlatformType, error) {
|
||||
func (g *igdb) GetPlatformTypes(query string) ([]*pb.PlatformType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +27,7 @@ func (g *Client) GetPlatformTypes(query string) ([]*pb.PlatformType, error) {
|
||||
return data.Platformtypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformTypeByID(id uint64) (*pb.PlatformType, error) {
|
||||
func (g *igdb) GetPlatformTypeByID(id uint64) (*pb.PlatformType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformTypes, err := g.GetPlatformTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +36,7 @@ func (g *Client) GetPlatformTypeByID(id uint64) (*pb.PlatformType, error) {
|
||||
return platformTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformTypesByIDs(ids []uint64) ([]*pb.PlatformType, error) {
|
||||
func (g *igdb) GetPlatformTypesByIDs(ids []uint64) ([]*pb.PlatformType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +47,7 @@ func (g *Client) GetPlatformTypesByIDs(ids []uint64) ([]*pb.PlatformType, error)
|
||||
return g.GetPlatformTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformTypesLength() (int, error) {
|
||||
func (g *igdb) GetPlatformTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformTypes, err := g.GetPlatformTypes(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformVersionCompanies(query string) ([]*pb.PlatformVersionCompany, error) {
|
||||
func (g *igdb) GetPlatformVersionCompanies(query string) ([]*pb.PlatformVersionCompany, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_version_companies.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlatformVersionCompanies(query string) ([]*pb.PlatformVersio
|
||||
return data.Platformversioncompanies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompanyByID(id uint64) (*pb.PlatformVersionCompany, error) {
|
||||
func (g *igdb) GetPlatformVersionCompanyByID(id uint64) (*pb.PlatformVersionCompany, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformVersionCompanies, err := g.GetPlatformVersionCompanies(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlatformVersionCompanyByID(id uint64) (*pb.PlatformVersionCo
|
||||
return platformVersionCompanies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompaniesByIDs(ids []uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
func (g *igdb) GetPlatformVersionCompaniesByIDs(ids []uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetPlatformVersionCompaniesByIDs(ids []uint64) ([]*pb.PlatformV
|
||||
return g.GetPlatformVersionCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompaniesByCompanyID(id uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
func (g *igdb) GetPlatformVersionCompaniesByCompanyID(id uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
query := fmt.Sprintf(`where company = %d; fields *;`, id)
|
||||
return g.GetPlatformVersionCompanies(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompaniesByCompanyIDs(ids []uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
func (g *igdb) GetPlatformVersionCompaniesByCompanyIDs(ids []uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetPlatformVersionCompaniesByCompanyIDs(ids []uint64) ([]*pb.Pl
|
||||
return g.GetPlatformVersionCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompaniesLength() (int, error) {
|
||||
func (g *igdb) GetPlatformVersionCompaniesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformVersionCompanies, err := g.GetPlatformVersionCompanies(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDates(query string) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDates(query string) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_version_release_dates.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlatformVersionReleaseDates(query string) ([]*pb.PlatformVer
|
||||
return data.Platformversionreleasedates, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDateByID(id uint64) (*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDateByID(id uint64) (*pb.PlatformVersionReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformVersionReleaseDates, err := g.GetPlatformVersionReleaseDates(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlatformVersionReleaseDateByID(id uint64) (*pb.PlatformVersi
|
||||
return platformVersionReleaseDates[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetPlatformVersionReleaseDatesByIDs(ids []uint64) ([]*pb.Platfo
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByPlatformVersionID(id uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByPlatformVersionID(id uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where platform_version = %d; fields *;`, id)
|
||||
return g.GetPlatformVersionReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByPlatformVersionIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByPlatformVersionIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetPlatformVersionReleaseDatesByPlatformVersionIDs(ids []uint64
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByReleaseRegionID(id uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByReleaseRegionID(id uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where release_region = %d; fields *;`, id)
|
||||
return g.GetPlatformVersionReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByReleaseRegionIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByReleaseRegionIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +78,12 @@ func (g *Client) GetPlatformVersionReleaseDatesByReleaseRegionIDs(ids []uint64)
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByDateFormatID(id uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByDateFormatID(id uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where date_format = %d; fields *;`, id)
|
||||
return g.GetPlatformVersionReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByDateFormatIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesByDateFormatIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,7 +94,7 @@ func (g *Client) GetPlatformVersionReleaseDatesByDateFormatIDs(ids []uint64) ([]
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesLength() (int, error) {
|
||||
func (g *igdb) GetPlatformVersionReleaseDatesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformVersionReleaseDates, err := g.GetPlatformVersionReleaseDates(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformVersions(query string) ([]*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersions(query string) ([]*pb.PlatformVersion, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_versions.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlatformVersions(query string) ([]*pb.PlatformVersion, error
|
||||
return data.Platformversions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionByID(id uint64) (*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersionByID(id uint64) (*pb.PlatformVersion, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformVersions, err := g.GetPlatformVersions(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlatformVersionByID(id uint64) (*pb.PlatformVersion, error)
|
||||
return platformVersions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsByIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersionsByIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetPlatformVersionsByIDs(ids []uint64) ([]*pb.PlatformVersion,
|
||||
return g.GetPlatformVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsByMainManufacturerID(id uint64) ([]*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersionsByMainManufacturerID(id uint64) ([]*pb.PlatformVersion, error) {
|
||||
query := fmt.Sprintf(`where main_manufacturer = %d; fields *;`, id)
|
||||
return g.GetPlatformVersions(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsByMainManufacturerIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersionsByMainManufacturerIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetPlatformVersionsByMainManufacturerIDs(ids []uint64) ([]*pb.P
|
||||
return g.GetPlatformVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsByPlatformLogoID(id uint64) ([]*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersionsByPlatformLogoID(id uint64) ([]*pb.PlatformVersion, error) {
|
||||
query := fmt.Sprintf(`where platform_logo = %d; fields *;`, id)
|
||||
return g.GetPlatformVersions(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsByPlatformLogoIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
func (g *igdb) GetPlatformVersionsByPlatformLogoIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetPlatformVersionsByPlatformLogoIDs(ids []uint64) ([]*pb.Platf
|
||||
return g.GetPlatformVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsLength() (int, error) {
|
||||
func (g *igdb) GetPlatformVersionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformVersions, err := g.GetPlatformVersions(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatformWebsites(query string) ([]*pb.PlatformWebsite, error) {
|
||||
func (g *igdb) GetPlatformWebsites(query string) ([]*pb.PlatformWebsite, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platform_websites.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlatformWebsites(query string) ([]*pb.PlatformWebsite, error
|
||||
return data.Platformwebsites, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformWebsiteByID(id uint64) (*pb.PlatformWebsite, error) {
|
||||
func (g *igdb) GetPlatformWebsiteByID(id uint64) (*pb.PlatformWebsite, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformWebsites, err := g.GetPlatformWebsites(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlatformWebsiteByID(id uint64) (*pb.PlatformWebsite, error)
|
||||
return platformWebsites[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformWebsitesByIDs(ids []uint64) ([]*pb.PlatformWebsite, error) {
|
||||
func (g *igdb) GetPlatformWebsitesByIDs(ids []uint64) ([]*pb.PlatformWebsite, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetPlatformWebsitesByIDs(ids []uint64) ([]*pb.PlatformWebsite,
|
||||
return g.GetPlatformWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformWebsitesLength() (int, error) {
|
||||
func (g *igdb) GetPlatformWebsitesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformWebsites, err := g.GetPlatformWebsites(query)
|
||||
if err != nil {
|
||||
|
23
platforms.go
23
platforms.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlatforms(query string) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatforms(query string) ([]*pb.Platform, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/platforms.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -26,7 +25,7 @@ func (g *Client) GetPlatforms(query string) ([]*pb.Platform, error) {
|
||||
return data.Platforms, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformByID(id uint64) (*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformByID(id uint64) (*pb.Platform, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platforms, err := g.GetPlatforms(query)
|
||||
if err != nil {
|
||||
@ -35,7 +34,7 @@ func (g *Client) GetPlatformByID(id uint64) (*pb.Platform, error) {
|
||||
return platforms[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -46,12 +45,12 @@ func (g *Client) GetPlatformsByIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByPlatformFamilyID(id uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByPlatformFamilyID(id uint64) ([]*pb.Platform, error) {
|
||||
query := fmt.Sprintf(`where platform_family = %d; fields *;`, id)
|
||||
return g.GetPlatforms(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByPlatformFamilyIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByPlatformFamilyIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -62,12 +61,12 @@ func (g *Client) GetPlatformsByPlatformFamilyIDs(ids []uint64) ([]*pb.Platform,
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByPlatformLogoID(id uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByPlatformLogoID(id uint64) ([]*pb.Platform, error) {
|
||||
query := fmt.Sprintf(`where platform_logo = %d; fields *;`, id)
|
||||
return g.GetPlatforms(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByPlatformLogoIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByPlatformLogoIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -78,12 +77,12 @@ func (g *Client) GetPlatformsByPlatformLogoIDs(ids []uint64) ([]*pb.Platform, er
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByPlatformTypeID(id uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByPlatformTypeID(id uint64) ([]*pb.Platform, error) {
|
||||
query := fmt.Sprintf(`where platform_type = %d; fields *;`, id)
|
||||
return g.GetPlatforms(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByPlatformTypeIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
func (g *igdb) GetPlatformsByPlatformTypeIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -94,7 +93,7 @@ func (g *Client) GetPlatformsByPlatformTypeIDs(ids []uint64) ([]*pb.Platform, er
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsLength() (int, error) {
|
||||
func (g *igdb) GetPlatformsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platforms, err := g.GetPlatforms(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPlayerPerspectives(query string) ([]*pb.PlayerPerspective, error) {
|
||||
func (g *igdb) GetPlayerPerspectives(query string) ([]*pb.PlayerPerspective, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/player_perspectives.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPlayerPerspectives(query string) ([]*pb.PlayerPerspective, e
|
||||
return data.Playerperspectives, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlayerPerspectiveByID(id uint64) (*pb.PlayerPerspective, error) {
|
||||
func (g *igdb) GetPlayerPerspectiveByID(id uint64) (*pb.PlayerPerspective, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
playerPerspectives, err := g.GetPlayerPerspectives(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPlayerPerspectiveByID(id uint64) (*pb.PlayerPerspective, err
|
||||
return playerPerspectives[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlayerPerspectivesByIDs(ids []uint64) ([]*pb.PlayerPerspective, error) {
|
||||
func (g *igdb) GetPlayerPerspectivesByIDs(ids []uint64) ([]*pb.PlayerPerspective, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetPlayerPerspectivesByIDs(ids []uint64) ([]*pb.PlayerPerspecti
|
||||
return g.GetPlayerPerspectives(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlayerPerspectivesLength() (int, error) {
|
||||
func (g *igdb) GetPlayerPerspectivesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
playerPerspectives, err := g.GetPlayerPerspectives(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPopularityPrimitives(query string) ([]*pb.PopularityPrimitive, error) {
|
||||
func (g *igdb) GetPopularityPrimitives(query string) ([]*pb.PopularityPrimitive, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/popularity_primitives.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPopularityPrimitives(query string) ([]*pb.PopularityPrimitiv
|
||||
return data.Popularityprimitives, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitiveByID(id uint64) (*pb.PopularityPrimitive, error) {
|
||||
func (g *igdb) GetPopularityPrimitiveByID(id uint64) (*pb.PopularityPrimitive, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
popularityPrimitives, err := g.GetPopularityPrimitives(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPopularityPrimitiveByID(id uint64) (*pb.PopularityPrimitive,
|
||||
return popularityPrimitives[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesByIDs(ids []uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
func (g *igdb) GetPopularityPrimitivesByIDs(ids []uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -52,17 +51,17 @@ func (g *Client) GetPopularityPrimitivesByIDs(ids []uint64) ([]*pb.PopularityPri
|
||||
// popularity_type = 2 IGDB Want to Play
|
||||
// popularity_type = 3 IGDB Playing
|
||||
// popularity_type = 4 IGDB Played
|
||||
func (g *Client) GetPopularityPrimitivesByPopularityType(popularityType, offset, limit int) ([]*pb.PopularityPrimitive, error) {
|
||||
func (g *igdb) GetPopularityPrimitivesByPopularityType(popularityType, offset, limit int) ([]*pb.PopularityPrimitive, error) {
|
||||
query := fmt.Sprintf("fields game_id,value,popularity_type; sort value desc; limit %d; offset %d; where popularity_type = %d;", limit, offset, popularityType)
|
||||
return g.GetPopularityPrimitives(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesByExternalPopularitySourceID(id uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
func (g *igdb) GetPopularityPrimitivesByExternalPopularitySourceID(id uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
query := fmt.Sprintf(`where external_popularity_source = %d; fields *;`, id)
|
||||
return g.GetPopularityPrimitives(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesByExternalPopularitySourceIDs(ids []uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
func (g *igdb) GetPopularityPrimitivesByExternalPopularitySourceIDs(ids []uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -73,7 +72,7 @@ func (g *Client) GetPopularityPrimitivesByExternalPopularitySourceIDs(ids []uint
|
||||
return g.GetPopularityPrimitives(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesLength() (int, error) {
|
||||
func (g *igdb) GetPopularityPrimitivesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
popularityPrimitives, err := g.GetPopularityPrimitives(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetPopularityTypes(query string) ([]*pb.PopularityType, error) {
|
||||
func (g *igdb) GetPopularityTypes(query string) ([]*pb.PopularityType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/popularity_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetPopularityTypes(query string) ([]*pb.PopularityType, error)
|
||||
return data.Popularitytypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypeByID(id uint64) (*pb.PopularityType, error) {
|
||||
func (g *igdb) GetPopularityTypeByID(id uint64) (*pb.PopularityType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
popularityTypes, err := g.GetPopularityTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetPopularityTypeByID(id uint64) (*pb.PopularityType, error) {
|
||||
return popularityTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypesByIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
func (g *igdb) GetPopularityTypesByIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetPopularityTypesByIDs(ids []uint64) ([]*pb.PopularityType, er
|
||||
return g.GetPopularityTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypesByExternalPopularitySourceID(id uint64) ([]*pb.PopularityType, error) {
|
||||
func (g *igdb) GetPopularityTypesByExternalPopularitySourceID(id uint64) ([]*pb.PopularityType, error) {
|
||||
query := fmt.Sprintf(`where external_popularity_source = %d; fields *;`, id)
|
||||
return g.GetPopularityTypes(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypesByExternalPopularitySourceIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
func (g *igdb) GetPopularityTypesByExternalPopularitySourceIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetPopularityTypesByExternalPopularitySourceIDs(ids []uint64) (
|
||||
return g.GetPopularityTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypesLength() (int, error) {
|
||||
func (g *igdb) GetPopularityTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
popularityTypes, err := g.GetPopularityTypes(query)
|
||||
if err != nil {
|
||||
|
@ -1,48 +0,0 @@
|
||||
package igdb
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type rateLimiter struct {
|
||||
mu sync.Mutex
|
||||
rate int
|
||||
interval time.Duration
|
||||
tokens int
|
||||
lastRefill time.Time
|
||||
}
|
||||
|
||||
func newRateLimiter(rate int) *rateLimiter {
|
||||
return &rateLimiter{
|
||||
rate: rate,
|
||||
interval: time.Second,
|
||||
tokens: rate,
|
||||
lastRefill: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
func (r *rateLimiter) wait() {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
elapsed := now.Sub(r.lastRefill)
|
||||
|
||||
if elapsed >= r.interval {
|
||||
r.tokens = r.rate
|
||||
r.lastRefill = now
|
||||
}
|
||||
|
||||
if r.tokens <= 0 {
|
||||
waitTime := r.interval - elapsed
|
||||
r.mu.Unlock()
|
||||
time.Sleep(waitTime)
|
||||
r.mu.Lock()
|
||||
r.tokens = r.rate - 1
|
||||
r.lastRefill = time.Now()
|
||||
return
|
||||
}
|
||||
|
||||
r.tokens--
|
||||
}
|
11
regions.go
11
regions.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetRegions(query string) ([]*pb.Region, error) {
|
||||
func (g *igdb) GetRegions(query string) ([]*pb.Region, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/regions.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetRegions(query string) ([]*pb.Region, error) {
|
||||
return data.Regions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetRegionByID(id uint64) (*pb.Region, error) {
|
||||
func (g *igdb) GetRegionByID(id uint64) (*pb.Region, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
regions, err := g.GetRegions(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetRegionByID(id uint64) (*pb.Region, error) {
|
||||
return regions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetRegionsByIDs(ids []uint64) ([]*pb.Region, error) {
|
||||
func (g *igdb) GetRegionsByIDs(ids []uint64) ([]*pb.Region, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetRegionsByIDs(ids []uint64) ([]*pb.Region, error) {
|
||||
return g.GetRegions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetRegionsLength() (int, error) {
|
||||
func (g *igdb) GetRegionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
regions, err := g.GetRegions(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetReleaseDateRegions(query string) ([]*pb.ReleaseDateRegion, error) {
|
||||
func (g *igdb) GetReleaseDateRegions(query string) ([]*pb.ReleaseDateRegion, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/release_date_regions.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetReleaseDateRegions(query string) ([]*pb.ReleaseDateRegion, e
|
||||
return data.Releasedateregions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateRegionByID(id uint64) (*pb.ReleaseDateRegion, error) {
|
||||
func (g *igdb) GetReleaseDateRegionByID(id uint64) (*pb.ReleaseDateRegion, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
releaseDateRegions, err := g.GetReleaseDateRegions(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetReleaseDateRegionByID(id uint64) (*pb.ReleaseDateRegion, err
|
||||
return releaseDateRegions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateRegionsByIDs(ids []uint64) ([]*pb.ReleaseDateRegion, error) {
|
||||
func (g *igdb) GetReleaseDateRegionsByIDs(ids []uint64) ([]*pb.ReleaseDateRegion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetReleaseDateRegionsByIDs(ids []uint64) ([]*pb.ReleaseDateRegi
|
||||
return g.GetReleaseDateRegions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateRegionsLength() (int, error) {
|
||||
func (g *igdb) GetReleaseDateRegionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
releaseDateRegions, err := g.GetReleaseDateRegions(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetReleaseDateStatuses(query string) ([]*pb.ReleaseDateStatus, error) {
|
||||
func (g *igdb) GetReleaseDateStatuses(query string) ([]*pb.ReleaseDateStatus, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/release_date_statuses.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetReleaseDateStatuses(query string) ([]*pb.ReleaseDateStatus,
|
||||
return data.Releasedatestatuses, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateStatusByID(id uint64) (*pb.ReleaseDateStatus, error) {
|
||||
func (g *igdb) GetReleaseDateStatusByID(id uint64) (*pb.ReleaseDateStatus, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
releaseDateStatuses, err := g.GetReleaseDateStatuses(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetReleaseDateStatusByID(id uint64) (*pb.ReleaseDateStatus, err
|
||||
return releaseDateStatuses[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateStatusesByIDs(ids []uint64) ([]*pb.ReleaseDateStatus, error) {
|
||||
func (g *igdb) GetReleaseDateStatusesByIDs(ids []uint64) ([]*pb.ReleaseDateStatus, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetReleaseDateStatusesByIDs(ids []uint64) ([]*pb.ReleaseDateSta
|
||||
return g.GetReleaseDateStatuses(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateStatusesLength() (int, error) {
|
||||
func (g *igdb) GetReleaseDateStatusesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
releaseDateStatuses, err := g.GetReleaseDateStatuses(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetReleaseDates(query string) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDates(query string) ([]*pb.ReleaseDate, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/release_dates.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetReleaseDates(query string) ([]*pb.ReleaseDate, error) {
|
||||
return data.Releasedates, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateByID(id uint64) (*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDateByID(id uint64) (*pb.ReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
releaseDates, err := g.GetReleaseDates(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetReleaseDateByID(id uint64) (*pb.ReleaseDate, error) {
|
||||
return releaseDates[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetReleaseDatesByIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByGameID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByGameID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByGameIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByGameIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetReleaseDatesByGameIDs(ids []uint64) ([]*pb.ReleaseDate, erro
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByPlatformID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByPlatformID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where platform = %d; fields *;`, id)
|
||||
return g.GetReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByPlatformIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByPlatformIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,12 +78,12 @@ func (g *Client) GetReleaseDatesByPlatformIDs(ids []uint64) ([]*pb.ReleaseDate,
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByReleaseRegionID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByReleaseRegionID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where release_region = %d; fields *;`, id)
|
||||
return g.GetReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByReleaseRegionIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByReleaseRegionIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -95,12 +94,12 @@ func (g *Client) GetReleaseDatesByReleaseRegionIDs(ids []uint64) ([]*pb.ReleaseD
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByStatusID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByStatusID(id uint64) ([]*pb.ReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where status = %d; fields *;`, id)
|
||||
return g.GetReleaseDates(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByStatusIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
func (g *igdb) GetReleaseDatesByStatusIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -111,7 +110,7 @@ func (g *Client) GetReleaseDatesByStatusIDs(ids []uint64) ([]*pb.ReleaseDate, er
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesLength() (int, error) {
|
||||
func (g *igdb) GetReleaseDatesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
releaseDates, err := g.GetReleaseDates(query)
|
||||
if err != nil {
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetScreenshots(query string) ([]*pb.Screenshot, error) {
|
||||
func (g *igdb) GetScreenshots(query string) ([]*pb.Screenshot, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/screenshots.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetScreenshots(query string) ([]*pb.Screenshot, error) {
|
||||
return data.Screenshots, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotByID(id uint64) (*pb.Screenshot, error) {
|
||||
func (g *igdb) GetScreenshotByID(id uint64) (*pb.Screenshot, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
screenshots, err := g.GetScreenshots(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetScreenshotByID(id uint64) (*pb.Screenshot, error) {
|
||||
return screenshots[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotsByIDs(ids []uint64) ([]*pb.Screenshot, error) {
|
||||
func (g *igdb) GetScreenshotsByIDs(ids []uint64) ([]*pb.Screenshot, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetScreenshotsByIDs(ids []uint64) ([]*pb.Screenshot, error) {
|
||||
return g.GetScreenshots(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotsByGameID(id uint64) ([]*pb.Screenshot, error) {
|
||||
func (g *igdb) GetScreenshotsByGameID(id uint64) ([]*pb.Screenshot, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetScreenshots(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotsByGameIDs(ids []uint64) ([]*pb.Screenshot, error) {
|
||||
func (g *igdb) GetScreenshotsByGameIDs(ids []uint64) ([]*pb.Screenshot, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,7 +62,7 @@ func (g *Client) GetScreenshotsByGameIDs(ids []uint64) ([]*pb.Screenshot, error)
|
||||
return g.GetScreenshots(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotsLength() (int, error) {
|
||||
func (g *igdb) GetScreenshotsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
screenshots, err := g.GetScreenshots(query)
|
||||
if err != nil {
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/bestnite/go-flaresolverr"
|
||||
@ -21,7 +21,7 @@ var webSearchCFCookies struct {
|
||||
expires time.Time
|
||||
}
|
||||
|
||||
func (g *Client) Search(query string) ([]*pb.Search, error) {
|
||||
func (g *igdb) Search(query string) ([]*pb.Search, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/search.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -39,7 +39,7 @@ func (g *Client) Search(query string) ([]*pb.Search, error) {
|
||||
return data.Searches, nil
|
||||
}
|
||||
|
||||
func (g *Client) WebSearchGames(name string) ([]*pb.Game, error) {
|
||||
func (g *igdb) WebSearchGames(name string) ([]*pb.Game, error) {
|
||||
params := url.Values{}
|
||||
params.Add("q", name)
|
||||
params.Add("utf8", "✓")
|
||||
|
11
themes.go
11
themes.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetThemes(query string) ([]*pb.Theme, error) {
|
||||
func (g *igdb) GetThemes(query string) ([]*pb.Theme, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/themes.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetThemes(query string) ([]*pb.Theme, error) {
|
||||
return data.Themes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetThemeByID(id uint64) (*pb.Theme, error) {
|
||||
func (g *igdb) GetThemeByID(id uint64) (*pb.Theme, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
themes, err := g.GetThemes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetThemeByID(id uint64) (*pb.Theme, error) {
|
||||
return themes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetThemesByIDs(ids []uint64) ([]*pb.Theme, error) {
|
||||
func (g *igdb) GetThemesByIDs(ids []uint64) ([]*pb.Theme, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetThemesByIDs(ids []uint64) ([]*pb.Theme, error) {
|
||||
return g.GetThemes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetThemesLength() (int, error) {
|
||||
func (g *igdb) GetThemesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
themes, err := g.GetThemes(query)
|
||||
if err != nil {
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/bestnite/go-igdb/endpoint"
|
||||
"github/bestnite/go-igdb/endpoint"
|
||||
)
|
||||
|
||||
func (g *Client) ActiveWebhook(endpoint endpoint.Endpoint, secret, callbackUrl string) error {
|
||||
func (g *igdb) ActiveWebhook(endpoint endpoint.Endpoint, secret, callbackUrl string) error {
|
||||
dataBody := url.Values{}
|
||||
dataBody.Set("url", callbackUrl)
|
||||
dataBody.Set("secret", secret)
|
||||
|
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetWebsiteTypes(query string) ([]*pb.WebsiteType, error) {
|
||||
func (g *igdb) GetWebsiteTypes(query string) ([]*pb.WebsiteType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/website_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetWebsiteTypes(query string) ([]*pb.WebsiteType, error) {
|
||||
return data.Websitetypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteTypeByID(id uint64) (*pb.WebsiteType, error) {
|
||||
func (g *igdb) GetWebsiteTypeByID(id uint64) (*pb.WebsiteType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
websiteTypes, err := g.GetWebsiteTypes(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetWebsiteTypeByID(id uint64) (*pb.WebsiteType, error) {
|
||||
return websiteTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteTypesByIDs(ids []uint64) ([]*pb.WebsiteType, error) {
|
||||
func (g *igdb) GetWebsiteTypesByIDs(ids []uint64) ([]*pb.WebsiteType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,7 +46,7 @@ func (g *Client) GetWebsiteTypesByIDs(ids []uint64) ([]*pb.WebsiteType, error) {
|
||||
return g.GetWebsiteTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteTypesLength() (int, error) {
|
||||
func (g *igdb) GetWebsiteTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
websiteTypes, err := g.GetWebsiteTypes(query)
|
||||
if err != nil {
|
||||
|
19
websites.go
19
websites.go
@ -2,14 +2,13 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pb "github/bestnite/go-igdb/proto"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *Client) GetWebsites(query string) ([]*pb.Website, error) {
|
||||
func (g *igdb) GetWebsites(query string) ([]*pb.Website, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/websites.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@ -27,7 +26,7 @@ func (g *Client) GetWebsites(query string) ([]*pb.Website, error) {
|
||||
return data.Websites, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteByID(id uint64) (*pb.Website, error) {
|
||||
func (g *igdb) GetWebsiteByID(id uint64) (*pb.Website, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
websites, err := g.GetWebsites(query)
|
||||
if err != nil {
|
||||
@ -36,7 +35,7 @@ func (g *Client) GetWebsiteByID(id uint64) (*pb.Website, error) {
|
||||
return websites[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesByIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
func (g *igdb) GetWebsitesByIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -47,12 +46,12 @@ func (g *Client) GetWebsitesByIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
return g.GetWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesByGameID(id uint64) ([]*pb.Website, error) {
|
||||
func (g *igdb) GetWebsitesByGameID(id uint64) ([]*pb.Website, error) {
|
||||
query := fmt.Sprintf(`where game = %d; fields *;`, id)
|
||||
return g.GetWebsites(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesByGameIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
func (g *igdb) GetWebsitesByGameIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -63,12 +62,12 @@ func (g *Client) GetWebsitesByGameIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
return g.GetWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesByTypeID(id uint64) ([]*pb.Website, error) {
|
||||
func (g *igdb) GetWebsitesByTypeID(id uint64) ([]*pb.Website, error) {
|
||||
query := fmt.Sprintf(`where type = %d; fields *;`, id)
|
||||
return g.GetWebsites(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesByTypeIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
func (g *igdb) GetWebsitesByTypeIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
@ -79,7 +78,7 @@ func (g *Client) GetWebsitesByTypeIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
return g.GetWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesLength() (int, error) {
|
||||
func (g *igdb) GetWebsitesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
websites, err := g.GetWebsites(query)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user