owmonecall

package module
v0.0.0-...-56b21d0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 6 Imported by: 0

README

owm-onecall

Use this package to call this API:

This package is designed to be close to the API. It doesn't do a lot.

Call OneCall and get the result as documented on the OpenWeatherMap page.

License

MIT license. See the license file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	SenderName string   `json:"sender_name"`
	Event      string   `json:"event"`
	Start      int64    `json:"start"`
	End        int64    `json:"end"`
	Decription string   `json:"description"`
	Tags       []string `json:"tags"`
}

type CurrentWeather

type CurrentWeather struct {
	Dt         int64                      `json:"dt"`
	Sunrise    int64                      `json:"sunrise"`
	Sunset     int64                      `json:"sunset"`
	Temp       decimal.Decimal            `json:"temp"`
	FeelsLike  decimal.Decimal            `json:"feels_like"`
	Pressure   int64                      `json:"pressure"`
	Humidity   int64                      `json:"humidity"`
	DewPoint   decimal.Decimal            `json:"dew_point"`
	Uvi        decimal.Decimal            `json:"uvi"`
	Clouds     int64                      `json:"clouds"`
	Visibility int64                      `json:"visibility"`
	WindSpeed  decimal.Decimal            `json:"wind_speed"`
	WindDeg    int64                      `json:"wind_deg"`
	Weather    []Weather                  `json:"weather"`
	Rain       map[string]decimal.Decimal `json:"rain"`
}

type Daily

type Daily struct {
	Dt        int64           `json:"dt"`
	Sunrise   int64           `json:"sunrise"`
	Sunset    int64           `json:"sunset"`
	Moonrise  int64           `json:"moonrise"`
	Moonset   int64           `json:"moonset"`
	MoonPhase decimal.Decimal `json:"moon_phase"`
	Temp      DayTemp         `json:"temp"`
	FeelsLike DayFeelsLike    `json:"feels_like"`
	Pressure  int64           `json:"pressure"`
	Humidity  int64           `json:"humidity"`
	DewPoint  decimal.Decimal `json:"dew_point"`
	WindSpeed decimal.Decimal `json:"wind_speed"`
	WindDeg   decimal.Decimal `json:"wind_deg"`
	Weather   []Weather       `json:"weather"`
	Clouds    int64           `json:"clouds"`
	Pop       decimal.Decimal `json:"pop"`
	Rain      decimal.Decimal `json:"rain"`
	Uvi       decimal.Decimal `json:"uvi"`
}

type DayFeelsLike

type DayFeelsLike struct {
	Day   decimal.Decimal `json:"day"`
	Night decimal.Decimal `json:"night"`
	Eve   decimal.Decimal `json:"eve"`
	Morn  decimal.Decimal `json:"morn"`
}

type DayTemp

type DayTemp struct {
	Day   decimal.Decimal `json:"day"`
	Min   decimal.Decimal `json:"min"`
	Max   decimal.Decimal `json:"max"`
	Night decimal.Decimal `json:"night"`
	Eve   decimal.Decimal `json:"eve"`
	Morn  decimal.Decimal `json:"morn"`
}

type Hourly

type Hourly struct {
	Dt         int64           `json:"dt"`
	Temp       decimal.Decimal `json:"temp"`
	FeelsLike  decimal.Decimal `json:"feels_like"`
	Pressure   int64           `json:"pressure"`
	Humidity   int64           `json:"humidity"`
	DewPoint   decimal.Decimal `json:"dew_point"`
	Uvi        decimal.Decimal `json:"uvi"`
	Clouds     int64           `json:"clouds"`
	Visibility int64           `json:"visibility"`
	WindSpeed  decimal.Decimal `json:"wind_speed"`
	WindDeg    int64           `json:"wind_deg"`
	WindGust   decimal.Decimal `json:"wind_gust"`
	Weather    []Weather       `json:"weather"`
	Pop        decimal.Decimal `json:"pop"`
}

type Minutely

type Minutely struct {
	Dt            int64           `json:"dt"`
	Precipitation decimal.Decimal `json:"precipitation"`
}

type OneCallAPI

type OneCallAPI struct {
	AppID   string
	BaseURL string
}

func (OneCallAPI) OneCall

func (api OneCallAPI) OneCall(lat, long decimal.Decimal, optionals ...OptionalParameter) (*OneCallResponse, error)

type OneCallResponse

type OneCallResponse struct {
	Lat            decimal.Decimal `json:"lat"`
	Lon            decimal.Decimal `json:"lon"`
	Timezone       string          `json:"timezone"`
	TimezoneOffset int             `json:"timezone_offset"`
	Current        CurrentWeather  `json:"current"`
	Minutely       []Minutely      `json:"minutely"`
	Hourly         []Hourly        `json:"hourly"`
	Daily          []Daily         `json:"daily"`
	Alerts         []Alert         `json:"alerts"`
}

func OneCall

func OneCall(lat, long decimal.Decimal, appId string, optionals ...OptionalParameter) (*OneCallResponse, error)

type OptionalParameter

type OptionalParameter struct {
	Name  string
	Value string
}

func Exclude

func Exclude(excludes []string) OptionalParameter

func ImperialUnits

func ImperialUnits() OptionalParameter

func Lang

func Lang(lang string) OptionalParameter

func MetricUnits

func MetricUnits() OptionalParameter

func StandardUnits

func StandardUnits() OptionalParameter

type Weather

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

Jump to

Keyboard shortcuts

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