Version: v0.0.0-...-2bf0e1a Latest Latest

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

Go to latest
Published: Aug 7, 2021 License: MIT Imports: 13 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	Points     *PointsService
	GridPoints *GridPointsService
	// contains filtered or unexported fields

Client .

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new client and applies all provided Options

type Elevation

type Elevation struct {
	Value    float64 `json:"value"`
	UnitCode string  `json:"unitCode"`

type Fault

type Fault struct {
	CorrelationID string `json:"correlationId"`
	Title         string `json:"title"`
	Type          string `json:"type"`
	Status        int    `json:"status"`
	Detail        string `json:"detail"`
	Instance      string `json:"instance"`

Fault .

func (*Fault) Error

func (f *Fault) Error() string

type Forecast

type Forecast struct {
	Context  []interface{} `json:"@context"`
	Type     string        `json:"type"`
	Geometry struct {
		Type        string        `json:"type"`
		Coordinates [][][]float64 `json:"coordinates"`
	} `json:"geometry"`
	Properties struct {
		Updated           time.Time `json:"updated"`
		Units             string    `json:"units"`
		ForecastGenerator string    `json:"forecastGenerator"`
		GeneratedAt       time.Time `json:"generatedAt"`
		UpdateTime        time.Time `json:"updateTime"`
		// formatted as => 2020-10-17T15:00:00+00:00/P7DT10H
		ValidTimes string     `json:"validTimes"`
		Elevation  *Elevation `json:"elevation"`
		Periods    []*Period  `json:"periods"`
	} `json:"properties"`

func (*Forecast) Forecast

func (f *Forecast) Forecast() (*wx.Forecast, error)

Forecast .

type GridPoint

type GridPoint struct {
	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"`
				State    string `json:"state"`
				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"`
		County          string `json:"county"`
		FireWeatherZone string `json:"fireWeatherZone"`
		TimeZone        string `json:"timeZone"`
		RadarStation    string `json:"radarStation"`
	} `json:"properties"`

GridPoint .

type GridPointsService

type GridPointsService service

GridPointsService .

func (*GridPointsService) Forecast

func (s *GridPointsService) Forecast(ctx context.Context, wfo string, x, y int) (*Forecast, error)

Forecast .

type Option

type Option func(*Client) error

Option provides a configuration mechanism for a Client

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets the underlying http client.

func WithHTTPTracing

func WithHTTPTracing(debug bool) Option

WithHTTPTracing enables tracing http calls.

func WithTransport

func WithTransport(t http.RoundTripper) Option

WithTransport sets the underlying http client transport.

type Period

type Period struct {
	Number           int    `json:"number"`
	Name             string `json:"name"`
	StartTime        string `json:"startTime"`
	EndTime          string `json:"endTime"`
	IsDaytime        bool   `json:"isDaytime"`
	Temperature      int    `json:"temperature"`
	TemperatureUnit  string `json:"temperatureUnit"`
	TemperatureTrend string `json:"temperatureTrend"`
	WindSpeed        string `json:"windSpeed"`
	WindDirection    string `json:"windDirection"`
	Icon             string `json:"icon"`
	ShortForecast    string `json:"shortForecast"`
	DetailedForecast string `json:"detailedForecast"`

type PointsService

type PointsService service

PointsService .

func (*PointsService) Forecast

func (s *PointsService) Forecast(ctx context.Context, opts wx.ForecastOptions) (*Forecast, error)

Forecast weather conditions

func (*PointsService) ForecastHourly

func (s *PointsService) ForecastHourly(ctx context.Context, opts wx.ForecastOptions) (*Forecast, error)

ForecastHourly weather conditions

func (*PointsService) GridPoint

func (s *PointsService) GridPoint(ctx context.Context, point *geom.Point) (*GridPoint, error)

GridPoint .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL