Documentation ¶
Index ¶
- Constants
- Variables
- type AttributionRequest
- type AttributionResponse
- type AvailabilityRequest
- type AvailabilityResponse
- type Certainty
- type Client
- func (d *Client) Alert(ctx context.Context, token string, request WeatherAlertRequest) (*WeatherAlertResponse, error)
- func (d *Client) Attribution(ctx context.Context, request AttributionRequest) (*AttributionResponse, error)
- func (d *Client) Availability(ctx context.Context, token string, request AvailabilityRequest) (*AvailabilityResponse, error)
- func (d *Client) Weather(ctx context.Context, token string, request WeatherRequest) (*WeatherResponse, error)
- type CredentialedClient
- func (d *CredentialedClient) Alert(ctx context.Context, request WeatherAlertRequest) (*WeatherAlertResponse, error)
- func (d *CredentialedClient) Attribution(ctx context.Context, request AttributionRequest) (*AttributionResponse, error)
- func (d *CredentialedClient) Availability(ctx context.Context, request AvailabilityRequest) (*AvailabilityResponse, error)
- func (d *CredentialedClient) Weather(ctx context.Context, request WeatherRequest) (*WeatherResponse, error)
- type CredentialedClientOption
- type Credentials
- type CurrentWeather
- type CurrentWeatherData
- type DailyForecast
- type DataSet
- type DataSets
- type DayPartForecast
- type DayWeatherConditions
- type ErrorResponse
- type EventText
- type ForecastMinute
- type ForecastPeriodSummary
- type HourWeatherConditions
- type HourlyForecast
- type Metadata
- type MoonPhase
- type NextHourForecast
- type NextHourForecastData
- type PrecipitationType
- type PressureTrend
- type ProductData
- type ResponseType
- type RestError
- type Severity
- type UnitsSystem
- type Urgency
- type WeatherAlertArea
- type WeatherAlertCollection
- type WeatherAlertData
- type WeatherAlertRequest
- type WeatherAlertResponse
- type WeatherAlertSummary
- type WeatherRequest
- type WeatherResponse
Constants ¶
const ( // The moon isn’t visible. MoonPhaseNew = "new" // A crescent-shaped sliver of the moon is visible, and increasing in size. MoonPhaseWaxingCrescent = "waxingCrescent" // Approximately half of the moon is visible, and increasing in size. MoonPhaseFirstQuarter = "firstQuarter" // The entire disc of the moon is visible. MoonPhaseFull = "full" // More than half of the moon is visible, and increasing in size. MoonPhaseWaxingGibbous = "waxingGibbous" // More than half of the moon is visible, and decreasing in size. MoonPhaseWaningGibbous = "waningGibbous" // Approximately half of the moon is visible, and decreasing in size. MoonPhaseThirdQuarter = "thirdQuarter" // A crescent-shaped sliver of the moon is visible, and decreasing in size. MoonPhaseWaningCrescent = "waningCrescent" )
const DefaultUserAgent = "shawntoffel/go-weatherkit"
DefaultUserAgent to send along with requests.
Variables ¶
var BaseUrl = "https://weatherkit.apple.com"
WeatherKit API base URL
Functions ¶
This section is empty.
Types ¶
type AttributionRequest ¶ added in v0.1.0
type AttributionRequest struct { // (Required) The language tag to use for localizing responses. Language string `json:"language,omitempty"` }
AttributionRequest requests attribution details.
type AttributionResponse ¶ added in v0.1.0
type AttributionResponse struct { LogoDark1x string `json:"logoDark@1x,omitempty"` LogoDark2x string `json:"logoDark@2x,omitempty"` LogoDark3x string `json:"logoDark@3x,omitempty"` LogoLight1x string `json:"logoLight@1x,omitempty"` LogoLight2x string `json:"logoLight@2x,omitempty"` LogoLight3x string `json:"logoLight@3x,omitempty"` LogoSquare1x string `json:"logoSquare@1x,omitempty"` LogoSquare2x string `json:"logoSquare@2x,omitempty"` LogoSquare3x string `json:"logoSquare@3x,omitempty"` ServiceName string `json:"serviceName,omitempty"` }
AttributionResponse contains an official attribution branding.
type AvailabilityRequest ¶
type AvailabilityRequest struct { // The latitude of the desired location. Latitude float64 // The longitude of the desired location. Longitude float64 // (Required) The ISO Alpha-2 country code for the requested location. // This parameter is necessary for air quality and weather alerts. Country string }
type AvailabilityResponse ¶
type AvailabilityResponse DataSets
AvailabilityResponse has the data sets available for the specified location.
type Certainty ¶
type Certainty string
Certainty is how likely the event is to occur.
const ( // The event has already occurred or is ongoing. CertaintyObserved Certainty = "observed" // The event is likely to occur (greater than 50% probability). CertaintyLikely Certainty = "likely" // The event is unlikely to occur (less than 50% probability). CertaintyPossible Certainty = "possible" // The event is not expected to occur (approximately 0% probability). CertaintyUnlikely Certainty = "unlikely" // It is unknown if the event will occur. CertaintyUnknown Certainty = "unknown" )
type Client ¶
type Client struct { HttpClient *http.Client // The UserAgent header value to send along with requests. UserAgent string }
Client is a WeatherKit API client without Credentials. Use NewCredentialedClient for automatic JWT handling.
func (*Client) Alert ¶
func (d *Client) Alert(ctx context.Context, token string, request WeatherAlertRequest) (*WeatherAlertResponse, error)
Alert receives information on an active weather alert. The token parameter is a JWT developer token.
func (*Client) Attribution ¶ added in v0.1.0
func (d *Client) Attribution(ctx context.Context, request AttributionRequest) (*AttributionResponse, error)
Attribution retrieves official attribution branding.
func (*Client) Availability ¶
func (d *Client) Availability(ctx context.Context, token string, request AvailabilityRequest) (*AvailabilityResponse, error)
Availability determines the data sets available for the specified location. The token parameter is a JWT developer token.
func (*Client) Weather ¶
func (d *Client) Weather(ctx context.Context, token string, request WeatherRequest) (*WeatherResponse, error)
Weather obtains weather data for the specified location. The token parameter is a JWT developer token.
type CredentialedClient ¶ added in v0.1.0
type CredentialedClient struct {
// contains filtered or unexported fields
}
CredentialedClient is a WeatherKit API client. Construct with NewCredentialedClient.
func NewCredentialedClient ¶ added in v0.1.0
func NewCredentialedClient(credentials Credentials, opts ...CredentialedClientOption) *CredentialedClient
NewCredentialedClient creates a new client with creds.
func (*CredentialedClient) Alert ¶ added in v0.1.0
func (d *CredentialedClient) Alert(ctx context.Context, request WeatherAlertRequest) (*WeatherAlertResponse, error)
Alert receives information on an active weather alert.
func (*CredentialedClient) Attribution ¶ added in v0.1.0
func (d *CredentialedClient) Attribution(ctx context.Context, request AttributionRequest) (*AttributionResponse, error)
Attribution retrieves official attribution branding.
func (*CredentialedClient) Availability ¶ added in v0.1.0
func (d *CredentialedClient) Availability(ctx context.Context, request AvailabilityRequest) (*AvailabilityResponse, error)
Availability determines the data sets available for the specified location.
func (*CredentialedClient) Weather ¶ added in v0.1.0
func (d *CredentialedClient) Weather(ctx context.Context, request WeatherRequest) (*WeatherResponse, error)
Weather obtains weather data for the specified location.
type CredentialedClientOption ¶ added in v0.1.0
type CredentialedClientOption interface {
// contains filtered or unexported methods
}
CredentialedClientOption configures a CredentialedClient.
func WithClient ¶ added in v0.1.0
func WithClient(client *Client) CredentialedClientOption
WithClient returns an Option which configures a custom Client.
func WithTokenDuration ¶ added in v0.1.0
func WithTokenDuration(duration time.Duration) CredentialedClientOption
WithTokenDuration returns an Option which configures the expiration duration of the internally generated JWTs. The default duration is 10 minutes.
func WithoutCache ¶ added in v0.1.0
func WithoutCache() CredentialedClientOption
WithoutCache returns an Option which disables token caching. A new JWT will be generated for each request.
type Credentials ¶ added in v0.1.0
type Credentials struct { // PrivateKey is your PEM encoded private key. PrivateKey []byte // KeyID is the Key identifier from your developer account. KeyID string // TeamID is the Team ID from your developer account. TeamID string // ServiceID is the Service ID from your developer account. ServiceID string }
Credentials holds information required to authenticate against the weatherkit API.
type CurrentWeather ¶
type CurrentWeather struct { ProductData CurrentWeatherData }
CurrentWeather is the current weather conditions for the specified location.
type CurrentWeatherData ¶
type CurrentWeatherData struct { // (Required) The date and time. AsOf *time.Time `json:"asOf,omitempty"` // The percentage of the sky covered with clouds during the period, from 0 to 1. CloudCover float64 `json:"cloudCover"` // (Required) An enumeration value indicating the condition at the time. ConditionCode string `json:"conditionCode,omitempty"` // A Boolean value indicating whether there is daylight. DayLight bool `json:"daylight"` // (Required) The relative humidity, from 0 to 1. Humidity float64 `json:"humidity"` // (Required) The precipitation intensity, in millimeters per hour. PrecipitationIntensity float64 `json:"precipitationIntensity"` // (Required) The sea level air pressure, in millibars. Pressure float64 `json:"pressure"` // (Required) The direction of change of the sea-level air pressure. PressureTrend PressureTrend `json:"pressureTrend,omitempty"` // (Required) The current temperature, in degrees Celsius. Temperature float64 `json:"temperature"` // (Required) The feels-like temperature when factoring wind and humidity, in degrees Celsius. TemperatureApparent float64 `json:"temperatureApparent"` // (Required) The temperature at which relative humidity is 100%, in Celsius. TemperatureDewPoint float64 `json:"temperatureDewPoint"` // (Required) The level of ultraviolet radiation. UvIndex int64 `json:"uvIndex"` // (Required) The distance at which terrain is visible, in meters. Visibility float64 `json:"visibility"` // The direction of the wind, in degrees. WindDirection float64 `json:"windDirection"` // The maximum wind gust speed, in kilometers per hour. WindGust float64 `json:"windGust"` // (Required) The wind speed, in kilometers per hour. WindSpeed float64 `json:"windSpeed"` }
CurrentWeatherData is the current weather object.
type DailyForecast ¶
type DailyForecast struct { ProductData Days []DayWeatherConditions `json:"days,omitempty"` }
HourlyForecast represents the various weather phenomena occurring over a period of time
type DataSet ¶
type DataSet string
The collection of weather information for a location.
const ( // The current weather for the requested location. DataSetCurrentWeather DataSet = "currentWeather" // The daily forecast for the requested location. DataSetForecastDaily DataSet = "forecastDaily" // The hourly forecast for the requested location. DataSetForecastHourly DataSet = "forecastHourly" // The next hour forecast for the requested location. DataSetForecastNextHour DataSet = "forecastNextHour" // Weather alerts for the requested location. DataSetWeatherAlerts DataSet = "weatherAlerts" )
type DayPartForecast ¶
type DayPartForecast struct { // (Required) The percentage of the sky covered with clouds during the period, from 0 to 1. CloudCover float64 `json:"cloudCover"` // (Required) An enumeration value indicating the condition at the time. ConditionCode string `json:"conditionCode,omitempty"` // (Required) The ending date and time of the forecast. ForecastEnd *time.Time `json:"forecastEnd,omitempty"` // (Required) The starting date and time of the forecast. ForecastStart *time.Time `json:"forecastStart,omitempty"` // (Required) The relative humidity during the period, from 0 to 1. Humidity float64 `json:"humidity"` // (Required) The amount of precipitation forecasted to occur during the period, in millimeters. PrecipitationAmount float64 `json:"precipitationAmount"` // (Required) The chance of precipitation forecasted to occur during the period. PrecipitationChance float64 `json:"precipitationChance"` // (Required) The type of precipitation forecasted to occur during the period. PrecipitationType PrecipitationType `json:"precipitationType,omitempty"` // (Required) The depth of snow as ice crystals forecasted to occur during the period, in millimeters. SnowfallAmount float64 `json:"snowfallAmount"` // The direction the wind is forecasted to come from during the period, in degrees. WindDirection float64 `json:"windDirection"` // (Required) The average speed the wind is forecasted to be during the period, in kilometers per hour. WindSpeed float64 `json:"windSpeed"` }
DayPartForecast is a summary forecast for a daytime or overnight period.
type DayWeatherConditions ¶
type DayWeatherConditions struct { // (Required) An enumeration value indicating the condition at the time. ConditionCode string `json:"conditionCode,omitempty"` // The forecast between 7 AM and 7 PM for the day. DaytimeForecast DayPartForecast `json:"daytimeForecast,omitempty"` // (Required) The ending date and time of the day. ForecastEnd *time.Time `json:"forecastEnd,omitempty"` // (Required) The starting date and time of the day. ForecastStart *time.Time `json:"forecastStart,omitempty"` // (Required) The maximum ultraviolet index value during the day. MaxUvIndex int64 `json:"maxUvIndex"` // (Required) The phase of the moon on the specified day. MoonPhase MoonPhase `json:"moonPhase,omitempty"` // The time of moonrise on the specified day. MoonRise *time.Time `json:"moonrise,omitempty"` // The time of moonset on the specified day. MoonSet *time.Time `json:"moonset,omitempty"` // The day part forecast between 7 PM and 7 AM for the overnight. OvernightForecast DayPartForecast `json:"overnightForecast,omitempty"` // (Required) The amount of precipitation forecasted to occur during the day, in millimeters. PrecipitationAmount float64 `json:"precipitationAmount"` // (Required) The chance of precipitation forecasted to occur during the day. PrecipitationChance float64 `json:"precipitationChance"` // (Required) The type of precipitation forecasted to occur during the day. PrecipitationType PrecipitationType `json:"precipitationType,omitempty"` // (Required) The depth of snow as ice crystals forecasted to occur during the day, in millimeters. SnowfallAmount float64 `json:"snowfallAmount"` // The time when the sun is lowest in the sky. SolarMidnight *time.Time `json:"solarMidnight,omitempty"` // The time when the sun is highest in the sky. SolarNoon *time.Time `json:"solarNoon,omitempty"` // The time when the top edge of the sun reaches the horizon in the morning. Sunrise *time.Time `json:"sunrise,omitempty"` // The time when the sun is 18 degrees below the horizon in the morning. SunriseAstronomical *time.Time `json:"sunriseAstronomical,omitempty"` // The time when the sun is 6 degrees below the horizon in the morning. SunriseCivil *time.Time `json:"sunriseCivil,omitempty"` // The time when the sun is 12 degrees below the horizon in the morning. SunriseNautical *time.Time `json:"sunriseNautical,omitempty"` // The time when the top edge of the sun reaches the horizon in the evening. Sunset *time.Time `json:"sunset,omitempty"` // The time when the sun is 18 degrees below the horizon in the evening. SunsetAstronomical *time.Time `json:"sunsetAstronomical,omitempty"` // The time when the sun is 6 degrees below the horizon in the evening. SunsetCivil *time.Time `json:"sunsetCivil,omitempty"` // The time when the sun is 12 degrees below the horizon in the evening. SunsetNautical *time.Time `json:"sunsetNautical,omitempty"` // (Required) The maximum temperature forecasted to occur during the day, in degrees Celsius. TemperatureMax float64 `json:"temperatureMax"` // (Required) The minimum temperature forecasted to occur during the day, in degrees Celsius. TemperatureMin float64 `json:"temperatureMin"` }
DayWeatherConditions contains the historical or forecasted weather conditions for a specified day.
type ErrorResponse ¶
type ErrorResponse struct { Timestamp *time.Time `json:"timestamp,omitempty"` Status int `json:"status,omitempty"` Error string `json:"error,omitempty"` Message string `json:"message,omitempty"` Path string `json:"path,omitempty"` }
ErrorResponse is returned in response to an API error.
type EventText ¶
type EventText struct { // The ISO language code that the text is in. Language string `json:"language,omitempty"` // The severe weather event text. Text string `json:"text,omitempty"` }
EventText is the official text describing a severe weather event from the agency.
type ForecastMinute ¶
type ForecastMinute struct { // (Required) The probability of precipitation during this minute. PrecipitationChance float64 `json:"precipitationChance"` // (Required) The precipitation intensity in millimeters per hour. PrecipitationIntensity float64 `json:"precipitationIntensity"` // (Required) The start time of the minute. StartTime *time.Time `json:"startTime,omitempty"` }
ForecastMinute is the precipitation forecast for a specified minute.
type ForecastPeriodSummary ¶
type ForecastPeriodSummary struct { // (Required) The type of precipitation forecasted. Condition PrecipitationType `json:"condition,omitempty"` // The end time of the forecast. EndTime *time.Time `json:"endTime,omitempty"` // (Required) The probability of precipitation during this period. PrecipitationChance float64 `json:"precipitationChance"` // (Required) The precipitation intensity in millimeters per hour. PrecipitationIntensity float64 `json:"precipitationIntensity"` // (Required) The start time of the forecast. StartTime *time.Time `json:"startTime,omitempty"` }
ForecastPeriodSummary is the summary for a specified period in the minute forecast.
type HourWeatherConditions ¶
type HourWeatherConditions struct { // (Required) The percentage of the sky covered with clouds during the period, from 0 to 1. CloudCover float64 `json:"cloudCover"` // (Required) An enumeration value indicating the condition at the time. ConditionCode string `json:"conditionCode,omitempty"` // Indicates whether the hour starts during the day or night. DayLight bool `json:"daylight"` // (Required) The starting date and time of the forecast. ForecastStart *time.Time `json:"forecastStart,omitempty"` // (Required) The relative humidity at the start of the hour, from 0 to 1. Humidity float64 `json:"humidity"` // (Required) The chance of precipitation forecasted to occur during the hour, from 0 to 1. PrecipitationChance float64 `json:"precipitationChance"` // (Required) The type of precipitation forecasted to occur during the period. PrecipitationType PrecipitationType `json:"precipitationType,omitempty"` // (Required) The sea-level air pressure, in millibars. Pressure float64 `json:"pressure"` // The direction of change of the sea-level air pressure. PressureTrend PressureTrend `json:"pressureTrend"` // The rate at which snow crystals are falling, in millimeters per hour. SnowfallIntensity float64 `json:"snowfallIntensity"` // (Required) The temperature at the start of the hour, in degrees Celsius. Temperature float64 `json:"temperature"` // (Required) The feels-like temperature when considering wind and humidity, at the start of the hour, in degrees Celsius. TemperatureApparent float64 `json:"temperatureApparent"` // The temperature at which relative humidity is 100% at the top of the hour, in degrees Celsius. TemperatureDewPoint float64 `json:"temperatureDewPoint"` // (Required) The level of ultraviolet radiation at the start of the hour. UvIndex int64 `json:"uvIndex"` // (Required) The distance at which terrain is visible at the start of the hour, in meters. Visibility float64 `json:"visibility"` // The direction of the wind at the start of the hour, in degrees. WindDirection float64 `json:"windDirection"` // The maximum wind gust speed during the hour, in kilometers per hour. WindGust float64 `json:"windGust"` // (Required) The wind speed at the start of the hour, in kilometers per hour. WindSpeed float64 `json:"windSpeed"` // The amount of precipitation forecasted to occur during period, in millimeters. PrecipitationAmount float64 `json:"precipitationAmount"` }
HourWeatherConditions contains the historical or forecasted weather conditions for a specified hour.
type HourlyForecast ¶
type HourlyForecast struct { ProductData // The hourly forecast information. Hours []HourWeatherConditions `json:"hours,omitempty"` }
HourlyForecast represents the various weather phenomena occurring over a period of time
type Metadata ¶
type Metadata struct { // The URL of the legal attribution for the data source. AttributionURL string `json:"attributionURL,omitempty"` // (Required) The time when the weather data is no longer valid. ExpireTime *time.Time `json:"expireTime,omitempty"` // The ISO language code for localizable fields. Language string `json:"language,omitempty"` // (Required) The latitude of the relevant location. Latitude float64 `json:"latitude"` // (Required) The longitude of the relevant location. Longitude float64 `json:"longitude"` // The URL of a logo for the data provider. ProviderLogo string `json:"providerLogo,omitempty"` // The name of the data provider. ProviderName string `json:"providerName,omitempty"` // (Required) The time the weather data was procured. ReadTime *time.Time `json:"readTime,omitempty"` // The time the provider reported the weather data. ReportedTime *time.Time `json:"reportedTime,omitempty"` TemporarilyUnavailable bool `json:"temporarilyUnavailable,omitempty"` // The system of units that the weather data is reported in. Units UnitsSystem `json:"units,omitempty"` // (Required) The data format version. Version int `json:"version"` }
Metadata holds descriptive information about the weather data.
type MoonPhase ¶
type MoonPhase string
MoonPhase is the shape of the moon as seen by an observer on the ground at a given time.
type NextHourForecast ¶
type NextHourForecast struct { ProductData NextHourForecastData }
NextHourForecast is a minute-by-minute forecast for the next hour.
type NextHourForecastData ¶
type NextHourForecastData struct { // The time the forecast ends. ForecastEnd *time.Time `json:"forecastEnd,omitempty"` // The time the forecast starts. ForecastStart *time.Time `json:"forecastStart,omitempty"` // (Required) An array of the forecast minutes. Minutes []ForecastMinute `json:"minutes,omitempty"` // (Required) An array of the forecast summaries. Summary []ForecastPeriodSummary `json:"summary,omitempty"` }
NextHourForecastData is the next hour forecast information.
type PrecipitationType ¶
type PrecipitationType string
PrecipitationType is the type of precipitation forecasted to occur during the day.
const ( // No precipitation is occurring. PrecipitationTypeClear PrecipitationType = "clear" // An unknown type of precipitation is occurring. PrecipitationTypePrecipitation PrecipitationType = "precipitation" // Rain or freezing rain is falling. PrecipitationTypeRain PrecipitationType = "rain" // Snow is falling. PrecipitationTypeSnow PrecipitationType = "snow" // Sleet or ice pellets are falling. PrecipitationTypeSleet PrecipitationType = "sleet" // Hail is falling. PrecipitationTypeHail PrecipitationType = "hail" // Winter weather (wintery mix or wintery showers) is falling. PrecipitationTypeMixed PrecipitationType = "mixed" )
type PressureTrend ¶
type PressureTrend string
PressureTrend is the direction of change of the sea level air pressure.
const ( // The sea level air pressure is increasing. PressureTrendRising PressureTrend = "rising" // The sea level air pressure is decreasing. PressureTrendFalling PressureTrend = "falling" // The sea level air pressure is remaining about the same. PressureTrendSteady PressureTrend = "steady" )
type ProductData ¶
type ProductData struct { // The name of the data set. Name DataSet `json:"name,omitempty" yaml:"name,omitempty"` // (Required) Descriptive information about the weather data. Metadata Metadata `json:"metadata,omitempty"` }
ProductData is a base type for all weather data.
type ResponseType ¶
type ResponseType string
ResponseType is the recommended action from a reporting agency.
const ( // Take shelter in place. ResponseTypeShelter ResponseType = "shelter" // Relocate. ResponseTypeEvacuate ResponseType = "evacuate" // Make preparations. ResponseTypePrepare ResponseType = "prepare" // Execute a pre-planned activity. ResponseTypeExecute ResponseType = "execute" // Avoid the event. ResponseTypeAvoid ResponseType = "avoid" // Monitor the situation. ResponseTypeMonitor ResponseType = "monitor" // Assess the situation. ResponseTypeAssess ResponseType = "assess" // The event no longer poses a threat. ResponseTypeAllClear ResponseType = "allClear" // No action recommended. ResponseTypeNone ResponseType = "none" )
type RestError ¶
type RestError struct { Response *http.Response ErrorResponse *ErrorResponse }
type Severity ¶
type Severity string
Severity is the level of danger to life and property.
const ( // Extraordinary threat. SeverityExtreme Severity = "extreme" // Significant threat. SeveritySevere Severity = "severe" // Possible threat. SeverityModerate Severity = "moderate" // Minimal or no known threat. SeverityMinor Severity = "minor" // Unknown threat. SeverityUnknown Severity = "unknown" )
type UnitsSystem ¶
type UnitsSystem string
UnitsSystem is the system of units that the weather data is reported in.
const ( // The metric system. UnitsMetric UnitsSystem = "m" )
type Urgency ¶
type Urgency string
Urgency is an indication of urgency of action from the reporting agency.
const ( // Take responsive action immediately. UrgencyImmediate Urgency = "immediate" // Take responsive action in the next hour. UrgencyExpected Urgency = "expected" // Take responsive action in the near future. UrgencyFuture Urgency = "future" // Responsive action is no longer required. UrgencyPast Urgency = "past" // The urgency is unknown. UrgencyUnknown Urgency = "unknown" )
type WeatherAlertArea ¶
type WeatherAlertArea struct { }
WeatherAlertArea defines the geographic region the weather alert applies to.
type WeatherAlertCollection ¶
type WeatherAlertCollection struct { // (Required) An array of weather alert summaries. Alerts []WeatherAlertSummary `json:"alerts,omitempty"` // A URL that provides more information about the alerts. DetailsURL string `json:"detailsUrl,omitempty"` }
WeatherAlertCollection is a collection of weather alerts.
type WeatherAlertData ¶
type WeatherAlertData struct { // (Required) An object defining the geographic region the weather alert applies to. Area WeatherAlertArea `json:"area"` // (Required) An array of official text messages describing a severe weather event from the agency. EventText []EventText `json:"eventText"` }
WeatherAlertData is the weather alert information.
type WeatherAlertRequest ¶
type WeatherAlertRequest struct { // (Required) The unique identifier for the weather alert. ID string `json:"id,omitempty"` // (Required) The language tag to use for localizing responses. Language string `json:"language,omitempty"` }
WeatherAlertRequest requests weather alert details for a specific alert id.
type WeatherAlertResponse ¶
type WeatherAlertResponse struct { WeatherAlertData WeatherAlertSummary }
WeatherAlertResponse contains an official message indicating severe weather from a reporting agency.
type WeatherAlertSummary ¶
type WeatherAlertSummary struct { // An official designation of the affected area. AreaID string `json:"areaId,omitempty"` // A human-readable name of the affected area. AreaName string `json:"areaName,omitempty"` // (Required) How likely the event is to occur. Certainty Certainty `json:"certainty,omitempty"` // (Required) The ISO code of the reporting country. CountryCode string `json:"countryCode,omitempty"` // (Required) A human-readable description of the event. Description string `json:"description,omitempty"` // The URL to a page containing detailed information about the event. DetailsURL string `json:"detailsUrl,omitempty"` // (Required) The time the event went into effect. EffectiveTime *time.Time `json:"effectiveTime,omitempty"` // The time when the underlying weather event is projected to end. EventEndTime *time.Time `json:"eventEndTime,omitempty"` // The time when the underlying weather event is projected to start. EventOnSetTime *time.Time `json:"eventOnSetTime,omitempty"` // (Required) The time when the event expires. ExpireTime *time.Time `json:"expireTime,omitempty"` // (Required) A unique identifier of the event. ID string `json:"id,omitempty"` // (Required) The time that event was issued by the reporting agency. IssuedTime *time.Time `json:"issuedTime,omitempty"` // (Required) An array of recommended actions from the reporting agency. Responses []ResponseType `json:"responses,omitempty"` // (Required) The level of danger to life and property. Severity Severity `json:"severity,omitempty"` // (Required) The name of the reporting agency. Source string `json:"source,omitempty"` // An indication of urgency of action from the reporting agency. Urgency Urgency `json:"urgency,omitempty"` }
WeatherAlertSummary contains detailed information about the weather alert.
type WeatherRequest ¶
type WeatherRequest struct { // The language tag to use for localizing responses. Language string // The latitude of the desired location. Latitude float64 // The longitude of the desired location. Longitude float64 // The ISO Alpha-2 country code for the requested location. // This parameter is necessary for air quality and weather alerts. CountryCode string // The time to obtain current conditions. Defaults to now. CurrentAsOf *time.Time // The time to end the daily forecast. // If this parameter is absent, daily forecasts run for 10 days. DailyEnd *time.Time // The time to start the daily forecast. // If this parameter is absent, daily forecasts start on the current day. DailyStart *time.Time // A list of data sets to include in the response. DataSets DataSets // The time to end the hourly forecast. // If this parameter is absent, hourly forecasts run 24 hours or the length of the daily forecast, whichever is longer. HourlyEnd *time.Time // The time to start the hourly forecast. // If this parameter is absent, hourly forecasts start on the current hour. HourlyStart *time.Time // (Required) The name of the timezone to use for rolling up weather forecasts into daily forecasts. Timezone string }
WeatherRequest obtains weather data for the specified location.
type WeatherResponse ¶
type WeatherResponse struct { // The current weather for the requested location. CurrentWeather *CurrentWeather `json:"currentWeather,omitempty"` // The daily forecast for the requested location. ForcastDaily *DailyForecast `json:"forecastDaily,omitempty"` // The hourly forecast for the requested location. ForcastHourly *HourlyForecast `json:"forecastHourly,omitempty"` // The next hour forecast for the requested location. ForcastNextHour *NextHourForecast `json:"forecastNextHour,omitempty"` // Weather alerts for the requested location. WeatherAlerts *WeatherAlertCollection `json:"weatherAlerts,omitempty"` }
WeatherResponse contains all requested properties.