vapi_client/models/
bot_message.rs

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