hookburn-core 0.2.2

Shared HTTP client and WebhookSender trait for the Hookburn crates
Documentation
// crates/hookburn-core/src/lib.rs

//! # Hookburn Core
//!
//! Shared types and traits for the hookburn webhook ecosystem.
//!
//! This crate provides the foundation for building webhook clients that work
//! with multiple services (Discord, Slack, Teams, etc.). It defines common
//! interfaces, message types, and utilities that service crates can implement.
//!
//! # Features
//!
//! - **Unified API**: Send messages to any webhook service through a common trait
//! - **Generic Messages**: Service-agnostic message types with conversion support
//! - **Service Registry**: Discover and create webhook clients dynamically
//! - **Retry Policies**: Automatic retries with exponential backoff and jitter
//! - **HTTP Client**: Configurable HTTP client with timeout support
//!
//! # Example
//!
//! ```rust,no_run
//! use hookburn_core::{WebhookSender, GenericMessage, WebhookService};
//!
//! // Create a service-specific sender (e.g., Discord)
//! // let sender = ...;
//!
//! // Send a generic message
//! let msg = GenericMessage::new("Hello from Hookburn!")
//!     .with_username("MyBot");
//!
//! // sender.send(&msg).await?;
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! # Crate Organization
//!
//! | Module | Purpose |
//! |--------|---------|
//! | `builder` | HTTP client builder with configurable timeouts |
//! | `client` | HTTP client wrapper with retry support |
//! | `error` | Common error types for all services |
//! | `message` | Generic message types and conversion trait |
//! | `registry` | Service discovery and registration |
//! | `retry` | Retry policies with exponential backoff |
//! | `sender` | Core `WebhookSender` trait for all services |
//! | `service` | Service metadata and builder trait |
//! | `webhook_service` | Generic service wrapper for easy usage |

#![deny(missing_docs)]

/// HTTP client builder with configurable timeouts.
pub mod builder;

/// HTTP client with retry support and timeout handling.
pub mod client;

/// Common error types for the hookburn ecosystem.
pub mod error;

/// Service-agnostic message types and conversion traits.
pub mod message;

/// Service registry for discovering and creating webhook clients.
pub mod registry;

/// Retry policies with exponential backoff and jitter.
pub mod retry;

/// Core `WebhookSender` trait implemented by all services.
pub mod sender;

/// Service metadata and builder traits for service creation.
pub mod service;

/// Generic webhook service wrapper implementation.
pub mod webhook_service;

// Re-exports

/// HTTP client builder for configuring timeouts and connection settings.
pub use builder::HttpClientBuilder;

/// HTTP client with retry support and shared connection pool.
pub use client::HttpClient;

/// Common error type used across all hookburn services.
pub use error::CoreError;

/// Generic message types for service-agnostic webhook sending.
pub use message::{GenericEmbed, GenericMessage, MessageConverter};

/// Service registry for discovering and creating webhook clients.
pub use registry::WebhookRegistry;

/// Retry policy with exponential backoff and optional jitter.
pub use retry::RetryPolicy;

/// Core trait for sending webhook messages to any service.
pub use sender::WebhookSender;

/// Service metadata, configuration, and builder traits.
pub use service::{Platform, ServiceBuilder, ServiceConfig, ServiceInfo};

/// Generic webhook service wrapper that sends `GenericMessage`.
pub use webhook_service::{BoxedWebhookSender, WebhookService};