EdgeQuake Rust SDK
Production-ready async Rust client for the EdgeQuake RAG API.
Features
- Async/await — built on
reqwest+tokio - Builder pattern — fluent client configuration
- Thread-safe —
Clone + Send + SyncviaArcinternals - Automatic retry — exponential backoff on 429/5xx
- Multi-tenant — first-class tenant + workspace headers
- 22 resources — full API coverage
- Strong types — typed request/response structs with
serde - Rich errors —
thiserrorvariants withstatus_code()+is_retryable()
Installation
Add to your Cargo.toml:
[]
= { = "https://github.com/raphaelmansuy/edgequake", = "sdks/rust" }
= { = "1", = ["full"] }
Quick Start
use EdgeQuakeClient;
async
Client Configuration
| Method | Description | Default |
|---|---|---|
.base_url(url) |
API server URL | http://localhost:8080 |
.api_key(key) |
API key (X-API-Key header) | None |
.bearer_token(token) |
JWT token (Authorization: Bearer) | None |
.tenant_id(id) |
Tenant ID header | None |
.workspace_id(id) |
Workspace ID header | None |
.timeout(duration) |
Request timeout | 30s |
.connect_timeout(duration) |
Connection timeout | 5s |
.max_retries(n) |
Max retry attempts on 429/5xx | 3 |
.user_agent(ua) |
Custom User-Agent string | edgequake-rust/{version} |
use Duration;
let client = builder
.base_url
.api_key
.tenant_id
.workspace_id
.timeout
.max_retries
.build?;
API Reference
Health
let health = client.health.check.await?;
println!;
Documents
// List documents
let docs = client.documents.list.await?;
// Get document by ID
let doc = client.documents.get.await?;
// Upload text content
let body = json!;
let result = client.documents.upload_text.await?;
// Track processing status
let status = client.documents.track.await?;
println!;
// Status check
let s = client.documents.status.await?;
// Delete document
client.documents.delete.await?;
Graph
// Get full graph
let graph = client.graph.get.await?;
println!;
// Search nodes
let results = client.graph.search.await?;
Entities
use CreateEntityRequest;
// List entities
let entities = client.entities.list.await?;
// Get entity detail
let entity = client.entities.get.await?;
// Create entity
let req = CreateEntityRequest ;
let result = client.entities.create.await?;
// Merge entities
let merged = client.entities.merge.await?;
// Delete entity
client.entities.delete.await?;
Relationships
use CreateRelationshipRequest;
// List relationships
let rels = client.relationships.list.await?;
// Create relationship
let req = CreateRelationshipRequest ;
let rel = client.relationships.create.await?;
// Delete relationship
client.relationships.delete.await?;
Query
use ;
let req = QueryRequest ;
let response = client.query.execute.await?;
println!;
Chat
use ;
let req = ChatCompletionRequest ;
let response = client.chat.completions.await?;
Auth
use ;
// Login
let token = client.auth.login.await?;
// Get current user
let me = client.auth.me.await?;
// Refresh token
let new_token = client.auth.refresh.await?;
Users
use CreateUserRequest;
let users = client.users.list.await?;
let user = client.users.create.await?;
let user = client.users.get.await?;
client.users.delete.await?;
API Keys
let keys = client.api_keys.list.await?;
let key = client.api_keys.create.await?;
client.api_keys.revoke.await?;
Tenants
use CreateTenantRequest;
let tenants = client.tenants.list.await?;
let tenant = client.tenants.create.await?;
let tenant = client.tenants.get.await?;
client.tenants.delete.await?;
Conversations
use *;
let convos = client.conversations.list.await?;
let convo = client.conversations.create.await?;
let detail = client.conversations.get.await?;
// Send a message
let msg = client.conversations.create_message.await?;
// Share conversation
let share = client.conversations.share.await?;
// Bulk delete
let result = client.conversations.bulk_delete.await?;
// Pin/unpin
client.conversations.pin.await?;
client.conversations.unpin.await?;
// Delete
client.conversations.delete.await?;
Folders
use CreateFolderRequest;
let folders = client.folders.list.await?;
let folder = client.folders.create.await?;
client.folders.delete.await?;
Tasks
let tasks = client.tasks.list.await?;
let task = client.tasks.get.await?;
client.tasks.cancel.await?;
Pipeline
let status = client.pipeline.status.await?;
println!;
let metrics = client.pipeline.metrics.await?;
println!;
Costs
let summary = client.costs.summary.await?;
println!;
let history = client.costs.history.await?;
let budget = client.costs.budget.await?;
Chunks
let chunks = client.chunks.list.await?;
let chunk = client.chunks.get.await?;
Provenance
let records = client.provenance.for_entity.await?;
let lineage = client.provenance.lineage.await?;
Models
let catalog = client.models.list.await?;
let provider = client.models.current_provider.await?;
let health = client.models.providers_health.await?;
let status = client.models.set_provider.await?;
Workspaces
use CreateWorkspaceRequest;
let workspaces = client.workspaces.list.await?;
let ws = client.workspaces.create.await?;
let stats = client.workspaces.stats.await?;
let progress = client.pdf.progress.await?;
let content = client.pdf.content.await?;
Error Handling
All methods return edgequake_sdk::Result<T>. Errors are strongly typed:
use Error;
match client.documents.get.await
Error Variants
| Variant | HTTP Status | Description |
|---|---|---|
BadRequest |
400 | Invalid request parameters |
Unauthorized |
401 | Authentication failed |
Forbidden |
403 | Permission denied |
NotFound |
404 | Resource not found |
Conflict |
409 | Resource conflict |
Validation |
422 | Validation error |
RateLimited |
429 | Rate limit exceeded |
Server |
5xx | Server error |
Network |
— | Transport error |
Json |
— | Serialization error |
Url |
— | URL parsing error |
Config |
— | Configuration error |
Timeout |
— | Operation timeout |
Retry Behavior
The client automatically retries on:
- 429 Too Many Requests
- 500, 502, 503, 504 Server Errors
- Network errors (connection timeouts, etc.)
Default: 3 retries with 500ms base exponential backoff (500ms → 1s → 2s).
Testing
# Run unit + integration tests (uses wiremock, no server needed)
# Run E2E tests against a live server
EDGEQUAKE_BASE_URL=http://localhost:8080
License
Apache-2.0 — see LICENSE.