Skip to main content

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.

Requirements

  • Rust 1.85+
  • Tokio async runtime

Install

Add to your Cargo.toml:
[dependencies]
law4devs = "0.1"
tokio    = { version = "1", features = ["full"] }
futures  = "0.3"
Or use cargo add:
cargo add law4devs
cargo add tokio --features full
cargo add futures

First Call

use law4devs::Law4DevsClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Law4DevsClient::new();
    let page = client.frameworks.list(None, None).await?;
    println!("{} frameworks", page.meta.total);
    Ok(())
}

Configuration

use std::time::Duration;
use law4devs::Law4DevsClient;

let client = Law4DevsClient::builder()
    .api_key(std::env::var("LAW4DEVS_API_KEY").unwrap_or_default())
    .base_url("https://api.law4devs.eu/v1") // default
    .timeout(Duration::from_secs(30))           // default
    .max_retries(3)                             // retries on 429/5xx
    .build();
OptionTypeDefaultDescription
api_key&strNoneYour API key (required for authenticated endpoints)
base_url&strProduction URLOverride for dev/staging environment
timeoutDuration30 secondsPer-request HTTP timeout
max_retriesu323Retries on 429/5xx with exponential backoff

Environment Variable

export LAW4DEVS_API_KEY="your-key"
let client = Law4DevsClient::builder()
    .api_key(std::env::var("LAW4DEVS_API_KEY").unwrap_or_default())
    .build();
Never hardcode your API key in source code or commit it to version control.

Verify the Install

// src/main.rs
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();
    let page = client.frameworks.list(None, None).await?;
    println!("{} frameworks", page.meta.total);
    Ok(())
}
LAW4DEVS_API_KEY=your-key cargo run
# → 19 frameworks