Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertItem ¶
type AlertItem struct { Event string `json:"event"` // Short event summary Headline string `json:"headline"` // Full headline description Description string `json:"description"` // Long description of the event Severity string `json:"severity"` // Severity of the event Urgency string `json:"urgency"` // Urgency of the event AreaDescription string `json:"area_description"` // Affected Area description Sender string `json:"sender"` // Sender (email) of the event SenderName string `json:"sendername"` // Sender name of the event Effective time.Time `json:"effective"` // Event effective start time Expiration time.Time `json:"expiration"` // Event effective end time }
type AlertReport ¶
type AlertReport struct { Latitude float64 `json:"latitude"` // Latitude Longitude float64 `json:"longitude"` // Longitude City string `json:"city"` // City name State string `json:"state"` // State name NWSZone string `json:"zone"` // National weather service zone NWSZoneURL string `json:"zoneurl"` // National weather service zone URL (for more information) ActiveAlertsForZoneURL string `json:"alertsurl"` // URL to see active alerts on the NWS website for the current NWS zone Alerts []AlertItem `json:"alerts"` // Active alerts Version string `json:"version"` // Service version }
AlertReport defines an alert report
func GetWeatherAlerts ¶
func GetWeatherAlerts(ctx context.Context, services []AlertService, lat, long string) AlertReport
GetWeatherAlerts calls all services in parallel and returns the first result
type AlertService ¶
type AlertService interface { // GetWeatherReport gets the weather report GetWeatherAlerts(ctx context.Context, lat, long string) (AlertReport, error) }
AlertService is the interface for all services that can fetch weather alerts
type NWSAlertsResponse ¶
type NWSAlertsResponse struct { Context []interface{} `json:"@context"` Type string `json:"type"` Features []struct { ID string `json:"id"` Type string `json:"type"` Geometry interface{} `json:"geometry"` Properties struct { ID string `json:"@id"` Type string `json:"@type"` AreaDesc string `json:"areaDesc"` Geocode struct { SAME []string `json:"SAME"` UGC []string `json:"UGC"` } `json:"geocode"` AffectedZones []string `json:"affectedZones"` References []struct { ID string `json:"@id"` Identifier string `json:"identifier"` Sender string `json:"sender"` Sent string `json:"sent"` } `json:"references"` Sent time.Time `json:"sent"` Effective time.Time `json:"effective"` Onset time.Time `json:"onset"` Expires time.Time `json:"expires"` Ends time.Time `json:"ends"` Status string `json:"status"` MessageType string `json:"messageType"` Category string `json:"category"` Severity string `json:"severity"` Certainty string `json:"certainty"` Urgency string `json:"urgency"` Event string `json:"event"` Sender string `json:"sender"` SenderName string `json:"senderName"` Headline string `json:"headline"` Description string `json:"description"` Instruction string `json:"instruction"` Response string `json:"response"` Parameters struct { PIL []string `json:"PIL"` NWSheadline []string `json:"NWSheadline"` BLOCKCHANNEL []string `json:"BLOCKCHANNEL"` EASORG []string `json:"EAS-ORG"` VTEC []string `json:"VTEC"` EventEndingTime []time.Time `json:"eventEndingTime"` ExpiredReferences []string `json:"expiredReferences"` } `json:"parameters"` } `json:"properties"` } `json:"features"` Title string `json:"title"` Updated time.Time `json:"updated"` }
NWSAlertsResponse defines the expected response from the NWS alerts service (for a specific zone)
type NWSAlertsService ¶
type NWSAlertsService struct{}
OpenWeatherService is a weather service for OpenWeather formatted data
func (NWSAlertsService) GetWeatherAlerts ¶
func (s NWSAlertsService) GetWeatherAlerts(ctx context.Context, lat, long string) (AlertReport, error)
GetWeatherReport gets the weather report
type NWSPointsResponse ¶
type NWSPointsResponse struct { Context []interface{} `json:"@context"` ID string `json:"id"` Type string `json:"type"` Geometry struct { Type string `json:"type"` Coordinates []float64 `json:"coordinates"` } `json:"geometry"` Properties struct { ID string `json:"@id"` Type string `json:"@type"` Cwa string `json:"cwa"` ForecastOffice string `json:"forecastOffice"` GridID string `json:"gridId"` GridX int `json:"gridX"` GridY int `json:"gridY"` Forecast string `json:"forecast"` ForecastHourly string `json:"forecastHourly"` ForecastGridData string `json:"forecastGridData"` ObservationStations string `json:"observationStations"` RelativeLocation struct { Type string `json:"type"` Geometry struct { Type string `json:"type"` Coordinates []float64 `json:"coordinates"` } `json:"geometry"` Properties struct { City string `json:"city"` // City name State string `json:"state"` // State name Distance struct { Value float64 `json:"value"` UnitCode string `json:"unitCode"` } `json:"distance"` Bearing struct { Value int `json:"value"` UnitCode string `json:"unitCode"` } `json:"bearing"` } `json:"properties"` } `json:"relativeLocation"` ForecastZone string `json:"forecastZone"` // Forecast zone County string `json:"county"` FireWeatherZone string `json:"fireWeatherZone"` TimeZone string `json:"timeZone"` RadarStation string `json:"radarStation"` } `json:"properties"` }
NWSPointsResponse defines the expected response format from the NWS points service
Click to show internal directories.
Click to hide internal directories.