openweather

package
Version: v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIKeyFilename = "./.weather-api-key"
	URLPattern     = "http://api.openweathermap.org/data/2.5/weather?%s&units=imperial&APPID=%s"
)

Variables

This section is empty.

Functions

func ComposeRequestURI added in v0.0.3

func ComposeRequestURI(apiKey, t, p string) (string, error)

ComposeRequestURI takes API key, request type t, parameter argument p and returns a request URI.

Types

type Clouds

type Clouds struct {
	All int `json:"all"`
}

type Coord

type Coord struct {
	Lon float32 `json:"lon"`
	Lat float32 `json:"lat"`
}

type Main

type Main struct {
	Temp      float32 `json:"temp"`
	FeelsLike float32 `json:"feels_like"`
	TempMin   float32 `json:"temp_min"`
	TempMax   float32 `json:"temp_max"`
	Pressure  int     `json:"pressure"`
	Humidity  int     `json:"humidity"`
}

type OpenWeatherCurrent

type OpenWeatherCurrent struct {
	Coord      `json:"coord"`
	Weather    []Weather `json:"weather"`
	Base       string    `json:"base"`
	Main       `json:"main"`
	Visibility int `json:"visibility"`
	Wind       `json:"wind"`
	Clouds     `json:"clouds"`
	DT         int32 `json:"dt"`
	Sys        `json:"sys"`
	Timezone   int    `json:"timezone"`
	ID         int32  `json:"id"`
	Name       string `json:"name"`
	Cod        int    `json:"cod"`
}

func (*OpenWeatherCurrent) PrettyPrint

func (w *OpenWeatherCurrent) PrettyPrint() string

PrettyPrint uses a template to print nicely formatted weather output.

type Sys

type Sys struct {
	Type    int    `json:"type"`
	ID      int    `json:"id"`
	Country string `json:"country"`
	Sunrise int32  `json:"sunrise"`
	Sunset  int32  `json:"sunset"`
}

type Weather

type Weather struct {
	ID          int    `json:"id"`
	Main        string `json:"main"`
	Description string `json:"description"`
}

type Wind

type Wind struct {
	Speed float32 `json:"speed"`
	Deg   int     `json:"deg"`
}

Source Files

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