allscreenshots_sdk/
lib.rs

1//! # Allscreenshots SDK
2//!
3//! Official Rust SDK for the Allscreenshots API - capture website screenshots programmatically.
4//!
5//! ## Quick start
6//!
7//! ```rust,no_run
8//! use allscreenshots_sdk::{AllscreenshotsClient, ScreenshotRequest};
9//!
10//! #[tokio::main]
11//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
12//!     // Create client (reads API key from ALLSCREENSHOTS_API_KEY env var)
13//!     let client = AllscreenshotsClient::from_env()?;
14//!
15//!     // Take a screenshot
16//!     let request = ScreenshotRequest::builder()
17//!         .url("https://github.com")
18//!         .device("Desktop HD")
19//!         .build()?;
20//!
21//!     let image_bytes = client.screenshot(&request).await?;
22//!     std::fs::write("screenshot.png", &image_bytes)?;
23//!
24//!     Ok(())
25//! }
26//! ```
27//!
28//! ## Configuration
29//!
30//! ```rust,no_run
31//! use allscreenshots_sdk::AllscreenshotsClient;
32//! use std::time::Duration;
33//!
34//! let client = AllscreenshotsClient::builder()
35//!     .api_key("your-api-key")
36//!     .base_url("https://api.allscreenshots.com")
37//!     .timeout(Duration::from_secs(60))
38//!     .max_retries(3)
39//!     .build()?;
40//! # Ok::<(), allscreenshots_sdk::AllscreenshotsError>(())
41//! ```
42
43pub mod client;
44pub mod error;
45pub mod models;
46mod retry;
47
48pub use client::{AllscreenshotsClient, AllscreenshotsClientBuilder};
49pub use error::{AllscreenshotsError, ErrorCode};
50pub use models::*;