vapi_client/models/
user_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 UserMessage {
16    /// The role of the user in the conversation.
17    #[serde(rename = "role")]
18    pub role: String,
19    /// The message content from the user.
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 duration of the message in seconds.
32    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
33    pub duration: Option<f64>,
34}
35
36impl UserMessage {
37    pub fn new(
38        role: String,
39        message: String,
40        time: f64,
41        end_time: f64,
42        seconds_from_start: f64,
43    ) -> UserMessage {
44        UserMessage {
45            role,
46            message,
47            time,
48            end_time,
49            seconds_from_start,
50            duration: None,
51        }
52    }
53}