bibby 0.1.0

The official Rust SDK for Bytebury — typed clients, smart .env initialization, and ergonomic macros for Geo, Images, PDF, Mailer, Uploader, Cron, Forms, Webhooks, Monitors, and Vault.
Documentation
//! # `bibby` — The Official Rust SDK for Bytebury
//!
//! `bibby` provides strongly-typed async clients, smart `.env` initialization,
//! constant-time webhook signature verification, and ergonomic macros for every
//! [Bytebury](https://bytebury.com) developer product:
//!
//! | Service | Accessor | What it does |
//! |---|---|---|
//! | **Geo** | [`Bibby::geo`] | IPv4/IPv6 geolocation, SVG maps, random IPs, corrections |
//! | **Images** | [`Bibby::images`] | Resize, crop, transform, background removal, vectorize, analyze, icons, diff, QR codes |
//! | **PDF** | [`Bibby::pdf`] | HTML/CSS (MiniJinja) and live URL to PDF rendering |
//! | **Mailer** | [`Bibby::mailer`] | Transactional email sending (with idempotency) and email validation |
//! | **Uploader** | [`Bibby::uploader`] | Private/public file storage, signed URLs, share links, one-time upload links |
//! | **Cron** | [`Bibby::cron`] | Scheduled UTC HTTP jobs, manual runs, run history, schedule previews |
//! | **Forms** | [`Bibby::forms`] | HTML form backends, submissions, CSV export |
//! | **Webhooks** | [`Bibby::webhooks`] | Signed outgoing webhooks, event publishing, replay, HMAC verification |
//! | **Monitors** | [`Bibby::monitors`] | Uptime monitors, on-demand checks, 90-day status summaries, incidents, heartbeats |
//! | **Vault** | [`Bibby::vault`] | Encrypted secrets, `.env` import/export, versions, burn-after-reading shares |
//!
//! ## Smart `.env` Initialization
//!
//! Add `BYTEBURY_API_TOKEN=bb_live_...` to your `.env` file (or environment), then call
//! [`Bibby::init()`]:
//!
//! ```no_run
//! use bibby::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//!     // Automatically loads `.env` (if present) and reads `BYTEBURY_API_TOKEN`.
//!     // Optionally honors `BYTEBURY_API_URL` for local/staging gateways.
//!     let client = Bibby::init()?;
//!
//!     let geo = client.geo().lookup("1.1.1.1").await?;
//!     println!("{} — {}", geo.ip, geo.country.name);
//!
//!     let email = email! {
//!         to: "ada@example.com",
//!         subject: "Hello from Bibby",
//!         html: "<h1>Welcome to Bytebury!</h1>",
//!     };
//!     client.mailer().send(&email).await?;
//!
//!     Ok(())
//! }
//! ```
//!
//! ## Ergonomic Macros
//!
//! - [`email!`] — concise [`mailer::SendEmailRequest`] construction
//! - [`image_ops!`] — readable [`images::Operation`] pipeline DSL
//! - [`pdf!`] — concise [`pdf::RenderPdfRequest`] with inline JSON template data
//! - [`webhook_event!`] — concise [`webhooks::PublishEventRequest`] with inline JSON payload
//! - [`headers!`] — `BTreeMap<String, String>` header literal for Cron, Webhooks, and Monitors
//! - [`vault_ref!`] — builds `{{vault:project/environment/KEY}}` header placeholders

#![warn(missing_docs)]
#![forbid(unsafe_code)]

mod client;
pub mod error;
mod macros;
pub mod pagination;
pub mod prelude;
pub mod services;

pub use client::{API_TOKEN_ENV, API_URL_ENV, Bibby, BibbyBuilder, DEFAULT_BASE_URL};
pub use error::{Error, Result};
pub use pagination::{Page, PageParams};

// Re-export every service module at the crate root for ergonomic imports
// (e.g. `use bibby::geo::IpLocation;` or `use bibby::webhooks::verify_signature;`).
pub use services::{cron, forms, geo, images, mailer, monitors, pdf, uploader, vault, webhooks};

/// Hidden re-export used by declarative macros (`pdf!`, `webhook_event!`).
#[doc(hidden)]
pub use serde_json as __serde_json;