Class Supabase

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

public class Supabase extends Object

A Supabase client in pure Java over the project's REST endpoints: PostgREST queries, GoTrue auth, Storage and Realtime.

Requests carry the anon key and, once a user signs in, the user's access token, so your row level security policies apply. An expired session is refreshed before a request, and a 401 refreshes it once and retries.

Supabase supabase = new Supabase("https://xyzcompany.supabase.co", "public-anon-key");
supabase.from("countries").select("id,name").eq("continent", "Europe").order("name", true).limit(10)
        .execute().ready(new SuccessCallback<List<Map<String, Object>>>() {
    public void onSucess(List<Map<String, Object>> rows) {
        Log.p("Got " + rows.size() + " countries");
    }
});
  • Constructor Details

    • Supabase

      public Supabase(String url, String anonKey)

      Creates a client.

      Parameters
      • url: the project URL, https://xyzcompany.supabase.co

      • anonKey: the project's anon (public) key

  • Method Details

    • getUrl

      public String getUrl()

      The project URL without a trailing slash.

      Returns

      the URL

    • getKey

      public String getKey()

      The anon key.

      Returns

      the key

    • setTransport

      public void setTransport(CloudHttpTransport transport)

      Replaces the HTTP transport, for tests or a custom stack.

      Parameters
      • transport: the transport
    • auth

      public SupabaseAuth auth()

      The GoTrue auth client.

      Returns

      the auth client

    • from

      public PostgrestQuery from(String table)

      Starts a PostgREST query or write on a table or view.

      Parameters
      • table: the table name
      Returns

      a new query builder

    • storage

      public SupabaseStorage storage()

      The Storage client.

      Returns

      the storage client

    • realtime

      public SupabaseRealtime realtime()

      The Realtime client.

      Returns

      the realtime client