summaryrefslogtreecommitdiff
path: root/lib/couch.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/couch.ex')
-rw-r--r--lib/couch.ex6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/couch.ex b/lib/couch.ex
index 50b031c..71f86a3 100644
--- a/lib/couch.ex
+++ b/lib/couch.ex
@@ -24,8 +24,10 @@ defmodule Couch do
`params` are [documented here](https://docs.couchdb.org/en/3.2.2-docs/api/document/common.html)
"""
- @spec get(String.t(), String.t(), Keyword.t()) :: {:ok, Map.t()} | {:error, :not_found} | {:error, any()}
- def get(db, doc, params \\ []) do
+ @spec get(String.t(), String.t() | :all_docs, Keyword.t()) :: {:ok, Map.t()} | {:error, :not_found} | {:error, any()}
+ def get(db, doc, params \\ [])
+ def get(db, :all_docs, params), do: get(db, "_all_docs", params)
+ def get(db, doc, params) do
{url, headers, options} = prepare_request([db, doc], [], params)
case HTTPoison.get(url, headers, options) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->