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 VonagePhoneNumber {
    #[serde(
        rename = "fallbackDestination",
        skip_serializing_if = "Option::is_none"
    )]
    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
    /// This is the hooks that will be used for incoming calls to this phone number.
    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
    pub hooks: Option<Vec<models::ImportTwilioPhoneNumberDtoHooksInner>>,
    /// This is to use numbers bought on Vonage.
    #[serde(rename = "provider")]
    pub provider: ProviderTrue,
    /// This is the unique identifier for the phone number.
    #[serde(rename = "id")]
    pub id: String,
    /// This is the unique identifier for the org that this phone number belongs to.
    #[serde(rename = "orgId")]
    pub org_id: String,
    /// This is the ISO 8601 date-time string of when the phone number was created.
    #[serde(rename = "createdAt")]
    pub created_at: String,
    /// This is the ISO 8601 date-time string of when the phone number was last updated.
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    /// This is the status of the phone number.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<StatusTrue>,
    /// This is the name of the phone number. This is just for your own reference.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// This is the assistant that will be used for incoming calls to this phone number.  If neither `assistantId`, `squadId` nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
    pub assistant_id: Option<String>,
    /// This is the workflow that will be used for incoming calls to this phone number.  If neither `assistantId`, `squadId`, nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
    #[serde(rename = "workflowId", skip_serializing_if = "Option::is_none")]
    pub workflow_id: Option<String>,
    /// This is the squad that will be used for incoming calls to this phone number.  If neither `assistantId`, `squadId`, nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
    pub squad_id: Option<String>,
    /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.  The order of precedence is:  1. assistant.server 2. phoneNumber.server 3. org.server
    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
    pub server: Option<models::Server>,
    /// These are the digits of the phone number you own on your Vonage.
    #[serde(rename = "number")]
    pub number: String,
    /// This is the credential you added in dashboard.vapi.ai/keys. This is used to configure the number to send inbound calls to Vapi, make outbound calls and do live call updates like transfers and hangups.
    #[serde(rename = "credentialId")]
    pub credential_id: String,
}

impl VonagePhoneNumber {
    pub fn new(
        provider: ProviderTrue,
        id: String,
        org_id: String,
        created_at: String,
        updated_at: String,
        number: String,
        credential_id: String,
    ) -> VonagePhoneNumber {
        VonagePhoneNumber {
            fallback_destination: None,
            hooks: None,
            provider,
            id,
            org_id,
            created_at,
            updated_at,
            status: None,
            name: None,
            assistant_id: None,
            workflow_id: None,
            squad_id: None,
            server: None,
            number,
            credential_id,
        }
    }
}
/// This is to use numbers bought on Vonage.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ProviderTrue {
    #[serde(rename = "vonage")]
    Vonage,
}

impl Default for ProviderTrue {
    fn default() -> ProviderTrue {
        Self::Vonage
    }
}
/// This is the status of the phone number.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StatusTrue {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "activating")]
    Activating,
    #[serde(rename = "blocked")]
    Blocked,
}

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