onecall

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Albanian           lang // sq
	Afrikaans               // af
	Arabic                  // ar
	Azerbaijani             // az
	Basque                  // eu
	Belarusian              // be
	Bulgarian               // bg
	Catalan                 // ca
	ChineseSimplified       // zh_cn
	ChineseTraditional      // zh_tw
	Croatian                // hr
	Czech                   // cz
	Danish                  // da
	Dutch                   // nl
	English                 // en
	Finnish                 // fi
	French                  // fr
	Galician                // gl
	German                  // de
	Greek                   // el
	Hebrew                  // he
	Hindi                   // hi
	Hungarian               // hu
	Icelandic               // is
	Indonesian              // id
	Italian                 // it
	Japanese                // ja
	Korean                  // kr
	Kurmanji                // ku
	Latvian                 // la
	Lithuanian              // lt
	Macedonian              // mk
	Norwegian               // no
	Persian                 // fa
	Polish                  // pl
	Portuguese              // pt
	PortugueseBrazil        // pt_br
	Romanian                // ro
	Russian                 // ru
	Serbian                 // sr
	Slovak                  // sk
	Slovenian               // sl
	Spanish                 // sp
	Swedish                 // sv
	Thai                    // th
	Turkish                 // tr
	Ukrainian               // ua
	Vietnamese              // vi
	Zulu                    // zu
)

Variables

View Source
var Excludes = excludesContainer{
	UNKNOWNEXCLUDE: Exclude{
		// contains filtered or unexported fields
	},
	CURRENT: Exclude{
		// contains filtered or unexported fields
	},
	MINUTELY: Exclude{
		// contains filtered or unexported fields
	},
	HOURLY: Exclude{
		// contains filtered or unexported fields
	},
	DAILY: Exclude{
		// contains filtered or unexported fields
	},
	ALERTS: Exclude{
		// contains filtered or unexported fields
	},
}

Excludes is a main entry point using the Exclude type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var Langs = langsContainer{
	UNKNOWNLANG: Lang{
		// contains filtered or unexported fields
	},
	ALBANIAN: Lang{
		// contains filtered or unexported fields
	},
	AFRIKAANS: Lang{
		// contains filtered or unexported fields
	},
	ARABIC: Lang{
		// contains filtered or unexported fields
	},
	AZERBAIJANI: Lang{
		// contains filtered or unexported fields
	},
	BASQUE: Lang{
		// contains filtered or unexported fields
	},
	BELARUSIAN: Lang{
		// contains filtered or unexported fields
	},
	BULGARIAN: Lang{
		// contains filtered or unexported fields
	},
	CATALAN: Lang{
		// contains filtered or unexported fields
	},
	CHINESESIMPLIFIED: Lang{
		// contains filtered or unexported fields
	},
	CHINESETRADITIONAL: Lang{
		// contains filtered or unexported fields
	},
	CROATIAN: Lang{
		// contains filtered or unexported fields
	},
	CZECH: Lang{
		// contains filtered or unexported fields
	},
	DANISH: Lang{
		// contains filtered or unexported fields
	},
	DUTCH: Lang{
		// contains filtered or unexported fields
	},
	ENGLISH: Lang{
		// contains filtered or unexported fields
	},
	FINNISH: Lang{
		// contains filtered or unexported fields
	},
	FRENCH: Lang{
		// contains filtered or unexported fields
	},
	GALICIAN: Lang{
		// contains filtered or unexported fields
	},
	GERMAN: Lang{
		// contains filtered or unexported fields
	},
	GREEK: Lang{
		// contains filtered or unexported fields
	},
	HEBREW: Lang{
		// contains filtered or unexported fields
	},
	HINDI: Lang{
		// contains filtered or unexported fields
	},
	HUNGARIAN: Lang{
		// contains filtered or unexported fields
	},
	ICELANDIC: Lang{
		// contains filtered or unexported fields
	},
	INDONESIAN: Lang{
		// contains filtered or unexported fields
	},
	ITALIAN: Lang{
		// contains filtered or unexported fields
	},
	JAPANESE: Lang{
		// contains filtered or unexported fields
	},
	KOREAN: Lang{
		// contains filtered or unexported fields
	},
	KURMANJI: Lang{
		// contains filtered or unexported fields
	},
	LATVIAN: Lang{
		// contains filtered or unexported fields
	},
	LITHUANIAN: Lang{
		// contains filtered or unexported fields
	},
	MACEDONIAN: Lang{
		// contains filtered or unexported fields
	},
	NORWEGIAN: Lang{
		// contains filtered or unexported fields
	},
	PERSIAN: Lang{
		// contains filtered or unexported fields
	},
	POLISH: Lang{
		// contains filtered or unexported fields
	},
	PORTUGUESE: Lang{
		// contains filtered or unexported fields
	},
	PORTUGUESEBRAZIL: Lang{
		// contains filtered or unexported fields
	},
	ROMANIAN: Lang{
		// contains filtered or unexported fields
	},
	RUSSIAN: Lang{
		// contains filtered or unexported fields
	},
	SERBIAN: Lang{
		// contains filtered or unexported fields
	},
	SLOVAK: Lang{
		// contains filtered or unexported fields
	},
	SLOVENIAN: Lang{
		// contains filtered or unexported fields
	},
	SPANISH: Lang{
		// contains filtered or unexported fields
	},
	SWEDISH: Lang{
		// contains filtered or unexported fields
	},
	THAI: Lang{
		// contains filtered or unexported fields
	},
	TURKISH: Lang{
		// contains filtered or unexported fields
	},
	UKRAINIAN: Lang{
		// contains filtered or unexported fields
	},
	VIETNAMESE: Lang{
		// contains filtered or unexported fields
	},
	ZULU: Lang{
		// contains filtered or unexported fields
	},
}

Langs is a main entry point using the Lang type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var Units = unitsContainer{
	UNKNOWNUNIT: Unit{
		// contains filtered or unexported fields
	},
	STANDARD: Unit{
		// contains filtered or unexported fields
	},
	METRIC: Unit{
		// contains filtered or unexported fields
	},
	IMPERIAL: Unit{
		// contains filtered or unexported fields
	},
}

Units is a main entry point using the Unit type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var WeatherConditions = weatherConditionsContainer{
	THUNDERSTORMWITHLIGHTRAIN: WeatherCondition{

		Code:        200,
		Group:       "Thunderstorm",
		Description: "thunderstorm with light rain",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	THUNDERSTORMWITHRAIN: WeatherCondition{

		Code:        201,
		Group:       "Thunderstorm",
		Description: "thunderstorm with rain",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	THUNDERSTORMWITHHEAVYRAIN: WeatherCondition{

		Code:        202,
		Group:       "Thunderstorm",
		Description: "thunderstorm with heavy rain",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	LIGHTTHUNDERSTORM: WeatherCondition{

		Code:        210,
		Group:       "Thunderstorm",
		Description: "light thunderstorm",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	THUNDERSTORM: WeatherCondition{

		Code:        211,
		Group:       "Thunderstorm",
		Description: "thunderstorm",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	HEAVYTHUNDERSTORM: WeatherCondition{

		Code:        212,
		Group:       "Thunderstorm",
		Description: "heavy thunderstorm",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	RAGGEDTHUNDERSTORM: WeatherCondition{

		Code:        221,
		Group:       "Thunderstorm",
		Description: "ragged thunderstorm",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	THUNDERSTORMWITHLIGHTDRIZZLE: WeatherCondition{

		Code:        230,
		Group:       "Thunderstorm",
		Description: "thunderstorm with light drizzle",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	THUNDERSTORMWITHDRIZZLE: WeatherCondition{

		Code:        231,
		Group:       "Thunderstorm",
		Description: "thunderstorm with drizzle",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	THUNDERSTORMWITHHEAVYDRIZZLE: WeatherCondition{

		Code:        232,
		Group:       "Thunderstorm",
		Description: "thunderstorm with drizzle",
		Icon:        "11d",
		// contains filtered or unexported fields
	},
	LIGHTINTENSITYDRIZZLE: WeatherCondition{

		Code:        300,
		Group:       "Drizzle",
		Description: "light intensity drizzle",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	DRIZZLE: WeatherCondition{

		Code:        301,
		Group:       "Drizzle",
		Description: "drizzle",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	HEAVYINTENSITYDRIZZLE: WeatherCondition{

		Code:        310,
		Group:       "Drizzle",
		Description: "heavy intensity drizzle",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	LIGHTINTENSITYDRIZZLERAIN: WeatherCondition{

		Code:        311,
		Group:       "Drizzle",
		Description: "light intensity drizzle rain",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	DRIZZLERAIN: WeatherCondition{

		Code:        312,
		Group:       "Drizzle",
		Description: "drizzle rain",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	SHOWERRAINANDDRIZZLE: WeatherCondition{

		Code:        313,
		Group:       "Drizzle",
		Description: "shower rain and drizzle",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	HEAVYSHOWERRAINANDDRIZZLE: WeatherCondition{

		Code:        314,
		Group:       "Drizzle",
		Description: "heavy shower rain and drizzle",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	SHOWERDRIZZLE: WeatherCondition{

		Code:        321,
		Group:       "Drizzle",
		Description: "shower drizzle",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	LIGHTRAIN: WeatherCondition{

		Code:        500,
		Group:       "Rain",
		Description: "light rain",
		Icon:        "10d",
		// contains filtered or unexported fields
	},
	MODERATERAIN: WeatherCondition{

		Code:        501,
		Group:       "Rain",
		Description: "moderate rain",
		Icon:        "10d",
		// contains filtered or unexported fields
	},
	HEAVYINTENSITYRAIN: WeatherCondition{

		Code:        502,
		Group:       "Rain",
		Description: "heavy intensity rain",
		Icon:        "10d",
		// contains filtered or unexported fields
	},
	VERYHEAVYRAIN: WeatherCondition{

		Code:        503,
		Group:       "Rain",
		Description: "very heavy rain",
		Icon:        "10d",
		// contains filtered or unexported fields
	},
	EXTREMERAIN: WeatherCondition{

		Code:        504,
		Group:       "Rain",
		Description: "extreme rain",
		Icon:        "10d",
		// contains filtered or unexported fields
	},
	FREEZINGRAIN: WeatherCondition{

		Code:        511,
		Group:       "Rain",
		Description: "freezing rain",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	LIGHTINTENSITYSHOWERRAIN: WeatherCondition{

		Code:        520,
		Group:       "Rain",
		Description: "light intensity shower rain",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	SHOWERRAIN: WeatherCondition{

		Code:        521,
		Group:       "Rain",
		Description: "shower rain",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	HEAVYINTENSITYSHOWERRAIN: WeatherCondition{

		Code:        522,
		Group:       "Rain",
		Description: "heavy intensity shower rain",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	RAGGEDSHOWERRAIN: WeatherCondition{

		Code:        531,
		Group:       "Rain",
		Description: "ragged shower rain",
		Icon:        "09d",
		// contains filtered or unexported fields
	},
	LIGHTSNOW: WeatherCondition{

		Code:        600,
		Group:       "Snow",
		Description: "light snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	SNOW: WeatherCondition{

		Code:        601,
		Group:       "Snow",
		Description: "snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	HEAVYSNOW: WeatherCondition{

		Code:        602,
		Group:       "Snow",
		Description: "heavy snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	SLEET: WeatherCondition{

		Code:        611,
		Group:       "Snow",
		Description: "sleet",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	LIGHTSHOWERSLEET: WeatherCondition{

		Code:        612,
		Group:       "Snow",
		Description: "light shower sleet",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	SHOWERSLEET: WeatherCondition{

		Code:        613,
		Group:       "Snow",
		Description: "shower sleet",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	LIGHTRAINANDSNOW: WeatherCondition{

		Code:        615,
		Group:       "Snow",
		Description: "light rain and snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	RAINANDSNOW: WeatherCondition{

		Code:        616,
		Group:       "Snow",
		Description: "rain and snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	LIGHTSHOWERSNOW: WeatherCondition{

		Code:        620,
		Group:       "Snow",
		Description: "light shower snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	SHOWERSNOW: WeatherCondition{

		Code:        621,
		Group:       "Snow",
		Description: "shower snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	HEAVYSHOWERSNOW: WeatherCondition{

		Code:        622,
		Group:       "Snow",
		Description: "heavy shower snow",
		Icon:        "13d",
		// contains filtered or unexported fields
	},
	MIST: WeatherCondition{

		Code:        701,
		Group:       "Mist",
		Description: "mist",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	SMOKE: WeatherCondition{

		Code:        711,
		Group:       "Smoke",
		Description: "smoke",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	HAZE: WeatherCondition{

		Code:        721,
		Group:       "Haze",
		Description: "haze",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	SANDDUSTWHIRLS: WeatherCondition{

		Code:        731,
		Group:       "Dust",
		Description: "sand/dust whirls",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	FOG: WeatherCondition{

		Code:        741,
		Group:       "Fog",
		Description: "fog",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	SAND: WeatherCondition{

		Code:        751,
		Group:       "Sand",
		Description: "sand",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	DUST: WeatherCondition{

		Code:        761,
		Group:       "Dust",
		Description: "dust",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	VOLCANICASH: WeatherCondition{

		Code:        762,
		Group:       "Ash",
		Description: "volcanic ash",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	SQUALLS: WeatherCondition{

		Code:        771,
		Group:       "Squall",
		Description: "squalls",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	TORNADO: WeatherCondition{

		Code:        781,
		Group:       "Tornado",
		Description: "tornado",
		Icon:        "50d",
		// contains filtered or unexported fields
	},
	CLEAR: WeatherCondition{

		Code:        800,
		Group:       "Clear",
		Description: "clear sky",
		Icon:        "01d",
		// contains filtered or unexported fields
	},
	FEWCLOUDS: WeatherCondition{

		Code:        801,
		Group:       "Clouds",
		Description: "few clouds",
		Icon:        "02d",
		// contains filtered or unexported fields
	},
	SCATTEREDCLOUDS: WeatherCondition{

		Code:        802,
		Group:       "Clouds",
		Description: "scattered clouds",
		Icon:        "03d",
		// contains filtered or unexported fields
	},
	BROKENCLOUDS: WeatherCondition{

		Code:        803,
		Group:       "Clouds",
		Description: "broken clouds",
		Icon:        "04d",
		// contains filtered or unexported fields
	},
	OVERCASTCLOUDS: WeatherCondition{

		Code:        804,
		Group:       "Clouds",
		Description: "overcast clouds",
		Icon:        "04d",
		// contains filtered or unexported fields
	},
}

WeatherConditions is a main entry point using the WeatherCondition type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

Functions

func ExhaustiveExcludes

func ExhaustiveExcludes(f func(Exclude))

ExhaustiveExcludes iterates over all enum values and calls the provided function for each value. This function is useful for performing operations on all valid enum values in a loop.

func ExhaustiveLangs

func ExhaustiveLangs(f func(Lang))

ExhaustiveLangs iterates over all enum values and calls the provided function for each value. This function is useful for performing operations on all valid enum values in a loop.

func ExhaustiveUnits

func ExhaustiveUnits(f func(Unit))

ExhaustiveUnits iterates over all enum values and calls the provided function for each value. This function is useful for performing operations on all valid enum values in a loop.

func ExhaustiveWeatherConditions

func ExhaustiveWeatherConditions(f func(WeatherCondition))

ExhaustiveWeatherConditions iterates over all enum values and calls the provided function for each value. This function is useful for performing operations on all valid enum values in a loop.

Types

type Client

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

func NewClient

func NewClient(opts *ClientOptions) *Client

func (*Client) CurrentAndForecast

func (c *Client) CurrentAndForecast(lat, lon float64, opts *OneCallOptions) (*OneCallResponse, error)

func (*Client) CurrentAndForecastRaw

func (c *Client) CurrentAndForecastRaw(lat, lon float64, opts *OneCallOptions) (*OneCallResponseRaw, error)

type ClientOptions

type ClientOptions struct {
	HttpClient *http.Client
	Logger     *slog.Logger
	AppID      string // Your OpenWeather API key. May also be set as environment variable.
	Units      Unit   // Units to use for the client. Overruled by unit option explicitly passed to client calls.
}

type CurrentResponse

type CurrentResponse struct {

	// Current time
	Dt time.Time

	// Sunrise time. For polar areas in midnight sun and polar night periods this parameter is not returned in the response.
	// Use time.IsZero() to distinguish if a value was returned or not.
	Sunrise time.Time

	// Sunset time. For polar areas in midnight sun and polar night periods this parameter is not returned in the response.
	// Use time.IsZero() to distinguish if a value was returned or not.
	Sunset time.Time

	Weather []WeatherCondition
	// contains filtered or unexported fields
}

func (CurrentResponse) Parse

type CurrentResponseRaw

type CurrentResponseRaw struct {

	// Current time, Unix, UTC
	Dt int64 `json:"dt"`

	// Sunrise time, Unix, UTC. For polar areas in midnight sun and polar night periods this parameter is not returned in the response
	Sunrise int64 `json:"sunrise"`

	// Sunset time, Unix, UTC. For polar areas in midnight sun and polar night periods this parameter is not returned in the response
	Sunset int64 `json:"sunset"`

	Weather []WeatherRaw `json:"weather"`
	// contains filtered or unexported fields
}

Current weather data API response

func (*CurrentResponseRaw) Parse

func (c *CurrentResponseRaw) Parse() *CurrentResponse

type DailyResponse

type DailyResponse struct {
	Dt       time.Time
	Sunrise  time.Time
	Sunset   time.Time
	Moonrise time.Time
	Moonset  time.Time
	Weather  []WeatherCondition
	// contains filtered or unexported fields
}

type DailyResponseRaw

type DailyResponseRaw struct {
	Dt       int64 // Time of the forecasted data, Unix, UTC
	Sunrise  int64 // Sunrise time, Unix, UTC. For polar areas in midnight sun and polar night periods this parameter is not returned in the response
	Sunset   int64 // Sunset time, Unix, UTC. For polar areas in midnight sun and polar night periods this parameter is not returned in the response
	Moonrise int64 // The time of when the moon rises for this day, Unix, UTC
	Moonset  int64 //  The time of when the moon rises for this day, Unix, UTC
	Weather  []WeatherRaw
	// contains filtered or unexported fields
}

type Exclude

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

Exclude is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func ParseExclude

func ParseExclude(input any) (Exclude, error)

ParseExclude parses the input value into an enum value. It returns the parsed enum value or an error if the input is invalid. It is a convenience function that can be used to parse enum values from various input types, such as strings, byte slices, or other enum types.

func (Exclude) IsValid

func (e Exclude) IsValid() bool

IsValid checks whether the Excludes value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (Exclude) MarshalBinary

func (e Exclude) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for Exclude. It returns the binary representation of the enum value as a byte slice.

func (Exclude) MarshalJSON

func (e Exclude) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Exclude. It returns the JSON representation of the enum value as a byte slice.

func (Exclude) MarshalText

func (e Exclude) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Exclude. It returns the string representation of the enum value as a byte slice

func (Exclude) MarshalYAML

func (e Exclude) MarshalYAML() ([]byte, error)

MarshalYAML implements the yaml.Marshaler interface for Exclude. It returns the string representation of the enum value.

func (*Exclude) Scan

func (e *Exclude) Scan(value any) error

Scan implements the database/sql.Scanner interface for Exclude. It parses the string representation of the enum value from the database row. It returns an error if the row does not contain a valid enum value.

func (Exclude) String

func (e Exclude) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*Exclude) UnmarshalBinary

func (e *Exclude) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Exclude. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Exclude) UnmarshalJSON

func (e *Exclude) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Exclude. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*Exclude) UnmarshalText

func (e *Exclude) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Exclude. It parses the string representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Exclude) UnmarshalYAML

func (e *Exclude) UnmarshalYAML(b []byte) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Planet. It parses the byte slice representation of the enum value and returns an error if the YAML byte slice does not contain a valid enum value.

func (Exclude) Value

func (e Exclude) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface for Exclude. It returns the string representation of the enum value.

type ExcludeList

type ExcludeList []Exclude

func (ExcludeList) String

func (e ExcludeList) String() string

type FeelsLike

type FeelsLike struct {
	Morn  float64 `json:"morn"`  // Morning temperature.
	Day   float64 `json:"day"`   // Day temperature.
	Eve   float64 `json:"eve"`   // Evening temperature.
	Night float64 `json:"night"` // Night temperature.
}

type Lang

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

Lang is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func ParseLang

func ParseLang(input any) (Lang, error)

ParseLang parses the input value into an enum value. It returns the parsed enum value or an error if the input is invalid. It is a convenience function that can be used to parse enum values from various input types, such as strings, byte slices, or other enum types.

func (Lang) IsValid

func (l Lang) IsValid() bool

IsValid checks whether the Langs value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (Lang) MarshalBinary

func (l Lang) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for Lang. It returns the binary representation of the enum value as a byte slice.

func (Lang) MarshalJSON

func (l Lang) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Lang. It returns the JSON representation of the enum value as a byte slice.

func (Lang) MarshalText

func (l Lang) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Lang. It returns the string representation of the enum value as a byte slice

func (Lang) MarshalYAML

func (l Lang) MarshalYAML() ([]byte, error)

MarshalYAML implements the yaml.Marshaler interface for Lang. It returns the string representation of the enum value.

func (*Lang) Scan

func (l *Lang) Scan(value any) error

Scan implements the database/sql.Scanner interface for Lang. It parses the string representation of the enum value from the database row. It returns an error if the row does not contain a valid enum value.

func (Lang) String

func (l Lang) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*Lang) UnmarshalBinary

func (l *Lang) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Lang. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Lang) UnmarshalJSON

func (l *Lang) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Lang. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*Lang) UnmarshalText

func (l *Lang) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Lang. It parses the string representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Lang) UnmarshalYAML

func (l *Lang) UnmarshalYAML(b []byte) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Planet. It parses the byte slice representation of the enum value and returns an error if the YAML byte slice does not contain a valid enum value.

func (Lang) Value

func (l Lang) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface for Lang. It returns the string representation of the enum value.

type MinuteResponse

type MinuteResponse struct {
	Dt            time.Time `json:"dt"`            // Time of the forecasted data
	Precipitation int64     `json:"precipitation"` // Precipitation, mm/h. Please note that only mm/h as units of measurement are available for this parameter

}

Minute forecast weather data API response

type MinuteResponseRaw

type MinuteResponseRaw struct {
	Dt            int64 `json:"dt"`            // Time of the forecasted data, unix, UTC
	Precipitation int64 `json:"precipitation"` // Precipitation, mm/h. Please note that only mm/h as units of measurement are available for this parameter
}

Minute forecast weather data API response

type OneCallOptions

type OneCallOptions struct {
	Exclude []Exclude
	Units   Unit
	Lang    Lang
}

type OneCallResponse

type OneCallResponse struct {
	Current  CurrentResponse
	Minutely []MinuteResponse
	Daily    []DailyResponse
	// contains filtered or unexported fields
}

OneCallResponse is parsed from `OneCallResponseRaw` and is a more convenient, ergonomic data structure.

type OneCallResponseRaw

type OneCallResponseRaw struct {
	Current  CurrentResponseRaw  `json:"current"`
	Minutely []MinuteResponseRaw `json:"minutely"`
	Daily    []DailyResponseRaw  `json:"daily"`
	// contains filtered or unexported fields
}

OneCallResponseRaw is a direct mapping of what is returned from One Call API calls.

func (OneCallResponseRaw) Parse

type Temp

type Temp struct {
	Morn  float64 `json:"morn"`  // Morning temperature.
	Day   float64 `json:"day"`   // Day temperature.
	Eve   float64 `json:"eve"`   // Evening temperature.
	Night float64 `json:"night"` // Night temperature.
	Min   float64 `json:"min"`   //  Min daily temperature.
	Max   float64 `json:"max"`   //  Max daily temperature.
}

type Unit

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

Unit is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func ParseUnit

func ParseUnit(input any) (Unit, error)

ParseUnit parses the input value into an enum value. It returns the parsed enum value or an error if the input is invalid. It is a convenience function that can be used to parse enum values from various input types, such as strings, byte slices, or other enum types.

func (Unit) IsValid

func (u Unit) IsValid() bool

IsValid checks whether the Units value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (Unit) MarshalBinary

func (u Unit) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for Unit. It returns the binary representation of the enum value as a byte slice.

func (Unit) MarshalJSON

func (u Unit) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Unit. It returns the JSON representation of the enum value as a byte slice.

func (Unit) MarshalText

func (u Unit) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Unit. It returns the string representation of the enum value as a byte slice

func (Unit) MarshalYAML

func (u Unit) MarshalYAML() ([]byte, error)

MarshalYAML implements the yaml.Marshaler interface for Unit. It returns the string representation of the enum value.

func (*Unit) Scan

func (u *Unit) Scan(value any) error

Scan implements the database/sql.Scanner interface for Unit. It parses the string representation of the enum value from the database row. It returns an error if the row does not contain a valid enum value.

func (Unit) String

func (u Unit) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*Unit) UnmarshalBinary

func (u *Unit) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Unit. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Unit) UnmarshalJSON

func (u *Unit) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Unit. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*Unit) UnmarshalText

func (u *Unit) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Unit. It parses the string representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Unit) UnmarshalYAML

func (u *Unit) UnmarshalYAML(b []byte) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Planet. It parses the byte slice representation of the enum value and returns an error if the YAML byte slice does not contain a valid enum value.

func (Unit) Value

func (u Unit) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface for Unit. It returns the string representation of the enum value.

type WeatherCondition

type WeatherCondition struct {
	Code        int64
	Group       string
	Description string
	Icon        string
	// contains filtered or unexported fields
}

WeatherCondition is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func ParseWeatherCondition

func ParseWeatherCondition(input any) (WeatherCondition, error)

ParseWeatherCondition parses the input value into an enum value. It returns the parsed enum value or an error if the input is invalid. It is a convenience function that can be used to parse enum values from various input types, such as strings, byte slices, or other enum types.

func (WeatherCondition) IsValid

func (w WeatherCondition) IsValid() bool

IsValid checks whether the WeatherConditions value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (WeatherCondition) MarshalBinary

func (w WeatherCondition) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for WeatherCondition. It returns the binary representation of the enum value as a byte slice.

func (WeatherCondition) MarshalJSON

func (w WeatherCondition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for WeatherCondition. It returns the JSON representation of the enum value as a byte slice.

func (WeatherCondition) MarshalText

func (w WeatherCondition) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for WeatherCondition. It returns the string representation of the enum value as a byte slice

func (WeatherCondition) MarshalYAML

func (w WeatherCondition) MarshalYAML() ([]byte, error)

MarshalYAML implements the yaml.Marshaler interface for WeatherCondition. It returns the string representation of the enum value.

func (*WeatherCondition) Scan

func (w *WeatherCondition) Scan(value any) error

Scan implements the database/sql.Scanner interface for WeatherCondition. It parses the string representation of the enum value from the database row. It returns an error if the row does not contain a valid enum value.

func (WeatherCondition) String

func (w WeatherCondition) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*WeatherCondition) UnmarshalBinary

func (w *WeatherCondition) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for WeatherCondition. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*WeatherCondition) UnmarshalJSON

func (w *WeatherCondition) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for WeatherCondition. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*WeatherCondition) UnmarshalText

func (w *WeatherCondition) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for WeatherCondition. It parses the string representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*WeatherCondition) UnmarshalYAML

func (w *WeatherCondition) UnmarshalYAML(b []byte) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Planet. It parses the byte slice representation of the enum value and returns an error if the YAML byte slice does not contain a valid enum value.

func (WeatherCondition) Value

func (w WeatherCondition) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface for WeatherCondition. It returns the string representation of the enum value.

type WeatherRaw

type WeatherRaw 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