FdcEx (fdc-ex v0.1.0) View Source

Documentation for FdcEx.

Link to this section Summary

Functions

Fetches details for multiple food items using input FDC IDs

Fetches details for one food item by FDC ID

Link to this section Functions

Link to this function

fetch_many(fdc_ids, format \\ "full", nutrients \\ [])

View Source

Fetches details for multiple food items using input FDC IDs

Link to this function

fetch_one(fdc_id, format \\ "full", nutrients \\ [])

View Source

Specs

fetch_one(any(), any(), any()) ::
  {:error, HTTPoison.Error.t()}
  | {:ok,
     %{
       :__struct__ => HTTPoison.AsyncResponse | HTTPoison.Response,
       optional(:body) => any(),
       optional(:headers) => list(),
       optional(:id) => reference(),
       optional(:request) => HTTPoison.Request.t(),
       optional(:request_url) => any(),
       optional(:status_code) => integer()
     }}

Fetches details for one food item by FDC ID

Link to this function

fetch_pages(data_type \\ [], page_size \\ 50, page_number \\ 1, sort_by \\ "", sort_order \\ "")

View Source

Returns a paged list of foods, in the 'abridged' format

Specs

get_spec(:json | :yaml) :: %{
  :__struct__ => HTTPoison.AsyncResponse | HTTPoison.Response,
  optional(:body) => any(),
  optional(:headers) => list(),
  optional(:id) => reference(),
  optional(:request) => HTTPoison.Request.t(),
  optional(:request_url) => any(),
  optional(:status_code) => integer()
}
Link to this function

search(query, data_type \\ [], page_size \\ 50, sort_by \\ "", sort_order \\ "", brand_owner \\ "")

View Source

Specs

search(any(), any(), any(), any(), any(), any()) :: :results

Returns a list of foods that matched search (query) keywords