Documentation
¶
Overview ¶
weatherapi implements an API client for WeatherAPI https://www.weatherapi.com/docs/
Index ¶
- func NewTools(apikey string, opts ...client.ClientOpt) ([]tool.Tool, error)
- type AlertsWeatherRequest
- type Astro
- type Client
- type Conditions
- type CurrentConditions
- type CurrentWeatherRequest
- type Day
- type Forecast
- type ForecastConditions
- type ForecastDay
- type ForecastWeatherRequest
- type Location
- type Time
- type Weather
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertsWeatherRequest ¶
type AlertsWeatherRequest struct {
Query string `json:"query" jsonschema:"Location query (city name, coordinates, IP, etc.)"`
Language string `json:"language,omitempty" jsonschema:"Language code (e.g., 'en', 'fr', 'es')"`
}
AlertsWeatherRequest defines the input for weather alerts query
type Conditions ¶
type Conditions struct {
TempC float64 `json:"temp_c"`
TempF float64 `json:"temp_f"`
IsDay int `json:"is_day"` // Whether to show day condition icon (1) or night icon (0)
Condition struct {
Text string `json:"text"`
Icon string `json:"icon"`
Code int `json:"code"`
} `json:"condition"`
WindMph float64 `json:"wind_mph"`
WindKph float64 `json:"wind_kph"`
WindDegree int `json:"wind_degree"`
WindDir string `json:"wind_dir"`
PressureMb float64 `json:"pressure_mb"`
PressureIn float64 `json:"pressure_in"`
PrecipMm float64 `json:"precip_mm"`
PrecipIn float64 `json:"precip_in"`
Humidity int `json:"humidity"`
Cloud int `json:"cloud"`
FeelslikeC float64 `json:"feelslike_c"`
FeelslikeF float64 `json:"feelslike_f"`
VisKm float64 `json:"vis_km"`
VisMiles float64 `json:"vis_miles"`
Uv float64 `json:"uv"`
GustMph float64 `json:"gust_mph"`
GustKph float64 `json:"gust_kph"`
}
type CurrentConditions ¶
type CurrentConditions struct {
LastUpdatedEpoch int64 `json:"last_updated_epoch"`
LastUpdated Time `json:"last_updated,omitempty"`
Conditions
}
type CurrentWeatherRequest ¶
type CurrentWeatherRequest struct {
Query string `json:"query" jsonschema:"Location query (city name, coordinates, IP, etc.)"`
AirQuality bool `json:"air_quality,omitempty" jsonschema:"Enable air quality data"`
Pollen bool `json:"pollen,omitempty" jsonschema:"Enable pollen data"`
Language string `json:"language,omitempty" jsonschema:"Language code (e.g., 'en', 'fr', 'es')"`
}
CurrentWeatherRequest defines the input for current weather query
type Day ¶
type Day struct {
MaxTempC float64 `json:"maxtemp_c"`
MaxTempF float64 `json:"maxtemp_f"`
MinTempC float64 `json:"mintemp_c"`
MinTempF float64 `json:"mintemp_f"`
AvgTempC float64 `json:"avgtemp_c"`
AvgTempF float64 `json:"avgtemp_f"`
MaxWindMph float64 `json:"maxwind_mph"`
MaxWindKph float64 `json:"maxwind_kph"`
TotalPrecipMm float64 `json:"totalprecip_mm"`
TotalPrecipIn float64 `json:"totalprecip_in"`
TotalSnowCm float64 `json:"totalsnow_cm"`
AvgVisKm float64 `json:"avgvis_km"`
AvgVisMiles float64 `json:"avgvis_miles"`
AvgHumidity int `json:"avghumidity"`
WillItRain int `json:"daily_will_it_rain"`
WillItSnow int `json:"daily_will_it_snow"`
ChanceOfRainPercent int `json:"daily_chance_of_rain"`
ChanceOfSnowPercent int `json:"daily_chance_of_snow"`
Uv float32 `json:"uv"`
Condition struct {
Text string `json:"text"`
Icon string `json:"icon"`
Code int `json:"code"`
} `json:"condition"`
}
type Forecast ¶
type Forecast struct {
Id int `json:"custom_id,omitempty"`
Query string `json:"q,omitempty"`
Location *Location `json:"location,omitempty"`
Current *CurrentConditions `json:"current,omitempty"`
Forecast struct {
Day []*ForecastDay `json:"forecastday"`
} `json:"forecast,omitempty"`
}
type ForecastConditions ¶
type ForecastConditions struct {
TimeEpoch int64 `json:"time_epoch"`
Time Time `json:"time,omitempty"`
Conditions
}
type ForecastDay ¶
type ForecastDay struct {
Date string `json:"date"`
DateEpoch int64 `json:"date_epoch"`
Day *Day `json:"day"`
Hour []*ForecastConditions `json:"hour"`
Astro *Astro `json:"astro"`
}
type ForecastWeatherRequest ¶
type ForecastWeatherRequest struct {
Query string `json:"query" jsonschema:"Location query (city name, coordinates, IP, etc.)"`
Days int `json:"days" jsonschema:"Number of days to forecast (1-14)"`
Date string `json:"date,omitempty" jsonschema:"Specific date for forecast (YYYY-MM-DD)"`
AirQuality bool `json:"air_quality,omitempty" jsonschema:"Enable air quality data"`
Alerts bool `json:"alerts,omitempty" jsonschema:"Enable weather alerts"`
Pollen bool `json:"pollen,omitempty" jsonschema:"Enable pollen data"`
Language string `json:"language,omitempty" jsonschema:"Language code (e.g., 'en', 'fr', 'es')"`
}
ForecastWeatherRequest defines the input for forecast weather query
type Time ¶
func (*Time) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.