supabase-swift icon indicating copy to clipboard operation
supabase-swift copied to clipboard

Upload file result

Open arbyruns opened this issue 11 months ago • 0 comments

Improve documentation

Link

https://supabase.com/docs/reference/swift/storage-from-download

Describe the problem

The documentation for file upload does not describe what the result looks like for a success or a failure. This makes it unclear what developers can expect from the API and how to handle the response effectively.

For example, using the following Swift code:

let fileName = "avatar1.png"

let result  = try await supabase.storage
  .from("avatars")
  .upload(
    path: "public/\(fileName)",
    file: fileData,
    options: FileOptions(
      cacheControl: "3600",
      contentType: "image/png",
      upsert: false
    )
  )

The result returned on success (I assume success) is:

(id = "8558a89d-9a60-4b74-9b09-5f007114cf9b", path = "Sample Title.jpg", fullPath = "storage/Sample Title.jpg")

Describe the improvement

However, there is no information on what the structure of the response will look like in the event of a failure, leaving developers uncertain about how to handle error scenarios.

Additional context

This creates a problem trying to do any follow up tasks based on a success or failure.

arbyruns avatar Nov 18 '24 18:11 arbyruns