This commit is contained in:
2025-04-06 03:24:50 +10:00
parent f88ba544c2
commit a8e650e4d7
75 changed files with 1250 additions and 533 deletions

View File

@ -4,12 +4,24 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type AgeRatingCategories struct {
BaseEndpoint
BaseEndpoint[pb.AgeRatingCategory]
}
func NewAgeRatingCategories(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingCategories {
a := &AgeRatingCategories{
BaseEndpoint: BaseEndpoint[pb.AgeRatingCategory]{
endpointName: EPAgeRatingCategories,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *AgeRatingCategories) Query(query string) ([]*pb.AgeRatingCategory, error) {

View File

@ -4,12 +4,24 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type AgeRatingContentDescriptions struct {
BaseEndpoint
BaseEndpoint[pb.AgeRatingContentDescription]
}
func NewAgeRatingContentDescriptions(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingContentDescriptions {
a := &AgeRatingContentDescriptions{
BaseEndpoint[pb.AgeRatingContentDescription]{
endpointName: EPAgeRatingContentDescriptions,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *AgeRatingContentDescriptions) Query(query string) ([]*pb.AgeRatingContentDescription, error) {

View File

@ -4,12 +4,24 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type AgeRatingContentDescriptionsV2 struct {
BaseEndpoint
BaseEndpoint[pb.AgeRatingContentDescriptionV2]
}
func NewAgeRatingContentDescriptionsV2(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingContentDescriptionsV2 {
a := &AgeRatingContentDescriptionsV2{
BaseEndpoint[pb.AgeRatingContentDescriptionV2]{
endpointName: EPAgeRatingContentDescriptionsV2,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *AgeRatingContentDescriptionsV2) Query(query string) ([]*pb.AgeRatingContentDescriptionV2, error) {

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type AgeRatingOrganizations struct{ BaseEndpoint }
type AgeRatingOrganizations struct {
BaseEndpoint[pb.AgeRatingOrganization]
}
func NewAgeRatingOrganizations(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingOrganizations {
a := &AgeRatingOrganizations{
BaseEndpoint[pb.AgeRatingOrganization]{
endpointName: EPAgeRatingOrganizations,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *AgeRatingOrganizations) Query(query string) ([]*pb.AgeRatingOrganization, error) {
resp, err := a.request("https://api.igdb.com/v4/age_rating_organizations.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type AgeRatings struct{ BaseEndpoint }
type AgeRatings struct {
BaseEndpoint[pb.AgeRating]
}
func NewAgeRatings(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatings {
a := &AgeRatings{
BaseEndpoint[pb.AgeRating]{
endpointName: EPAgeRatings,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *AgeRatings) Query(query string) ([]*pb.AgeRating, error) {
resp, err := a.request("https://api.igdb.com/v4/age_ratings.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type AlternativeNames struct{ BaseEndpoint }
type AlternativeNames struct {
BaseEndpoint[pb.AlternativeName]
}
func NewAlternativeNames(request func(URL string, dataBody any) (*resty.Response, error)) *AlternativeNames {
a := &AlternativeNames{
BaseEndpoint[pb.AlternativeName]{
endpointName: EPAlternativeNames,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *AlternativeNames) Query(query string) ([]*pb.AlternativeName, error) {
resp, err := a.request("https://api.igdb.com/v4/alternative_names.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Artworks struct{ BaseEndpoint }
type Artworks struct {
BaseEndpoint[pb.Artwork]
}
func NewArtworks(request func(URL string, dataBody any) (*resty.Response, error)) *Artworks {
a := &Artworks{
BaseEndpoint[pb.Artwork]{
endpointName: EPArtworks,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Artworks) Query(query string) ([]*pb.Artwork, error) {
resp, err := a.request("https://api.igdb.com/v4/artworks.pb", query)

View File

@ -1,38 +1,70 @@
package endpoint
import (
"fmt"
"strconv"
"strings"
"github.com/go-resty/resty/v2"
)
type BaseEndpoint struct {
type BaseEndpoint[T any] struct {
request func(URL string, dataBody any) (*resty.Response, error)
endpointName EndpointName
queryFunc func(string) ([]*T, error)
}
func NewBaseEndpoint(request func(URL string, dataBody any) (*resty.Response, error), endpointName EndpointName) *BaseEndpoint {
return &BaseEndpoint{
request: request,
endpointName: endpointName,
}
}
func (b *BaseEndpoint) GetEndpointName() EndpointName {
func (b *BaseEndpoint[T]) GetEndpointName() EndpointName {
return b.endpointName
}
func (b *BaseEndpoint) Query(query string) (any, error) {
return nil, nil
func (b *BaseEndpoint[T]) Query(query string) ([]*T, error) {
if b.queryFunc == nil {
return nil, fmt.Errorf("Query method must be implemented by specific endpoint")
}
return b.queryFunc(query)
}
func (b *BaseEndpoint) QueryAny(query string) (any, error) {
return b.Query(query)
func (b *BaseEndpoint[T]) GetByID(id uint64) (*T, error) {
res, err := b.Query(fmt.Sprintf("where id = %d; fields *;", id))
if err != nil {
return nil, err
}
if len(res) == 0 {
return nil, fmt.Errorf("no results")
}
return res[0], nil
}
type Endpoint interface {
GetEndpointName() EndpointName
func (b *BaseEndpoint[T]) GetByIDs(ids []uint64) ([]*T, error) {
builder := strings.Builder{}
for i, v := range ids {
if i > 0 {
builder.WriteByte(',')
}
builder.WriteString(strconv.FormatUint(v, 10))
}
return b.Query(fmt.Sprintf("where id = (%s); fields *;", builder.String()))
}
type EntityEndpoint interface {
QueryAny(query string) (any, error)
GetEndpointName() EndpointName
func (b *BaseEndpoint[T]) GetLastOneId() (uint64, error) {
res, err := b.Query("fields *; sort id desc; limit 1;")
if err != nil {
return 0, err
}
if len(res) == 0 {
return 0, fmt.Errorf("no results")
}
type IdGetter interface {
GetId() uint64
}
item, ok := any(res[0]).(IdGetter)
if !ok {
return 0, fmt.Errorf("invalid type")
}
return item.GetId(), nil
}
func (b *BaseEndpoint[T]) Paginated(offset, limit uint64) ([]*T, error) {
return b.Query(fmt.Sprintf("offset %d; limit %d; fields *; sort id asc;", offset, limit))
}

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CharacterGenders struct{ BaseEndpoint }
type CharacterGenders struct {
BaseEndpoint[pb.CharacterGender]
}
func NewCharacterGenders(request func(URL string, dataBody any) (*resty.Response, error)) *CharacterGenders {
a := &CharacterGenders{
BaseEndpoint[pb.CharacterGender]{
endpointName: EPCharacterGenders,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CharacterGenders) Query(query string) ([]*pb.CharacterGender, error) {
resp, err := a.request("https://api.igdb.com/v4/character_genders.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CharacterMugShots struct{ BaseEndpoint }
type CharacterMugShots struct {
BaseEndpoint[pb.CharacterMugShot]
}
func NewCharacterMugShots(request func(URL string, dataBody any) (*resty.Response, error)) *CharacterMugShots {
a := &CharacterMugShots{
BaseEndpoint[pb.CharacterMugShot]{
endpointName: EPCharacterMugShots,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CharacterMugShots) Query(query string) ([]*pb.CharacterMugShot, error) {
resp, err := a.request("https://api.igdb.com/v4/character_mug_shots.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CharacterSpecies struct{ BaseEndpoint }
type CharacterSpecies struct {
BaseEndpoint[pb.CharacterSpecie]
}
func NewCharacterSpecies(request func(URL string, dataBody any) (*resty.Response, error)) *CharacterSpecies {
a := &CharacterSpecies{
BaseEndpoint[pb.CharacterSpecie]{
endpointName: EPCharacterSpecies,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CharacterSpecies) Query(query string) ([]*pb.CharacterSpecie, error) {
resp, err := a.request("https://api.igdb.com/v4/character_species.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Characters struct{ BaseEndpoint }
type Characters struct {
BaseEndpoint[pb.Character]
}
func NewCharacters(request func(URL string, dataBody any) (*resty.Response, error)) *Characters {
a := &Characters{
BaseEndpoint[pb.Character]{
endpointName: EPCharacters,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Characters) Query(query string) ([]*pb.Character, error) {
resp, err := a.request("https://api.igdb.com/v4/characters.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CollectionMembershipTypes struct{ BaseEndpoint }
type CollectionMembershipTypes struct {
BaseEndpoint[pb.CollectionMembershipType]
}
func NewCollectionMembershipTypes(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionMembershipTypes {
a := &CollectionMembershipTypes{
BaseEndpoint[pb.CollectionMembershipType]{
endpointName: EPCollectionMembershipTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CollectionMembershipTypes) Query(query string) ([]*pb.CollectionMembershipType, error) {
resp, err := a.request("https://api.igdb.com/v4/collection_membership_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CollectionMemberships struct{ BaseEndpoint }
type CollectionMemberships struct {
BaseEndpoint[pb.CollectionMembership]
}
func NewCollectionMemberships(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionMemberships {
a := &CollectionMemberships{
BaseEndpoint[pb.CollectionMembership]{
endpointName: EPCollectionMemberships,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CollectionMemberships) Query(query string) ([]*pb.CollectionMembership, error) {
resp, err := a.request("https://api.igdb.com/v4/collection_memberships.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CollectionRelationTypes struct{ BaseEndpoint }
type CollectionRelationTypes struct {
BaseEndpoint[pb.CollectionRelationType]
}
func NewCollectionRelationTypes(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionRelationTypes {
a := &CollectionRelationTypes{
BaseEndpoint[pb.CollectionRelationType]{
endpointName: EPCollectionRelationTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CollectionRelationTypes) Query(query string) ([]*pb.CollectionRelationType, error) {
resp, err := a.request("https://api.igdb.com/v4/collection_relation_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CollectionRelations struct{ BaseEndpoint }
type CollectionRelations struct {
BaseEndpoint[pb.CollectionRelation]
}
func NewCollectionRelations(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionRelations {
a := &CollectionRelations{
BaseEndpoint[pb.CollectionRelation]{
endpointName: EPCollectionRelations,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CollectionRelations) Query(query string) ([]*pb.CollectionRelation, error) {
resp, err := a.request("https://api.igdb.com/v4/collection_relations.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CollectionTypes struct{ BaseEndpoint }
type CollectionTypes struct {
BaseEndpoint[pb.CollectionType]
}
func NewCollectionTypes(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionTypes {
a := &CollectionTypes{
BaseEndpoint[pb.CollectionType]{
endpointName: EPCollectionTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CollectionTypes) Query(query string) ([]*pb.CollectionType, error) {
resp, err := a.request("https://api.igdb.com/v4/collection_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Collections struct{ BaseEndpoint }
type Collections struct {
BaseEndpoint[pb.Collection]
}
func NewCollections(request func(URL string, dataBody any) (*resty.Response, error)) *Collections {
a := &Collections{
BaseEndpoint[pb.Collection]{
endpointName: EPCollections,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Collections) Query(query string) ([]*pb.Collection, error) {
resp, err := a.request("https://api.igdb.com/v4/collections.pb", query)

View File

@ -5,11 +5,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Companies struct{ BaseEndpoint }
type Companies struct {
BaseEndpoint[pb.Company]
}
func NewCompanies(request func(URL string, dataBody any) (*resty.Response, error)) *Companies {
a := &Companies{
BaseEndpoint[pb.Company]{
endpointName: EPCompanies,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Companies) Query(query string) ([]*pb.Company, error) {
resp, err := a.request("https://api.igdb.com/v4/companies.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CompanyLogos struct{ BaseEndpoint }
type CompanyLogos struct {
BaseEndpoint[pb.CompanyLogo]
}
func NewCompanyLogos(request func(URL string, dataBody any) (*resty.Response, error)) *CompanyLogos {
a := &CompanyLogos{
BaseEndpoint[pb.CompanyLogo]{
endpointName: EPCompanyLogos,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CompanyLogos) Query(query string) ([]*pb.CompanyLogo, error) {
resp, err := a.request("https://api.igdb.com/v4/company_logos.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CompanyStatuses struct{ BaseEndpoint }
type CompanyStatuses struct {
BaseEndpoint[pb.CompanyStatus]
}
func NewCompanyStatuses(request func(URL string, dataBody any) (*resty.Response, error)) *CompanyStatuses {
a := &CompanyStatuses{
BaseEndpoint[pb.CompanyStatus]{
endpointName: EPCompanyStatuses,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CompanyStatuses) Query(query string) ([]*pb.CompanyStatus, error) {
resp, err := a.request("https://api.igdb.com/v4/company_statuses.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type CompanyWebsites struct{ BaseEndpoint }
type CompanyWebsites struct {
BaseEndpoint[pb.CompanyWebsite]
}
func NewCompanyWebsites(request func(URL string, dataBody any) (*resty.Response, error)) *CompanyWebsites {
a := &CompanyWebsites{
BaseEndpoint[pb.CompanyWebsite]{
endpointName: EPCompanyWebsites,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *CompanyWebsites) Query(query string) ([]*pb.CompanyWebsite, error) {
resp, err := a.request("https://api.igdb.com/v4/company_websites.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Covers struct{ BaseEndpoint }
type Covers struct {
BaseEndpoint[pb.Cover]
}
func NewCovers(request func(URL string, dataBody any) (*resty.Response, error)) *Covers {
a := &Covers{
BaseEndpoint[pb.Cover]{
endpointName: EPCovers,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Covers) Query(query string) ([]*pb.Cover, error) {
resp, err := a.request("https://api.igdb.com/v4/covers.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type DateFormats struct{ BaseEndpoint }
type DateFormats struct {
BaseEndpoint[pb.DateFormat]
}
func NewDateFormats(request func(URL string, dataBody any) (*resty.Response, error)) *DateFormats {
a := &DateFormats{
BaseEndpoint[pb.DateFormat]{
endpointName: EPDateFormats,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *DateFormats) Query(query string) ([]*pb.DateFormat, error) {
resp, err := a.request("https://api.igdb.com/v4/date_formats.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type EventLogos struct{ BaseEndpoint }
type EventLogos struct {
BaseEndpoint[pb.EventLogo]
}
func NewEventLogos(request func(URL string, dataBody any) (*resty.Response, error)) *EventLogos {
a := &EventLogos{
BaseEndpoint[pb.EventLogo]{
endpointName: EPEventLogos,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *EventLogos) Query(query string) ([]*pb.EventLogo, error) {
resp, err := a.request("https://api.igdb.com/v4/event_logos.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type EventNetworks struct{ BaseEndpoint }
type EventNetworks struct {
BaseEndpoint[pb.EventNetwork]
}
func NewEventNetworks(request func(URL string, dataBody any) (*resty.Response, error)) *EventNetworks {
a := &EventNetworks{
BaseEndpoint[pb.EventNetwork]{
endpointName: EPEventNetworks,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *EventNetworks) Query(query string) ([]*pb.EventNetwork, error) {
resp, err := a.request("https://api.igdb.com/v4/event_networks.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Events struct{ BaseEndpoint }
type Events struct {
BaseEndpoint[pb.Event]
}
func NewEvents(request func(URL string, dataBody any) (*resty.Response, error)) *Events {
a := &Events{
BaseEndpoint[pb.Event]{
endpointName: EPEvents,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Events) Query(query string) ([]*pb.Event, error) {
resp, err := a.request("https://api.igdb.com/v4/events.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type ExternalGameSources struct{ BaseEndpoint }
type ExternalGameSources struct {
BaseEndpoint[pb.ExternalGameSource]
}
func NewExternalGameSources(request func(URL string, dataBody any) (*resty.Response, error)) *ExternalGameSources {
a := &ExternalGameSources{
BaseEndpoint[pb.ExternalGameSource]{
endpointName: EPExternalGameSources,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *ExternalGameSources) Query(query string) ([]*pb.ExternalGameSource, error) {
resp, err := a.request("https://api.igdb.com/v4/external_game_sources.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type ExternalGames struct{ BaseEndpoint }
type ExternalGames struct {
BaseEndpoint[pb.ExternalGame]
}
func NewExternalGames(request func(URL string, dataBody any) (*resty.Response, error)) *ExternalGames {
a := &ExternalGames{
BaseEndpoint[pb.ExternalGame]{
endpointName: EPExternalGames,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *ExternalGames) Query(query string) ([]*pb.ExternalGame, error) {
resp, err := a.request("https://api.igdb.com/v4/external_games.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Franchises struct{ BaseEndpoint }
type Franchises struct {
BaseEndpoint[pb.Franchise]
}
func NewFranchises(request func(URL string, dataBody any) (*resty.Response, error)) *Franchises {
a := &Franchises{
BaseEndpoint[pb.Franchise]{
endpointName: EPFranchises,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Franchises) Query(query string) ([]*pb.Franchise, error) {
resp, err := a.request("https://api.igdb.com/v4/franchises.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameEngineLogos struct{ BaseEndpoint }
type GameEngineLogos struct {
BaseEndpoint[pb.GameEngineLogo]
}
func NewGameEngineLogos(request func(URL string, dataBody any) (*resty.Response, error)) *GameEngineLogos {
a := &GameEngineLogos{
BaseEndpoint[pb.GameEngineLogo]{
endpointName: EPGameEngineLogos,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameEngineLogos) Query(query string) ([]*pb.GameEngineLogo, error) {
resp, err := a.request("https://api.igdb.com/v4/game_engine_logos.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameEngines struct{ BaseEndpoint }
type GameEngines struct {
BaseEndpoint[pb.GameEngine]
}
func NewGameEngines(request func(URL string, dataBody any) (*resty.Response, error)) *GameEngines {
a := &GameEngines{
BaseEndpoint[pb.GameEngine]{
endpointName: EPGameEngines,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameEngines) Query(query string) ([]*pb.GameEngine, error) {
resp, err := a.request("https://api.igdb.com/v4/game_engines.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameLocalizations struct{ BaseEndpoint }
type GameLocalizations struct {
BaseEndpoint[pb.GameLocalization]
}
func NewGameLocalizations(request func(URL string, dataBody any) (*resty.Response, error)) *GameLocalizations {
a := &GameLocalizations{
BaseEndpoint[pb.GameLocalization]{
endpointName: EPGameLocalizations,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameLocalizations) Query(query string) ([]*pb.GameLocalization, error) {
resp, err := a.request("https://api.igdb.com/v4/game_localizations.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameModes struct{ BaseEndpoint }
type GameModes struct {
BaseEndpoint[pb.GameMode]
}
func NewGameModes(request func(URL string, dataBody any) (*resty.Response, error)) *GameModes {
a := &GameModes{
BaseEndpoint[pb.GameMode]{
endpointName: EPGameModes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameModes) Query(query string) ([]*pb.GameMode, error) {
resp, err := a.request("https://api.igdb.com/v4/game_modes.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameReleaseFormats struct{ BaseEndpoint }
type GameReleaseFormats struct {
BaseEndpoint[pb.GameReleaseFormat]
}
func NewGameReleaseFormats(request func(URL string, dataBody any) (*resty.Response, error)) *GameReleaseFormats {
a := &GameReleaseFormats{
BaseEndpoint[pb.GameReleaseFormat]{
endpointName: EPGameReleaseFormats,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameReleaseFormats) Query(query string) ([]*pb.GameReleaseFormat, error) {
resp, err := a.request("https://api.igdb.com/v4/game_release_formats.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameStatuses struct{ BaseEndpoint }
type GameStatuses struct {
BaseEndpoint[pb.GameStatus]
}
func NewGameStatuses(request func(URL string, dataBody any) (*resty.Response, error)) *GameStatuses {
a := &GameStatuses{
BaseEndpoint[pb.GameStatus]{
endpointName: EPGameStatuses,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameStatuses) Query(query string) ([]*pb.GameStatus, error) {
resp, err := a.request("https://api.igdb.com/v4/game_statuses.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameTimeToBeats struct{ BaseEndpoint }
type GameTimeToBeats struct {
BaseEndpoint[pb.GameTimeToBeat]
}
func NewGameTimeToBeats(request func(URL string, dataBody any) (*resty.Response, error)) *GameTimeToBeats {
a := &GameTimeToBeats{
BaseEndpoint[pb.GameTimeToBeat]{
endpointName: EPGameTimeToBeats,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameTimeToBeats) Query(query string) ([]*pb.GameTimeToBeat, error) {
resp, err := a.request("https://api.igdb.com/v4/game_time_to_beats.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameTypes struct{ BaseEndpoint }
type GameTypes struct {
BaseEndpoint[pb.GameType]
}
func NewGameTypes(request func(URL string, dataBody any) (*resty.Response, error)) *GameTypes {
a := &GameTypes{
BaseEndpoint[pb.GameType]{
endpointName: EPGameTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameTypes) Query(query string) ([]*pb.GameType, error) {
resp, err := a.request("https://api.igdb.com/v4/game_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameVersionFeatureValues struct{ BaseEndpoint }
type GameVersionFeatureValues struct {
BaseEndpoint[pb.GameVersionFeatureValue]
}
func NewGameVersionFeatureValues(request func(URL string, dataBody any) (*resty.Response, error)) *GameVersionFeatureValues {
a := &GameVersionFeatureValues{
BaseEndpoint[pb.GameVersionFeatureValue]{
endpointName: EPGameVersionFeatureValues,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameVersionFeatureValues) Query(query string) ([]*pb.GameVersionFeatureValue, error) {
resp, err := a.request("https://api.igdb.com/v4/game_version_feature_values.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameVersionFeatures struct{ BaseEndpoint }
type GameVersionFeatures struct {
BaseEndpoint[pb.GameVersionFeature]
}
func NewGameVersionFeatures(request func(URL string, dataBody any) (*resty.Response, error)) *GameVersionFeatures {
a := &GameVersionFeatures{
BaseEndpoint[pb.GameVersionFeature]{
endpointName: EPGameVersionFeatures,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameVersionFeatures) Query(query string) ([]*pb.GameVersionFeature, error) {
resp, err := a.request("https://api.igdb.com/v4/game_version_features.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameVersions struct{ BaseEndpoint }
type GameVersions struct {
BaseEndpoint[pb.GameVersion]
}
func NewGameVersions(request func(URL string, dataBody any) (*resty.Response, error)) *GameVersions {
a := &GameVersions{
BaseEndpoint[pb.GameVersion]{
endpointName: EPGameVersions,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameVersions) Query(query string) ([]*pb.GameVersion, error) {
resp, err := a.request("https://api.igdb.com/v4/game_versions.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type GameVideos struct{ BaseEndpoint }
type GameVideos struct {
BaseEndpoint[pb.GameVideo]
}
func NewGameVideos(request func(URL string, dataBody any) (*resty.Response, error)) *GameVideos {
a := &GameVideos{
BaseEndpoint[pb.GameVideo]{
endpointName: EPGameVideos,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *GameVideos) Query(query string) ([]*pb.GameVideo, error) {
resp, err := a.request("https://api.igdb.com/v4/game_videos.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Games struct{ BaseEndpoint }
type Games struct {
BaseEndpoint[pb.Game]
}
func NewGames(request func(URL string, dataBody any) (*resty.Response, error)) *Games {
a := &Games{
BaseEndpoint[pb.Game]{
endpointName: EPGames,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Games) Query(query string) ([]*pb.Game, error) {
resp, err := a.request("https://api.igdb.com/v4/games.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Genres struct{ BaseEndpoint }
type Genres struct {
BaseEndpoint[pb.Genre]
}
func NewGenres(request func(URL string, dataBody any) (*resty.Response, error)) *Genres {
a := &Genres{
BaseEndpoint[pb.Genre]{
endpointName: EPGenres,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Genres) Query(query string) ([]*pb.Genre, error) {
resp, err := a.request("https://api.igdb.com/v4/genres.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type InvolvedCompanies struct{ BaseEndpoint }
type InvolvedCompanies struct {
BaseEndpoint[pb.InvolvedCompany]
}
func NewInvolvedCompanies(request func(URL string, dataBody any) (*resty.Response, error)) *InvolvedCompanies {
a := &InvolvedCompanies{
BaseEndpoint[pb.InvolvedCompany]{
endpointName: EPInvolvedCompanies,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *InvolvedCompanies) Query(query string) ([]*pb.InvolvedCompany, error) {
resp, err := a.request("https://api.igdb.com/v4/involved_companies.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Keywords struct{ BaseEndpoint }
type Keywords struct {
BaseEndpoint[pb.Keyword]
}
func NewKeywords(request func(URL string, dataBody any) (*resty.Response, error)) *Keywords {
a := &Keywords{
BaseEndpoint[pb.Keyword]{
endpointName: EPKeywords,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Keywords) Query(query string) ([]*pb.Keyword, error) {
resp, err := a.request("https://api.igdb.com/v4/keywords.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type LanguageSupportTypes struct{ BaseEndpoint }
type LanguageSupportTypes struct {
BaseEndpoint[pb.LanguageSupportType]
}
func NewLanguageSupportTypes(request func(URL string, dataBody any) (*resty.Response, error)) *LanguageSupportTypes {
a := &LanguageSupportTypes{
BaseEndpoint[pb.LanguageSupportType]{
endpointName: EPLanguageSupportTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *LanguageSupportTypes) Query(query string) ([]*pb.LanguageSupportType, error) {
resp, err := a.request("https://api.igdb.com/v4/language_support_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type LanguageSupports struct{ BaseEndpoint }
type LanguageSupports struct {
BaseEndpoint[pb.LanguageSupport]
}
func NewLanguageSupports(request func(URL string, dataBody any) (*resty.Response, error)) *LanguageSupports {
a := &LanguageSupports{
BaseEndpoint[pb.LanguageSupport]{
endpointName: EPLanguageSupports,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *LanguageSupports) Query(query string) ([]*pb.LanguageSupport, error) {
resp, err := a.request("https://api.igdb.com/v4/language_supports.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Languages struct{ BaseEndpoint }
type Languages struct {
BaseEndpoint[pb.Language]
}
func NewLanguages(request func(URL string, dataBody any) (*resty.Response, error)) *Languages {
a := &Languages{
BaseEndpoint[pb.Language]{
endpointName: EPLanguages,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Languages) Query(query string) ([]*pb.Language, error) {
resp, err := a.request("https://api.igdb.com/v4/languages.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type MultiplayerModes struct{ BaseEndpoint }
type MultiplayerModes struct {
BaseEndpoint[pb.MultiplayerMode]
}
func NewMultiplayerModes(request func(URL string, dataBody any) (*resty.Response, error)) *MultiplayerModes {
a := &MultiplayerModes{
BaseEndpoint[pb.MultiplayerMode]{
endpointName: EPMultiplayerModes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *MultiplayerModes) Query(query string) ([]*pb.MultiplayerMode, error) {
resp, err := a.request("https://api.igdb.com/v4/multiplayer_modes.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type NetworkTypes struct{ BaseEndpoint }
type NetworkTypes struct {
BaseEndpoint[pb.NetworkType]
}
func NewNetworkTypes(request func(URL string, dataBody any) (*resty.Response, error)) *NetworkTypes {
a := &NetworkTypes{
BaseEndpoint[pb.NetworkType]{
endpointName: EPNetworkTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *NetworkTypes) Query(query string) ([]*pb.NetworkType, error) {
resp, err := a.request("https://api.igdb.com/v4/network_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformFamilies struct{ BaseEndpoint }
type PlatformFamilies struct {
BaseEndpoint[pb.PlatformFamily]
}
func NewPlatformFamilies(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformFamilies {
a := &PlatformFamilies{
BaseEndpoint[pb.PlatformFamily]{
endpointName: EPPlatformFamilies,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformFamilies) Query(query string) ([]*pb.PlatformFamily, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_families.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformLogos struct{ BaseEndpoint }
type PlatformLogos struct {
BaseEndpoint[pb.PlatformLogo]
}
func NewPlatformLogos(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformLogos {
a := &PlatformLogos{
BaseEndpoint[pb.PlatformLogo]{
endpointName: EPPlatformLogos,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformLogos) Query(query string) ([]*pb.PlatformLogo, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_logos.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformTypes struct{ BaseEndpoint }
type PlatformTypes struct {
BaseEndpoint[pb.PlatformType]
}
func NewPlatformTypes(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformTypes {
a := &PlatformTypes{
BaseEndpoint[pb.PlatformType]{
endpointName: EPPlatformTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformTypes) Query(query string) ([]*pb.PlatformType, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformVersionCompanies struct{ BaseEndpoint }
type PlatformVersionCompanies struct {
BaseEndpoint[pb.PlatformVersionCompany]
}
func NewPlatformVersionCompanies(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformVersionCompanies {
a := &PlatformVersionCompanies{
BaseEndpoint[pb.PlatformVersionCompany]{
endpointName: EPPlatformVersionCompanies,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformVersionCompanies) Query(query string) ([]*pb.PlatformVersionCompany, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_version_companies.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformVersionReleaseDates struct{ BaseEndpoint }
type PlatformVersionReleaseDates struct {
BaseEndpoint[pb.PlatformVersionReleaseDate]
}
func NewPlatformVersionReleaseDates(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformVersionReleaseDates {
a := &PlatformVersionReleaseDates{
BaseEndpoint[pb.PlatformVersionReleaseDate]{
endpointName: EPPlatformVersionReleaseDates,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformVersionReleaseDates) Query(query string) ([]*pb.PlatformVersionReleaseDate, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_version_release_dates.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformVersions struct{ BaseEndpoint }
type PlatformVersions struct {
BaseEndpoint[pb.PlatformVersion]
}
func NewPlatformVersions(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformVersions {
a := &PlatformVersions{
BaseEndpoint[pb.PlatformVersion]{
endpointName: EPPlatformVersions,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformVersions) Query(query string) ([]*pb.PlatformVersion, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_versions.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlatformWebsites struct{ BaseEndpoint }
type PlatformWebsites struct {
BaseEndpoint[pb.PlatformWebsite]
}
func NewPlatformWebsites(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformWebsites {
a := &PlatformWebsites{
BaseEndpoint[pb.PlatformWebsite]{
endpointName: EPPlatformWebsites,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlatformWebsites) Query(query string) ([]*pb.PlatformWebsite, error) {
resp, err := a.request("https://api.igdb.com/v4/platform_websites.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Platforms struct{ BaseEndpoint }
type Platforms struct {
BaseEndpoint[pb.Platform]
}
func NewPlatforms(request func(URL string, dataBody any) (*resty.Response, error)) *Platforms {
a := &Platforms{
BaseEndpoint[pb.Platform]{
endpointName: EPPlatforms,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Platforms) Query(query string) ([]*pb.Platform, error) {
resp, err := a.request("https://api.igdb.com/v4/platforms.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PlayerPerspectives struct{ BaseEndpoint }
type PlayerPerspectives struct {
BaseEndpoint[pb.PlayerPerspective]
}
func NewPlayerPerspectives(request func(URL string, dataBody any) (*resty.Response, error)) *PlayerPerspectives {
a := &PlayerPerspectives{
BaseEndpoint[pb.PlayerPerspective]{
endpointName: EPPlayerPerspectives,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PlayerPerspectives) Query(query string) ([]*pb.PlayerPerspective, error) {
resp, err := a.request("https://api.igdb.com/v4/player_perspectives.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PopularityPrimitives struct{ BaseEndpoint }
type PopularityPrimitives struct {
BaseEndpoint[pb.PopularityPrimitive]
}
func NewPopularityPrimitives(request func(URL string, dataBody any) (*resty.Response, error)) *PopularityPrimitives {
a := &PopularityPrimitives{
BaseEndpoint[pb.PopularityPrimitive]{
endpointName: EPPopularityPrimitives,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PopularityPrimitives) Query(query string) ([]*pb.PopularityPrimitive, error) {
resp, err := a.request("https://api.igdb.com/v4/popularity_primitives.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type PopularityTypes struct{ BaseEndpoint }
type PopularityTypes struct {
BaseEndpoint[pb.PopularityType]
}
func NewPopularityTypes(request func(URL string, dataBody any) (*resty.Response, error)) *PopularityTypes {
a := &PopularityTypes{
BaseEndpoint[pb.PopularityType]{
endpointName: EPPopularityTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *PopularityTypes) Query(query string) ([]*pb.PopularityType, error) {
resp, err := a.request("https://api.igdb.com/v4/popularity_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Regions struct{ BaseEndpoint }
type Regions struct {
BaseEndpoint[pb.Region]
}
func NewRegions(request func(URL string, dataBody any) (*resty.Response, error)) *Regions {
a := &Regions{
BaseEndpoint[pb.Region]{
endpointName: EPRegions,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Regions) Query(query string) ([]*pb.Region, error) {
resp, err := a.request("https://api.igdb.com/v4/regions.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type ReleaseDateRegions struct{ BaseEndpoint }
type ReleaseDateRegions struct {
BaseEndpoint[pb.ReleaseDateRegion]
}
func NewReleaseDateRegions(request func(URL string, dataBody any) (*resty.Response, error)) *ReleaseDateRegions {
a := &ReleaseDateRegions{
BaseEndpoint[pb.ReleaseDateRegion]{
endpointName: EPReleaseDateRegions,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *ReleaseDateRegions) Query(query string) ([]*pb.ReleaseDateRegion, error) {
resp, err := a.request("https://api.igdb.com/v4/release_date_regions.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type ReleaseDateStatuses struct{ BaseEndpoint }
type ReleaseDateStatuses struct {
BaseEndpoint[pb.ReleaseDateStatus]
}
func NewReleaseDateStatuses(request func(URL string, dataBody any) (*resty.Response, error)) *ReleaseDateStatuses {
a := &ReleaseDateStatuses{
BaseEndpoint[pb.ReleaseDateStatus]{
endpointName: EPReleaseDateStatuses,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *ReleaseDateStatuses) Query(query string) ([]*pb.ReleaseDateStatus, error) {
resp, err := a.request("https://api.igdb.com/v4/release_date_statuses.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type ReleaseDates struct{ BaseEndpoint }
type ReleaseDates struct {
BaseEndpoint[pb.ReleaseDate]
}
func NewReleaseDates(request func(URL string, dataBody any) (*resty.Response, error)) *ReleaseDates {
a := &ReleaseDates{
BaseEndpoint[pb.ReleaseDate]{
endpointName: EPReleaseDates,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *ReleaseDates) Query(query string) ([]*pb.ReleaseDate, error) {
resp, err := a.request("https://api.igdb.com/v4/release_dates.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Screenshots struct{ BaseEndpoint }
type Screenshots struct {
BaseEndpoint[pb.Screenshot]
}
func NewScreenshots(request func(URL string, dataBody any) (*resty.Response, error)) *Screenshots {
a := &Screenshots{
BaseEndpoint[pb.Screenshot]{
endpointName: EPScreenshots,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Screenshots) Query(query string) ([]*pb.Screenshot, error) {
resp, err := a.request("https://api.igdb.com/v4/screenshots.pb", query)

View File

@ -10,6 +10,7 @@ import (
"time"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"github.com/PuerkitoBio/goquery"
"github.com/bestnite/go-flaresolverr"
@ -22,10 +23,16 @@ var webSearchCFCookies struct {
}
type Search struct {
BaseEndpoint
request func(URL string, dataBody any) (*resty.Response, error)
flaresolverr *flaresolverr.Flaresolverr
}
func NewSearch(request func(URL string, dataBody any) (*resty.Response, error)) *Search {
return &Search{
request: request,
}
}
func (a *Search) Search(query string) ([]*pb.Search, error) {
resp, err := a.request("https://api.igdb.com/v4/search.pb", query)
if err != nil {

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Themes struct{ BaseEndpoint }
type Themes struct {
BaseEndpoint[pb.Theme]
}
func NewThemes(request func(URL string, dataBody any) (*resty.Response, error)) *Themes {
a := &Themes{
BaseEndpoint[pb.Theme]{
endpointName: EPThemes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Themes) Query(query string) ([]*pb.Theme, error) {
resp, err := a.request("https://api.igdb.com/v4/themes.pb", query)

View File

@ -4,9 +4,19 @@ import (
"fmt"
"net/http"
"net/url"
"github.com/go-resty/resty/v2"
)
type Webhooks struct{ BaseEndpoint }
type Webhooks struct {
request func(URL string, dataBody any) (*resty.Response, error)
}
func NewWebhooks(request func(URL string, dataBody any) (*resty.Response, error)) *Webhooks {
return &Webhooks{
request: request,
}
}
func (a *Webhooks) Register(endpoint EndpointName, secret, callbackUrl string) error {
dataBody := url.Values{}

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type WebsiteTypes struct{ BaseEndpoint }
type WebsiteTypes struct {
BaseEndpoint[pb.WebsiteType]
}
func NewWebsiteTypes(request func(URL string, dataBody any) (*resty.Response, error)) *WebsiteTypes {
a := &WebsiteTypes{
BaseEndpoint[pb.WebsiteType]{
endpointName: EPWebsiteTypes,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *WebsiteTypes) Query(query string) ([]*pb.WebsiteType, error) {
resp, err := a.request("https://api.igdb.com/v4/website_types.pb", query)

View File

@ -4,11 +4,25 @@ import (
"fmt"
pb "github.com/bestnite/go-igdb/proto"
"github.com/go-resty/resty/v2"
"google.golang.org/protobuf/proto"
)
type Websites struct{ BaseEndpoint }
type Websites struct {
BaseEndpoint[pb.Website]
}
func NewWebsites(request func(URL string, dataBody any) (*resty.Response, error)) *Websites {
a := &Websites{
BaseEndpoint[pb.Website]{
endpointName: EPWebsites,
request: request,
},
}
a.queryFunc = a.Query
return a
}
func (a *Websites) Query(query string) ([]*pb.Website, error) {
resp, err := a.request("https://api.igdb.com/v4/websites.pb", query)