openweather

package
v0.0.0-...-7fd60d6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Current

type Current struct {
	Dt         float64 `json:"dt"`
	Sunrise    float64 `json:"sunrise"`
	Sunset     float64 `json:"sunset"`
	Temp       float64 `json:"temp"`
	FeelsLike  float64 `json:"feels_like"`
	Pressure   float64 `json:"pressure"`
	Humidity   float64 `json:"humidity"`
	DewPoint   float64 `json:"dew_point"`
	Uvi        float64 `json:"uvi"`
	Clouds     float64 `json:"clouds"`
	Visibility float64 `json:"visibility"`
	WindSpeed  float64 `json:"wind_speed"`
	WindDeg    float64 `json:"wind_deg"`
	Weather    []struct {
		ID          float64 `json:"id"`
		Main        string  `json:"main"`
		Description string  `json:"description"`
		Icon        string  `json:"icon"`
	}
}

type OpenWeather

type OpenWeather struct {
	// contains filtered or unexported fields
}

OpenWeather provides a WeatherOfficer implementation that uses http protocol to gather weather information from openweathermap.org

func NewOpenWeather

func NewOpenWeather(client *gentleman.Client) (*OpenWeather, error)

NewOpenWeather creates a new OpenWeather

func (OpenWeather) GetWeather

func (o OpenWeather) GetWeather(lat, lng float64) (*WeatherInfo, error)

GetWeather impl

type WeatherInfo

type WeatherInfo struct {
	Lat            float64 `json:"lat"`
	Lon            float64 `json:"lon"`
	Timezone       string  `json:"timezone"`
	TimezoneOffset int     `json:"timezone_offset"`
	Current        Current `json:"current"`
}

WeatherInfo holds structured data from the open weather api

type WeatherOfficer

type WeatherOfficer interface {

	// GetWeather retrives weather info from a given latitude and longitude
	GetWeather(lat, lng float64) (*WeatherInfo, error)
}

WeatherOfficer deliver weather information

Jump to

Keyboard shortcuts

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