Various typespec and compilation improvements
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -143,15 +143,13 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
|
||||
if is_nil(value), do: url, else: do_add_parameter(url, key, value)
|
||||
end
|
||||
|
||||
@spec do_add_parameter(String.t(), atom(), any()) :: String.t()
|
||||
@spec do_add_parameter(String.t(), :zoom | :country_code | :api_key, any()) :: String.t()
|
||||
defp do_add_parameter(url, :zoom, zoom),
|
||||
do: "#{url}&zoom=#{zoom}"
|
||||
|
||||
@spec do_add_parameter(String.t(), atom(), any()) :: String.t()
|
||||
defp do_add_parameter(url, :country_code, country_code),
|
||||
do: "#{url}&countrycodes=#{country_code}"
|
||||
|
||||
@spec do_add_parameter(String.t(), atom(), any()) :: String.t()
|
||||
defp do_add_parameter(url, :api_key, api_key),
|
||||
do: "#{url}&key=#{api_key}"
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ defmodule Mobilizon.Service.Geospatial.Provider do
|
||||
@doc """
|
||||
Returns a `Geo.Point` for given coordinates
|
||||
"""
|
||||
@spec coordinates([number], number) :: Geo.Point.t()
|
||||
@spec coordinates([number], number) :: Geo.Point.t() | nil
|
||||
def coordinates(coords, srid \\ 4326)
|
||||
|
||||
def coordinates([x, y], srid) when is_number(x) and is_number(y) do
|
||||
@@ -78,7 +78,6 @@ defmodule Mobilizon.Service.Geospatial.Provider do
|
||||
%Geo.Point{coordinates: {String.to_float(x), String.to_float(y)}, srid: srid}
|
||||
end
|
||||
|
||||
@spec coordinates(any) :: nil
|
||||
def coordinates(_, _), do: nil
|
||||
|
||||
@spec endpoint(atom()) :: String.t()
|
||||
|
||||
Reference in New Issue
Block a user