api

package
v0.0.0-...-a8b6473 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpGetWithRetry

func HttpGetWithRetry[T any](name, url string) (T, error)

Types

type ForecastAPIResponse

type ForecastAPIResponse struct {
	Forecasts []struct {
		Detailed struct {
			IssueDate   time.Time `json:"issueDate"`
			LastUpdated time.Time `json:"lastUpdated"`
			Reports     []struct {
				EnhancedWeatherDescription        string `json:"enhancedWeatherDescription"`
				ExtendedWeatherType               int    `json:"extendedWeatherType"`
				FeelsLikeTemperatureC             int    `json:"feelsLikeTemperatureC"`
				FeelsLikeTemperatureF             int    `json:"feelsLikeTemperatureF"`
				GustSpeedKph                      int    `json:"gustSpeedKph"`
				GustSpeedMph                      int    `json:"gustSpeedMph"`
				Humidity                          int    `json:"humidity"`
				LocalDate                         string `json:"localDate"`
				PrecipitationProbabilityInPercent int    `json:"precipitationProbabilityInPercent"`
				PrecipitationProbabilityText      string `json:"precipitationProbabilityText"`
				Pressure                          int    `json:"pressure"`
				TemperatureC                      int    `json:"temperatureC"`
				TemperatureF                      int    `json:"temperatureF"`
				Timeslot                          string `json:"timeslot"`
				TimeslotLength                    int    `json:"timeslotLength"`
				Visibility                        string `json:"visibility"`
				WeatherType                       int    `json:"weatherType"`
				WeatherTypeText                   string `json:"weatherTypeText"`
				WindDescription                   string `json:"windDescription"`
				WindDirection                     string `json:"windDirection"`
				WindDirectionAbbreviation         string `json:"windDirectionAbbreviation"`
				WindDirectionFull                 string `json:"windDirectionFull"`
				WindSpeedKph                      int    `json:"windSpeedKph"`
				WindSpeedMph                      int    `json:"windSpeedMph"`
			} `json:"reports"`
		} `json:"detailed"`
		Summary struct {
			IssueDate   time.Time `json:"issueDate"`
			LastUpdated time.Time `json:"lastUpdated"`
			Report      struct {
				EnhancedWeatherDescription        string `json:"enhancedWeatherDescription"`
				GustSpeedKph                      int    `json:"gustSpeedKph"`
				GustSpeedMph                      int    `json:"gustSpeedMph"`
				LocalDate                         string `json:"localDate"`
				MaxTempC                          int    `json:"maxTempC"`
				MaxTempF                          int    `json:"maxTempF"`
				MinTempC                          int    `json:"minTempC"`
				MinTempF                          int    `json:"minTempF"`
				MostLikelyHighTemperatureC        int    `json:"mostLikelyHighTemperatureC"`
				MostLikelyHighTemperatureF        int    `json:"mostLikelyHighTemperatureF"`
				MostLikelyLowTemperatureC         int    `json:"mostLikelyLowTemperatureC"`
				MostLikelyLowTemperatureF         int    `json:"mostLikelyLowTemperatureF"`
				PollenIndex                       int    `json:"pollenIndex"`
				PollenIndexBand                   string `json:"pollenIndexBand"`
				PollenIndexIconText               string `json:"pollenIndexIconText"`
				PollenIndexText                   string `json:"pollenIndexText"`
				PollutionIndex                    int    `json:"pollutionIndex"`
				PollutionIndexBand                string `json:"pollutionIndexBand"`
				PollutionIndexIconText            string `json:"pollutionIndexIconText"`
				PollutionIndexText                string `json:"pollutionIndexText"`
				PrecipitationProbabilityInPercent int    `json:"precipitationProbabilityInPercent"`
				PrecipitationProbabilityText      string `json:"precipitationProbabilityText"`
				Sunrise                           string `json:"sunrise"`
				Sunset                            string `json:"sunset"`
				UvIndex                           int    `json:"uvIndex"`
				UvIndexBand                       string `json:"uvIndexBand"`
				UvIndexIconText                   string `json:"uvIndexIconText"`
				UvIndexText                       string `json:"uvIndexText"`
				WeatherType                       int    `json:"weatherType"`
				WeatherTypeText                   string `json:"weatherTypeText"`
				WindDescription                   string `json:"windDescription"`
				WindDirection                     string `json:"windDirection"`
				WindDirectionAbbreviation         string `json:"windDirectionAbbreviation"`
				WindDirectionFull                 string `json:"windDirectionFull"`
				WindSpeedKph                      int    `json:"windSpeedKph"`
				WindSpeedMph                      int    `json:"windSpeedMph"`
			} `json:"report"`
		} `json:"summary"`
	} `json:"forecasts"`
	IsNight     bool      `json:"isNight"`
	IssueDate   time.Time `json:"issueDate"`
	LastUpdated time.Time `json:"lastUpdated"`
	Location    struct {
		ID        string  `json:"id"`
		Name      string  `json:"name"`
		Container string  `json:"container"`
		Latitude  float64 `json:"latitude"`
		Longitude float64 `json:"longitude"`
	} `json:"location"`
	Night bool `json:"night"`
}

func ForecastWeather

func ForecastWeather(id string) (ForecastAPIResponse, error)

type LocateAPIResponse

type LocateAPIResponse struct {
	Response struct {
		Results struct {
			Results      []LocateAPIResult `json:"results"`
			TotalResults int               `json:"totalResults"`
		} `json:"results"`
	} `json:"response"`
}

type LocateAPIResult

type LocateAPIResult struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Container   string  `json:"container"`
	ContainerID int     `json:"containerId"`
	Language    string  `json:"language"`
	Timezone    string  `json:"timezone"`
	Country     string  `json:"country"`
	Latitude    float64 `json:"latitude"`
	Longitude   float64 `json:"longitude"`
	PlaceType   string  `json:"placeType"`
}

func LocationMatches

func LocationMatches(query string) ([]LocateAPIResult, error)

LocationMatches returns the matched locations that match the given query.

type ObserveAPIResult

type ObserveAPIResult struct {
	Station struct {
		Name     string `json:"name"`
		Distance struct {
			Km    float64 `json:"km"`
			Miles float64 `json:"miles"`
		} `json:"distance"`
		Latitude  float64 `json:"latitude"`
		Longitude float64 `json:"longitude"`
	} `json:"station"`
	Observations []struct {
		LocalTime   string `json:"localTime"`
		LocalDate   string `json:"localDate"`
		Temperature struct {
			C int `json:"C"`
			F int `json:"F"`
		} `json:"temperature"`
		Wind struct {
			WindSpeedMph              int    `json:"windSpeedMph"`
			WindSpeedKph              int    `json:"windSpeedKph"`
			WindDirection             string `json:"windDirection"`
			WindDirectionFull         string `json:"windDirectionFull"`
			WindDirectionAbbreviation string `json:"windDirectionAbbreviation"`
		} `json:"wind"`
		HumidityPercent   int       `json:"humidityPercent"`
		PressureMb        int       `json:"pressureMb"`
		PressureDirection string    `json:"pressureDirection"`
		Visibility        string    `json:"visibility"`
		UpdateTimestamp   time.Time `json:"updateTimestamp"`
	} `json:"observations"`
}

func CurrentObservedWeather

func CurrentObservedWeather(id string) (ObserveAPIResult, error)

Jump to

Keyboard shortcuts

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