Simple library to connect ESP32/8266 to Supabase via REST API, including user authentication
This library is available at Arduino's Library Manager, as well as PlatformIO Library Manager
See all examples in examples
folder
Method | Description |
---|---|
login_email(String email_a, String password_a) |
(OPTIONAL, ONLY IF USING RLS), Returns http response code int |
login_phone(String phone_a, String password_a) |
(OPTIONAL, ONLY IF USING RLS), Returns http response code int |
begin(String url_a, String key_a); |
url_a is a Supabase URL and key_a is supabase anon key. Returns void |
insert(String table, String json, bool upsert) |
Returns http response code int . If you want to do upsert, set third parameter to true |
.doSelect() |
Called at the end of select query chain. Returns HTTP response payload (your data) from Supabase String |
.doUpdate(String json) |
Called at the end of update query chain. Returns HTTP response code from Supabase int |
When building the queries, you can chain the method like in this example.
Remember in
.select()
method, you have to put.limit()
, so your microcontroller's memory don't get overflowed
String read = db.from("table").select("*").eq("column", "value").order("column", "asc", true).limit(1).doSelect();
Methods | Description |
---|---|
.from(String table); |
Specify which table you want to query. It will append ?table_name in Request URL |
.select(String colls); |
Specify that you want to do select query. It will append &select=colls in Request URL |
.update(String table); |
Specify that you want to do update query. It will append &update in Request URL |
Methods | Description |
---|---|
.eq(String colls, String value) |
Equals |
.gt(String colls, String value) |
Greater than |
.gte(String colls, String value) |
Greater than or equal |
.lt(String colls, String value) |
Less than |
.lte(String colls, String value) |
Less than or equal |
.neq(String colls, String value) |
Not equal |
.in(String colls, String value) |
One of a list of values, e.g. 1,2,3 – also supports commas in quoted strings like "hi,there","yes,you" |
.is(String colls, String value) |
Checking for exact equality <null, true, false, unknown> |
.cs(String colls, String value) |
Contains e.g. example, new |
.cd(String colls, String value) |
Contained in e.g. 1, 2, 3 |
.ov(String colls, String value) |
Overlap (have points in common), e.g. 2017-01-01, 2017-06-30 |
.sl(String colls, String value) |
Strictly left of, e.g. 1,10 |
.sr(String colls, String value) |
Strictly right of |
.nxr(String colls, String value) |
Does not extend to the right of, e.g. 1,10 |
.nxl(String colls, String value) |
Does not extend to the left of |
.adj(String colls, String value) |
Is adjacent to, e.g. 1,10 |
Methods | Description |
---|---|
.order(String coll, String by, bool nulls); |
This reorders the response rows. coll parameter is column name, by parameter is either asc or desc . The last parameter specifies the position of nulls, nullsfirst or nullslast |
.limit(unsigned int by); |
Limit the amount of response rows. THIS IS MANDATORY FOR SELECT METHOD!!! |
.offset(int by); |
Request response rows with offset is with its parameters. |
db.urlQuery_reset();
This method calls in mandatory, must be called after one opetation (let's say doSelect()
, or doUpdate()
) before doing anything else.
db.urlQuery_reset();
- Implement Supabase Realtime