notifica_rust_sdk/lib.rs
1//! # notifica-crate
2//!
3//! Rust client SDK for the [Notifica](https://github.com/flippico/notifica) notification service.
4//!
5//! Install this crate in any project that needs to broadcast notifications
6//! (email, push, webhooks) to the Notifica service.
7//!
8//! ## Quick start
9//!
10//! ```rust,no_run
11//! use notifica_crate::{EmailPayload, Notification, NotificaClient};
12//!
13//! #[tokio::main]
14//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
15//! let client = NotificaClient::new(
16//! std::env::var("NOTIFICA_URL")?, // e.g. "http://notifica:8000"
17//! std::env::var("NOTIFICA_TENANT")?, // e.g. "my-app"
18//! );
19//!
20//! client.send(
21//! "user_registered",
22//! Notification::new()
23//! .email(
24//! EmailPayload::new("alice@example.com")
25//! .target_name("Alice")
26//! .subject("Welcome!")
27//! .param("code", "1234"),
28//! )
29//! .push(vec!["expo-device-token".into()]),
30//! ).await?;
31//!
32//! Ok(())
33//! }
34//! ```
35
36pub mod client;
37pub mod error;
38pub mod payload;
39
40#[cfg(feature = "queue")]
41pub mod queue_client;
42
43pub use client::NotificaClient;
44pub use error::{NotificaError, NotificaResult};
45pub use payload::{EmailPayload, Notification, WebhookPayload};
46
47#[cfg(feature = "queue")]
48pub use queue_client::NotificaQueueClient;