Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/cloudex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ defmodule Cloudex do
@spec start(settings :: map) :: {:ok, pid}
defdelegate start(settings), to: Cloudex.Settings

@type upload_result ::
{:ok, Cloudex.UploadedImage.t()}
| {:error, any}
| [{:ok, Cloudex.UploadedImage.t()} | {:error, any}]
@type upload_result :: {:ok, Cloudex.UploadedImage.t()} | {:error, any}

@doc ~S"""
Uploads a (list of) image file(s) and/or url(s) to cloudinary
"""
@spec upload(list | String.t()) :: upload_result
@spec upload(list | [String.t()], map) :: upload_result
@spec upload(list | String.t(), map) :: upload_result
@spec upload(list | [String.t()], map) :: [upload_result]
def upload(list, options \\ %{}) do
sanitized_list = sanitize_list(list)
invalid_list = Enum.filter(sanitized_list, &match?({:error, _}, &1))
Expand Down