rustigram_api/lib.rs
1//! HTTP client and typed method builders for the Telegram Bot API.
2//!
3//! The central type is [`BotClient`], which is cheap to clone (all state is
4//! behind an `Arc`) and safe to share across tasks. Every Bot API method is
5//! exposed as a builder that returns a future:
6//!
7//! ```rust,ignore
8//! let message = client
9//! .send_message(chat_id, "Hello!")
10//! .parse_mode(ParseMode::HTML)
11//! .disable_notification(true)
12//! .await?;
13//! ```
14//!
15//! # Error handling
16//!
17//! All methods return [`Result<T>`]. The [`Error`] type covers API-level
18//! failures (bad token, flood control, missing permissions), transport errors,
19//! and serialisation failures. Rate-limit errors (HTTP 429) are automatically
20//! retried by the polling engine in `rustigram-bot`; individual API calls
21//! surface them as [`Error::RateLimit`].
22//!
23//! # Feature flags
24//!
25//! | Feature | Default | Description |
26//! |---|---|---|
27//! | `rustls` | yes | TLS via rustls |
28//!
29//! # Re-exports
30//!
31//! The [`methods`] module re-exports every builder type. You generally do not
32//! need to import them directly — call the corresponding method on
33//! [`BotClient`] and the builder is returned.
34#![warn(missing_docs)]
35/// Core HTTP client and configuration.
36pub mod client;
37
38/// Error types for API operations.
39pub mod error;
40
41/// Typed method builders for every Telegram Bot API endpoint.
42pub mod methods;
43
44pub use client::{BotClient, ClientConfig};
45pub use error::{Error, Result};