vapi-client 0.4.2

Unofficial crate for Vapi - Voice AI for developers.
Documentation
/*
 * Vapi API
 *
 * Voice AI for developers.
 *
 * The version of the OpenAPI document: 1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Session {
    /// This is the unique identifier for the session.
    #[serde(rename = "id")]
    pub id: String,
    /// This is the unique identifier for the organization that owns this session.
    #[serde(rename = "orgId")]
    pub org_id: String,
    /// This is the ISO 8601 timestamp indicating when the session was created.
    #[serde(rename = "createdAt")]
    pub created_at: String,
    /// This is the ISO 8601 timestamp indicating when the session was last updated.
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    /// This is a user-defined name for the session. Maximum length is 40 characters.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// This is the current status of the session. Can be either 'active' or 'completed'.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<StatusTrue>,
    /// Session expiration time in seconds. Defaults to 24 hours (86400 seconds) if not set.
    #[serde(rename = "expirationSeconds", skip_serializing_if = "Option::is_none")]
    pub expiration_seconds: Option<f64>,
    /// This is the ID of the assistant associated with this session. Use this when referencing an existing assistant.
    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
    pub assistant_id: Option<String>,
    /// This is the assistant configuration for this session. Use this when creating a new assistant configuration. If assistantId is provided, this will be ignored.
    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
    pub assistant: Option<models::CreateAssistantDto>,
    /// This is an array of chat messages in the session.
    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
    pub messages: Option<Vec<models::MessageArrayInner>>,
    /// This is the customer information associated with this session.
    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
    pub customer: Option<models::CreateCustomerDto>,
    /// This is the ID of the phone number associated with this session.
    #[serde(rename = "phoneNumberId", skip_serializing_if = "Option::is_none")]
    pub phone_number_id: Option<String>,
    /// This is the phone number configuration for this session.
    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<models::ImportTwilioPhoneNumberDto>,
}

impl Session {
    pub fn new(id: String, org_id: String, created_at: String, updated_at: String) -> Session {
        Session {
            id,
            org_id,
            created_at,
            updated_at,
            name: None,
            status: None,
            expiration_seconds: None,
            assistant_id: None,
            assistant: None,
            messages: None,
            customer: None,
            phone_number_id: None,
            phone_number: None,
        }
    }
}
/// This is the current status of the session. Can be either 'active' or 'completed'.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StatusTrue {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "completed")]
    Completed,
}

impl Default for StatusTrue {
    fn default() -> StatusTrue {
        Self::Active
    }
}