Class SupabaseStorage

java.lang.Object
com.codename1.cloud.supabase.SupabaseStorage

public class SupabaseStorage extends Object
Supabase Storage: upload, download and remove objects in buckets, and build public URLs for public buckets.
  • Method Details

    • upload

      public AsyncResource<Map<String,Object>> upload(String bucket, String path, byte[] data, String contentType, boolean upsert)

      Uploads an object.

      Parameters
      • bucket: the bucket

      • path: the object path inside the bucket, folder/file.png

      • data: the content

      • contentType: the MIME type

      • upsert: true to replace an existing object

      Returns

      the response, holding the object Key

    • download

      public AsyncResource<byte[]> download(String bucket, String path)

      Downloads an object with the current user's credentials.

      Parameters
      • bucket: the bucket

      • path: the object path

      Returns

      the bytes

    • remove

      public AsyncResource<Boolean> remove(String bucket, String... paths)

      Removes objects from a bucket.

      Parameters
      • bucket: the bucket

      • paths: the object paths

      Returns

      completes with true when the request succeeds

    • getPublicUrl

      public String getPublicUrl(String bucket, String path)

      The URL of an object in a public bucket. It makes no request.

      Parameters
      • bucket: the bucket

      • path: the object path

      Returns

      the URL