CouchDB (couchdb_auth v0.2.4)

View Source

Lightweight CouchDB client builder focused on authentication flows.

The module exposes helpers to build a pre-configured Tesla.Client alongside a thin wrapper around Tesla.request/2 to keep the original API surface available.

Summary

Types

interface()

@type interface() :: :base | :backend | :admin

Functions

admin_client(overrides \\ %{})

@spec admin_client(map()) :: Tesla.Client.t()

Convenience wrapper around client/2 for admin or cluster endpoints.

admin_delete(url, opts \\ [])

@spec admin_delete(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_get(url, opts \\ [])

@spec admin_get(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_head(url, opts \\ [])

@spec admin_head(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_options(url, opts \\ [])

@spec admin_options(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_patch(url, opts \\ [])

@spec admin_patch(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_post(url, opts \\ [])

@spec admin_post(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_put(url, opts \\ [])

@spec admin_put(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

admin_request(method, url, opts \\ [])

@spec admin_request(atom(), String.t(), keyword()) ::
  {:ok, Tesla.Env.t()} | {:error, any()}

Executes an HTTP request against the admin interface.

admin_trace(url, opts \\ [])

@spec admin_trace(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

client(interface \\ :base, overrides \\ %{})

@spec client(interface(), map()) :: Tesla.Client.t()

Build a Tesla.Client configured for the requested interface.

The interface can be :base (default), :backend, or :admin. Additional credential overrides may be supplied via overrides.

delete(url, opts \\ [])

@spec delete(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

get(url, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

head(url, opts \\ [])

@spec head(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

options(url, opts \\ [])

@spec options(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

patch(url, opts \\ [])

@spec patch(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

post(url, opts \\ [])

@spec post(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

put(url, opts \\ [])

@spec put(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

request(method, url, opts \\ [])

@spec request(atom(), String.t(), keyword()) :: {:ok, Tesla.Env.t()} | {:error, any()}

Executes an HTTP request using either the provided %Tesla.Client{} or a freshly built one.

trace(url, opts \\ [])

@spec trace(
  String.t(),
  keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}