vapi_client/models/
vonage_phone_number.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 VonagePhoneNumber {
16    #[serde(rename = "fallbackDestination", skip_serializing_if = "Option::is_none")]
17    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
18    /// This is the hooks that will be used for incoming calls to this phone number.
19    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
20    pub hooks: Option<Vec<serde_json::Value>>,
21    /// This is to use numbers bought on Vonage.
22    #[serde(rename = "provider")]
23    pub provider: Provider,
24    /// This is the unique identifier for the phone number.
25    #[serde(rename = "id")]
26    pub id: String,
27    /// This is the unique identifier for the org that this phone number belongs to.
28    #[serde(rename = "orgId")]
29    pub org_id: String,
30    /// This is the ISO 8601 date-time string of when the phone number was created.
31    #[serde(rename = "createdAt")]
32    pub created_at: String,
33    /// This is the ISO 8601 date-time string of when the phone number was last updated.
34    #[serde(rename = "updatedAt")]
35    pub updated_at: String,
36    /// This is the status of the phone number.
37    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
38    pub status: Option<Status>,
39    /// This is the name of the phone number. This is just for your own reference.
40    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
41    pub name: Option<String>,
42    /// This is the assistant that will be used for incoming calls to this phone number.  If neither `assistantId` nor `squadId` 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.
43    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
44    pub assistant_id: Option<String>,
45    /// This is the squad that will be used for incoming calls to this phone number.  If neither `assistantId` nor `squadId` 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.
46    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
47    pub squad_id: Option<String>,
48    /// 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
49    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
50    pub server: Option<models::Server>,
51    /// These are the digits of the phone number you own on your Vonage.
52    #[serde(rename = "number")]
53    pub number: String,
54    /// 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.
55    #[serde(rename = "credentialId")]
56    pub credential_id: String,
57}
58
59impl VonagePhoneNumber {
60    pub fn new(provider: Provider, id: String, org_id: String, created_at: String, updated_at: String, number: String, credential_id: String) -> VonagePhoneNumber {
61        VonagePhoneNumber {
62            fallback_destination: None,
63            hooks: None,
64            provider,
65            id,
66            org_id,
67            created_at,
68            updated_at,
69            status: None,
70            name: None,
71            assistant_id: None,
72            squad_id: None,
73            server: None,
74            number,
75            credential_id,
76        }
77    }
78}
79/// This is to use numbers bought on Vonage.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum Provider {
82    #[serde(rename = "vonage")]
83    Vonage,
84}
85
86impl Default for Provider {
87    fn default() -> Provider {
88        Self::Vonage
89    }
90}
91/// This is the status of the phone number.
92#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
93pub enum Status {
94    #[serde(rename = "active")]
95    Active,
96    #[serde(rename = "activating")]
97    Activating,
98    #[serde(rename = "blocked")]
99    Blocked,
100}
101
102impl Default for Status {
103    fn default() -> Status {
104        Self::Active
105    }
106}
107