vapi-client 0.4.2

Unofficial crate for Vapi - Voice AI for developers.
Documentation
/*
 * Vapi API
 *
 * Voice AI for developers.
 *
 * The version of the OpenAPI document: 1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResponseObject {
    /// Unique identifier for this Response
    #[serde(rename = "id")]
    pub id: String,
    /// The object type
    #[serde(rename = "object")]
    pub object: ObjectTrue,
    /// Unix timestamp (in seconds) of when this Response was created
    #[serde(rename = "created_at")]
    pub created_at: f64,
    /// Status of the response
    #[serde(rename = "status")]
    pub status: StatusTrue,
    /// Error message if the response failed
    #[serde(
        rename = "error",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub error: Option<Option<String>>,
    /// Output messages from the model
    #[serde(rename = "output")]
    pub output: Vec<models::ResponseOutputMessage>,
}

impl ResponseObject {
    pub fn new(
        id: String,
        object: ObjectTrue,
        created_at: f64,
        status: StatusTrue,
        output: Vec<models::ResponseOutputMessage>,
    ) -> ResponseObject {
        ResponseObject {
            id,
            object,
            created_at,
            status,
            error: None,
            output,
        }
    }
}
/// The object type
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ObjectTrue {
    #[serde(rename = "response")]
    Response,
}

impl Default for ObjectTrue {
    fn default() -> ObjectTrue {
        Self::Response
    }
}
/// Status of the response
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StatusTrue {
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "incomplete")]
    Incomplete,
}

impl Default for StatusTrue {
    fn default() -> StatusTrue {
        Self::Completed
    }
}