mirror of
https://github.com/bestnite/go-igdb.git
synced 2025-04-20 00:45:54 +08:00
39 lines
813 B
Go
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
|
|
}
|