Expand description
§arxivis
Official Rust SDK for the Arxivis document store.
§Quick start
use arxivis::{ArxivisClient, UploadOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ArxivisClient::new("http://localhost:8080", "axv_xxxx_yyyy")?;
// Upload a file
let data = std::fs::read("invoice.pdf")?;
let record = client
.upload(
data,
"invoice.pdf",
UploadOptions::new()
.path("/invoices/2024/")
.tags(vec!["cliente".into(), "enero".into()]),
)
.await?;
println!("stored: {} ({} bytes)", record.id, record.size);
// List files
let result = client.list("/invoices/2024/", Default::default()).await?;
for f in &result.files {
println!("{}", f.original_name);
}
// Download
let bytes = client.download(&record.id).await?;
std::fs::write("copy.pdf", &bytes)?;
// Delete
client.delete_file(&record.id).await?;
Ok(())
}Re-exports§
pub use client::ArxivisClient;pub use error::ArxivisError;pub use types::ApiKey;pub use types::CreateKeyResult;pub use types::FileRecord;pub use types::ListOptions;pub use types::ListResult;pub use types::SearchOptions;pub use types::SearchResult;pub use types::Stats;pub use types::UploadOptions;