vapi_client/models/
user_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};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct UserMessage {
19    /// The role of the user in the conversation.
20    #[serde(rename = "role")]
21    pub role: String,
22    /// The message content from the user.
23    #[serde(rename = "message")]
24    pub message: String,
25    /// The timestamp when the message was sent.
26    #[serde(rename = "time")]
27    pub time: f64,
28    /// The timestamp when the message ended.
29    #[serde(rename = "endTime")]
30    pub end_time: f64,
31    /// The number of seconds from the start of the conversation.
32    #[serde(rename = "secondsFromStart")]
33    pub seconds_from_start: f64,
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 UserMessage {
40    pub fn new(
41        role: String,
42        message: String,
43        time: f64,
44        end_time: f64,
45        seconds_from_start: f64,
46    ) -> UserMessage {
47        UserMessage {
48            role,
49            message,
50            time,
51            end_time,
52            seconds_from_start,
53            duration: None,
54        }
55    }
56}