From c42db45800425e3ebf84ec246927738717615059 Mon Sep 17 00:00:00 2001 From: Neil Berkman Date: Sun, 29 Dec 2024 09:37:03 -0800 Subject: [PATCH] correct type specs and add dialyzer configuration - Update @specs in APIClient and Connection to match actual returns - Add dialyzer config to handle generated code warnings --- .dialyzer_ignore.exs | 3 +++ lib/docusign/api_client.ex | 5 +++-- lib/docusign/connection.ex | 2 +- mix.exs | 6 +++++- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .dialyzer_ignore.exs diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs new file mode 100644 index 0000000..d32c36a --- /dev/null +++ b/.dialyzer_ignore.exs @@ -0,0 +1,3 @@ +[ + ~r/lib\/docusign\/api\/.*/ +] diff --git a/lib/docusign/api_client.ex b/lib/docusign/api_client.ex index f58daf4..c3170c3 100644 --- a/lib/docusign/api_client.ex +++ b/lib/docusign/api_client.ex @@ -3,13 +3,14 @@ defmodule DocuSign.APIClient do Deprecated interface to manage OAuth2 clients. `DocuSign.ClientRegistry` should be used instead. """ + alias DocuSign.ClientRegistry @doc """ Get Api Client """ @deprecated "Use DocuSign.ClientRegistry.client/1 instead." - @spec client() :: OAuth2.Client.t() + @spec client() :: {:ok, OAuth2.Client.t()} | {:error, any()} def client do ClientRegistry.client(default_user_id()) end @@ -18,7 +19,7 @@ defmodule DocuSign.APIClient do Forces an access token refresh. """ @deprecated "Use DocuSign.ClientRegistry.refresh_token/1 instead." - @spec refresh_token() :: OAuth2.Client.t() + @spec refresh_token() :: {:ok, OAuth2.Client.t()} | {:error, any()} def refresh_token do # TO BE IMPLEMENTED # ClientRegistry.refresh_token(default_user_id()) diff --git a/lib/docusign/connection.ex b/lib/docusign/connection.ex index 6d45036..514c0bc 100644 --- a/lib/docusign/connection.ex +++ b/lib/docusign/connection.ex @@ -130,7 +130,7 @@ defmodule DocuSign.Connection do @doc """ Makes a request. """ - @spec request(t(), Keyword.t()) :: OAuth2.Response.t() + @spec request(t(), Keyword.t()) :: {:ok, OAuth2.Response.t()} | {:error, Tesla.Env.t()} def request(conn, opts \\ []) do timeout = Application.get_env(:docusign, :timeout, @timeout) opts = opts |> Keyword.merge(opts: [adapter: [timeout: timeout]]) diff --git a/mix.exs b/mix.exs index ad2f272..4a25a26 100644 --- a/mix.exs +++ b/mix.exs @@ -21,7 +21,11 @@ defmodule DocuSign.MixProject do homepage_url: @url, deps: deps(), elixirc_paths: elixirc_paths(Mix.env()), - docs: docs() + docs: docs(), + dialyzer: [ + ignore_warnings: ".dialyzer_ignore.exs", + plt_add_apps: [:mix] + ] ] end