marcelog / elixir_ami

An Elixir AMI client
Apache License 2.0
13 stars 8 forks source link

Wrong return type on new action (?) #2

Closed thomasvargiu closed 6 years ago

thomasvargiu commented 6 years ago

The return value in spec for the new function on ElixirAmi.Action is defined as t.Should it be ElixirAmi.Action?

Same thing for all the functions that calls new function.

https://github.com/marcelog/elixir_ami/blob/a42998e2363c95d562e0c650fe761d7c7cdf94e2/lib/elixir_ami/action.ex#L403-L404

Running dyalizer on a function like this:

  @doc """
  Login an agent
  """
  @spec login(GenServer.server, String.t) :: {:ok, String.t} | {:error, String.t}
  def login(source, extension) do
     AmiConn.send_action source, Action.new(
      "Originate",
      %{
        channel: "Local/#{extension}@from-internal/n",
        exten: extension,
        context: "agent-login",
        async: "yes",
      },
      %{}
    )
      |> handle_response()
  end

it says:

The call 'Elixir.ElixirAmi.Connection':send_action(Vsource@1::any(),{'error',_}) breaks the contract 
('Elixir.GenServer':server(),'Elixir.ElixirAmi.Action':t()) -> 'Elixir.ElixirAmi.Response':t()

If confirmed, I could open a PR.

thomasvargiu commented 6 years ago

Nevermind. I'm new programming with elixir.