Skip to main content

Crate bibby

Crate bibby 

Source
Expand description

§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 developer product:

ServiceAccessorWhat it does
GeoBibby::geoIPv4/IPv6 geolocation, SVG maps, random IPs, corrections
ImagesBibby::imagesResize, crop, transform, vectorize, analyze, icons, diff, QR codes
PDFBibby::pdfHTML/CSS (MiniJinja) and live URL to PDF rendering
MailerBibby::mailerTransactional email sending (with idempotency) and email validation
UploaderBibby::uploaderPrivate/public file storage, signed URLs, share links, one-time upload links
CronBibby::cronScheduled UTC HTTP jobs, manual runs, run history, schedule previews
FormsBibby::formsHTML form backends, submissions, CSV export
WebhooksBibby::webhooksSigned outgoing webhooks, event publishing, replay, HMAC verification
MonitorsBibby::monitorsUptime monitors, on-demand checks, 90-day status summaries, incidents, heartbeats
VaultBibby::vaultEncrypted 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():

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

Re-exports§

pub use error::Error;
pub use error::Result;
pub use pagination::Page;
pub use pagination::PageParams;
pub use services::cron;
pub use services::forms;
pub use services::geo;
pub use services::images;
pub use services::mailer;
pub use services::monitors;
pub use services::pdf;
pub use services::uploader;
pub use services::vault;
pub use services::webhooks;

Modules§

error
Error types returned by the Bytebury SDK.
pagination
Shared pagination types used across Bytebury list endpoints.
prelude
Convenient re-exports for common Bytebury SDK types and macros.
services
Service clients and request/response models for every Bytebury product.

Macros§

email
Builds a SendEmailRequest with concise syntax.
headers
Builds a BTreeMap<String, String> of HTTP headers for Cron jobs, Webhook endpoints, and Uptime monitors.
image_ops
Builds a Vec<Operation> pipeline for Bytebury Images.
pdf
Builds a RenderPdfRequest with inline template data and ergonomic options.
vault_ref
Formats a Bytebury Vault secret placeholder ({{vault:project/environment/KEY}}) for use inside Cron, Webhook, and Monitor headers.
webhook_event
Builds a PublishEventRequest with an inline JSON payload.

Structs§

Bibby
The main Bytebury SDK client.
BibbyBuilder
Builder for customizing a Bibby client.

Constants§

API_TOKEN_ENV
Default environment variable read by Bibby::init.
API_URL_ENV
Optional environment variable checked by Bibby::init to override DEFAULT_BASE_URL.
DEFAULT_BASE_URL
Default base URL for the Bytebury public API gateway.