Trifolium 🍀
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.
Installation 💻
The package can be installed by adding trifolium to your list of dependencies in mix.exs:
def deps do
[
{:trifolium, "~> 0.1.0"}
]
endThe docs can be found on HexDocs.
Usage ⌨️
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
endFor 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
endFor every available method, please check our documentation on HexDocs.
Disclaimer ⚠️
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.