vapi_client/models/
bot_message.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BotMessage {
17    /// The role of the bot in the conversation.
18    #[serde(rename = "role")]
19    pub role: String,
20    /// The message content from the bot.
21    #[serde(rename = "message")]
22    pub message: String,
23    /// The timestamp when the message was sent.
24    #[serde(rename = "time")]
25    pub time: f64,
26    /// The timestamp when the message ended.
27    #[serde(rename = "endTime")]
28    pub end_time: f64,
29    /// The number of seconds from the start of the conversation.
30    #[serde(rename = "secondsFromStart")]
31    pub seconds_from_start: f64,
32    /// The source of the message.
33    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
34    pub source: Option<String>,
35    /// The duration of the message in seconds.
36    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
37    pub duration: Option<f64>,
38}
39
40impl BotMessage {
41    pub fn new(
42        role: String,
43        message: String,
44        time: f64,
45        end_time: f64,
46        seconds_from_start: f64,
47    ) -> BotMessage {
48        BotMessage {
49            role,
50            message,
51            time,
52            end_time,
53            seconds_from_start,
54            source: None,
55            duration: None,
56        }
57    }
58}