buienradar

package
v0.0.0-...-3cdd1f1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URL is the URL to the Buienradar JSON API
	URL = "https://data.buienradar.nl/2.0/feed/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Buienradar

type Buienradar struct {
	Buienradar struct {
		Copyright string `json:"copyright"`
		Terms     string `json:"terms"`
	} `json:"buienradar"`
	Actual struct {
		Stationmeasurements []StationMeasurement `json:"stationmeasurements"`
		Actualradarurl      string               `json:"actualradarurl"`
		Sunrise             string               `json:"sunrise"`
		Sunset              string               `json:"sunset"`
	} `json:"actual"`
	Forecast struct {
		Weatherreport struct {
			Published string `json:"published"`
			Title     string `json:"title"`
			Summary   string `json:"summary"`
			Text      string `json:"text"`
			Author    string `json:"author"`
			Authorbio string `json:"authorbio"`
			URL       string `json:"url"`
		} `json:"weatherreport"`
		Shortterm struct {
			Startdate string `json:"startdate"`
			Enddate   string `json:"enddate"`
			Forecast  string `json:"forecast"`
		} `json:"shortterm"`
		Longterm struct {
			Startdate string `json:"startdate"`
			Enddate   string `json:"enddate"`
			Forecast  string `json:"forecast"`
		} `json:"longterm"`
		Fivedayforecast []DayForecast `json:"fivedayforecast"`
	} `json:"forecast"`
}

Buienradar represents data returned from the JSON API. Autogenerated using https://mholt.github.io/json-to-go/

type Client

type Client struct {
	*http.Client
}

Client is a HTTP client for the Buienradar API

func NewClient

func NewClient(cli *http.Client) *Client

NewClient creates a new HTTP client for the Buienradar API

func (*Client) Get

func (c *Client) Get() (b *Buienradar, err error)

Get retrieves the latest data from the Buienradar API

func (*Client) GetSenML

func (c *Client) GetSenML(stations ...string) (measurements []senml.Measurement, err error)

GetSenML collects measurements from Buienradar and converts them to SenML

type DayForecast

type DayForecast struct {
	Day                string  `json:"day"`
	Mintemperature     string  `json:"mintemperature"`
	Maxtemperature     string  `json:"maxtemperature"`
	MintemperatureMax  int     `json:"mintemperatureMax"`
	MaxtemperatureMax  int     `json:"maxtemperatureMax"`
	MintemperatureMin  int     `json:"mintemperatureMin"`
	MaxtemperatureMin  int     `json:"maxtemperatureMin"`
	RainChance         int     `json:"rainChance"`
	SunChance          int     `json:"sunChance"`
	WindDirection      string  `json:"windDirection"`
	Wind               int     `json:"wind"`
	MmRainMin          float64 `json:"mmRainMin"`
	MmRainMax          float64 `json:"mmRainMax"`
	Iconurl            string  `json:"iconurl"`
	Weatherdescription string  `json:"weatherdescription"`
}

DayForecast represents a weather forecast for a day

type StationMeasurement

type StationMeasurement struct {
	Stationid            int     `json:"stationid"`
	Stationname          string  `json:"stationname"`
	Lat                  float64 `json:"lat"`
	Lon                  float64 `json:"lon"`
	Regio                string  `json:"regio"`
	Timestamp            string  `json:"timestamp"`
	Graphurl             string  `json:"graphurl"`
	Iconurl              string  `json:"iconurl"`
	Weatherdescription   string  `json:"weatherdescription"`
	Winddirection        string  `json:"winddirection"`
	Airpressure          float64 `json:"airpressure"`
	Temperature          float64 `json:"temperature"`
	Groundtemperature    float64 `json:"groundtemperature"`
	Feeltemperature      float64 `json:"feeltemperature"`
	Visibility           float64 `json:"visibility"`
	Windgusts            float64 `json:"windgusts"`
	Windspeed            float64 `json:"windspeed"`
	WindspeedBft         int     `json:"windspeedBft"`
	Humidity             float64 `json:"humidity"`
	Precipitation        float64 `json:"precipitation"`
	Sunpower             float64 `json:"sunpower"`
	RainFallLast24Hour   float64 `json:"rainFallLast24Hour"`
	RainFallLastHour     float64 `json:"rainFallLastHour"`
	Winddirectiondegrees float64 `json:"winddirectiondegrees"`
	Dayhistory           struct {
		Timestamp               string  `json:"timestamp"`
		TemperatureMin          float64 `json:"temperatureMin"`
		TemperatureMax          float64 `json:"temperatureMax"`
		GroundtemperatureMin    float64 `json:"groundtemperatureMin"`
		SunshineHours           float64 `json:"sunshineHours"`
		WindgustsMax            float64 `json:"windgustsMax"`
		WindspeedMax            float64 `json:"windspeedMax"`
		WindspeedBftMax         int     `json:"windspeedBftMax"`
		WindDirectionDegreesMax int     `json:"windDirectionDegreesMax"`
	} `json:"dayhistory"`
}

StationMeasurement represents a single measurement from a weather station

func (*StationMeasurement) IconEmoji

func (s *StationMeasurement) IconEmoji() string

IconEmoji returns a string of emoji corresponding to the Iconurl

Jump to

Keyboard shortcuts

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