Skip to content

Commit

Permalink
correct type specs and add dialyzer configuration
Browse files Browse the repository at this point in the history
- Update @specs in APIClient and Connection to match actual returns
- Add dialyzer config to handle generated code warnings
  • Loading branch information
neilberkman committed Dec 29, 2024
1 parent 97ad934 commit c42db45
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
~r/lib\/docusign\/api\/.*/
]
5 changes: 3 additions & 2 deletions lib/docusign/api_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion lib/docusign/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
Expand Down
6 changes: 5 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c42db45

Please sign in to comment.