   """
   @spec all_recipients(integer, integer, integer) :: list(%{}) | :error
   def all_recipients(list_id, page \\ 1, page_size \\ 100) do
-    SendGrid.get(@base_api_url <> "/#{list_id}/recipients?page_size=#{page_size}&page=#{page}")
-    |> case do
-      { :ok, %{ status_code: 200, body: body } } -> body["recipients"]
+    url = @base_api_url <> "/#{list_id}/recipients?page_size=#{page_size}&page=#{page}"
+    case SendGrid.get(url) do
+      {:ok, %{status_code: 200, body: body}} -> body["recipients"]
       _ -> :error
     end
   end

  Deletes a recipient from an email list.

      :ok = delete_recipient(123, "recipient_id")
  """
  @spec delete_recipient(integer, String.t) :: :ok | :error
  def delete_recipient(list_id, recipient_id) do
    SendGrid.delete(@base_api_url <> "/#{list_id}/recipients/#{recipient_id}", %{})
    |> case do
      { :ok, %{ status_code: 204 } } -> :ok
      _ -> :error
    end
  end


  @base_api_url "/v3/contactdb/lists"

  @doc """
  Retrieves all email lists.
  """
  @spec all() :: list(%{}) | :error
  def all() do
    case SendGrid.get(@base_api_url) do
      {:ok, %{status_code: 200, body: body}} -> body["lists"]
      _ -> :error
    end
  end
