weathergov

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package weathergov provides a client for the Weather.gov API described at https://www.weather.gov/documentation/services-web-api#

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetForecast gets the forecast for the given location.
	GetForecast(ctx context.Context, lat, long float64) (*Forecast, error)
	// Name provides a client name used to report health check issues.
	Name() string
	// Ping checks the client is healthy.
	Ping(ctx context.Context) error
}

Client is a client for the Weather.gov API.

func New

func New(httpc *http.Client) Client

New returns a new client for the Weather.gov API.

type Forecast

type Forecast struct {
	// Location is the location of the forecast.
	Location *Location
	// Periods is the forecast for the location.
	Periods []*Period
}

Forecast represents the forecast for a given location.

type Location

type Location struct {
	// Lat is the latitude of the location.
	Lat float64
	// Long is the longitude of the location.
	Long float64
	// City is the city of the location.
	City string
	// State is the state of the location.
	State string
}

Location represents the geographical location of a forecast.

type Period

type Period struct {
	// Name is the name of the forecast period.
	Name string
	// StartTime is the start time of the forecast period in RFC3339 format.
	StartTime string
	// EndTime is the end time of the forecast period in RFC3339 format.
	EndTime string
	// Temperature is the temperature of the forecast period.
	Temperature int
	// TemperatureUnit is the temperature unit of the forecast period.
	TemperatureUnit string
	// Summary is the summary of the forecast period.
	Summary string
}

Period represents a forecast period.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL