mirror of
https://github.com/bestnite/go-igdb.git
synced 2025-04-19 22:25:54 +08:00
u
This commit is contained in:
parent
35c27b28a3
commit
7f5a09098a
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetAgeRatingCategories(query string) ([]*pb.AgeRatingCategory,
|
||||
|
||||
return data.Ageratingcategories, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoryByID(id uint64) (*pb.AgeRatingCategory, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingCategories, err := g.GetAgeRatingCategories(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ageRatingCategories[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoriesByIDs(ids []uint64) ([]*pb.AgeRatingCategory, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatingCategories(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where organization = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatingCategories(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingCategoriesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingCategories, err := g.GetAgeRatingCategories(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(ageRatingCategories[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetAgeRatingContentDescriptions(query string) ([]*pb.AgeRatingC
|
||||
|
||||
return data.Ageratingcontentdescriptions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionByID(id uint64) (*pb.AgeRatingContentDescription, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptions(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ageRatingContentDescriptions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsByIDs(ids []uint64) ([]*pb.AgeRatingContentDescription, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatingContentDescriptions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptions(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(ageRatingContentDescriptions[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetAgeRatingContentDescriptionsV2(query string) ([]*pb.AgeRatin
|
||||
|
||||
return data.Ageratingcontentdescriptionsv2, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionV2ByID(id uint64) (*pb.AgeRatingContentDescriptionV2, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptionsV2(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ageRatingContentDescriptions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2ByIDs(ids []uint64) ([]*pb.AgeRatingContentDescriptionV2, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatingContentDescriptionsV2(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where organization = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatingContentDescriptionsV2(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingContentDescriptionsV2Length() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingContentDescriptions, err := g.GetAgeRatingContentDescriptionsV2(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(ageRatingContentDescriptions[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetAgeRatingOrganizations(query string) ([]*pb.AgeRatingOrganiz
|
||||
|
||||
return data.Ageratingorganizations, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizationByID(id uint64) (*pb.AgeRatingOrganization, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatingOrganizations, err := g.GetAgeRatingOrganizations(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ageRatingOrganizations[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizationsByIDs(ids []uint64) ([]*pb.AgeRatingOrganization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatingOrganizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingOrganizationsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatingOrganizations, err := g.GetAgeRatingOrganizations(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(ageRatingOrganizations[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetAgeRatings(query string) ([]*pb.AgeRating, error) {
|
||||
|
||||
return data.Ageratings, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingByID(id uint64) (*pb.AgeRating, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
ageRatings, err := g.GetAgeRatings(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ageRatings[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsByIDs(ids []uint64) ([]*pb.AgeRating, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatings(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where organization = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatings(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where rating_category = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAgeRatings(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAgeRatingsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
ageRatings, err := g.GetAgeRatings(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(ageRatings[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetAlternativeNames(query string) ([]*pb.AlternativeName, error
|
||||
|
||||
return data.Alternativenames, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNameByID(id uint64) (*pb.AlternativeName, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
alternativeNames, err := g.GetAlternativeNames(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return alternativeNames[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNamesByIDs(ids []uint64) ([]*pb.AlternativeName, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAlternativeNames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetAlternativeNames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetAlternativeNamesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
alternativeNames, err := g.GetAlternativeNames(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(alternativeNames[0].Id), nil
|
||||
}
|
||||
|
46
artworks.go
46
artworks.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetArtworks(query string) ([]*pb.Artwork, error) {
|
||||
|
||||
return data.Artworks, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworkByID(id uint64) (*pb.Artwork, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
artworks, err := g.GetArtworks(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return artworks[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworksByIDs(ids []uint64) ([]*pb.Artwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetArtworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetArtworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetArtworksLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
artworks, err := g.GetArtworks(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(artworks[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetCharacterGenders(query string) ([]*pb.CharacterGender, error
|
||||
|
||||
return data.Charactergenders, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterGenderByID(id uint64) (*pb.CharacterGender, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characterGenders, err := g.GetCharacterGenders(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return characterGenders[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterGendersByIDs(ids []uint64) ([]*pb.CharacterGender, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacterGenders(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterGendersLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characterGenders, err := g.GetCharacterGenders(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(characterGenders[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetCharacterMugShots(query string) ([]*pb.CharacterMugShot, err
|
||||
|
||||
return data.Charactermugshots, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterMugShotByID(id uint64) (*pb.CharacterMugShot, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characterMugShots, err := g.GetCharacterMugShots(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return characterMugShots[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterMugShotsByIDs(ids []uint64) ([]*pb.CharacterMugShot, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacterMugShots(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterMugShotsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characterMugShots, err := g.GetCharacterMugShots(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(characterMugShots[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetCharacterSpecies(query string) ([]*pb.CharacterSpecie, error
|
||||
|
||||
return data.Characterspecies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterSpecieByID(id uint64) (*pb.CharacterSpecie, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characterSpecies, err := g.GetCharacterSpecies(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return characterSpecies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterSpeciesByIDs(ids []uint64) ([]*pb.CharacterSpecie, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacterSpecies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterSpeciesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characterSpecies, err := g.GetCharacterSpecies(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(characterSpecies[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,80 +25,3 @@ func (g *Client) GetCharacters(query string) ([]*pb.Character, error) {
|
||||
|
||||
return data.Characters, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharacterByID(id uint64) (*pb.Character, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
characters, err := g.GetCharacters(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return characters[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersByIDs(ids []uint64) ([]*pb.Character, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where character_gender = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where character_species = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where mug_shot = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCharacters(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCharactersLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
characters, err := g.GetCharacters(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(characters[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetCollectionMembershipTypes(query string) ([]*pb.CollectionMem
|
||||
|
||||
return data.Collectionmembershiptypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypeByID(id uint64) (*pb.CollectionMembershipType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionMembershipTypes, err := g.GetCollectionMembershipTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return collectionMembershipTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypesByIDs(ids []uint64) ([]*pb.CollectionMembershipType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionMembershipTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where allowed_collection_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionMembershipTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionMembershipTypes, err := g.GetCollectionMembershipTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(collectionMembershipTypes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,69 +25,3 @@ func (g *Client) GetCollectionMemberships(query string) ([]*pb.CollectionMembers
|
||||
|
||||
return data.Collectionmemberships, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipByID(id uint64) (*pb.CollectionMembership, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionMemberships, err := g.GetCollectionMemberships(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return collectionMemberships[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionMemberships(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionMemberships(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
query := fmt.Sprintf(`where type = %d; fields *;`, id)
|
||||
return g.GetCollectionMemberships(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsByCollectionMembershipTypeIDs(ids []uint64) ([]*pb.CollectionMembership, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionMemberships(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionMembershipsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionMemberships, err := g.GetCollectionMemberships(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(collectionMemberships[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelat
|
||||
|
||||
return data.Collectionrelationtypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypeByID(id uint64) (*pb.CollectionRelationType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionRelationTypes, err := g.GetCollectionRelationTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return collectionRelationTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesByIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelationTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where allowed_child_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelationTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where allowed_parent_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelationTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionRelationTypes, err := g.GetCollectionRelationTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(collectionRelationTypes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,80 +25,3 @@ func (g *Client) GetCollectionRelations(query string) ([]*pb.CollectionRelation,
|
||||
|
||||
return data.Collectionrelations, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationByID(id uint64) (*pb.CollectionRelation, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionRelations, err := g.GetCollectionRelations(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return collectionRelations[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsByIDs(ids []uint64) ([]*pb.CollectionRelation, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where child_collection = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where parent_collection = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionRelations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionRelationsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionRelations, err := g.GetCollectionRelations(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(collectionRelations[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetCollectionTypes(query string) ([]*pb.CollectionType, error)
|
||||
|
||||
return data.Collectiontypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionTypeByID(id uint64) (*pb.CollectionType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collectionTypes, err := g.GetCollectionTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return collectionTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionTypesByIDs(ids []uint64) ([]*pb.CollectionType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollectionTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collectionTypes, err := g.GetCollectionTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(collectionTypes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetCollections(query string) ([]*pb.Collection, error) {
|
||||
|
||||
return data.Collections, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionByID(id uint64) (*pb.Collection, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
collections, err := g.GetCollections(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return collections[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionsByIDs(ids []uint64) ([]*pb.Collection, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollections(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where collection_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCollections(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCollectionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
collections, err := g.GetCollections(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(collections[0].Id), nil
|
||||
}
|
||||
|
126
companies.go
126
companies.go
@ -3,7 +3,6 @@ package igdb
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -27,128 +26,3 @@ func (g *Client) GetCompanies(query string) ([]*pb.Company, error) {
|
||||
|
||||
return data.Companies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByID(id uint64) (*pb.Company, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companys, err := g.GetCompanies(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return companys[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyByIDs(ids []uint64) ([]*pb.Company, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where change_date_format = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where changed_company_id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where logo = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where parent = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where start_date_format = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where status = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompaniesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companies, err := g.GetCompanies(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(companies[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetCompanyLogos(query string) ([]*pb.CompanyLogo, error) {
|
||||
|
||||
return data.Companylogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyLogoByID(id uint64) (*pb.CompanyLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companyLogos, err := g.GetCompanyLogos(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return companyLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyLogosByIDs(ids []uint64) ([]*pb.CompanyLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanyLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companyLogos, err := g.GetCompanyLogos(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(companyLogos[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetCompanyStatuses(query string) ([]*pb.CompanyStatus, error) {
|
||||
|
||||
return data.Companystatuses, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyStatusByID(id uint64) (*pb.CompanyStatus, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companyStatuses, err := g.GetCompanyStatuses(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return companyStatuses[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyStatusesByIDs(ids []uint64) ([]*pb.CompanyStatus, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanyStatuses(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyStatusesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companyStatuses, err := g.GetCompanyStatuses(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(companyStatuses[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetCompanyWebsites(query string) ([]*pb.CompanyWebsite, error)
|
||||
|
||||
return data.Companywebsites, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsiteByID(id uint64) (*pb.CompanyWebsite, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
companyWebsites, err := g.GetCompanyWebsites(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return companyWebsites[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsitesByIDs(ids []uint64) ([]*pb.CompanyWebsite, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanyWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCompanyWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCompanyWebsitesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
companyWebsites, err := g.GetCompanyWebsites(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(companyWebsites[0].Id), nil
|
||||
}
|
||||
|
62
covers.go
62
covers.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetCovers(query string) ([]*pb.Cover, error) {
|
||||
|
||||
return data.Covers, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCoverByID(id uint64) (*pb.Cover, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
covers, err := g.GetCovers(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return covers[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversByIDs(ids []uint64) ([]*pb.Cover, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCovers(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCovers(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game_localization = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetCovers(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetCoversLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
covers, err := g.GetCovers(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(covers[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetDateFormats(query string) ([]*pb.DateFormat, error) {
|
||||
|
||||
return data.Dateformats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatByID(id uint64) (*pb.DateFormat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
dateFormats, err := g.GetDateFormats(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dateFormats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatsByIDs(ids []uint64) ([]*pb.DateFormat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetDateFormats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
dateFormats, err := g.GetDateFormats(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(dateFormats[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetEventLogos(query string) ([]*pb.EventLogo, error) {
|
||||
|
||||
return data.Eventlogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogoByID(id uint64) (*pb.EventLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
eventLogos, err := g.GetEventLogos(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return eventLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogosByIDs(ids []uint64) ([]*pb.EventLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEventLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where event = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEventLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
eventLogos, err := g.GetEventLogos(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(eventLogos[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetEventNetworks(query string) ([]*pb.EventNetwork, error) {
|
||||
|
||||
return data.Eventnetworks, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworkByID(id uint64) (*pb.EventNetwork, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
eventNetworks, err := g.GetEventNetworks(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return eventNetworks[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksByIDs(ids []uint64) ([]*pb.EventNetwork, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEventNetworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where event = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEventNetworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where network_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEventNetworks(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventNetworksLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
eventNetworks, err := g.GetEventNetworks(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(eventNetworks[0].Id), nil
|
||||
}
|
||||
|
46
events.go
46
events.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetEvents(query string) ([]*pb.Event, error) {
|
||||
|
||||
return data.Events, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventByID(id uint64) (*pb.Event, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
events, err := g.GetEvents(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return events[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetEventsByIDs(ids []uint64) ([]*pb.Event, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEvents(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where event_logo = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetEvents(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetEventsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
events, err := g.GetEvents(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(events[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetExternalGameSources(query string) ([]*pb.ExternalGameSource,
|
||||
|
||||
return data.Externalgamesources, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameSourceByID(id uint64) (*pb.ExternalGameSource, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
externalGameSources, err := g.GetExternalGameSources(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return externalGameSources[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameSourcesByIDs(ids []uint64) ([]*pb.ExternalGameSource, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetExternalGameSources(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameSourcesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
externalGameSources, err := g.GetExternalGameSources(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(externalGameSources[0].Id), nil
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -27,103 +25,3 @@ func (g *Client) GetExternalGames(query string) ([]*pb.ExternalGame, error) {
|
||||
|
||||
return data.Externalgames, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGameByID(id uint64) (*pb.ExternalGame, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
externalGames, err := g.GetExternalGames(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return externalGames[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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 {
|
||||
return 0, err
|
||||
}
|
||||
return externalGames[0].Game.Id, nil
|
||||
}
|
||||
|
||||
func (g *Client) 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 {
|
||||
return 0, err
|
||||
}
|
||||
return strconv.ParseUint(externalGames[0].Uid, 10, 64)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
query := fmt.Sprintf(`where external_game_source = %d; fields *;`, id)
|
||||
return g.GetExternalGames(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesByExternalGameSourceIDs(ids []uint64) ([]*pb.ExternalGame, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where external_game_source = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game_release_format = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform_version = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetExternalGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetExternalGamesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
externalGames, err := g.GetExternalGames(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(externalGames[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetFranchises(query string) ([]*pb.Franchise, error) {
|
||||
|
||||
return data.Franchises, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetFranchiseByID(id uint64) (*pb.Franchise, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
franchises, err := g.GetFranchises(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return franchises[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetFranchisesByIDs(ids []uint64) ([]*pb.Franchise, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetFranchises(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetFranchisesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
franchises, err := g.GetFranchises(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(franchises[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGameEngineLogos(query string) ([]*pb.GameEngineLogo, error)
|
||||
|
||||
return data.Gameenginelogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineLogoByID(id uint64) (*pb.GameEngineLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameEngineLogos, err := g.GetGameEngineLogos(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameEngineLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineLogosByIDs(ids []uint64) ([]*pb.GameEngineLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameEngineLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameEngineLogos, err := g.GetGameEngineLogos(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameEngineLogos[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetGameEngines(query string) ([]*pb.GameEngine, error) {
|
||||
|
||||
return data.Gameengines, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEngineByID(id uint64) (*pb.GameEngine, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameEngines, err := g.GetGameEngines(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameEngines[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesByIDs(ids []uint64) ([]*pb.GameEngine, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameEngines(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameEngines(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where logo = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameEngines(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameEnginesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameEngines, err := g.GetGameEngines(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameEngines[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,80 +25,3 @@ func (g *Client) GetGameLocalizations(query string) ([]*pb.GameLocalization, err
|
||||
|
||||
return data.Gamelocalizations, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationByID(id uint64) (*pb.GameLocalization, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameLocalizations, err := g.GetGameLocalizations(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameLocalizations[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsByIDs(ids []uint64) ([]*pb.GameLocalization, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where cover = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where region = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameLocalizations(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameLocalizationsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameLocalizations, err := g.GetGameLocalizations(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameLocalizations[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGameModes(query string) ([]*pb.GameMode, error) {
|
||||
|
||||
return data.Gamemodes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameModeByID(id uint64) (*pb.GameMode, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameModes, err := g.GetGameModes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameModes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameModesByIDs(ids []uint64) ([]*pb.GameMode, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameModesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameModes, err := g.GetGameModes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameModes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGameReleaseFormats(query string) ([]*pb.GameReleaseFormat, e
|
||||
|
||||
return data.Gamereleaseformats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameReleaseFormatByID(id uint64) (*pb.GameReleaseFormat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameReleaseFormats, err := g.GetGameReleaseFormats(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameReleaseFormats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameReleaseFormatsByIDs(ids []uint64) ([]*pb.GameReleaseFormat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameReleaseFormats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameReleaseFormatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameReleaseFormats, err := g.GetGameReleaseFormats(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameReleaseFormats[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGameStatuses(query string) ([]*pb.GameStatus, error) {
|
||||
|
||||
return data.Gamestatuses, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameStatusByID(id uint64) (*pb.GameStatus, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameStatuses, err := g.GetGameStatuses(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameStatuses[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameStatusesByIDs(ids []uint64) ([]*pb.GameStatus, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameStatuses(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameStatusesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameStatuses, err := g.GetGameStatuses(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameStatuses[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetGameTimeToBeats(query string) ([]*pb.GameTimeToBeat, error)
|
||||
|
||||
return data.Gametimetobeats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatByID(id uint64) (*pb.GameTimeToBeat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameTimeToBeats, err := g.GetGameTimeToBeats(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameTimeToBeats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatsByIDs(ids []uint64) ([]*pb.GameTimeToBeat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameTimeToBeats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameTimeToBeats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTimeToBeatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameTimeToBeats, err := g.GetGameTimeToBeats(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameTimeToBeats[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGameTypes(query string) ([]*pb.GameType, error) {
|
||||
|
||||
return data.Gametypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTypeByID(id uint64) (*pb.GameType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameTypes, err := g.GetGameTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTypesByIDs(ids []uint64) ([]*pb.GameType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameTypes, err := g.GetGameTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameTypes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetGameVersionFeatureValues(query string) ([]*pb.GameVersionFea
|
||||
|
||||
return data.Gameversionfeaturevalues, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValueByID(id uint64) (*pb.GameVersionFeatureValue, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVersionFeatureValues, err := g.GetGameVersionFeatureValues(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameVersionFeatureValues[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesByIDs(ids []uint64) ([]*pb.GameVersionFeatureValue, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVersionFeatureValues(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVersionFeatureValues(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game_version_feature = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVersionFeatureValues(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureValuesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVersionFeatureValues, err := g.GetGameVersionFeatureValues(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameVersionFeatureValues[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGameVersionFeatures(query string) ([]*pb.GameVersionFeature,
|
||||
|
||||
return data.Gameversionfeatures, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeatureByID(id uint64) (*pb.GameVersionFeature, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVersionFeatures, err := g.GetGameVersionFeatures(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameVersionFeatures[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeaturesByIDs(ids []uint64) ([]*pb.GameVersionFeature, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVersionFeatures(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionFeaturesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVersionFeatures, err := g.GetGameVersionFeatures(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameVersionFeatures[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetGameVersions(query string) ([]*pb.GameVersion, error) {
|
||||
|
||||
return data.Gameversions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionByID(id uint64) (*pb.GameVersion, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVersions, err := g.GetGameVersions(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameVersions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionsByIDs(ids []uint64) ([]*pb.GameVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVersionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVersions, err := g.GetGameVersions(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameVersions[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetGameVideos(query string) ([]*pb.GameVideo, error) {
|
||||
|
||||
return data.Gamevideos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideoByID(id uint64) (*pb.GameVideo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
gameVideos, err := g.GetGameVideos(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gameVideos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideosByIDs(ids []uint64) ([]*pb.GameVideo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVideos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGameVideos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGameVideosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
gameVideos, err := g.GetGameVideos(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(gameVideos[0].Id), nil
|
||||
}
|
||||
|
158
games.go
158
games.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -27,143 +26,30 @@ func (g *Client) GetGames(query string) ([]*pb.Game, error) {
|
||||
return data.Games, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByID(id uint64) (*pb.Game, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
games, err := g.GetGames(query)
|
||||
func (g *Client) GetParentGameID(id uint64) (uint64, error) {
|
||||
detail, err := GetItemByID(id, g.GetGames)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return 0, fmt.Errorf("failed to fetch IGDB app detail for parent: %d: %w", id, err)
|
||||
}
|
||||
return games[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGameByIDs(ids []uint64) ([]*pb.Game, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where collection = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where cover = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where franchise = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game_status = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where parent_game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where version_parent = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGames(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGamesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
games, err := g.GetGames(query)
|
||||
hasParent := false
|
||||
if detail.ParentGame != nil && detail.ParentGame.Id != 0 {
|
||||
hasParent = true
|
||||
detail, err = GetItemByID(detail.ParentGame.Id, g.GetGames)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return 0, fmt.Errorf("failed to fetch IGDB version parent: %d: %w", detail.VersionParent.Id, err)
|
||||
}
|
||||
return int(games[0].Id), nil
|
||||
}
|
||||
for detail.VersionParent != nil && detail.VersionParent.Id != 0 {
|
||||
hasParent = true
|
||||
detail, err = GetItemByID(detail.VersionParent.Id, g.GetGames)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to fetch IGDB version parent: %d: %w", detail.VersionParent.Id, err)
|
||||
}
|
||||
}
|
||||
|
||||
if hasParent {
|
||||
return detail.Id, nil
|
||||
}
|
||||
|
||||
return id, nil
|
||||
}
|
||||
|
30
genres.go
30
genres.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetGenres(query string) ([]*pb.Genre, error) {
|
||||
|
||||
return data.Genres, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGenreByID(id uint64) (*pb.Genre, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
genres, err := g.GetGenres(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return genres[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetGenresByIDs(ids []uint64) ([]*pb.Genre, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetGenres(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetGenresLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
genres, err := g.GetGenres(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(genres[0].Id), nil
|
||||
}
|
||||
|
35
igdb.go
35
igdb.go
@ -2,6 +2,7 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/bestnite/go-flaresolverr"
|
||||
"github.com/go-resty/resty/v2"
|
||||
@ -59,3 +60,37 @@ func (g *Client) getFlaresolverr() (*flaresolverr.Flaresolverr, error) {
|
||||
}
|
||||
return g.flaresolverr, nil
|
||||
}
|
||||
|
||||
func GetItemByID[T any](id uint64, f func(string) ([]*T, error)) (*T, error) {
|
||||
query := fmt.Sprintf("where id = %d; fields *;", id)
|
||||
items, err := f(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items[0], nil
|
||||
}
|
||||
|
||||
func GetItemsByIDs[T any](ids []uint64, f func(string) ([]*T, error)) ([]*T, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return f(idStr)
|
||||
}
|
||||
|
||||
func GetItemsPagniated[T any](offset, limit int, f func(string) ([]*T, error)) ([]*T, error) {
|
||||
query := fmt.Sprintf("offset %d; limit %d; f *; sort id asc;", offset, limit)
|
||||
return f(query)
|
||||
}
|
||||
|
||||
func GetItemsLength[T any](f func(string) ([]*T, error)) (int, error) {
|
||||
query := "fields id; sort id desc; limit 1;"
|
||||
items, err := f(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return len(items), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetInvolvedCompanies(query string) ([]*pb.InvolvedCompany, erro
|
||||
|
||||
return data.Involvedcompanies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompanyByID(id uint64) (*pb.InvolvedCompany, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
involvedCompanies, err := g.GetInvolvedCompanies(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return involvedCompanies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesByIDs(ids []uint64) ([]*pb.InvolvedCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetInvolvedCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetInvolvedCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where company = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetInvolvedCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetInvolvedCompaniesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
involvedCompanies, err := g.GetInvolvedCompanies(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(involvedCompanies[0].Id), nil
|
||||
}
|
||||
|
30
keywords.go
30
keywords.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetKeywords(query string) ([]*pb.Keyword, error) {
|
||||
|
||||
return data.Keywords, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetKeywordByID(id uint64) (*pb.Keyword, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
keywords, err := g.GetKeywords(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return keywords[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetKeywordsByIDs(ids []uint64) ([]*pb.Keyword, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetKeywords(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetKeywordsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
keywords, err := g.GetKeywords(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(keywords[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetLanguageSupportTypes(query string) ([]*pb.LanguageSupportTyp
|
||||
|
||||
return data.Languagesupporttypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportTypeByID(id uint64) (*pb.LanguageSupportType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
languageSupportTypes, err := g.GetLanguageSupportTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return languageSupportTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportTypesByIDs(ids []uint64) ([]*pb.LanguageSupportType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetLanguageSupportTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
languageSupportTypes, err := g.GetLanguageSupportTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(languageSupportTypes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,80 +25,3 @@ func (g *Client) GetLanguageSupports(query string) ([]*pb.LanguageSupport, error
|
||||
|
||||
return data.Languagesupports, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportByID(id uint64) (*pb.LanguageSupport, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
languageSupports, err := g.GetLanguageSupports(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return languageSupports[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsByIDs(ids []uint64) ([]*pb.LanguageSupport, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where language = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where language_support_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetLanguageSupports(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageSupportsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
languageSupports, err := g.GetLanguageSupports(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(languageSupports[0].Id), nil
|
||||
}
|
||||
|
30
languages.go
30
languages.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetLanguages(query string) ([]*pb.Language, error) {
|
||||
|
||||
return data.Languages, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguageByID(id uint64) (*pb.Language, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
languages, err := g.GetLanguages(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return languages[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguagesByIDs(ids []uint64) ([]*pb.Language, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetLanguages(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetLanguagesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
languages, err := g.GetLanguages(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(languages[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetMultiplayerModes(query string) ([]*pb.MultiplayerMode, error
|
||||
|
||||
return data.Multiplayermodes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModeByID(id uint64) (*pb.MultiplayerMode, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
multiplayerModes, err := g.GetMultiplayerModes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return multiplayerModes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesByIDs(ids []uint64) ([]*pb.MultiplayerMode, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetMultiplayerModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetMultiplayerModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetMultiplayerModes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetMultiplayerModesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
multiplayerModes, err := g.GetMultiplayerModes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(multiplayerModes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetNetworkTypes(query string) ([]*pb.NetworkType, error) {
|
||||
|
||||
return data.Networktypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetNetworkTypeByID(id uint64) (*pb.NetworkType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
networkTypes, err := g.GetNetworkTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return networkTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetNetworkTypesByIDs(ids []uint64) ([]*pb.NetworkType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetNetworkTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetNetworkTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
networkTypes, err := g.GetNetworkTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(networkTypes[0].Id), nil
|
||||
}
|
||||
|
33
parent.go
33
parent.go
@ -1,33 +0,0 @@
|
||||
package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (g *Client) 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)
|
||||
}
|
||||
hasParent := false
|
||||
if detail.ParentGame != nil && detail.ParentGame.Id != 0 {
|
||||
hasParent = true
|
||||
detail, err = g.GetGameByID(detail.ParentGame.Id)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to fetch IGDB version parent: %d: %w", detail.VersionParent.Id, err)
|
||||
}
|
||||
}
|
||||
for detail.VersionParent != nil && detail.VersionParent.Id != 0 {
|
||||
hasParent = true
|
||||
detail, err = g.GetGameByID(detail.VersionParent.Id)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to fetch IGDB version parent: %d: %w", detail.VersionParent.Id, err)
|
||||
}
|
||||
}
|
||||
|
||||
if hasParent {
|
||||
return detail.Id, nil
|
||||
}
|
||||
|
||||
return id, nil
|
||||
}
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetPlatformFamilies(query string) ([]*pb.PlatformFamily, error)
|
||||
|
||||
return data.Platformfamilies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformFamilyByID(id uint64) (*pb.PlatformFamily, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformFamilies, err := g.GetPlatformFamilies(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformFamilies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformFamiliesByIDs(ids []uint64) ([]*pb.PlatformFamily, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformFamilies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformFamiliesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformFamilies, err := g.GetPlatformFamilies(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformFamilies[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetPlatformLogos(query string) ([]*pb.PlatformLogo, error) {
|
||||
|
||||
return data.Platformlogos, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformLogoByID(id uint64) (*pb.PlatformLogo, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformLogos, err := g.GetPlatformLogos(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformLogos[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformLogosByIDs(ids []uint64) ([]*pb.PlatformLogo, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformLogos(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformLogosLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformLogos, err := g.GetPlatformLogos(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformLogos[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetPlatformTypes(query string) ([]*pb.PlatformType, error) {
|
||||
|
||||
return data.Platformtypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformTypeByID(id uint64) (*pb.PlatformType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformTypes, err := g.GetPlatformTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformTypesByIDs(ids []uint64) ([]*pb.PlatformType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformTypes, err := g.GetPlatformTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformTypes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetPlatformVersionCompanies(query string) ([]*pb.PlatformVersio
|
||||
|
||||
return data.Platformversioncompanies, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompanyByID(id uint64) (*pb.PlatformVersionCompany, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformVersionCompanies, err := g.GetPlatformVersionCompanies(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformVersionCompanies[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompaniesByIDs(ids []uint64) ([]*pb.PlatformVersionCompany, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersionCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where company = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersionCompanies(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionCompaniesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformVersionCompanies, err := g.GetPlatformVersionCompanies(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformVersionCompanies[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,80 +25,3 @@ func (g *Client) GetPlatformVersionReleaseDates(query string) ([]*pb.PlatformVer
|
||||
|
||||
return data.Platformversionreleasedates, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDateByID(id uint64) (*pb.PlatformVersionReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformVersionReleaseDates, err := g.GetPlatformVersionReleaseDates(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformVersionReleaseDates[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesByIDs(ids []uint64) ([]*pb.PlatformVersionReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform_version = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where release_region = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where date_format = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersionReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionReleaseDatesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformVersionReleaseDates, err := g.GetPlatformVersionReleaseDates(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformVersionReleaseDates[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetPlatformVersions(query string) ([]*pb.PlatformVersion, error
|
||||
|
||||
return data.Platformversions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionByID(id uint64) (*pb.PlatformVersion, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformVersions, err := g.GetPlatformVersions(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformVersions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsByIDs(ids []uint64) ([]*pb.PlatformVersion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where main_manufacturer = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform_logo = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformVersions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformVersionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformVersions, err := g.GetPlatformVersions(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformVersions[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetPlatformWebsites(query string) ([]*pb.PlatformWebsite, error
|
||||
|
||||
return data.Platformwebsites, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformWebsiteByID(id uint64) (*pb.PlatformWebsite, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platformWebsites, err := g.GetPlatformWebsites(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platformWebsites[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformWebsitesByIDs(ids []uint64) ([]*pb.PlatformWebsite, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatformWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformWebsitesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platformWebsites, err := g.GetPlatformWebsites(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platformWebsites[0].Id), nil
|
||||
}
|
||||
|
78
platforms.go
78
platforms.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -25,80 +24,3 @@ func (g *Client) GetPlatforms(query string) ([]*pb.Platform, error) {
|
||||
}
|
||||
return data.Platforms, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformByID(id uint64) (*pb.Platform, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
platforms, err := g.GetPlatforms(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return platforms[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsByIDs(ids []uint64) ([]*pb.Platform, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform_family = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform_logo = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform_type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlatforms(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlatformsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
platforms, err := g.GetPlatforms(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(platforms[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetPlayerPerspectives(query string) ([]*pb.PlayerPerspective, e
|
||||
|
||||
return data.Playerperspectives, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlayerPerspectiveByID(id uint64) (*pb.PlayerPerspective, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
playerPerspectives, err := g.GetPlayerPerspectives(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return playerPerspectives[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPlayerPerspectivesByIDs(ids []uint64) ([]*pb.PlayerPerspective, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPlayerPerspectives(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPlayerPerspectivesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
playerPerspectives, err := g.GetPlayerPerspectives(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(playerPerspectives[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,58 +25,3 @@ func (g *Client) GetPopularityPrimitives(query string) ([]*pb.PopularityPrimitiv
|
||||
|
||||
return data.Popularityprimitives, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitiveByID(id uint64) (*pb.PopularityPrimitive, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
popularityPrimitives, err := g.GetPopularityPrimitives(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return popularityPrimitives[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesByIDs(ids []uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPopularityPrimitives(idStr)
|
||||
}
|
||||
|
||||
// GetPopularityPrimitive retrieves popular IGDB game IDs based on a given popularity type.
|
||||
// popularity_type = 1 IGDB Visits
|
||||
// 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) {
|
||||
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) {
|
||||
query := fmt.Sprintf(`where external_popularity_source = %d; fields *;`, id)
|
||||
return g.GetPopularityPrimitives(query)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesByExternalPopularitySourceIDs(ids []uint64) ([]*pb.PopularityPrimitive, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where external_popularity_source = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPopularityPrimitives(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityPrimitivesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
popularityPrimitives, err := g.GetPopularityPrimitives(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(popularityPrimitives[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetPopularityTypes(query string) ([]*pb.PopularityType, error)
|
||||
|
||||
return data.Popularitytypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypeByID(id uint64) (*pb.PopularityType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
popularityTypes, err := g.GetPopularityTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return popularityTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypesByIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPopularityTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where external_popularity_source = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetPopularityTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetPopularityTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
popularityTypes, err := g.GetPopularityTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(popularityTypes[0].Id), nil
|
||||
}
|
||||
|
30
regions.go
30
regions.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetRegions(query string) ([]*pb.Region, error) {
|
||||
|
||||
return data.Regions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetRegionByID(id uint64) (*pb.Region, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
regions, err := g.GetRegions(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return regions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetRegionsByIDs(ids []uint64) ([]*pb.Region, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetRegions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetRegionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
regions, err := g.GetRegions(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(regions[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetReleaseDateRegions(query string) ([]*pb.ReleaseDateRegion, e
|
||||
|
||||
return data.Releasedateregions, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateRegionByID(id uint64) (*pb.ReleaseDateRegion, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
releaseDateRegions, err := g.GetReleaseDateRegions(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return releaseDateRegions[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateRegionsByIDs(ids []uint64) ([]*pb.ReleaseDateRegion, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDateRegions(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateRegionsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
releaseDateRegions, err := g.GetReleaseDateRegions(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(releaseDateRegions[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetReleaseDateStatuses(query string) ([]*pb.ReleaseDateStatus,
|
||||
|
||||
return data.Releasedatestatuses, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateStatusByID(id uint64) (*pb.ReleaseDateStatus, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
releaseDateStatuses, err := g.GetReleaseDateStatuses(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return releaseDateStatuses[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateStatusesByIDs(ids []uint64) ([]*pb.ReleaseDateStatus, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDateStatuses(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateStatusesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
releaseDateStatuses, err := g.GetReleaseDateStatuses(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(releaseDateStatuses[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,96 +25,3 @@ func (g *Client) GetReleaseDates(query string) ([]*pb.ReleaseDate, error) {
|
||||
|
||||
return data.Releasedates, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDateByID(id uint64) (*pb.ReleaseDate, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
releaseDates, err := g.GetReleaseDates(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return releaseDates[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesByIDs(ids []uint64) ([]*pb.ReleaseDate, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where platform = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where release_region = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where status = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetReleaseDates(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetReleaseDatesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
releaseDates, err := g.GetReleaseDates(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(releaseDates[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,48 +25,3 @@ func (g *Client) GetScreenshots(query string) ([]*pb.Screenshot, error) {
|
||||
|
||||
return data.Screenshots, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotByID(id uint64) (*pb.Screenshot, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
screenshots, err := g.GetScreenshots(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return screenshots[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotsByIDs(ids []uint64) ([]*pb.Screenshot, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetScreenshots(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetScreenshots(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetScreenshotsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
screenshots, err := g.GetScreenshots(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(screenshots[0].Id), nil
|
||||
}
|
||||
|
@ -93,5 +93,5 @@ func (g *Client) WebSearchGames(name string) ([]*pb.Game, error) {
|
||||
ids[i] = game.Id
|
||||
}
|
||||
|
||||
return g.GetGameByIDs(ids)
|
||||
return GetItemsByIDs(ids, g.GetGames)
|
||||
}
|
||||
|
30
themes.go
30
themes.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetThemes(query string) ([]*pb.Theme, error) {
|
||||
|
||||
return data.Themes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetThemeByID(id uint64) (*pb.Theme, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
themes, err := g.GetThemes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return themes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetThemesByIDs(ids []uint64) ([]*pb.Theme, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetThemes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetThemesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
themes, err := g.GetThemes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(themes[0].Id), nil
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,32 +25,3 @@ func (g *Client) GetWebsiteTypes(query string) ([]*pb.WebsiteType, error) {
|
||||
|
||||
return data.Websitetypes, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteTypeByID(id uint64) (*pb.WebsiteType, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
websiteTypes, err := g.GetWebsiteTypes(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return websiteTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteTypesByIDs(ids []uint64) ([]*pb.WebsiteType, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetWebsiteTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
websiteTypes, err := g.GetWebsiteTypes(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(websiteTypes[0].Id), nil
|
||||
}
|
||||
|
62
websites.go
62
websites.go
@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@ -26,64 +25,3 @@ func (g *Client) GetWebsites(query string) ([]*pb.Website, error) {
|
||||
|
||||
return data.Websites, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsiteByID(id uint64) (*pb.Website, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
websites, err := g.GetWebsites(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return websites[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesByIDs(ids []uint64) ([]*pb.Website, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where game = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) 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) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where type = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetWebsites(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetWebsitesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
websites, err := g.GetWebsites(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(websites[0].Id), nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user