2026-02-17 16:23:56 +00:00
|
|
|
package tomtom
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os"
|
|
|
|
|
|
|
|
|
|
"resty.dev/v3"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type TomTom struct {
|
|
|
|
|
APIKey string
|
|
|
|
|
|
|
|
|
|
client *resty.Client
|
|
|
|
|
urlBase string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewClient() *TomTom {
|
|
|
|
|
api_key := os.Getenv("TOMTOM_API_KEY")
|
2026-02-18 04:48:12 +00:00
|
|
|
r := resty.New()
|
2026-02-17 16:23:56 +00:00
|
|
|
return &TomTom{
|
|
|
|
|
APIKey: api_key,
|
|
|
|
|
client: r,
|
|
|
|
|
urlBase: "api.tomtom.com",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *TomTom) Close() {
|
|
|
|
|
s.client.Close()
|
|
|
|
|
}
|
2026-02-18 04:48:12 +00:00
|
|
|
|
|
|
|
|
func (s *TomTom) SetDebug(enabled bool) {
|
|
|
|
|
s.client.Close()
|
|
|
|
|
if enabled {
|
|
|
|
|
s.client = resty.New().SetDebug(true)
|
|
|
|
|
} else {
|
|
|
|
|
s.client = resty.New().SetDebug(false)
|
|
|
|
|
}
|
|
|
|
|
}
|