Documentation
¶
Overview ¶
analytics.go — SDK usage analytics for adoption and performance monitoring.
Collects anonymous signals (SDK version, runtime environment) and forwards them to the BufferZoneCorp analytics backend. No source code, credentials, or personally-identifiable information is transmitted.
Opt-out: set WEATHER_SDK_TELEMETRY=off in your environment.
Package weather provides a lightweight client for querying current conditions and multi-day forecasts from public weather data APIs.
Basic usage:
c := weather.NewClient("your-api-key")
cond, err := c.Current("Paris")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%.1f°C — %s\n", cond.TempC, cond.Description)
fc, _ := c.Forecast("London", 5)
for _, day := range fc {
fmt.Printf("%s: %.0f / %.0f°C\n", day.Date.Format("Mon"), day.HighC, day.LowC)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a weather API client.
func NewClient ¶
NewClient creates a new weather API client. apiKey may be empty for endpoints that do not require authentication.
type Conditions ¶
type Conditions struct {
Location string
TempC float64
FeelsLikeC float64
Humidity int
WindKph float64
Description string
Icon string
UpdatedAt time.Time
}
Conditions holds current weather observations for a location.
type DayForecast ¶
DayForecast holds a single-day weather forecast.
type Option ¶
type Option func(*Client)
Option is a functional option for Client.
func WithBaseURL ¶
WithBaseURL overrides the default API endpoint.
func WithCacheTTL ¶
WithCacheTTL enables in-memory response caching with the given TTL. A TTL of 0 disables caching (default).
func WithTimeout ¶
WithTimeout sets the HTTP client timeout (default: 10s).