Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class SupabaseStorage

  1. Object
  2. SupabaseStorage
Supabase Storage: upload, download and remove objects in buckets, and build public URLs for public buckets.

Methods

public AsyncResource<Map<String, Object>> upload(String bucket, String path, byte[] data, String contentType, boolean upsert)Uploads an object.
public AsyncResource<byte[]> download(String bucket, String path)Downloads an object with the current user’s credentials.
public AsyncResource<Boolean> remove(String bucket, String... paths)Removes objects from a bucket.
public String getPublicUrl(String bucket, String path)The URL of an object in a public bucket.

Inherited methods

Method details

upload

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

Parameters

bucket String
the bucket
path String
the object path inside the bucket, folder/file.png
data byte[]
the content
contentType String
the MIME type
upsert boolean
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 String
the bucket
path String
the object path

Returns

the bytes

remove

public AsyncResource<Boolean> remove(String bucket, String... paths)
Removes objects from a bucket.

Parameters

bucket String
the bucket
paths String...
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 String
the bucket
path String
the object path

Returns

the URL