vapi_client/models/
server_message_transfer_update.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 ServerMessageTransferUpdate {
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. \"transfer-update\" is sent whenever a transfer happens.
22    #[serde(rename = "type")]
23    pub r#type: Type,
24    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
25    pub destination: Option<models::ClientMessageTransferUpdateDestination>,
26    /// This is the ISO-8601 formatted timestamp of when the message was sent.
27    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
28    pub timestamp: Option<f64>,
29    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
30    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
31    pub artifact: Option<models::Artifact>,
32    /// 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`.
33    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
34    pub assistant: Option<models::CreateAssistantDto>,
35    /// This is the customer associated with the call.  This matches one of the following: - `call.customer`, - `call.customerId`.
36    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
37    pub customer: Option<models::CreateCustomerDto>,
38    /// 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.
39    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
40    pub call: Option<models::Call>,
41    /// This is the assistant that the call is being transferred to. This is only sent if `destination.type` is \"assistant\".
42    #[serde(rename = "toAssistant", skip_serializing_if = "Option::is_none")]
43    pub to_assistant: Option<models::CreateAssistantDto>,
44    /// This is the assistant that the call is being transferred from. This is only sent if `destination.type` is \"assistant\".
45    #[serde(rename = "fromAssistant", skip_serializing_if = "Option::is_none")]
46    pub from_assistant: Option<models::CreateAssistantDto>,
47    /// This is the step that the conversation moved to.
48    #[serde(rename = "toStepRecord", skip_serializing_if = "Option::is_none")]
49    pub to_step_record: Option<serde_json::Value>,
50    /// This is the step that the conversation moved from. =
51    #[serde(rename = "fromStepRecord", skip_serializing_if = "Option::is_none")]
52    pub from_step_record: Option<serde_json::Value>,
53}
54
55impl ServerMessageTransferUpdate {
56    pub fn new(r#type: Type) -> ServerMessageTransferUpdate {
57        ServerMessageTransferUpdate {
58            phone_number: None,
59            r#type,
60            destination: None,
61            timestamp: None,
62            artifact: None,
63            assistant: None,
64            customer: None,
65            call: None,
66            to_assistant: None,
67            from_assistant: None,
68            to_step_record: None,
69            from_step_record: None,
70        }
71    }
72}
73/// This is the type of the message. \"transfer-update\" is sent whenever a transfer happens.
74#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
75pub enum Type {
76    #[serde(rename = "transfer-update")]
77    TransferUpdate,
78}
79
80impl Default for Type {
81    fn default() -> Type {
82        Self::TransferUpdate
83    }
84}