wait_human/
types.rs

1// Re-export shared types from backend
2pub use crate::shared_types::{
3    AnswerContent, AnswerFormat, ConfirmationAnswer, ConfirmationAnswerWithDate,
4    ConfirmationQuestion, QuestionMethod,
5};
6
7/// Configuration for the WaitHuman client
8#[derive(Debug, Clone)]
9pub struct WaitHumanConfig {
10    /// Your WaitHuman API key (mandatory)
11    pub api_key: String,
12    /// Optional custom endpoint URL. Defaults to 'https://api.waithuman.com'
13    pub endpoint: Option<String>,
14}
15
16impl WaitHumanConfig {
17    /// Creates a new WaitHumanConfig with the given API key
18    pub fn new<S: Into<String>>(api_key: S) -> Self {
19        Self {
20            api_key: api_key.into(),
21            endpoint: None,
22        }
23    }
24
25    /// Sets the endpoint URL
26    pub fn with_endpoint<S: Into<String>>(mut self, endpoint: S) -> Self {
27        self.endpoint = Some(endpoint.into());
28        self
29    }
30}
31
32/// Options for ask requests
33#[derive(Debug, Clone, Default)]
34pub struct AskOptions {
35    /// Optional timeout in seconds. If None, will poll indefinitely
36    pub timeout_seconds: Option<u64>,
37}
38
39// Internal API request/response types
40#[derive(serde::Serialize, Debug)]
41pub(crate) struct CreateConfirmationRequest {
42    pub question: ConfirmationQuestion,
43}
44
45#[derive(serde::Deserialize, Debug)]
46pub(crate) struct CreateConfirmationResponse {
47    pub confirmation_request_id: String,
48}
49
50#[derive(serde::Deserialize, Debug)]
51pub(crate) struct GetConfirmationResponse {
52    pub maybe_answer: Option<ConfirmationAnswerWithDate>,
53}