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 ServerMessagePhoneCallControl {
    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<models::ClientMessageWorkflowNodeStartedPhoneNumber>,
    /// This is the type of the message. \"phone-call-control\" is an advanced type of message.  When it is requested in `assistant.serverMessages`, the hangup and forwarding responsibilities are delegated to your server. Vapi will no longer do the actual transfer and hangup.
    #[serde(rename = "type")]
    pub r#type: TypeTrue,
    /// This is the request to control the phone call.
    #[serde(rename = "request")]
    pub request: RequestTrue,
    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
    pub destination: Option<models::ServerMessagePhoneCallControlDestination>,
    /// This is the timestamp of the message.
    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<f64>,
    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
    pub artifact: Option<models::Artifact>,
    /// This is the assistant that the message is associated with.
    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
    pub assistant: Option<models::CreateAssistantDto>,
    /// This is the customer that the message is associated with.
    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
    pub customer: Option<models::CreateCustomerDto>,
    /// This is the call that the message is associated with.
    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
    pub call: Option<models::Call>,
    /// This is the chat object.
    #[serde(rename = "chat", skip_serializing_if = "Option::is_none")]
    pub chat: Option<models::Chat>,
}

impl ServerMessagePhoneCallControl {
    pub fn new(r#type: TypeTrue, request: RequestTrue) -> ServerMessagePhoneCallControl {
        ServerMessagePhoneCallControl {
            phone_number: None,
            r#type,
            request,
            destination: None,
            timestamp: None,
            artifact: None,
            assistant: None,
            customer: None,
            call: None,
            chat: None,
        }
    }
}
/// This is the type of the message. \"phone-call-control\" is an advanced type of message.  When it is requested in `assistant.serverMessages`, the hangup and forwarding responsibilities are delegated to your server. Vapi will no longer do the actual transfer and hangup.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TypeTrue {
    #[serde(rename = "phone-call-control")]
    PhoneCallControl,
}

impl Default for TypeTrue {
    fn default() -> TypeTrue {
        Self::PhoneCallControl
    }
}
/// This is the request to control the phone call.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RequestTrue {
    #[serde(rename = "forward")]
    Forward,
    #[serde(rename = "hang-up")]
    HangUp,
}

impl Default for RequestTrue {
    fn default() -> RequestTrue {
        Self::Forward
    }
}