Documentation Index
Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt
Use this file to discover all available pages before exploring further.
Install
[dependencies]
law4devs = "0.1"
tokio = { version = "1", features = ["full"] }
futures = "0.3"
Basic Usage
use futures::StreamExt;
use law4devs::Law4DevsClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Law4DevsClient::builder()
.api_key(std::env::var("LAW4DEVS_API_KEY").unwrap_or_default())
.build();
// List all frameworks
let page = client.frameworks.list(None, None).await?;
for fw in &page.data {
println!("{} — {}", fw.slug, fw.name);
}
// List first 5 CRA articles
let articles = client.articles.list("cra", None, Some(5)).await?;
for a in &articles.data {
println!("Art. {}: {}", a.article_number, a.title);
}
// Auto-paginate all GDPR articles
let mut stream = Box::pin(client.articles.iter("gdpr", 20));
while let Some(result) = stream.next().await {
let a = result?;
println!("{} {}", a.article_number, a.title);
}
// Search across all frameworks
let results = client
.search
.query("data breach notification", None, None, None, None)
.await?;
println!("Found {} results", results.meta.total);
Ok(())
}
Next Steps