Skip to main content

Crate hookburn_core

Crate hookburn_core 

Source
Expand description

§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

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?;

§Crate Organization

ModulePurpose
builderHTTP client builder with configurable timeouts
clientHTTP client wrapper with retry support
errorCommon error types for all services
messageGeneric message types and conversion trait
registryService discovery and registration
retryRetry policies with exponential backoff
senderCore WebhookSender trait for all services
serviceService metadata and builder trait
webhook_serviceGeneric service wrapper for easy usage

Re-exports§

pub use builder::HttpClientBuilder;
pub use client::HttpClient;
pub use error::CoreError;
pub use message::GenericEmbed;
pub use message::GenericMessage;
pub use message::MessageConverter;
pub use registry::WebhookRegistry;
pub use retry::RetryPolicy;
pub use sender::WebhookSender;
pub use service::Platform;
pub use service::ServiceBuilder;
pub use service::ServiceConfig;
pub use service::ServiceInfo;
pub use webhook_service::BoxedWebhookSender;
pub use webhook_service::WebhookService;

Modules§

builder
HTTP client builder with configurable timeouts.
client
HTTP client with retry support and timeout handling.
error
Common error types for the hookburn ecosystem.
message
Service-agnostic message types and conversion traits.
registry
Service registry for discovering and creating webhook clients.
retry
Retry policies with exponential backoff and jitter.
sender
Core WebhookSender trait implemented by all services.
service
Service metadata and builder traits for service creation.
webhook_service
Generic webhook service wrapper implementation.