openweathermap

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package openweathermap implements openweathermap.org API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Coord struct {
		Longitude float64 `json:"lon"`
		Latitude  float64 `json:"lat"`
	} `json:"coord"`
	Weather []struct {
		ID          int    `json:"id"`
		Main        string `json:"main"`
		Description string `json:"description"`
		Icon        string `json:"icon"`
	} `json:"weather"`
	Base string
	Main struct {
		Temperature         float64 `json:"temp"`
		Pressure            float64 `json:"pressure"`
		Humidity            int     `json:"humidity"`
		MinTemperature      float64 `json:"temp_min"`
		MaxTemperature      float64 `json:"temp_max"`
		SeaLevelPressure    float64 `json:"sea_level"`
		GroundLevelPressure float64 `json:"grnd_level"`
	} `json:"main"`
	Wind struct {
		Speed   float64 `json:"speed"` // meter/second
		Degrees float64 `json:"deg"`
	} `json:"wind"`
	Clouds struct {
		All int `json:"all"`
	} `json:"clouds"`
	Rain struct {
		OneHour    float64 `json:"1h"`
		ThreeHours float64 `json:"3h"`
	} `json:"rain"`
	Snow struct {
		OneHour    float64 `json:"1h"`
		ThreeHours float64 `json:"3h"`
	} `json:"snow"`
	Timestamp uint `json:"dt"`
	Sys       struct {
		Type    string `json:"type"`
		ID      string `json:"id"`
		Message string `json:"message"`
		Country string `json:"country"`
		Sunrise uint   `json:"sunrise"`
		Sunset  uint   `json:"sunset"`
	} `json:"sys"`
	ID   int    `json:"id"`
	Name string `json:"name"`
}

A Response represents the parameters in API response. https://openweathermap.org/current#parameter

func Find

func Find(apiKey string, q string) (*Response, error)

Find finds weather conditions for a search query.

func (*Response) String

func (s *Response) String() string

String formats a weather result on one line.

Directories

Path Synopsis
Binary openweathermap gets weather information for a location.
Binary openweathermap gets weather information for a location.

Jump to

Keyboard shortcuts

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