screenshotbase-sdk 0.1.0

Rust client for the screenshotbase.com API (status and website rendering).
Documentation
# screenshotbase (Rust)

Rust client for the `screenshotbase.com` API to:
- Retrieve API status and quota
- Take a website screenshot to image/PDF bytes

API docs: `https://screenshotbase.com/docs/`
Register API key: `https://screenshotbase.com`

## Features

- Async client via `reqwest`
- Optional blocking client behind `blocking` feature
- Configurable `base_url` (defaults to `https://api.screenshotbase.com`)
- Authentication via `X-API-Key` header and `api_key` query param

## Install

```toml
[dependencies]
screenshotbase-sdk = "0.1.0"
```

Or from your own registry/workspace as desired.

Enable blocking client:

```toml
[dependencies]
screenshotbase-sdk = { version = "0.1.0", features = ["blocking"] }
```

## Quickstart (async)

```rust
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = std::env::var("SCREENSHOTBASE_API_KEY")?;
    let client = screenshotbase_sdk::client::ScreenshotbaseClient::new(api_key)?;

    // Status
    let status = client.get_status().await?;
    println!("Plan: {:?}, Quota used: {:?}", status.plan, status.quota_used);

    // Take website screenshot
    let result = client
        .take_screenshot(
            "https://example.com",
            screenshotbase_sdk::types::RenderOptions {
                format: Some(screenshotbase_sdk::types::ImageFormat::Png),
                full_page: Some(true),
                width: Some(1280),
                height: Some(800),
                ..Default::default()
            },
        )
        .await?;
    println!("Content-Type: {:?}", result.content_type);
    println!("Received {} bytes", result.bytes.len());
    Ok(())
}
```

## Blocking

```rust
fn main() -> Result<(), Box<dyn std::error::Error>> {
    #[cfg(feature = "blocking")]
    {
        let api_key = std::env::var("SCREENSHOTBASE_API_KEY")?;
        let client = screenshotbase_sdk::client::ScreenshotbaseBlockingClient::new(api_key)?;
        let status = client.get_status()?;
        println!("Plan: {:?}", status.plan);
        let _result = client.take_screenshot("https://example.com", screenshotbase_sdk::types::RenderOptions::default())?;
    }
    Ok(())
}
```

## Notes

- Endpoints implemented:
  - `GET /v1/status`
  - `GET /v1/take?url=...` with additional query parameters from `RenderOptions`
- The default base URL is `https://api.screenshotbase.com`; override with `.with_base_url(...)` if necessary.
- Authentication uses `X-API-Key` header and also appends `api_key` as a query parameter for compatibility.

Refer to the official docs for details and the latest parameters: `https://screenshotbase.com/docs/`

## License

MIT