View Source ExOwm.Api (ExOwm v1.3.1)

This module contains functions for interacting with the OpenWeatherMap API. It prepares request strings, makes API calls, and parses the responses.

Summary

Functions

Prepares a request string based on the given parameters, calls the OWM API, and parses the JSON response.

Functions

Link to this function

send_and_parse_request(api_call_type, location, opts)

View Source
@spec send_and_parse_request(atom(), map(), term()) ::
  map() | {:error, term(), term()}

Prepares a request string based on the given parameters, calls the OWM API, and parses the JSON response.

Parameters

  • api_call_type (atom): The type of API call (e.g., :get_weather, :get_current_weather).
  • location (map): The location parameters (e.g., city, coordinates, zip code).
  • opts (term): Optional parameters for the API call (e.g., type, mode, units, cnt, lang).

Returns

  • (map): The parsed JSON response.
  • {:error, term, term}: An error tuple containing the error type and the response.