go-igdb/endpoint/base.go
2025-04-06 00:28:00 +11:00

39 lines
813 B
Go

package endpoint
import (
"github.com/go-resty/resty/v2"
)
type BaseEndpoint struct {
request func(URL string, dataBody any) (*resty.Response, error)
endpointName EndpointName
}
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 {
return b.endpointName
}
func (b *BaseEndpoint) Query(query string) (any, error) {
return nil, nil
}
func (b *BaseEndpoint) QueryAny(query string) (any, error) {
return b.Query(query)
}
type Endpoint interface {
GetEndpointName() EndpointName
}
type EntityEndpoint interface {
QueryAny(query string) (any, error)
GetEndpointName() EndpointName
}