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