hatang 0.1.1

Official Rust client for the Ha Tang (Hạ Tầng) API: transactional email, live chat and support CRM, VietQR payments, AI chatbot knowledge and webhook verification. Async (Tokio) and blocking.
Documentation
//! A synchronous client for code without an async runtime (scripts, CLIs, sync web frameworks).
//!
//! Same namespaces and methods as [`crate::Hatang`]; each call returns the result instead of a future.
//!
//! ```no_run
//! let hatang = hatang::blocking::Hatang::from_env()?;
//! let page = hatang.chat.products.list(&Default::default())?;
//! println!("{page}");
//! # Ok::<(), hatang::Error>(())
//! ```
//!
//! It runs its own small Tokio runtime, so do not call it from inside an async runtime: use [`crate::Hatang`]
//! there.

use crate::client::{Client, HatangBuilder};
use crate::error::Result;
use crate::transport::Blocking;

/// The blocking client.
pub type Hatang = Client<Blocking>;

impl Hatang {
    /// A client with this API key and the defaults.
    pub fn new(api_key: impl Into<String>) -> Result<Self> {
        HatangBuilder::default().api_key(api_key).build_blocking()
    }
    /// A client from `HATANG_API_KEY` (and `HATANG_BASE_URL`, `HATANG_ENVIRONMENT`).
    pub fn from_env() -> Result<Self> {
        HatangBuilder::default().build_blocking()
    }
    pub fn builder() -> HatangBuilder {
        HatangBuilder::default()
    }
}