lib/easypost.ex

defmodule EasyPost do
  alias EasyPost.{ Config, Request }

  @type http_headers_t ::
          [{ String.t(), String.t() }]

  @type http_method_t ::
          :delete | :get | :post | :put

  @type response_t ::
          { :ok, EasyPost.Response.t() } | { :error, EasyPost.Response.t() | any }

  @doc """
  Send an HTTP request to the EasyPost API.
  """
  @spec request(EasyPost.Operation.t(), map) :: response_t
  def request(operation, config) do
    Request.send(operation, Config.new(config))
  end
end