onecall

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 16 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 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 Parts = partsContainer{
	UNKNOWNPART: Part{
		// contains filtered or unexported fields
	},
	CURRENT: Part{
		// contains filtered or unexported fields
	},
	MINUTELY: Part{
		// contains filtered or unexported fields
	},
	HOURLY: Part{
		// contains filtered or unexported fields
	},
	DAILY: Part{
		// contains filtered or unexported fields
	},
	ALERTS: Part{
		// contains filtered or unexported fields
	},
}

Parts is a main entry point using the Part 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",
		// contains filtered or unexported fields
	},
	THUNDERSTORMWITHRAIN: WeatherCondition{

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		Code:        804,
		Group:       "Clouds",
		Description: "overcast clouds",
		// 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 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 ExhaustiveParts added in v0.2.0

func ExhaustiveParts(f func(Part))

ExhaustiveParts 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 `json:"dt"`

	// 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 `json:"sunrise"`

	// 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 `json:"sunset"`

	// (where available) Precipitation volume, mm. Please note that only mm as units of measurement are available for this parameter
	Rain1H *float64 `json:"rain1h"`

	// (where available) Snow volume, mm. Please note that only mm as units of measurement are available for this parameter
	Snow1H *float64 `json:"snow1h"`

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

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"`

	// (where available) Precipitation volume, mm. Please note that only mm as units of measurement are available for this parameter
	Rain *RainRaw `json:"rain,omitempty"`

	// (where available) Snow volume, mm. Please note that only mm as units of measurement are available for this parameter
	Snow *SnowRaw `json:"snow,omitempty"`

	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 `json:"dt"`
	Sunrise  time.Time `json:"sunrise"`
	Sunset   time.Time `json:"sunset"`
	Moonrise time.Time `json:"moonrise"`
	Moonset  time.Time `json:"moonset"`
	Weather  []Weather `json:"weather"`
	// 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 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 HourlyResponse added in v0.2.0

type HourlyResponse struct {
	Dt      time.Time `json:"dt"`
	Weather []Weather `json:"weather"`

	Rain1H *float64 `json:"rain1h"`
	Snow1H *float64 `json:"snow1h"`
	// contains filtered or unexported fields
}

type HourlyResponseRaw added in v0.2.0

type HourlyResponseRaw struct {
	Dt int64 // Time of the forecasted data, Unix, UTC

	Rain    *RainRaw `json:"rain,omitempty"` // (where available) Precipitation volume, mm. Please note that only mm as units of measurement are available for this parameter
	Snow    *SnowRaw `json:"snow,omitempty"` // (where available) Snow volume, mm. Please note that only mm as units of measurement are available for this parameter
	Weather []WeatherRaw
	// contains filtered or unexported fields
}

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 float64   `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 float64 `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    []Part // Exclude parts of the weather data from the API response. Supersedes Include'd parts.
	Include    []Part // Include parts of the weather data from the API response. Superseded by Exclude'd parts.
	Units      Unit
	Lang       Lang
	SaveAsJson string
}

type OneCallResponse

type OneCallResponse struct {
	Current  CurrentResponse  `json:"current"`
	Minutely []MinuteResponse `json:"minutely"`
	Hourly   []HourlyResponse `json:"hourly"`
	Daily    []DailyResponse  `json:"daily"`
	// 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"` // (where available)
	Hourly   []HourlyResponseRaw `json:"hourly"`
	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 Part added in v0.2.0

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

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

func ParsePart added in v0.2.0

func ParsePart(input any) (Part, error)

ParsePart 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 (Part) IsValid added in v0.2.0

func (p Part) IsValid() bool

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

func (Part) MarshalBinary added in v0.2.0

func (p Part) MarshalBinary() ([]byte, error)

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

func (Part) MarshalJSON added in v0.2.0

func (p Part) MarshalJSON() ([]byte, error)

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

func (Part) MarshalText added in v0.2.0

func (p Part) MarshalText() ([]byte, error)

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

func (Part) MarshalYAML added in v0.2.0

func (p Part) MarshalYAML() ([]byte, error)

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

func (*Part) Scan added in v0.2.0

func (p *Part) Scan(value any) error

Scan implements the database/sql.Scanner interface for Part. 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 (Part) String added in v0.2.0

func (p Part) String() string

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

func (*Part) UnmarshalBinary added in v0.2.0

func (p *Part) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Part. 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 (*Part) UnmarshalJSON added in v0.2.0

func (p *Part) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Part. 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 (*Part) UnmarshalText added in v0.2.0

func (p *Part) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Part. 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 (*Part) UnmarshalYAML added in v0.2.0

func (p *Part) 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 (Part) Value added in v0.2.0

func (p Part) Value() (driver.Value, error)

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

type PartList added in v0.2.0

type PartList []Part

func (PartList) Add added in v0.2.0

func (pl PartList) Add(parts []Part) PartList

func (PartList) Invert added in v0.2.0

func (pl PartList) Invert() PartList

func (PartList) String added in v0.2.0

func (pl PartList) String() string

type RainRaw added in v0.2.0

type RainRaw struct {
	OneH float64 `json:"1h"`
}

func (*RainRaw) Parse added in v0.2.0

func (r *RainRaw) Parse() *float64

type SnowRaw added in v0.2.0

type SnowRaw struct {
	OneH float64 `json:"1h"`
}

func (*SnowRaw) Parse added in v0.2.0

func (s *SnowRaw) Parse() *float64

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 Weather added in v0.2.0

type Weather struct {
	WeatherCondition
	Icon string
}

type WeatherCondition

type WeatherCondition struct {
	Code        int64
	Group       string
	Description 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