wait_human/lib.rs
1//! # WaitHuman Rust Client
2//!
3//! A Rust client library for interacting with the WaitHuman API.
4//!
5//! WaitHuman enables applications to pause execution and request human input
6//! or confirmation on demand. This client provides a simple, ergonomic API
7//! for creating confirmation requests and waiting for human responses.
8//!
9//! ## Features
10//!
11//! - **Async API**: Built on tokio for efficient async I/O
12//! - **Type-safe**: Leverages Rust's type system for compile-time safety
13//! - **Multiple answer formats**: Support for free text and multiple choice questions
14//! - **Configurable timeouts**: Optional timeout support for all requests
15//!
16//! ## Example
17//!
18//! ```no_run
19//! use wait_human::WaitHuman;
20//!
21//! #[tokio::main]
22//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! // Create a new client
24//! let client = WaitHuman::new_from_key("your-api-key")?;
25//!
26//! // Ask a free-text question
27//! let answer = client.ask_free_text(
28//! "What is your name?",
29//! None::<&str>,
30//! None,
31//! ).await?;
32//!
33//! println!("Answer: {}", answer);
34//!
35//! // Ask a multiple-choice question
36//! let choice = client.ask_multiple_choice(
37//! "Select an option",
38//! ["Option 1", "Option 2"],
39//! None::<&str>,
40//! None,
41//! ).await?;
42//!
43//! println!("Selected: {}", choice);
44//!
45//! Ok(())
46//! }
47//! ```
48
49mod client;
50mod error;
51#[rustfmt::skip]
52mod shared_types;
53mod types;
54
55// Public exports
56pub use client::WaitHuman;
57pub use error::{Result, WaitHumanError};
58pub use types::{
59 AnswerContent, AnswerFormat, AskOptions, ConfirmationAnswer, ConfirmationAnswerWithDate,
60 ConfirmationQuestion, QuestionMethod, WaitHumanConfig,
61};