Baserow-rs
Baserow-rs is a Rust client for the Baserow API. It provides a comprehensive set of features for interacting with Baserow tables, including CRUD operations and file management.
Authentication
Baserow supports two authentication methods:
- API Key (for server-to-server communication)
- JWT Token (for client-to-server communication)
Note: Some endpoints require a JWT token, some require an API key, and some require both.
Authentication (API Key)
let configuration = new
.base_url
.api_key
.build;
let baserow = with_configuration;
Authentication (JWT Token)
let configuration = new
.base_url
.email
.password
.build;
let baserow = with_configuration;
baserow.token_auth.await?;
Table Operations
Retrieve Table Rows
let baserow = with_configuration;
// retrieve rows from a table
let rows = baserow
.table_by_id
.rows
.filter_by
.order_by
.get
.await?;
Create a Row
let mut record: = new;
record.insert;
let row = baserow.table_by_id.create_one.await?;
Update a Row
let mut record: = new;
record.insert;
let updated_row = baserow.table_by_id.update.await?;
Get Table Fields
let fields = baserow.table_fields.await?;
Map Rows to Structs
You can map table rows directly to your own structs using serde's Deserialize:
use Deserialize;
use ;
// First auto_map the table to ensure field mappings are available
let table = baserow.table_by_id.auto_map.await?;
// Get a single row and deserialize it into your struct
let user: User = table.clone..await?;
println!;
// Query multiple rows with filtering, sorting, and pagination
let response = table.clone
.rows
.page_size // Get 10 rows per page
.filter_by // Only users over 18
.order_by // Sort by name
.
.await?;
println!;
for user in response.results
The field names in your struct should match the column names in your Baserow table. Use Option<T>
for nullable fields. Remember to clone the table when using it multiple times, as operations consume the table instance.
File Operations
Upload a File
let file = open.unwrap;
let result = baserow.upload_file.await?;
Upload a File via URL
let result = baserow.upload_file_via_url.await?;
License
Apache 2.0