This commit is contained in:
2025-04-05 16:29:30 +11:00
parent dab30b4938
commit 35c27b28a3
73 changed files with 444 additions and 444 deletions

View File

@@ -9,7 +9,7 @@ import (
"google.golang.org/protobuf/proto"
)
func (g *igdb) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelationType, error) {
func (g *Client) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelationType, error) {
resp, err := g.Request("https://api.igdb.com/v4/collection_relation_types.pb", query)
if err != nil {
return nil, fmt.Errorf("failed to request: %w", err)
@@ -27,7 +27,7 @@ func (g *igdb) GetCollectionRelationTypes(query string) ([]*pb.CollectionRelatio
return data.Collectionrelationtypes, nil
}
func (g *igdb) GetCollectionRelationTypeByID(id uint64) (*pb.CollectionRelationType, error) {
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 {
@@ -36,7 +36,7 @@ func (g *igdb) GetCollectionRelationTypeByID(id uint64) (*pb.CollectionRelationT
return collectionRelationTypes[0], nil
}
func (g *igdb) GetCollectionRelationTypesByIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
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)
@@ -47,12 +47,12 @@ func (g *igdb) GetCollectionRelationTypesByIDs(ids []uint64) ([]*pb.CollectionRe
return g.GetCollectionRelationTypes(idStr)
}
func (g *igdb) GetCollectionRelationTypesByAllowedChildTypeID(id uint64) ([]*pb.CollectionRelationType, error) {
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 *igdb) GetCollectionRelationTypesByAllowedChildTypeIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
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)
@@ -63,12 +63,12 @@ func (g *igdb) GetCollectionRelationTypesByAllowedChildTypeIDs(ids []uint64) ([]
return g.GetCollectionRelationTypes(idStr)
}
func (g *igdb) GetCollectionRelationTypesByAllowedParentTypeID(id uint64) ([]*pb.CollectionRelationType, error) {
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 *igdb) GetCollectionRelationTypesByAllowedParentTypeIDs(ids []uint64) ([]*pb.CollectionRelationType, error) {
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)
@@ -79,7 +79,7 @@ func (g *igdb) GetCollectionRelationTypesByAllowedParentTypeIDs(ids []uint64) ([
return g.GetCollectionRelationTypes(idStr)
}
func (g *igdb) GetCollectionRelationTypesLength() (int, error) {
func (g *Client) GetCollectionRelationTypesLength() (int, error) {
query := `fields *; sort id desc; limit 1;`
collectionRelationTypes, err := g.GetCollectionRelationTypes(query)
if err != nil {