vapi_client/models/
session.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Session {
16    /// This is the unique identifier for the session.
17    #[serde(rename = "id")]
18    pub id: String,
19    /// This is the unique identifier for the organization that owns this session.
20    #[serde(rename = "orgId")]
21    pub org_id: String,
22    /// This is the ISO 8601 timestamp indicating when the session was created.
23    #[serde(rename = "createdAt")]
24    pub created_at: String,
25    /// This is the ISO 8601 timestamp indicating when the session was last updated.
26    #[serde(rename = "updatedAt")]
27    pub updated_at: String,
28    /// This is a user-defined name for the session. Maximum length is 40 characters.
29    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
30    pub name: Option<String>,
31    /// This is the current status of the session. Can be either 'active' or 'completed'.
32    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
33    pub status: Option<StatusTrue>,
34    /// Session expiration time in seconds. Defaults to 24 hours (86400 seconds) if not set.
35    #[serde(rename = "expirationSeconds", skip_serializing_if = "Option::is_none")]
36    pub expiration_seconds: Option<f64>,
37    /// This is the ID of the assistant associated with this session. Use this when referencing an existing assistant.
38    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
39    pub assistant_id: Option<String>,
40    /// This is the assistant configuration for this session. Use this when creating a new assistant configuration. If assistantId is provided, this will be ignored.
41    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
42    pub assistant: Option<models::CreateAssistantDto>,
43    /// This is an array of chat messages in the session.
44    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
45    pub messages: Option<Vec<models::MessageArrayInner>>,
46    /// This is the customer information associated with this session.
47    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
48    pub customer: Option<models::CreateCustomerDto>,
49    /// This is the ID of the phone number associated with this session.
50    #[serde(rename = "phoneNumberId", skip_serializing_if = "Option::is_none")]
51    pub phone_number_id: Option<String>,
52    /// This is the phone number configuration for this session.
53    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
54    pub phone_number: Option<models::ImportTwilioPhoneNumberDto>,
55}
56
57impl Session {
58    pub fn new(id: String, org_id: String, created_at: String, updated_at: String) -> Session {
59        Session {
60            id,
61            org_id,
62            created_at,
63            updated_at,
64            name: None,
65            status: None,
66            expiration_seconds: None,
67            assistant_id: None,
68            assistant: None,
69            messages: None,
70            customer: None,
71            phone_number_id: None,
72            phone_number: None,
73        }
74    }
75}
76/// This is the current status of the session. Can be either 'active' or 'completed'.
77#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
78pub enum StatusTrue {
79    #[serde(rename = "active")]
80    Active,
81    #[serde(rename = "completed")]
82    Completed,
83}
84
85impl Default for StatusTrue {
86    fn default() -> StatusTrue {
87        Self::Active
88    }
89}