ex_twilio icon indicating copy to clipboard operation
ex_twilio copied to clipboard

Incorrect spec for find functions

Open al2o3cr opened this issue 2 years ago • 0 comments

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

al2o3cr avatar Apr 05 '22 16:04 al2o3cr