supabase / supabase-swift

A Swift client for Supabase
https://supabase.com/docs/reference/swift
MIT License
727 stars 111 forks source link

Upload file result #604

Open arbyruns opened 1 week ago

arbyruns commented 1 week ago

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.