Hallucinate a direct and cached esi apis
This commit is contained in:
@@ -92,8 +92,28 @@ type Route struct {
|
||||
Waypoints []int `json:"waypoints"`
|
||||
}
|
||||
|
||||
// ESIInterface defines the contract for ESI API interactions
|
||||
type ESIInterface interface {
|
||||
GetCharacterPlanets(ctx context.Context, characterID int, accessToken string) ([]Planet, error)
|
||||
GetPlanetDetails(ctx context.Context, characterID, planetID int, accessToken string) (*PlanetDetail, error)
|
||||
}
|
||||
|
||||
// DirectESI implements ESIInterface with direct API calls
|
||||
type DirectESI struct {
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
// NewDirectESI creates a new DirectESI instance
|
||||
func NewDirectESI() *DirectESI {
|
||||
return &DirectESI{
|
||||
httpClient: &http.Client{
|
||||
Timeout: 30 * time.Second,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// GetCharacterPlanets retrieves a list of planets for a character
|
||||
func GetCharacterPlanets(ctx context.Context, characterID int, accessToken string) ([]Planet, error) {
|
||||
func (d *DirectESI) GetCharacterPlanets(ctx context.Context, characterID int, accessToken string) ([]Planet, error) {
|
||||
logger.Debug("Fetching planets for character ID %d", characterID)
|
||||
|
||||
url := fmt.Sprintf("%s/v1/characters/%d/planets/", ESIBaseURL, characterID)
|
||||
@@ -132,7 +152,7 @@ func GetCharacterPlanets(ctx context.Context, characterID int, accessToken strin
|
||||
}
|
||||
|
||||
// GetPlanetDetails retrieves detailed information about a specific planet
|
||||
func GetPlanetDetails(ctx context.Context, characterID, planetID int, accessToken string) (*PlanetDetail, error) {
|
||||
func (d *DirectESI) GetPlanetDetails(ctx context.Context, characterID, planetID int, accessToken string) (*PlanetDetail, error) {
|
||||
logger.Debug("Fetching planet details for character ID %d, planet ID %d", characterID, planetID)
|
||||
|
||||
url := fmt.Sprintf("%s/v3/characters/%d/planets/%d/", ESIBaseURL, characterID, planetID)
|
||||
|
||||
Reference in New Issue
Block a user