kpedrok / trifolium

Trefle API Wrapper for Elixir, built for ease of use, with some cool helper methods to easily handle pagination.

Home Page:https://hexdocs.pm/trifolium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trifolium 🍀

Trifolium Version 1.0.1 Trefle Version 1.6.0

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"}
  ]
end

The 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
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.

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.

Author 🧙‍♂️

About

Trefle API Wrapper for Elixir, built for ease of use, with some cool helper methods to easily handle pagination.

https://hexdocs.pm/trifolium

License:MIT License


Languages

Language:Elixir 100.0%