vapi_client/models/
server_message_transcript.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 ServerMessageTranscript {
19    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
20    pub phone_number: Option<models::ServerMessageAssistantRequestPhoneNumber>,
21    /// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
22    #[serde(rename = "type")]
23    pub r#type: Type,
24    /// This is the ISO-8601 formatted timestamp of when the message was sent.
25    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
26    pub timestamp: Option<f64>,
27    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
28    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
29    pub artifact: Option<models::Artifact>,
30    /// This is the assistant that is currently active. This is provided for convenience.  This matches one of the following: - `call.assistant`, - `call.assistantId`, - `call.squad[n].assistant`, - `call.squad[n].assistantId`, - `call.squadId->[n].assistant`, - `call.squadId->[n].assistantId`.
31    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
32    pub assistant: Option<models::CreateAssistantDto>,
33    /// This is the customer associated with the call.  This matches one of the following: - `call.customer`, - `call.customerId`.
34    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
35    pub customer: Option<models::CreateCustomerDto>,
36    /// This is the call object.  This matches what was returned in POST /call.  Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.
37    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
38    pub call: Option<models::Call>,
39    /// This is the role for which the transcript is for.
40    #[serde(rename = "role")]
41    pub role: Role,
42    /// This is the type of the transcript.
43    #[serde(rename = "transcriptType")]
44    pub transcript_type: TranscriptType,
45    /// This is the transcript content.
46    #[serde(rename = "transcript")]
47    pub transcript: String,
48}
49
50impl ServerMessageTranscript {
51    pub fn new(
52        r#type: Type,
53        role: Role,
54        transcript_type: TranscriptType,
55        transcript: String,
56    ) -> ServerMessageTranscript {
57        ServerMessageTranscript {
58            phone_number: None,
59            r#type,
60            timestamp: None,
61            artifact: None,
62            assistant: None,
63            customer: None,
64            call: None,
65            role,
66            transcript_type,
67            transcript,
68        }
69    }
70}
71/// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
72#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
73pub enum Type {
74    #[serde(rename = "transcript")]
75    Transcript,
76    #[serde(rename = "transcript[transcriptType=\"final\"]")]
77    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
78}
79
80impl Default for Type {
81    fn default() -> Type {
82        Self::Transcript
83    }
84}
85/// This is the role for which the transcript is for.
86#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
87pub enum Role {
88    #[serde(rename = "assistant")]
89    Assistant,
90    #[serde(rename = "user")]
91    User,
92}
93
94impl Default for Role {
95    fn default() -> Role {
96        Self::Assistant
97    }
98}
99/// This is the type of the transcript.
100#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
101pub enum TranscriptType {
102    #[serde(rename = "partial")]
103    Partial,
104    #[serde(rename = "final")]
105    Final,
106}
107
108impl Default for TranscriptType {
109    fn default() -> TranscriptType {
110        Self::Partial
111    }
112}