demo/
demo.rs

1use wait_human::WaitHuman;
2
3#[tokio::main]
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let wait_human =
6        WaitHuman::new_from_key("sk_3a3b8e8e4bdfd121288cb995d41361042337ef6cada0e48d")?;
7
8    // Example: Multiple Choice Question
9    let answer = wait_human
10        .ask_multiple_choice(
11            "Send invoice?",
12            ["yes, send", "no"],
13            Some("Customer asked for a 3-page website. is 500$ ok?"),
14            None,
15        )
16        .await?;
17
18    if answer == "yes, send" {
19        println!("Send!");
20    } else {
21        println!("wait...");
22    }
23
24    // Example: Free Text
25    let feedback = wait_human
26        .ask_free_text(
27            "User Feedback",
28            Some("Please explain why you rejected the invoice."),
29            None,
30        )
31        .await?;
32
33    println!("{}", feedback);
34
35    Ok(())
36}