| Crates.io | scout_rs |
| lib.rs | scout_rs |
| version | 0.5.4 |
| created_at | 2025-07-01 01:48:20.701045+00 |
| updated_at | 2025-09-12 01:38:12.537206+00 |
| description | A Rust client for the Scout API that allows uploading events and images to the Scout database |
| homepage | |
| repository | https://github.com/Adventurous-Bytes/scout |
| max_upload_size | |
| id | 1732643 |
| size | 299,597 |
A Rust client for the Scout API that allows uploading events and images to the Scout database.
use scout_rs::client::ScoutClient;
// Create the client
let mut client = ScoutClient::new(
"https://api.example.com/api/scout".to_string(), // Now optional
"your_api_key_here".to_string()
)?;
// Identify device/herd and establish database connection directly from database
client.identify().await?;
// Now perform operations directly on the database via PostgREST
let event = Event::new(/* ... */);
let created_event = client.create_event(&event).await?;
let tags = vec![Tag::new(/* ... */)];
let created_tags = client.create_tags(created_event.id.unwrap(), &tags).await?;
Environment Variables Required:
SCOUT_DATABASE_REST_URL=https://your-db.supabase.co/rest/v1
SCOUT_DEVICE_API_KEY=your_device_api_key_here
Quick Setup:
env.example to .envThe Scout client has been completely refactored to use direct database access via PostgREST instead of HTTP API endpoints. This eliminates the need for "careful lockstep development" and provides:
Add to your Cargo.toml:
[dependencies]
scout_rs = "0.4.1"
Existing code continues to work without any changes! The client maintains the same public API:
ResponseScout<T> with status and data fieldsResponseScoutStatus::Success, ResponseScoutStatus::Failure, etc..data field as before// Your existing code works exactly the same
let response = client.get_device().await?;
if response.status == ResponseScoutStatus::Success {
if let Some(device) = response.data {
println!("Device: {}", device.name);
}
}
The only difference: Operations now go directly to the database instead of HTTP API endpoints, providing better performance and eliminating API dependencies.
See the examples directory for comprehensive usage examples including: