โ ๏ธ Unfortunately, Trefle API is over/down for now.From their README.md: We didn't got the time or the means to keep the Trefle API online any longer, so after spending months figuring out a solution, we decided to stop there. It has been a great adventure, and we are forever grateful for your support and feedback ๐
Trefle API Wrapper for Elixir, built for ease of use, with some cool helper methods to easily handle pagination. Currently supports Trefle on v1.6.0.
The package can be installed by adding trifolium
to your list of dependencies in mix.exs
:
def deps do
[
{:trifolium, "~> 0.1.0"}
]
end
The docs can be found on HexDocs.
defmodule YourApp.Trefle
alias Trifolium.Endpoints.Plants
def get_plant(id) do
Plants.find(id)
end
def search_umid_plants(query) do
Plants.search(q: query, filter: %{umidity: "20, 50"})
# You could use umidity as an array and we would parse it
end
end
For pagination you can use:
defmodule YourApp.Trefle
alias Trifolium.Endpoints.Plants
def get_two_plants_pages(page) do
page_1 = Plants.all(page: page)
next_page = Trifolium.Navigation.next(page_1)
{page_1, next_page}
end
end
For every available method, please check our documentation on HexDocs.
This library is not affiliated in any way to the original Trefle project, and we do not provide warranty of any kind that it will continue working with the latest Trefle version, as they could introduce breaking changes. For further information, please visit our LICENSE.