u
This commit is contained in:
		| @@ -2,6 +2,7 @@ package igdb | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/bestnite/go-flaresolverr" | ||||
| 	"github.com/bestnite/go-igdb/endpoint" | ||||
| @@ -101,13 +102,15 @@ func New(clientID, clientSecret string) *Client { | ||||
| 	return c | ||||
| } | ||||
|  | ||||
| type RequestFunc func(method string, URL string, dataBody any) (*resty.Response, error) | ||||
|  | ||||
| func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *Client { | ||||
| 	c := New(clientID, clientSecret) | ||||
| 	c.flaresolverr = f | ||||
| 	return c | ||||
| } | ||||
|  | ||||
| func (g *Client) Request(URL string, dataBody any) (*resty.Response, error) { | ||||
| func (g *Client) Request(method string, URL string, dataBody any) (*resty.Response, error) { | ||||
| 	g.limiter.wait() | ||||
|  | ||||
| 	t, err := g.token.getToken() | ||||
| @@ -120,7 +123,7 @@ func (g *Client) Request(URL string, dataBody any) (*resty.Response, error) { | ||||
| 		"Authorization": "Bearer " + t, | ||||
| 		"User-Agent":    "", | ||||
| 		"Content-Type":  "text/plain", | ||||
| 	}).Post(URL) | ||||
| 	}).Execute(strings.ToUpper(method), URL) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %s: %w", URL, err) | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type AgeRatingCategories struct { | ||||
| 	BaseEndpoint[pb.AgeRatingCategory] | ||||
| } | ||||
|  | ||||
| func NewAgeRatingCategories(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingCategories { | ||||
| func NewAgeRatingCategories(request RequestFunc) *AgeRatingCategories { | ||||
| 	a := &AgeRatingCategories{ | ||||
| 		BaseEndpoint: BaseEndpoint[pb.AgeRatingCategory]{ | ||||
| 			endpointName: EPAgeRatingCategories, | ||||
| @@ -25,7 +24,7 @@ func NewAgeRatingCategories(request func(URL string, dataBody any) (*resty.Respo | ||||
| } | ||||
|  | ||||
| func (a *AgeRatingCategories) Query(query string) ([]*pb.AgeRatingCategory, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type AgeRatingContentDescriptions struct { | ||||
| 	BaseEndpoint[pb.AgeRatingContentDescription] | ||||
| } | ||||
|  | ||||
| func NewAgeRatingContentDescriptions(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingContentDescriptions { | ||||
| func NewAgeRatingContentDescriptions(request RequestFunc) *AgeRatingContentDescriptions { | ||||
| 	a := &AgeRatingContentDescriptions{ | ||||
| 		BaseEndpoint[pb.AgeRatingContentDescription]{ | ||||
| 			endpointName: EPAgeRatingContentDescriptions, | ||||
| @@ -25,7 +24,7 @@ func NewAgeRatingContentDescriptions(request func(URL string, dataBody any) (*re | ||||
| } | ||||
|  | ||||
| func (a *AgeRatingContentDescriptions) Query(query string) ([]*pb.AgeRatingContentDescription, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type AgeRatingContentDescriptionsV2 struct { | ||||
| 	BaseEndpoint[pb.AgeRatingContentDescriptionV2] | ||||
| } | ||||
|  | ||||
| func NewAgeRatingContentDescriptionsV2(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingContentDescriptionsV2 { | ||||
| func NewAgeRatingContentDescriptionsV2(request RequestFunc) *AgeRatingContentDescriptionsV2 { | ||||
| 	a := &AgeRatingContentDescriptionsV2{ | ||||
| 		BaseEndpoint[pb.AgeRatingContentDescriptionV2]{ | ||||
| 			endpointName: EPAgeRatingContentDescriptionsV2, | ||||
| @@ -25,7 +24,7 @@ func NewAgeRatingContentDescriptionsV2(request func(URL string, dataBody any) (* | ||||
| } | ||||
|  | ||||
| func (a *AgeRatingContentDescriptionsV2) Query(query string) ([]*pb.AgeRatingContentDescriptionV2, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type AgeRatingOrganizations struct { | ||||
| 	BaseEndpoint[pb.AgeRatingOrganization] | ||||
| } | ||||
|  | ||||
| func NewAgeRatingOrganizations(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatingOrganizations { | ||||
| func NewAgeRatingOrganizations(request RequestFunc) *AgeRatingOrganizations { | ||||
| 	a := &AgeRatingOrganizations{ | ||||
| 		BaseEndpoint[pb.AgeRatingOrganization]{ | ||||
| 			endpointName: EPAgeRatingOrganizations, | ||||
| @@ -25,7 +24,7 @@ func NewAgeRatingOrganizations(request func(URL string, dataBody any) (*resty.Re | ||||
| } | ||||
|  | ||||
| func (a *AgeRatingOrganizations) Query(query string) ([]*pb.AgeRatingOrganization, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type AgeRatings struct { | ||||
| 	BaseEndpoint[pb.AgeRating] | ||||
| } | ||||
|  | ||||
| func NewAgeRatings(request func(URL string, dataBody any) (*resty.Response, error)) *AgeRatings { | ||||
| func NewAgeRatings(request RequestFunc) *AgeRatings { | ||||
| 	a := &AgeRatings{ | ||||
| 		BaseEndpoint[pb.AgeRating]{ | ||||
| 			endpointName: EPAgeRatings, | ||||
| @@ -25,7 +24,7 @@ func NewAgeRatings(request func(URL string, dataBody any) (*resty.Response, erro | ||||
| } | ||||
|  | ||||
| func (a *AgeRatings) Query(query string) ([]*pb.AgeRating, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type AlternativeNames struct { | ||||
| 	BaseEndpoint[pb.AlternativeName] | ||||
| } | ||||
|  | ||||
| func NewAlternativeNames(request func(URL string, dataBody any) (*resty.Response, error)) *AlternativeNames { | ||||
| func NewAlternativeNames(request RequestFunc) *AlternativeNames { | ||||
| 	a := &AlternativeNames{ | ||||
| 		BaseEndpoint[pb.AlternativeName]{ | ||||
| 			endpointName: EPAlternativeNames, | ||||
| @@ -25,7 +24,7 @@ func NewAlternativeNames(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *AlternativeNames) Query(query string) ([]*pb.AlternativeName, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Artworks struct { | ||||
| 	BaseEndpoint[pb.Artwork] | ||||
| } | ||||
|  | ||||
| func NewArtworks(request func(URL string, dataBody any) (*resty.Response, error)) *Artworks { | ||||
| func NewArtworks(request RequestFunc) *Artworks { | ||||
| 	a := &Artworks{ | ||||
| 		BaseEndpoint[pb.Artwork]{ | ||||
| 			endpointName: EPArtworks, | ||||
| @@ -25,7 +24,7 @@ func NewArtworks(request func(URL string, dataBody any) (*resty.Response, error) | ||||
| } | ||||
|  | ||||
| func (a *Artworks) Query(query string) ([]*pb.Artwork, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -2,16 +2,19 @@ package endpoint | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"google.golang.org/protobuf/proto" | ||||
|  | ||||
| 	"github.com/go-resty/resty/v2" | ||||
| ) | ||||
|  | ||||
| type RequestFunc func(method string, URL string, dataBody any) (*resty.Response, error) | ||||
|  | ||||
| type BaseEndpoint[T any] struct { | ||||
| 	request      func(URL string, dataBody any) (*resty.Response, error) | ||||
| 	request      RequestFunc | ||||
| 	endpointName Name | ||||
| 	queryFunc    func(string) ([]*T, error) | ||||
| } | ||||
| @@ -50,7 +53,7 @@ func (b *BaseEndpoint[T]) GetByIDs(ids []uint64) ([]*T, error) { | ||||
| } | ||||
|  | ||||
| func (b *BaseEndpoint[T]) Count() (uint64, error) { | ||||
| 	resp, err := b.request(fmt.Sprintf("https://api.igdb.com/v4/%s/count.pb", b.endpointName), "") | ||||
| 	resp, err := b.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s/count.pb", b.endpointName), "") | ||||
| 	if err != nil { | ||||
| 		return 0, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CharacterGenders struct { | ||||
| 	BaseEndpoint[pb.CharacterGender] | ||||
| } | ||||
|  | ||||
| func NewCharacterGenders(request func(URL string, dataBody any) (*resty.Response, error)) *CharacterGenders { | ||||
| func NewCharacterGenders(request RequestFunc) *CharacterGenders { | ||||
| 	a := &CharacterGenders{ | ||||
| 		BaseEndpoint[pb.CharacterGender]{ | ||||
| 			endpointName: EPCharacterGenders, | ||||
| @@ -25,7 +24,7 @@ func NewCharacterGenders(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *CharacterGenders) Query(query string) ([]*pb.CharacterGender, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CharacterMugShots struct { | ||||
| 	BaseEndpoint[pb.CharacterMugShot] | ||||
| } | ||||
|  | ||||
| func NewCharacterMugShots(request func(URL string, dataBody any) (*resty.Response, error)) *CharacterMugShots { | ||||
| func NewCharacterMugShots(request RequestFunc) *CharacterMugShots { | ||||
| 	a := &CharacterMugShots{ | ||||
| 		BaseEndpoint[pb.CharacterMugShot]{ | ||||
| 			endpointName: EPCharacterMugShots, | ||||
| @@ -25,7 +24,7 @@ func NewCharacterMugShots(request func(URL string, dataBody any) (*resty.Respons | ||||
| } | ||||
|  | ||||
| func (a *CharacterMugShots) Query(query string) ([]*pb.CharacterMugShot, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CharacterSpecies struct { | ||||
| 	BaseEndpoint[pb.CharacterSpecie] | ||||
| } | ||||
|  | ||||
| func NewCharacterSpecies(request func(URL string, dataBody any) (*resty.Response, error)) *CharacterSpecies { | ||||
| func NewCharacterSpecies(request RequestFunc) *CharacterSpecies { | ||||
| 	a := &CharacterSpecies{ | ||||
| 		BaseEndpoint[pb.CharacterSpecie]{ | ||||
| 			endpointName: EPCharacterSpecies, | ||||
| @@ -25,7 +24,7 @@ func NewCharacterSpecies(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *CharacterSpecies) Query(query string) ([]*pb.CharacterSpecie, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Characters struct { | ||||
| 	BaseEndpoint[pb.Character] | ||||
| } | ||||
|  | ||||
| func NewCharacters(request func(URL string, dataBody any) (*resty.Response, error)) *Characters { | ||||
| func NewCharacters(request RequestFunc) *Characters { | ||||
| 	a := &Characters{ | ||||
| 		BaseEndpoint[pb.Character]{ | ||||
| 			endpointName: EPCharacters, | ||||
| @@ -25,7 +24,7 @@ func NewCharacters(request func(URL string, dataBody any) (*resty.Response, erro | ||||
| } | ||||
|  | ||||
| func (a *Characters) Query(query string) ([]*pb.Character, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CollectionMembershipTypes struct { | ||||
| 	BaseEndpoint[pb.CollectionMembershipType] | ||||
| } | ||||
|  | ||||
| func NewCollectionMembershipTypes(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionMembershipTypes { | ||||
| func NewCollectionMembershipTypes(request RequestFunc) *CollectionMembershipTypes { | ||||
| 	a := &CollectionMembershipTypes{ | ||||
| 		BaseEndpoint[pb.CollectionMembershipType]{ | ||||
| 			endpointName: EPCollectionMembershipTypes, | ||||
| @@ -25,7 +24,7 @@ func NewCollectionMembershipTypes(request func(URL string, dataBody any) (*resty | ||||
| } | ||||
|  | ||||
| func (a *CollectionMembershipTypes) Query(query string) ([]*pb.CollectionMembershipType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CollectionMemberships struct { | ||||
| 	BaseEndpoint[pb.CollectionMembership] | ||||
| } | ||||
|  | ||||
| func NewCollectionMemberships(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionMemberships { | ||||
| func NewCollectionMemberships(request RequestFunc) *CollectionMemberships { | ||||
| 	a := &CollectionMemberships{ | ||||
| 		BaseEndpoint[pb.CollectionMembership]{ | ||||
| 			endpointName: EPCollectionMemberships, | ||||
| @@ -25,7 +24,7 @@ func NewCollectionMemberships(request func(URL string, dataBody any) (*resty.Res | ||||
| } | ||||
|  | ||||
| func (a *CollectionMemberships) Query(query string) ([]*pb.CollectionMembership, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CollectionRelationTypes struct { | ||||
| 	BaseEndpoint[pb.CollectionRelationType] | ||||
| } | ||||
|  | ||||
| func NewCollectionRelationTypes(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionRelationTypes { | ||||
| func NewCollectionRelationTypes(request RequestFunc) *CollectionRelationTypes { | ||||
| 	a := &CollectionRelationTypes{ | ||||
| 		BaseEndpoint[pb.CollectionRelationType]{ | ||||
| 			endpointName: EPCollectionRelationTypes, | ||||
| @@ -25,7 +24,7 @@ func NewCollectionRelationTypes(request func(URL string, dataBody any) (*resty.R | ||||
| } | ||||
|  | ||||
| func (a *CollectionRelationTypes) Query(query string) ([]*pb.CollectionRelationType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CollectionRelations struct { | ||||
| 	BaseEndpoint[pb.CollectionRelation] | ||||
| } | ||||
|  | ||||
| func NewCollectionRelations(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionRelations { | ||||
| func NewCollectionRelations(request RequestFunc) *CollectionRelations { | ||||
| 	a := &CollectionRelations{ | ||||
| 		BaseEndpoint[pb.CollectionRelation]{ | ||||
| 			endpointName: EPCollectionRelations, | ||||
| @@ -25,7 +24,7 @@ func NewCollectionRelations(request func(URL string, dataBody any) (*resty.Respo | ||||
| } | ||||
|  | ||||
| func (a *CollectionRelations) Query(query string) ([]*pb.CollectionRelation, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CollectionTypes struct { | ||||
| 	BaseEndpoint[pb.CollectionType] | ||||
| } | ||||
|  | ||||
| func NewCollectionTypes(request func(URL string, dataBody any) (*resty.Response, error)) *CollectionTypes { | ||||
| func NewCollectionTypes(request RequestFunc) *CollectionTypes { | ||||
| 	a := &CollectionTypes{ | ||||
| 		BaseEndpoint[pb.CollectionType]{ | ||||
| 			endpointName: EPCollectionTypes, | ||||
| @@ -25,7 +24,7 @@ func NewCollectionTypes(request func(URL string, dataBody any) (*resty.Response, | ||||
| } | ||||
|  | ||||
| func (a *CollectionTypes) Query(query string) ([]*pb.CollectionType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Collections struct { | ||||
| 	BaseEndpoint[pb.Collection] | ||||
| } | ||||
|  | ||||
| func NewCollections(request func(URL string, dataBody any) (*resty.Response, error)) *Collections { | ||||
| func NewCollections(request RequestFunc) *Collections { | ||||
| 	a := &Collections{ | ||||
| 		BaseEndpoint[pb.Collection]{ | ||||
| 			endpointName: EPCollections, | ||||
| @@ -25,7 +24,7 @@ func NewCollections(request func(URL string, dataBody any) (*resty.Response, err | ||||
| } | ||||
|  | ||||
| func (a *Collections) Query(query string) ([]*pb.Collection, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -5,7 +5,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -14,7 +13,7 @@ type Companies struct { | ||||
| 	BaseEndpoint[pb.Company] | ||||
| } | ||||
|  | ||||
| func NewCompanies(request func(URL string, dataBody any) (*resty.Response, error)) *Companies { | ||||
| func NewCompanies(request RequestFunc) *Companies { | ||||
| 	a := &Companies{ | ||||
| 		BaseEndpoint[pb.Company]{ | ||||
| 			endpointName: EPCompanies, | ||||
| @@ -26,7 +25,7 @@ func NewCompanies(request func(URL string, dataBody any) (*resty.Response, error | ||||
| } | ||||
|  | ||||
| func (a *Companies) Query(query string) ([]*pb.Company, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CompanyLogos struct { | ||||
| 	BaseEndpoint[pb.CompanyLogo] | ||||
| } | ||||
|  | ||||
| func NewCompanyLogos(request func(URL string, dataBody any) (*resty.Response, error)) *CompanyLogos { | ||||
| func NewCompanyLogos(request RequestFunc) *CompanyLogos { | ||||
| 	a := &CompanyLogos{ | ||||
| 		BaseEndpoint[pb.CompanyLogo]{ | ||||
| 			endpointName: EPCompanyLogos, | ||||
| @@ -25,7 +24,7 @@ func NewCompanyLogos(request func(URL string, dataBody any) (*resty.Response, er | ||||
| } | ||||
|  | ||||
| func (a *CompanyLogos) Query(query string) ([]*pb.CompanyLogo, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CompanyStatuses struct { | ||||
| 	BaseEndpoint[pb.CompanyStatus] | ||||
| } | ||||
|  | ||||
| func NewCompanyStatuses(request func(URL string, dataBody any) (*resty.Response, error)) *CompanyStatuses { | ||||
| func NewCompanyStatuses(request RequestFunc) *CompanyStatuses { | ||||
| 	a := &CompanyStatuses{ | ||||
| 		BaseEndpoint[pb.CompanyStatus]{ | ||||
| 			endpointName: EPCompanyStatuses, | ||||
| @@ -25,7 +24,7 @@ func NewCompanyStatuses(request func(URL string, dataBody any) (*resty.Response, | ||||
| } | ||||
|  | ||||
| func (a *CompanyStatuses) Query(query string) ([]*pb.CompanyStatus, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type CompanyWebsites struct { | ||||
| 	BaseEndpoint[pb.CompanyWebsite] | ||||
| } | ||||
|  | ||||
| func NewCompanyWebsites(request func(URL string, dataBody any) (*resty.Response, error)) *CompanyWebsites { | ||||
| func NewCompanyWebsites(request RequestFunc) *CompanyWebsites { | ||||
| 	a := &CompanyWebsites{ | ||||
| 		BaseEndpoint[pb.CompanyWebsite]{ | ||||
| 			endpointName: EPCompanyWebsites, | ||||
| @@ -25,7 +24,7 @@ func NewCompanyWebsites(request func(URL string, dataBody any) (*resty.Response, | ||||
| } | ||||
|  | ||||
| func (a *CompanyWebsites) Query(query string) ([]*pb.CompanyWebsite, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Covers struct { | ||||
| 	BaseEndpoint[pb.Cover] | ||||
| } | ||||
|  | ||||
| func NewCovers(request func(URL string, dataBody any) (*resty.Response, error)) *Covers { | ||||
| func NewCovers(request RequestFunc) *Covers { | ||||
| 	a := &Covers{ | ||||
| 		BaseEndpoint[pb.Cover]{ | ||||
| 			endpointName: EPCovers, | ||||
| @@ -25,7 +24,7 @@ func NewCovers(request func(URL string, dataBody any) (*resty.Response, error)) | ||||
| } | ||||
|  | ||||
| func (a *Covers) Query(query string) ([]*pb.Cover, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type DateFormats struct { | ||||
| 	BaseEndpoint[pb.DateFormat] | ||||
| } | ||||
|  | ||||
| func NewDateFormats(request func(URL string, dataBody any) (*resty.Response, error)) *DateFormats { | ||||
| func NewDateFormats(request RequestFunc) *DateFormats { | ||||
| 	a := &DateFormats{ | ||||
| 		BaseEndpoint[pb.DateFormat]{ | ||||
| 			endpointName: EPDateFormats, | ||||
| @@ -25,7 +24,7 @@ func NewDateFormats(request func(URL string, dataBody any) (*resty.Response, err | ||||
| } | ||||
|  | ||||
| func (a *DateFormats) Query(query string) ([]*pb.DateFormat, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type EventLogos struct { | ||||
| 	BaseEndpoint[pb.EventLogo] | ||||
| } | ||||
|  | ||||
| func NewEventLogos(request func(URL string, dataBody any) (*resty.Response, error)) *EventLogos { | ||||
| func NewEventLogos(request RequestFunc) *EventLogos { | ||||
| 	a := &EventLogos{ | ||||
| 		BaseEndpoint[pb.EventLogo]{ | ||||
| 			endpointName: EPEventLogos, | ||||
| @@ -25,7 +24,7 @@ func NewEventLogos(request func(URL string, dataBody any) (*resty.Response, erro | ||||
| } | ||||
|  | ||||
| func (a *EventLogos) Query(query string) ([]*pb.EventLogo, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type EventNetworks struct { | ||||
| 	BaseEndpoint[pb.EventNetwork] | ||||
| } | ||||
|  | ||||
| func NewEventNetworks(request func(URL string, dataBody any) (*resty.Response, error)) *EventNetworks { | ||||
| func NewEventNetworks(request RequestFunc) *EventNetworks { | ||||
| 	a := &EventNetworks{ | ||||
| 		BaseEndpoint[pb.EventNetwork]{ | ||||
| 			endpointName: EPEventNetworks, | ||||
| @@ -25,7 +24,7 @@ func NewEventNetworks(request func(URL string, dataBody any) (*resty.Response, e | ||||
| } | ||||
|  | ||||
| func (a *EventNetworks) Query(query string) ([]*pb.EventNetwork, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Events struct { | ||||
| 	BaseEndpoint[pb.Event] | ||||
| } | ||||
|  | ||||
| func NewEvents(request func(URL string, dataBody any) (*resty.Response, error)) *Events { | ||||
| func NewEvents(request RequestFunc) *Events { | ||||
| 	a := &Events{ | ||||
| 		BaseEndpoint[pb.Event]{ | ||||
| 			endpointName: EPEvents, | ||||
| @@ -25,7 +24,7 @@ func NewEvents(request func(URL string, dataBody any) (*resty.Response, error)) | ||||
| } | ||||
|  | ||||
| func (a *Events) Query(query string) ([]*pb.Event, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type ExternalGameSources struct { | ||||
| 	BaseEndpoint[pb.ExternalGameSource] | ||||
| } | ||||
|  | ||||
| func NewExternalGameSources(request func(URL string, dataBody any) (*resty.Response, error)) *ExternalGameSources { | ||||
| func NewExternalGameSources(request RequestFunc) *ExternalGameSources { | ||||
| 	a := &ExternalGameSources{ | ||||
| 		BaseEndpoint[pb.ExternalGameSource]{ | ||||
| 			endpointName: EPExternalGameSources, | ||||
| @@ -25,7 +24,7 @@ func NewExternalGameSources(request func(URL string, dataBody any) (*resty.Respo | ||||
| } | ||||
|  | ||||
| func (a *ExternalGameSources) Query(query string) ([]*pb.ExternalGameSource, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type ExternalGames struct { | ||||
| 	BaseEndpoint[pb.ExternalGame] | ||||
| } | ||||
|  | ||||
| func NewExternalGames(request func(URL string, dataBody any) (*resty.Response, error)) *ExternalGames { | ||||
| func NewExternalGames(request RequestFunc) *ExternalGames { | ||||
| 	a := &ExternalGames{ | ||||
| 		BaseEndpoint[pb.ExternalGame]{ | ||||
| 			endpointName: EPExternalGames, | ||||
| @@ -25,7 +24,7 @@ func NewExternalGames(request func(URL string, dataBody any) (*resty.Response, e | ||||
| } | ||||
|  | ||||
| func (a *ExternalGames) Query(query string) ([]*pb.ExternalGame, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Franchises struct { | ||||
| 	BaseEndpoint[pb.Franchise] | ||||
| } | ||||
|  | ||||
| func NewFranchises(request func(URL string, dataBody any) (*resty.Response, error)) *Franchises { | ||||
| func NewFranchises(request RequestFunc) *Franchises { | ||||
| 	a := &Franchises{ | ||||
| 		BaseEndpoint[pb.Franchise]{ | ||||
| 			endpointName: EPFranchises, | ||||
| @@ -25,7 +24,7 @@ func NewFranchises(request func(URL string, dataBody any) (*resty.Response, erro | ||||
| } | ||||
|  | ||||
| func (a *Franchises) Query(query string) ([]*pb.Franchise, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameEngineLogos struct { | ||||
| 	BaseEndpoint[pb.GameEngineLogo] | ||||
| } | ||||
|  | ||||
| func NewGameEngineLogos(request func(URL string, dataBody any) (*resty.Response, error)) *GameEngineLogos { | ||||
| func NewGameEngineLogos(request RequestFunc) *GameEngineLogos { | ||||
| 	a := &GameEngineLogos{ | ||||
| 		BaseEndpoint[pb.GameEngineLogo]{ | ||||
| 			endpointName: EPGameEngineLogos, | ||||
| @@ -25,7 +24,7 @@ func NewGameEngineLogos(request func(URL string, dataBody any) (*resty.Response, | ||||
| } | ||||
|  | ||||
| func (a *GameEngineLogos) Query(query string) ([]*pb.GameEngineLogo, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameEngines struct { | ||||
| 	BaseEndpoint[pb.GameEngine] | ||||
| } | ||||
|  | ||||
| func NewGameEngines(request func(URL string, dataBody any) (*resty.Response, error)) *GameEngines { | ||||
| func NewGameEngines(request RequestFunc) *GameEngines { | ||||
| 	a := &GameEngines{ | ||||
| 		BaseEndpoint[pb.GameEngine]{ | ||||
| 			endpointName: EPGameEngines, | ||||
| @@ -25,7 +24,7 @@ func NewGameEngines(request func(URL string, dataBody any) (*resty.Response, err | ||||
| } | ||||
|  | ||||
| func (a *GameEngines) Query(query string) ([]*pb.GameEngine, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameLocalizations struct { | ||||
| 	BaseEndpoint[pb.GameLocalization] | ||||
| } | ||||
|  | ||||
| func NewGameLocalizations(request func(URL string, dataBody any) (*resty.Response, error)) *GameLocalizations { | ||||
| func NewGameLocalizations(request RequestFunc) *GameLocalizations { | ||||
| 	a := &GameLocalizations{ | ||||
| 		BaseEndpoint[pb.GameLocalization]{ | ||||
| 			endpointName: EPGameLocalizations, | ||||
| @@ -25,7 +24,7 @@ func NewGameLocalizations(request func(URL string, dataBody any) (*resty.Respons | ||||
| } | ||||
|  | ||||
| func (a *GameLocalizations) Query(query string) ([]*pb.GameLocalization, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameModes struct { | ||||
| 	BaseEndpoint[pb.GameMode] | ||||
| } | ||||
|  | ||||
| func NewGameModes(request func(URL string, dataBody any) (*resty.Response, error)) *GameModes { | ||||
| func NewGameModes(request RequestFunc) *GameModes { | ||||
| 	a := &GameModes{ | ||||
| 		BaseEndpoint[pb.GameMode]{ | ||||
| 			endpointName: EPGameModes, | ||||
| @@ -25,7 +24,7 @@ func NewGameModes(request func(URL string, dataBody any) (*resty.Response, error | ||||
| } | ||||
|  | ||||
| func (a *GameModes) Query(query string) ([]*pb.GameMode, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameReleaseFormats struct { | ||||
| 	BaseEndpoint[pb.GameReleaseFormat] | ||||
| } | ||||
|  | ||||
| func NewGameReleaseFormats(request func(URL string, dataBody any) (*resty.Response, error)) *GameReleaseFormats { | ||||
| func NewGameReleaseFormats(request RequestFunc) *GameReleaseFormats { | ||||
| 	a := &GameReleaseFormats{ | ||||
| 		BaseEndpoint[pb.GameReleaseFormat]{ | ||||
| 			endpointName: EPGameReleaseFormats, | ||||
| @@ -25,7 +24,7 @@ func NewGameReleaseFormats(request func(URL string, dataBody any) (*resty.Respon | ||||
| } | ||||
|  | ||||
| func (a *GameReleaseFormats) Query(query string) ([]*pb.GameReleaseFormat, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameStatuses struct { | ||||
| 	BaseEndpoint[pb.GameStatus] | ||||
| } | ||||
|  | ||||
| func NewGameStatuses(request func(URL string, dataBody any) (*resty.Response, error)) *GameStatuses { | ||||
| func NewGameStatuses(request RequestFunc) *GameStatuses { | ||||
| 	a := &GameStatuses{ | ||||
| 		BaseEndpoint[pb.GameStatus]{ | ||||
| 			endpointName: EPGameStatuses, | ||||
| @@ -25,7 +24,7 @@ func NewGameStatuses(request func(URL string, dataBody any) (*resty.Response, er | ||||
| } | ||||
|  | ||||
| func (a *GameStatuses) Query(query string) ([]*pb.GameStatus, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameTimeToBeats struct { | ||||
| 	BaseEndpoint[pb.GameTimeToBeat] | ||||
| } | ||||
|  | ||||
| func NewGameTimeToBeats(request func(URL string, dataBody any) (*resty.Response, error)) *GameTimeToBeats { | ||||
| func NewGameTimeToBeats(request RequestFunc) *GameTimeToBeats { | ||||
| 	a := &GameTimeToBeats{ | ||||
| 		BaseEndpoint[pb.GameTimeToBeat]{ | ||||
| 			endpointName: EPGameTimeToBeats, | ||||
| @@ -25,7 +24,7 @@ func NewGameTimeToBeats(request func(URL string, dataBody any) (*resty.Response, | ||||
| } | ||||
|  | ||||
| func (a *GameTimeToBeats) Query(query string) ([]*pb.GameTimeToBeat, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameTypes struct { | ||||
| 	BaseEndpoint[pb.GameType] | ||||
| } | ||||
|  | ||||
| func NewGameTypes(request func(URL string, dataBody any) (*resty.Response, error)) *GameTypes { | ||||
| func NewGameTypes(request RequestFunc) *GameTypes { | ||||
| 	a := &GameTypes{ | ||||
| 		BaseEndpoint[pb.GameType]{ | ||||
| 			endpointName: EPGameTypes, | ||||
| @@ -25,7 +24,7 @@ func NewGameTypes(request func(URL string, dataBody any) (*resty.Response, error | ||||
| } | ||||
|  | ||||
| func (a *GameTypes) Query(query string) ([]*pb.GameType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameVersionFeatureValues struct { | ||||
| 	BaseEndpoint[pb.GameVersionFeatureValue] | ||||
| } | ||||
|  | ||||
| func NewGameVersionFeatureValues(request func(URL string, dataBody any) (*resty.Response, error)) *GameVersionFeatureValues { | ||||
| func NewGameVersionFeatureValues(request RequestFunc) *GameVersionFeatureValues { | ||||
| 	a := &GameVersionFeatureValues{ | ||||
| 		BaseEndpoint[pb.GameVersionFeatureValue]{ | ||||
| 			endpointName: EPGameVersionFeatureValues, | ||||
| @@ -25,7 +24,7 @@ func NewGameVersionFeatureValues(request func(URL string, dataBody any) (*resty. | ||||
| } | ||||
|  | ||||
| func (a *GameVersionFeatureValues) Query(query string) ([]*pb.GameVersionFeatureValue, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameVersionFeatures struct { | ||||
| 	BaseEndpoint[pb.GameVersionFeature] | ||||
| } | ||||
|  | ||||
| func NewGameVersionFeatures(request func(URL string, dataBody any) (*resty.Response, error)) *GameVersionFeatures { | ||||
| func NewGameVersionFeatures(request RequestFunc) *GameVersionFeatures { | ||||
| 	a := &GameVersionFeatures{ | ||||
| 		BaseEndpoint[pb.GameVersionFeature]{ | ||||
| 			endpointName: EPGameVersionFeatures, | ||||
| @@ -25,7 +24,7 @@ func NewGameVersionFeatures(request func(URL string, dataBody any) (*resty.Respo | ||||
| } | ||||
|  | ||||
| func (a *GameVersionFeatures) Query(query string) ([]*pb.GameVersionFeature, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameVersions struct { | ||||
| 	BaseEndpoint[pb.GameVersion] | ||||
| } | ||||
|  | ||||
| func NewGameVersions(request func(URL string, dataBody any) (*resty.Response, error)) *GameVersions { | ||||
| func NewGameVersions(request RequestFunc) *GameVersions { | ||||
| 	a := &GameVersions{ | ||||
| 		BaseEndpoint[pb.GameVersion]{ | ||||
| 			endpointName: EPGameVersions, | ||||
| @@ -25,7 +24,7 @@ func NewGameVersions(request func(URL string, dataBody any) (*resty.Response, er | ||||
| } | ||||
|  | ||||
| func (a *GameVersions) Query(query string) ([]*pb.GameVersion, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type GameVideos struct { | ||||
| 	BaseEndpoint[pb.GameVideo] | ||||
| } | ||||
|  | ||||
| func NewGameVideos(request func(URL string, dataBody any) (*resty.Response, error)) *GameVideos { | ||||
| func NewGameVideos(request RequestFunc) *GameVideos { | ||||
| 	a := &GameVideos{ | ||||
| 		BaseEndpoint[pb.GameVideo]{ | ||||
| 			endpointName: EPGameVideos, | ||||
| @@ -25,7 +24,7 @@ func NewGameVideos(request func(URL string, dataBody any) (*resty.Response, erro | ||||
| } | ||||
|  | ||||
| func (a *GameVideos) Query(query string) ([]*pb.GameVideo, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Games struct { | ||||
| 	BaseEndpoint[pb.Game] | ||||
| } | ||||
|  | ||||
| func NewGames(request func(URL string, dataBody any) (*resty.Response, error)) *Games { | ||||
| func NewGames(request RequestFunc) *Games { | ||||
| 	a := &Games{ | ||||
| 		BaseEndpoint[pb.Game]{ | ||||
| 			endpointName: EPGames, | ||||
| @@ -25,7 +24,7 @@ func NewGames(request func(URL string, dataBody any) (*resty.Response, error)) * | ||||
| } | ||||
|  | ||||
| func (a *Games) Query(query string) ([]*pb.Game, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Genres struct { | ||||
| 	BaseEndpoint[pb.Genre] | ||||
| } | ||||
|  | ||||
| func NewGenres(request func(URL string, dataBody any) (*resty.Response, error)) *Genres { | ||||
| func NewGenres(request RequestFunc) *Genres { | ||||
| 	a := &Genres{ | ||||
| 		BaseEndpoint[pb.Genre]{ | ||||
| 			endpointName: EPGenres, | ||||
| @@ -25,7 +24,7 @@ func NewGenres(request func(URL string, dataBody any) (*resty.Response, error)) | ||||
| } | ||||
|  | ||||
| func (a *Genres) Query(query string) ([]*pb.Genre, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type InvolvedCompanies struct { | ||||
| 	BaseEndpoint[pb.InvolvedCompany] | ||||
| } | ||||
|  | ||||
| func NewInvolvedCompanies(request func(URL string, dataBody any) (*resty.Response, error)) *InvolvedCompanies { | ||||
| func NewInvolvedCompanies(request RequestFunc) *InvolvedCompanies { | ||||
| 	a := &InvolvedCompanies{ | ||||
| 		BaseEndpoint[pb.InvolvedCompany]{ | ||||
| 			endpointName: EPInvolvedCompanies, | ||||
| @@ -25,7 +24,7 @@ func NewInvolvedCompanies(request func(URL string, dataBody any) (*resty.Respons | ||||
| } | ||||
|  | ||||
| func (a *InvolvedCompanies) Query(query string) ([]*pb.InvolvedCompany, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Keywords struct { | ||||
| 	BaseEndpoint[pb.Keyword] | ||||
| } | ||||
|  | ||||
| func NewKeywords(request func(URL string, dataBody any) (*resty.Response, error)) *Keywords { | ||||
| func NewKeywords(request RequestFunc) *Keywords { | ||||
| 	a := &Keywords{ | ||||
| 		BaseEndpoint[pb.Keyword]{ | ||||
| 			endpointName: EPKeywords, | ||||
| @@ -25,7 +24,7 @@ func NewKeywords(request func(URL string, dataBody any) (*resty.Response, error) | ||||
| } | ||||
|  | ||||
| func (a *Keywords) Query(query string) ([]*pb.Keyword, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type LanguageSupportTypes struct { | ||||
| 	BaseEndpoint[pb.LanguageSupportType] | ||||
| } | ||||
|  | ||||
| func NewLanguageSupportTypes(request func(URL string, dataBody any) (*resty.Response, error)) *LanguageSupportTypes { | ||||
| func NewLanguageSupportTypes(request RequestFunc) *LanguageSupportTypes { | ||||
| 	a := &LanguageSupportTypes{ | ||||
| 		BaseEndpoint[pb.LanguageSupportType]{ | ||||
| 			endpointName: EPLanguageSupportTypes, | ||||
| @@ -25,7 +24,7 @@ func NewLanguageSupportTypes(request func(URL string, dataBody any) (*resty.Resp | ||||
| } | ||||
|  | ||||
| func (a *LanguageSupportTypes) Query(query string) ([]*pb.LanguageSupportType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type LanguageSupports struct { | ||||
| 	BaseEndpoint[pb.LanguageSupport] | ||||
| } | ||||
|  | ||||
| func NewLanguageSupports(request func(URL string, dataBody any) (*resty.Response, error)) *LanguageSupports { | ||||
| func NewLanguageSupports(request RequestFunc) *LanguageSupports { | ||||
| 	a := &LanguageSupports{ | ||||
| 		BaseEndpoint[pb.LanguageSupport]{ | ||||
| 			endpointName: EPLanguageSupports, | ||||
| @@ -25,7 +24,7 @@ func NewLanguageSupports(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *LanguageSupports) Query(query string) ([]*pb.LanguageSupport, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Languages struct { | ||||
| 	BaseEndpoint[pb.Language] | ||||
| } | ||||
|  | ||||
| func NewLanguages(request func(URL string, dataBody any) (*resty.Response, error)) *Languages { | ||||
| func NewLanguages(request RequestFunc) *Languages { | ||||
| 	a := &Languages{ | ||||
| 		BaseEndpoint[pb.Language]{ | ||||
| 			endpointName: EPLanguages, | ||||
| @@ -25,7 +24,7 @@ func NewLanguages(request func(URL string, dataBody any) (*resty.Response, error | ||||
| } | ||||
|  | ||||
| func (a *Languages) Query(query string) ([]*pb.Language, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type MultiplayerModes struct { | ||||
| 	BaseEndpoint[pb.MultiplayerMode] | ||||
| } | ||||
|  | ||||
| func NewMultiplayerModes(request func(URL string, dataBody any) (*resty.Response, error)) *MultiplayerModes { | ||||
| func NewMultiplayerModes(request RequestFunc) *MultiplayerModes { | ||||
| 	a := &MultiplayerModes{ | ||||
| 		BaseEndpoint[pb.MultiplayerMode]{ | ||||
| 			endpointName: EPMultiplayerModes, | ||||
| @@ -25,7 +24,7 @@ func NewMultiplayerModes(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *MultiplayerModes) Query(query string) ([]*pb.MultiplayerMode, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type NetworkTypes struct { | ||||
| 	BaseEndpoint[pb.NetworkType] | ||||
| } | ||||
|  | ||||
| func NewNetworkTypes(request func(URL string, dataBody any) (*resty.Response, error)) *NetworkTypes { | ||||
| func NewNetworkTypes(request RequestFunc) *NetworkTypes { | ||||
| 	a := &NetworkTypes{ | ||||
| 		BaseEndpoint[pb.NetworkType]{ | ||||
| 			endpointName: EPNetworkTypes, | ||||
| @@ -25,7 +24,7 @@ func NewNetworkTypes(request func(URL string, dataBody any) (*resty.Response, er | ||||
| } | ||||
|  | ||||
| func (a *NetworkTypes) Query(query string) ([]*pb.NetworkType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformFamilies struct { | ||||
| 	BaseEndpoint[pb.PlatformFamily] | ||||
| } | ||||
|  | ||||
| func NewPlatformFamilies(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformFamilies { | ||||
| func NewPlatformFamilies(request RequestFunc) *PlatformFamilies { | ||||
| 	a := &PlatformFamilies{ | ||||
| 		BaseEndpoint[pb.PlatformFamily]{ | ||||
| 			endpointName: EPPlatformFamilies, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformFamilies(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *PlatformFamilies) Query(query string) ([]*pb.PlatformFamily, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformLogos struct { | ||||
| 	BaseEndpoint[pb.PlatformLogo] | ||||
| } | ||||
|  | ||||
| func NewPlatformLogos(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformLogos { | ||||
| func NewPlatformLogos(request RequestFunc) *PlatformLogos { | ||||
| 	a := &PlatformLogos{ | ||||
| 		BaseEndpoint[pb.PlatformLogo]{ | ||||
| 			endpointName: EPPlatformLogos, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformLogos(request func(URL string, dataBody any) (*resty.Response, e | ||||
| } | ||||
|  | ||||
| func (a *PlatformLogos) Query(query string) ([]*pb.PlatformLogo, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformTypes struct { | ||||
| 	BaseEndpoint[pb.PlatformType] | ||||
| } | ||||
|  | ||||
| func NewPlatformTypes(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformTypes { | ||||
| func NewPlatformTypes(request RequestFunc) *PlatformTypes { | ||||
| 	a := &PlatformTypes{ | ||||
| 		BaseEndpoint[pb.PlatformType]{ | ||||
| 			endpointName: EPPlatformTypes, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformTypes(request func(URL string, dataBody any) (*resty.Response, e | ||||
| } | ||||
|  | ||||
| func (a *PlatformTypes) Query(query string) ([]*pb.PlatformType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformVersionCompanies struct { | ||||
| 	BaseEndpoint[pb.PlatformVersionCompany] | ||||
| } | ||||
|  | ||||
| func NewPlatformVersionCompanies(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformVersionCompanies { | ||||
| func NewPlatformVersionCompanies(request RequestFunc) *PlatformVersionCompanies { | ||||
| 	a := &PlatformVersionCompanies{ | ||||
| 		BaseEndpoint[pb.PlatformVersionCompany]{ | ||||
| 			endpointName: EPPlatformVersionCompanies, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformVersionCompanies(request func(URL string, dataBody any) (*resty. | ||||
| } | ||||
|  | ||||
| func (a *PlatformVersionCompanies) Query(query string) ([]*pb.PlatformVersionCompany, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformVersionReleaseDates struct { | ||||
| 	BaseEndpoint[pb.PlatformVersionReleaseDate] | ||||
| } | ||||
|  | ||||
| func NewPlatformVersionReleaseDates(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformVersionReleaseDates { | ||||
| func NewPlatformVersionReleaseDates(request RequestFunc) *PlatformVersionReleaseDates { | ||||
| 	a := &PlatformVersionReleaseDates{ | ||||
| 		BaseEndpoint[pb.PlatformVersionReleaseDate]{ | ||||
| 			endpointName: EPPlatformVersionReleaseDates, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformVersionReleaseDates(request func(URL string, dataBody any) (*res | ||||
| } | ||||
|  | ||||
| func (a *PlatformVersionReleaseDates) Query(query string) ([]*pb.PlatformVersionReleaseDate, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformVersions struct { | ||||
| 	BaseEndpoint[pb.PlatformVersion] | ||||
| } | ||||
|  | ||||
| func NewPlatformVersions(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformVersions { | ||||
| func NewPlatformVersions(request RequestFunc) *PlatformVersions { | ||||
| 	a := &PlatformVersions{ | ||||
| 		BaseEndpoint[pb.PlatformVersion]{ | ||||
| 			endpointName: EPPlatformVersions, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformVersions(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *PlatformVersions) Query(query string) ([]*pb.PlatformVersion, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlatformWebsites struct { | ||||
| 	BaseEndpoint[pb.PlatformWebsite] | ||||
| } | ||||
|  | ||||
| func NewPlatformWebsites(request func(URL string, dataBody any) (*resty.Response, error)) *PlatformWebsites { | ||||
| func NewPlatformWebsites(request RequestFunc) *PlatformWebsites { | ||||
| 	a := &PlatformWebsites{ | ||||
| 		BaseEndpoint[pb.PlatformWebsite]{ | ||||
| 			endpointName: EPPlatformWebsites, | ||||
| @@ -25,7 +24,7 @@ func NewPlatformWebsites(request func(URL string, dataBody any) (*resty.Response | ||||
| } | ||||
|  | ||||
| func (a *PlatformWebsites) Query(query string) ([]*pb.PlatformWebsite, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Platforms struct { | ||||
| 	BaseEndpoint[pb.Platform] | ||||
| } | ||||
|  | ||||
| func NewPlatforms(request func(URL string, dataBody any) (*resty.Response, error)) *Platforms { | ||||
| func NewPlatforms(request RequestFunc) *Platforms { | ||||
| 	a := &Platforms{ | ||||
| 		BaseEndpoint[pb.Platform]{ | ||||
| 			endpointName: EPPlatforms, | ||||
| @@ -25,7 +24,7 @@ func NewPlatforms(request func(URL string, dataBody any) (*resty.Response, error | ||||
| } | ||||
|  | ||||
| func (a *Platforms) Query(query string) ([]*pb.Platform, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PlayerPerspectives struct { | ||||
| 	BaseEndpoint[pb.PlayerPerspective] | ||||
| } | ||||
|  | ||||
| func NewPlayerPerspectives(request func(URL string, dataBody any) (*resty.Response, error)) *PlayerPerspectives { | ||||
| func NewPlayerPerspectives(request RequestFunc) *PlayerPerspectives { | ||||
| 	a := &PlayerPerspectives{ | ||||
| 		BaseEndpoint[pb.PlayerPerspective]{ | ||||
| 			endpointName: EPPlayerPerspectives, | ||||
| @@ -25,7 +24,7 @@ func NewPlayerPerspectives(request func(URL string, dataBody any) (*resty.Respon | ||||
| } | ||||
|  | ||||
| func (a *PlayerPerspectives) Query(query string) ([]*pb.PlayerPerspective, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PopularityPrimitives struct { | ||||
| 	BaseEndpoint[pb.PopularityPrimitive] | ||||
| } | ||||
|  | ||||
| func NewPopularityPrimitives(request func(URL string, dataBody any) (*resty.Response, error)) *PopularityPrimitives { | ||||
| func NewPopularityPrimitives(request RequestFunc) *PopularityPrimitives { | ||||
| 	a := &PopularityPrimitives{ | ||||
| 		BaseEndpoint[pb.PopularityPrimitive]{ | ||||
| 			endpointName: EPPopularityPrimitives, | ||||
| @@ -25,7 +24,7 @@ func NewPopularityPrimitives(request func(URL string, dataBody any) (*resty.Resp | ||||
| } | ||||
|  | ||||
| func (a *PopularityPrimitives) Query(query string) ([]*pb.PopularityPrimitive, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type PopularityTypes struct { | ||||
| 	BaseEndpoint[pb.PopularityType] | ||||
| } | ||||
|  | ||||
| func NewPopularityTypes(request func(URL string, dataBody any) (*resty.Response, error)) *PopularityTypes { | ||||
| func NewPopularityTypes(request RequestFunc) *PopularityTypes { | ||||
| 	a := &PopularityTypes{ | ||||
| 		BaseEndpoint[pb.PopularityType]{ | ||||
| 			endpointName: EPPopularityTypes, | ||||
| @@ -25,7 +24,7 @@ func NewPopularityTypes(request func(URL string, dataBody any) (*resty.Response, | ||||
| } | ||||
|  | ||||
| func (a *PopularityTypes) Query(query string) ([]*pb.PopularityType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Regions struct { | ||||
| 	BaseEndpoint[pb.Region] | ||||
| } | ||||
|  | ||||
| func NewRegions(request func(URL string, dataBody any) (*resty.Response, error)) *Regions { | ||||
| func NewRegions(request RequestFunc) *Regions { | ||||
| 	a := &Regions{ | ||||
| 		BaseEndpoint[pb.Region]{ | ||||
| 			endpointName: EPRegions, | ||||
| @@ -25,7 +24,7 @@ func NewRegions(request func(URL string, dataBody any) (*resty.Response, error)) | ||||
| } | ||||
|  | ||||
| func (a *Regions) Query(query string) ([]*pb.Region, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type ReleaseDateRegions struct { | ||||
| 	BaseEndpoint[pb.ReleaseDateRegion] | ||||
| } | ||||
|  | ||||
| func NewReleaseDateRegions(request func(URL string, dataBody any) (*resty.Response, error)) *ReleaseDateRegions { | ||||
| func NewReleaseDateRegions(request RequestFunc) *ReleaseDateRegions { | ||||
| 	a := &ReleaseDateRegions{ | ||||
| 		BaseEndpoint[pb.ReleaseDateRegion]{ | ||||
| 			endpointName: EPReleaseDateRegions, | ||||
| @@ -25,7 +24,7 @@ func NewReleaseDateRegions(request func(URL string, dataBody any) (*resty.Respon | ||||
| } | ||||
|  | ||||
| func (a *ReleaseDateRegions) Query(query string) ([]*pb.ReleaseDateRegion, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type ReleaseDateStatuses struct { | ||||
| 	BaseEndpoint[pb.ReleaseDateStatus] | ||||
| } | ||||
|  | ||||
| func NewReleaseDateStatuses(request func(URL string, dataBody any) (*resty.Response, error)) *ReleaseDateStatuses { | ||||
| func NewReleaseDateStatuses(request RequestFunc) *ReleaseDateStatuses { | ||||
| 	a := &ReleaseDateStatuses{ | ||||
| 		BaseEndpoint[pb.ReleaseDateStatus]{ | ||||
| 			endpointName: EPReleaseDateStatuses, | ||||
| @@ -25,7 +24,7 @@ func NewReleaseDateStatuses(request func(URL string, dataBody any) (*resty.Respo | ||||
| } | ||||
|  | ||||
| func (a *ReleaseDateStatuses) Query(query string) ([]*pb.ReleaseDateStatus, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type ReleaseDates struct { | ||||
| 	BaseEndpoint[pb.ReleaseDate] | ||||
| } | ||||
|  | ||||
| func NewReleaseDates(request func(URL string, dataBody any) (*resty.Response, error)) *ReleaseDates { | ||||
| func NewReleaseDates(request RequestFunc) *ReleaseDates { | ||||
| 	a := &ReleaseDates{ | ||||
| 		BaseEndpoint[pb.ReleaseDate]{ | ||||
| 			endpointName: EPReleaseDates, | ||||
| @@ -25,7 +24,7 @@ func NewReleaseDates(request func(URL string, dataBody any) (*resty.Response, er | ||||
| } | ||||
|  | ||||
| func (a *ReleaseDates) Query(query string) ([]*pb.ReleaseDate, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Screenshots struct { | ||||
| 	BaseEndpoint[pb.Screenshot] | ||||
| } | ||||
|  | ||||
| func NewScreenshots(request func(URL string, dataBody any) (*resty.Response, error)) *Screenshots { | ||||
| func NewScreenshots(request RequestFunc) *Screenshots { | ||||
| 	a := &Screenshots{ | ||||
| 		BaseEndpoint[pb.Screenshot]{ | ||||
| 			endpointName: EPScreenshots, | ||||
| @@ -25,7 +24,7 @@ func NewScreenshots(request func(URL string, dataBody any) (*resty.Response, err | ||||
| } | ||||
|  | ||||
| func (a *Screenshots) Query(query string) ([]*pb.Screenshot, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -10,7 +10,6 @@ import ( | ||||
| 	"time" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"github.com/PuerkitoBio/goquery" | ||||
| 	"github.com/bestnite/go-flaresolverr" | ||||
| @@ -24,11 +23,11 @@ var webSearchCFCookies struct { | ||||
|  | ||||
| type Search struct { | ||||
| 	endpointName Name | ||||
| 	request      func(URL string, dataBody any) (*resty.Response, error) | ||||
| 	request      RequestFunc | ||||
| 	flaresolverr *flaresolverr.Flaresolverr | ||||
| } | ||||
|  | ||||
| func NewSearch(request func(URL string, dataBody any) (*resty.Response, error)) *Search { | ||||
| func NewSearch(request RequestFunc) *Search { | ||||
| 	return &Search{ | ||||
| 		endpointName: EPSearch, | ||||
| 		request:      request, | ||||
| @@ -36,7 +35,7 @@ func NewSearch(request func(URL string, dataBody any) (*resty.Response, error)) | ||||
| } | ||||
|  | ||||
| func (a *Search) Search(query string) ([]*pb.Search, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Themes struct { | ||||
| 	BaseEndpoint[pb.Theme] | ||||
| } | ||||
|  | ||||
| func NewThemes(request func(URL string, dataBody any) (*resty.Response, error)) *Themes { | ||||
| func NewThemes(request RequestFunc) *Themes { | ||||
| 	a := &Themes{ | ||||
| 		BaseEndpoint[pb.Theme]{ | ||||
| 			endpointName: EPThemes, | ||||
| @@ -25,7 +24,7 @@ func NewThemes(request func(URL string, dataBody any) (*resty.Response, error)) | ||||
| } | ||||
|  | ||||
| func (a *Themes) Query(query string) ([]*pb.Theme, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -1,36 +1,103 @@ | ||||
| package endpoint | ||||
|  | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"net/url" | ||||
|  | ||||
| 	"github.com/go-resty/resty/v2" | ||||
| ) | ||||
|  | ||||
| type Webhooks struct { | ||||
| 	request func(URL string, dataBody any) (*resty.Response, error) | ||||
| 	request RequestFunc | ||||
| } | ||||
|  | ||||
| func NewWebhooks(request func(URL string, dataBody any) (*resty.Response, error)) *Webhooks { | ||||
| func NewWebhooks(request RequestFunc) *Webhooks { | ||||
| 	return &Webhooks{ | ||||
| 		request: request, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (a *Webhooks) Register(endpoint Name, secret, callbackUrl string) error { | ||||
| type WebhookMethod string | ||||
|  | ||||
| const ( | ||||
| 	WebhookMethodUpdate WebhookMethod = "update" | ||||
| 	WebhookMethodDelete WebhookMethod = "delete" | ||||
| 	WebhookMethodCreate WebhookMethod = "create" | ||||
| ) | ||||
|  | ||||
| type WebhookResponse struct { | ||||
| 	Id          uint64 `json:"id"` | ||||
| 	Url         string `json:"url"` | ||||
| 	Category    uint64 `json:"category"` | ||||
| 	SubCategory uint64 `json:"sub_category"` | ||||
| 	Active      bool   `json:"active"` | ||||
| 	ApiKey      string `json:"api_key"` | ||||
| 	Secret      string `json:"secret"` | ||||
| 	CreatedAt   string `json:"created_at"` | ||||
| 	UpdatedAt   string `json:"updated_at"` | ||||
| } | ||||
|  | ||||
| func (a *Webhooks) Register(endpoint Name, secret, callbackUrl string, method WebhookMethod) (*WebhookResponse, error) { | ||||
| 	dataBody := url.Values{} | ||||
| 	dataBody.Set("url", callbackUrl) | ||||
| 	dataBody.Set("secret", secret) | ||||
| 	dataBody.Set("method", "update") | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s/webhooks/", endpoint), dataBody.Encode()) | ||||
| 	dataBody.Set("method", string(method)) | ||||
|  | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s/webhooks/", endpoint), dataBody.Encode()) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("failed to make request: %s: %w", callbackUrl, err) | ||||
| 		return nil, fmt.Errorf("failed to make request: %s: %w", callbackUrl, err) | ||||
| 	} | ||||
|  | ||||
| 	if resp.StatusCode() == http.StatusOK { | ||||
| 		return nil, nil | ||||
| 	} | ||||
|  | ||||
| 	var data WebhookResponse | ||||
| 	if err = json.Unmarshal(resp.Body(), &data); err != nil { | ||||
| 		return nil, fmt.Errorf("failed to unmarshal: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	return &data, fmt.Errorf("failed to activate webhook: %s: %s", callbackUrl, resp.String()) | ||||
| } | ||||
|  | ||||
| func (a *Webhooks) Unregister(webhookId uint64) error { | ||||
| 	resp, err := a.request("DELETE", fmt.Sprintf("https://api.igdb.com/v4/webhooks/%v", webhookId), "") | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("failed to make request: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	if resp.StatusCode() == http.StatusOK { | ||||
| 		return nil | ||||
| 	} | ||||
| 	return fmt.Errorf("failed to activate webhook: %s: %s", callbackUrl, resp.String()) | ||||
|  | ||||
| 	return fmt.Errorf("failed to unregister webhook: %s", resp.String()) | ||||
| } | ||||
|  | ||||
| func (a *Webhooks) List() ([]*WebhookResponse, error) { | ||||
| 	resp, err := a.request("GET", "https://api.igdb.com/v4/webhooks/", "") | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to make request: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	var data []*WebhookResponse | ||||
| 	if err = json.Unmarshal(resp.Body(), &data); err != nil { | ||||
| 		return nil, fmt.Errorf("failed to unmarshal: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	return data, nil | ||||
| } | ||||
|  | ||||
| func (a *Webhooks) Get(webhookId uint64) (*WebhookResponse, error) { | ||||
| 	resp, err := a.request("GET", fmt.Sprintf("https://api.igdb.com/v4/webhooks/%v", webhookId), "") | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to make request: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	var data WebhookResponse | ||||
| 	if err = json.Unmarshal(resp.Body(), &data); err != nil { | ||||
| 		return nil, fmt.Errorf("failed to unmarshal: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	return &data, nil | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type WebsiteTypes struct { | ||||
| 	BaseEndpoint[pb.WebsiteType] | ||||
| } | ||||
|  | ||||
| func NewWebsiteTypes(request func(URL string, dataBody any) (*resty.Response, error)) *WebsiteTypes { | ||||
| func NewWebsiteTypes(request RequestFunc) *WebsiteTypes { | ||||
| 	a := &WebsiteTypes{ | ||||
| 		BaseEndpoint[pb.WebsiteType]{ | ||||
| 			endpointName: EPWebsiteTypes, | ||||
| @@ -25,7 +24,7 @@ func NewWebsiteTypes(request func(URL string, dataBody any) (*resty.Response, er | ||||
| } | ||||
|  | ||||
| func (a *WebsiteTypes) Query(query string) ([]*pb.WebsiteType, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	pb "github.com/bestnite/go-igdb/proto" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
|  | ||||
| 	"google.golang.org/protobuf/proto" | ||||
| ) | ||||
| @@ -13,7 +12,7 @@ type Websites struct { | ||||
| 	BaseEndpoint[pb.Website] | ||||
| } | ||||
|  | ||||
| func NewWebsites(request func(URL string, dataBody any) (*resty.Response, error)) *Websites { | ||||
| func NewWebsites(request RequestFunc) *Websites { | ||||
| 	a := &Websites{ | ||||
| 		BaseEndpoint[pb.Website]{ | ||||
| 			endpointName: EPWebsites, | ||||
| @@ -25,7 +24,7 @@ func NewWebsites(request func(URL string, dataBody any) (*resty.Response, error) | ||||
| } | ||||
|  | ||||
| func (a *Websites) Query(query string) ([]*pb.Website, error) { | ||||
| 	resp, err := a.request(fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	resp, err := a.request("POST", fmt.Sprintf("https://api.igdb.com/v4/%s.pb", a.endpointName), query) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to request: %w", err) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user