Crate wait_human

Crate wait_human 

Source
Expand description

§WaitHuman Rust Client

A Rust client library for interacting with the WaitHuman API.

WaitHuman enables applications to pause execution and request human input or confirmation on demand. This client provides a simple, ergonomic API for creating confirmation requests and waiting for human responses.

§Features

  • Async API: Built on tokio for efficient async I/O
  • Type-safe: Leverages Rust’s type system for compile-time safety
  • Multiple answer formats: Support for free text and multiple choice questions
  • Configurable timeouts: Optional timeout support for all requests

§Example

use wait_human::WaitHuman;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a new client
    let client = WaitHuman::new_from_key("your-api-key")?;

    // Ask a free-text question
    let answer = client.ask_free_text(
        "What is your name?",
        None::<&str>,
        None,
    ).await?;

    println!("Answer: {}", answer);

    // Ask a multiple-choice question
    let choice = client.ask_multiple_choice(
        "Select an option",
        ["Option 1", "Option 2"],
        None::<&str>,
        None,
    ).await?;

    println!("Selected: {}", choice);

    Ok(())
}

Structs§

AskOptions
Options for ask requests
ConfirmationAnswer
The structure stored in DB for answers
ConfirmationAnswerWithDate
ConfirmationQuestion
The structure stored in DB for question
WaitHuman
Main WaitHuman client for making requests
WaitHumanConfig
Configuration for the WaitHuman client

Enums§

AnswerContent
AnswerFormat
QuestionMethod
WaitHumanError
Errors that can occur when using the WaitHuman client

Type Aliases§

Result
Result type alias for WaitHuman operations