crypto_pay_api/lib.rs
1//! crypto-pay-api
2//!
3//! A Rust client library for interacting with the CryptoPay API.
4//!
5//! # Example with tokio
6//!
7//! ```no_run
8//! use crypto_pay_api::prelude::*;
9//!
10//! #[tokio::main]
11//! async fn main() -> Result<(), CryptoBotError> {
12//! let client = CryptoBot::builder().api_token("YOUR_API_TOKEN").build()?;
13//! let invoice = client.create_invoice().amount(dec!(10.0)).asset(CryptoCurrencyCode::Ton).execute().await?;
14//! println!("Invoice created: {}", invoice.invoice_id);
15//! Ok(())
16//! }
17//! ```
18//!
19//! # Webhook Handling with axum
20//!
21//! ```no_run
22//! use crypto_pay_api::prelude::*;
23//!
24//! #[tokio::main]
25//! async fn main() -> Result<(), CryptoBotError> {
26//! let client = CryptoBot::builder().api_token("YOUR_API_TOKEN").build()?;
27//! let mut handler = client.webhook_handler().build();
28//! handler.on_update(|update| async move {
29//! println!("Invoice paid: {:?}", update.payload);
30//! Ok(())
31//! });
32//! Ok(())
33//! }
34//! ```
35//!
36//! For issues and contributions, please refer to the [GitHub repository](https://github.com/escwxyz/crypto-pay-api).
37
38mod api;
39mod client;
40mod error;
41mod models;
42mod utils;
43mod validation;
44mod webhook;
45
46pub mod prelude {
47 // Third-party crates re-exports
48 pub use crate::utils::types::*;
49
50 // Local crates re-exports
51 pub use crate::api::*;
52 pub use crate::client::CryptoBot;
53 pub use crate::error::*;
54 pub use crate::models::*;
55 pub use crate::webhook::*;
56}