forked from nite/go-igdb
u
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (g *igdb) GetPopularityTypes(query string) ([]*pb.PopularityType, error) {
|
||||
func (g *Client) GetPopularityTypes(query string) ([]*pb.PopularityType, error) {
|
||||
resp, err := g.Request("https://api.igdb.com/v4/popularity_types.pb", query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to request: %w", err)
|
||||
@@ -27,7 +27,7 @@ func (g *igdb) GetPopularityTypes(query string) ([]*pb.PopularityType, error) {
|
||||
return data.Popularitytypes, nil
|
||||
}
|
||||
|
||||
func (g *igdb) GetPopularityTypeByID(id uint64) (*pb.PopularityType, error) {
|
||||
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 {
|
||||
@@ -36,7 +36,7 @@ func (g *igdb) GetPopularityTypeByID(id uint64) (*pb.PopularityType, error) {
|
||||
return popularityTypes[0], nil
|
||||
}
|
||||
|
||||
func (g *igdb) GetPopularityTypesByIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
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)
|
||||
@@ -47,12 +47,12 @@ func (g *igdb) GetPopularityTypesByIDs(ids []uint64) ([]*pb.PopularityType, erro
|
||||
return g.GetPopularityTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *igdb) GetPopularityTypesByExternalPopularitySourceID(id uint64) ([]*pb.PopularityType, error) {
|
||||
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 *igdb) GetPopularityTypesByExternalPopularitySourceIDs(ids []uint64) ([]*pb.PopularityType, error) {
|
||||
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)
|
||||
@@ -63,7 +63,7 @@ func (g *igdb) GetPopularityTypesByExternalPopularitySourceIDs(ids []uint64) ([]
|
||||
return g.GetPopularityTypes(idStr)
|
||||
}
|
||||
|
||||
func (g *igdb) GetPopularityTypesLength() (int, error) {
|
||||
func (g *Client) GetPopularityTypesLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
popularityTypes, err := g.GetPopularityTypes(query)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user