danielberkompas / ex_twilio

Twilio API client for Elixir
MIT License
336 stars 147 forks source link

Incorrect spec for find functions #172

Open al2o3cr opened 2 years ago

al2o3cr commented 2 years ago

ExTwilio.Resource creates a find/2 function with a return type of Parser.parsed_list_response():

https://github.com/danielberkompas/ex_twilio/blob/master/lib/ex_twilio/resource.ex#L60-L63

but the function it calls (ExTwilio.Api.find/3) returns a Parser.parsed_response:

https://github.com/danielberkompas/ex_twilio/blob/master/lib/ex_twilio/api.ex#L47-L53

This causes Dialyzer failures on working code like:

    case IncomingPhoneNumber.find(sid, opts) do
      {:ok, _} ->
        update_query =
          from(n in TwilioNumber,
            where: n.id == ^id,
            update: [set: [released?: false, campaign_id: nil]]
          )

        Repo.update_all(update_query, [])

        :ok

      _ ->
        :not_updated