View Source Mobilizon.Addresses (Mobilizon v4.1.0-alpha.1)

The Addresses context.

Summary

Functions

Creates an address.

Deletes an address.

Gets a single address.

Gets a single address. Raises Ecto.NoResultsError if the address does not exist.

Gets a single address by its url.

Returns the list of addresses.

Reverse geocode from coordinates.

Updates an address.

Functions

Link to this function

create_address(attrs \\ %{})

View Source
@spec create_address(map()) ::
  {:ok, Mobilizon.Addresses.Address.t()} | {:error, Ecto.Changeset.t()}

Creates an address.

@spec delete_address(Mobilizon.Addresses.Address.t()) ::
  {:ok, Mobilizon.Addresses.Address.t()} | {:error, Ecto.Changeset.t()}

Deletes an address.

@spec get_address(integer() | String.t()) :: Mobilizon.Addresses.Address.t() | nil

Gets a single address.

@spec get_address!(integer() | String.t()) :: Mobilizon.Addresses.Address.t()

Gets a single address. Raises Ecto.NoResultsError if the address does not exist.

Link to this function

get_address_by_origin_id(origin_id)

View Source
@spec get_address_by_origin_id(String.t()) :: Mobilizon.Addresses.Address.t() | nil
@spec get_address_by_url(String.t()) :: Mobilizon.Addresses.Address.t() | nil

Gets a single address by its url.

@spec list_addresses() :: [Mobilizon.Addresses.Address.t()]

Returns the list of addresses.

Link to this function

reverse_geocode(lon, lat, options)

View Source
@spec reverse_geocode(number(), number(), keyword()) :: [
  Mobilizon.Addresses.Address.t()
]

Reverse geocode from coordinates.

We only take addresses 50km around and sort them by distance.

Link to this function

search_addresses(search, options \\ [])

View Source
@spec search_addresses(
  String.t(),
  keyword()
) :: [Mobilizon.Addresses.Address.t()]

Searches addresses.

We only look at the description for now, and eventually order by object distance.

Link to this function

update_address(address, attrs)

View Source
@spec update_address(Mobilizon.Addresses.Address.t(), map()) ::
  {:ok, Mobilizon.Addresses.Address.t()} | {:error, Ecto.Changeset.t()}

Updates an address.