defmodule Codat do @moduledoc """ Production-grade Elixir client for the Codat API. ## Quick Start client = Codat.client() {:ok, company} = Codat.Platform.Companies.create(client, %{name: "Acme Corp"}) redirect_to(company["redirect"]) {:ok, page} = Codat.Accounting.Invoices.list(client, company["id"]) ## Configuration config :codat, api_key: System.get_env("CODAT_API_KEY"), http_timeout: 30_000, max_retries: 3 """ alias Codat.Client alias Codat.Config @doc "Creates a `%Codat.Client{}` using application config and environment." @spec client() :: Client.t() def client, do: Client.new() @doc "Creates a `%Codat.Client{}` with the given options." @spec client(keyword()) :: Client.t() def client(opts) when is_list(opts), do: Client.new(opts) @doc "Returns the current application configuration." @spec config() :: Config.t() def config, do: Config.new() @doc "Returns the version of the `codat` hex package." @spec version() :: String.t() def version do :codat |> Application.spec(:vsn) |> to_string() end end