2 Commits

Author SHA1 Message Date
4b6f488f59 feat(proto): Regenerate Go protobufs for new IGDB API types
Regenerated `proto/igdbapi.pb.go` to reflect updates in the IGDB API schema.
This update incorporates new API types, such as `AgeRatingContentDescriptionType` and its corresponding result type.

The regeneration was performed with:
- `protoc-gen-go` updated from `v1.36.5` to `v1.36.10`
- `protoc` updated from `v6.30.1` to `v6.32.1`
2025-10-28 20:12:19 +11:00
3df648929d u 2025-05-17 16:27:46 +10:00
4 changed files with 2588 additions and 3318 deletions

View File

@@ -42,14 +42,30 @@ func (b *BaseEndpoint[T]) GetByID(id uint64) (*T, error) {
} }
func (b *BaseEndpoint[T]) GetByIDs(ids []uint64) ([]*T, error) { func (b *BaseEndpoint[T]) GetByIDs(ids []uint64) ([]*T, error) {
if len(ids) == 0 {
return nil, fmt.Errorf("ids cant be empty")
}
batches := make([][]uint64, 0)
for i := 0; i < len(ids); i += 500 {
end := min(i+500, len(ids))
batches = append(batches, ids[i:end])
}
res := []*T{}
for _, batch := range batches {
builder := strings.Builder{} builder := strings.Builder{}
for i, v := range ids { for i, v := range batch {
if i > 0 { if i > 0 {
builder.WriteByte(',') builder.WriteByte(',')
} }
builder.WriteString(strconv.FormatUint(v, 10)) builder.WriteString(strconv.FormatUint(v, 10))
} }
return b.Query(fmt.Sprintf("where id = (%s); fields *;", builder.String())) batchRes, err := b.Query(fmt.Sprintf("where id = (%s); fields *; limit 500;", builder.String()))
if err != nil {
return nil, err
}
res = append(res, batchRes...)
}
return res, nil
} }
func (b *BaseEndpoint[T]) Count() (uint64, error) { func (b *BaseEndpoint[T]) Count() (uint64, error) {

File diff suppressed because it is too large Load Diff

View File

@@ -209,6 +209,19 @@ enum AgeRatingContentDescriptionCategoryEnum {
CLASS_IND_ATOS_CRIMINOSOS = 85 [deprecated = true]; CLASS_IND_ATOS_CRIMINOSOS = 85 [deprecated = true];
} }
message AgeRatingContentDescriptionTypeResult {
repeated AgeRatingContentDescriptionType ageratingcontentdescriptiontypes = 1;
}
message AgeRatingContentDescriptionType {
uint64 id = 1;
string slug = 2;
string name = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
string checksum = 6;
}
message AgeRatingContentDescriptionV2Result { message AgeRatingContentDescriptionV2Result {
repeated AgeRatingContentDescriptionV2 ageratingcontentdescriptionsv2 = 1; repeated AgeRatingContentDescriptionV2 ageratingcontentdescriptionsv2 = 1;
} }
@@ -220,6 +233,7 @@ message AgeRatingContentDescriptionV2 {
google.protobuf.Timestamp created_at = 4; google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5; google.protobuf.Timestamp updated_at = 5;
string checksum = 6; string checksum = 6;
AgeRatingContentDescriptionType description_type = 7;
} }
message AgeRatingOrganizationResult { message AgeRatingOrganizationResult {
@@ -260,6 +274,20 @@ message Artwork {
string url = 7; string url = 7;
int32 width = 8; int32 width = 8;
string checksum = 9; string checksum = 9;
ArtworkType artwork_type = 10;
}
message ArtworkTypeResult {
repeated ArtworkType artworktypes = 1;
}
message ArtworkType {
uint64 id = 1;
string slug = 2;
string name = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
string checksum = 6;
} }
message CharacterResult { message CharacterResult {
@@ -1342,6 +1370,7 @@ message ReleaseDate {
ReleaseDateStatus status = 13; ReleaseDateStatus status = 13;
DateFormat date_format = 14; DateFormat date_format = 14;
ReleaseDateRegion release_region = 15; ReleaseDateRegion release_region = 15;
int32 d = 16;
} }
message ReleaseDateRegionResult { message ReleaseDateRegionResult {

View File

@@ -1,4 +1,4 @@
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
wget https://api.igdb.com/v4/igdbapi.proto -O ./igdbapi.proto wget https://api.igdb.com/v4/igdbapi.proto -O ./proto/igdbapi.proto
protoc --go_out=. --go_opt=Mproto/igdbapi.proto=/proto ./proto/igdbapi.proto protoc --go_out=. --go_opt=Mproto/igdbapi.proto=/proto ./proto/igdbapi.proto