vapi_client/models/
client_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 ClientMessageTranscript {
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 role for which the transcript is for.
23    #[serde(rename = "role")]
24    pub role: Role,
25    /// This is the type of the transcript.
26    #[serde(rename = "transcriptType")]
27    pub transcript_type: TranscriptType,
28    /// This is the transcript content.
29    #[serde(rename = "transcript")]
30    pub transcript: String,
31}
32
33impl ClientMessageTranscript {
34    pub fn new(
35        r#type: Type,
36        role: Role,
37        transcript_type: TranscriptType,
38        transcript: String,
39    ) -> ClientMessageTranscript {
40        ClientMessageTranscript {
41            r#type,
42            role,
43            transcript_type,
44            transcript,
45        }
46    }
47}
48/// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
50pub enum Type {
51    #[serde(rename = "transcript")]
52    Transcript,
53    #[serde(rename = "transcript[transcriptType=\"final\"]")]
54    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
55}
56
57impl Default for Type {
58    fn default() -> Type {
59        Self::Transcript
60    }
61}
62/// This is the role for which the transcript is for.
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
64pub enum Role {
65    #[serde(rename = "assistant")]
66    Assistant,
67    #[serde(rename = "user")]
68    User,
69}
70
71impl Default for Role {
72    fn default() -> Role {
73        Self::Assistant
74    }
75}
76/// This is the type of the transcript.
77#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
78pub enum TranscriptType {
79    #[serde(rename = "partial")]
80    Partial,
81    #[serde(rename = "final")]
82    Final,
83}
84
85impl Default for TranscriptType {
86    fn default() -> TranscriptType {
87        Self::Partial
88    }
89}