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};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ServerMessageTransferUpdate {
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. \"transfer-update\" is sent whenever a transfer happens.
20    #[serde(rename = "type")]
21    pub r#type: Type,
22    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
23    pub destination: Option<models::ClientMessageTransferUpdateDestination>,
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 assistant that the call is being transferred to. This is only sent if `destination.type` is \"assistant\".
40    #[serde(rename = "toAssistant", skip_serializing_if = "Option::is_none")]
41    pub to_assistant: Option<models::CreateAssistantDto>,
42    /// This is the assistant that the call is being transferred from. This is only sent if `destination.type` is \"assistant\".
43    #[serde(rename = "fromAssistant", skip_serializing_if = "Option::is_none")]
44    pub from_assistant: Option<models::CreateAssistantDto>,
45    /// This is the step that the conversation moved to.
46    #[serde(rename = "toStepRecord", skip_serializing_if = "Option::is_none")]
47    pub to_step_record: Option<serde_json::Value>,
48    /// This is the step that the conversation moved from. =
49    #[serde(rename = "fromStepRecord", skip_serializing_if = "Option::is_none")]
50    pub from_step_record: Option<serde_json::Value>,
51}
52
53impl ServerMessageTransferUpdate {
54    pub fn new(r#type: Type) -> ServerMessageTransferUpdate {
55        ServerMessageTransferUpdate {
56            phone_number: None,
57            r#type,
58            destination: None,
59            timestamp: None,
60            artifact: None,
61            assistant: None,
62            customer: None,
63            call: None,
64            to_assistant: None,
65            from_assistant: None,
66            to_step_record: None,
67            from_step_record: None,
68        }
69    }
70}
71/// This is the type of the message. \"transfer-update\" is sent whenever a transfer happens.
72#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
73pub enum Type {
74    #[serde(rename = "transfer-update")]
75    TransferUpdate,
76}
77
78impl Default for Type {
79    fn default() -> Type {
80        Self::TransferUpdate
81    }
82}