First pass at uniformed types, specs and docs

- spec public functions (skipping controllers, views, live views and
components)
- use types instead of explanations in docs
- remove redundant docs
- fix typos
This commit is contained in:
Claudio Ortolina
2026-03-06 08:33:11 +00:00
parent 99e30d5fdf
commit 7cf9b4e7f8
81 changed files with 652 additions and 300 deletions
+4
View File
@@ -5,6 +5,8 @@ defmodule BraveSearch.API do
require Logger
@spec search_images(String.t(), keyword(), BraveSearch.Config.t()) ::
{:ok, [map()]} | {:error, term()}
def search_images(query, opts, config) do
params = [q: query, count: Keyword.get(opts, :count, 20)]
@@ -34,6 +36,8 @@ defmodule BraveSearch.API do
end
end
@spec download_image(String.t(), BraveSearch.Config.t()) ::
{:ok, binary()} | {:error, :download_failed}
def download_image(url, config) do
case Req.new(url: url, max_retries: 1, user_agent: config.user_agent)
|> Req.Request.merge_options(config.req_options)