View Source ExOwm (ExOwm v1.3.1)

ExOwm, OpenWeatherMap API Elixir client. This module contains main public interface of the application.

Summary

Types

Current weather data API call options corresponding to OWM APIs described in official docs: http://openweathermap.org/api

Keyword list of options.

Current weather data API request.

Current weather data API requests.

Functions

Gets weather data of the given location with specified options.

Gets 5 day forecast data of the given location with specified options.

Gets historical weather data of the given location with specified options. dt should be within the last 5 days.

Gets 4 day hourly forecast data of the given location with specified options.

Gets 1 to 16 days forecast data of the given location with specified options.

Gets weather data of the given location with specified options.

Types

@type option() :: :format | :units | :lang | :cnt | :like | :accurate | :mode | :cnt

Current weather data API call options corresponding to OWM APIs described in official docs: http://openweathermap.org/api

The output of the request can be specified according to below options.

@type options() :: [{:option, term()}]

Keyword list of options.

@type request() ::
  %{city: String.t()}
  | %{city: String.t(), country_code: String.t()}
  | %{id: integer()}
  | %{lat: float(), lon: float()}
  | %{lat: float(), lon: float(), dt: integer()}
  | %{zip: String.t(), country_code: String.t()}

Current weather data API request.

@type requests() :: [request()]

Current weather data API requests.

Functions

Link to this function

get_current_weather(loc, opts \\ [])

View Source
@spec get_current_weather(requests(), options()) :: map()

Gets weather data of the given location with specified options.

Examples

iex> ExOwm.get_current_weather([%{city: "Warsaw"}, %{city: "London", country_code: "uk"}], units: :metric, lang: :pl)
Link to this function

get_five_day_forecast(locations, opts \\ [])

View Source
@spec get_five_day_forecast(requests(), options()) :: map()

Gets 5 day forecast data of the given location with specified options.

Examples

iex> ExOwm.get_five_day_forecast([%{city: "Warsaw"}, %{city: "London", country_code: "uk"}], units: :metric, lang: :pl)
Link to this function

get_historical_weather(loc, opts \\ [])

View Source
@spec get_historical_weather(requests(), options()) :: map()

Gets historical weather data of the given location with specified options. dt should be within the last 5 days.

Examples

iex> ExOwm.get_historical_weather([%{lat: 52.374031, lon: 4.88969, dt: 1615546800}], units: :metric, lang: :pl)
Link to this function

get_hourly_forecast(locations, opts \\ [])

View Source
@spec get_hourly_forecast(requests(), options()) :: map()

Gets 4 day hourly forecast data of the given location with specified options.

Examples

iex> ExOwm.get_hourly_forecast([%{city: "Warsaw"}, %{city: "London", country_code: "uk"}], units: :metric, lang: :pl)
Link to this function

get_sixteen_day_forecast(locations, opts \\ [])

View Source
@spec get_sixteen_day_forecast(requests(), options()) :: map()

Gets 1 to 16 days forecast data of the given location with specified options.

Examples

iex> ExOwm.get_sixteen_day_forecast([%{city: "Warsaw"}, %{city: "London", country_code: "uk"}], units: :metric, lang: :pl, cnt: 16)
Link to this function

get_weather(loc, opts \\ [])

View Source
@spec get_weather(requests(), options()) :: map()

Gets weather data of the given location with specified options.

Examples

iex> ExOwm.get_weather([%{lat: 52.374031, lon: 4.88969}], units: :metric, lang: :pl)