Improve GraphQL documentation and cleanup API

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-19 17:06:28 +01:00
parent e8a3b6aa94
commit 3eacbb2ca3
87 changed files with 6542 additions and 6314 deletions

View File

@@ -10,19 +10,19 @@ defmodule Mobilizon.GraphQL.Schema.AddressType do
field(:geom, :point, description: "The geocoordinates for the point where this address is")
field(:street, :string, description: "The address's street name (with number)")
field(:locality, :string, description: "The address's locality")
field(:postal_code, :string)
field(:region, :string)
field(:country, :string)
field(:description, :string)
field(:type, :string)
field(:url, :string)
field(:id, :id)
field(:origin_id, :string)
field(:postal_code, :string, description: "The address's postal code")
field(:region, :string, description: "The address's region")
field(:country, :string, description: "The address's country")
field(:description, :string, description: "The address's description")
field(:type, :string, description: "The address's type")
field(:url, :string, description: "The address's URL")
field(:id, :id, description: "The address's ID")
field(:origin_id, :string, description: "The address's original ID from the provider")
end
object :phone_address do
field(:phone, :string)
field(:info, :string)
field(:phone, :string, description: "The phone number")
field(:info, :string, description: "Additional information about the phone number")
end
object :online_address do
@@ -35,33 +35,46 @@ defmodule Mobilizon.GraphQL.Schema.AddressType do
field(:geom, :point, description: "The geocoordinates for the point where this address is")
field(:street, :string, description: "The address's street name (with number)")
field(:locality, :string, description: "The address's locality")
field(:postal_code, :string)
field(:region, :string)
field(:country, :string)
field(:description, :string)
field(:url, :string)
field(:type, :string)
field(:id, :id)
field(:origin_id, :string)
field(:postal_code, :string, description: "The address's postal code")
field(:region, :string, description: "The address's region")
field(:country, :string, description: "The address's country")
field(:description, :string, description: "The address's description")
field(:type, :string, description: "The address's type")
field(:url, :string, description: "The address's URL")
field(:id, :id, description: "The address's ID")
field(:origin_id, :string, description: "The address's original ID from the provider")
end
object :address_queries do
@desc "Search for an address"
field :search_address, type: list_of(:address) do
arg(:query, non_null(:string))
arg(:locale, :string, default_value: "en")
arg(:page, :integer, default_value: 1)
arg(:limit, :integer, default_value: 10)
arg(:locale, :string,
default_value: "en",
description: "The user's locale. Geocoding backends will make use of this value."
)
arg(:page, :integer,
default_value: 1,
description: "The page in the paginated search results list"
)
arg(:limit, :integer, default_value: 10, description: "The limit of search results per page")
resolve(&Address.search/3)
end
@desc "Reverse geocode coordinates"
field :reverse_geocode, type: list_of(:address) do
arg(:longitude, non_null(:float))
arg(:latitude, non_null(:float))
arg(:zoom, :integer, default_value: 15)
arg(:locale, :string, default_value: "en")
arg(:longitude, non_null(:float), description: "Geographical longitude (using WGS 84)")
arg(:latitude, non_null(:float), description: "Geographical latitude (using WGS 84)")
arg(:zoom, :integer, default_value: 15, description: "Zoom level")
arg(:locale, :string,
default_value: "en",
description: "The user's locale. Geocoding backends will make use of this value."
)
resolve(&Address.reverse_geocode/3)
end