vapi_client/models/
twilio_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 TwilioPhoneNumber {
16    #[serde(rename = "fallbackDestination", skip_serializing_if = "Option::is_none")]
17    pub fallback_destination: Option<Box<models::ImportTwilioPhoneNumberDtoFallbackDestination>>,
18    /// This is to use numbers bought on Twilio.
19    #[serde(rename = "provider")]
20    pub provider: Provider,
21    /// This is the unique identifier for the phone number.
22    #[serde(rename = "id")]
23    pub id: String,
24    /// This is the unique identifier for the org that this phone number belongs to.
25    #[serde(rename = "orgId")]
26    pub org_id: String,
27    /// This is the ISO 8601 date-time string of when the phone number was created.
28    #[serde(rename = "createdAt")]
29    pub created_at: String,
30    /// This is the ISO 8601 date-time string of when the phone number was last updated.
31    #[serde(rename = "updatedAt")]
32    pub updated_at: String,
33    /// This is the status of the phone number.
34    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
35    pub status: Option<Status>,
36    /// This is the name of the phone number. This is just for your own reference.
37    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
38    pub name: Option<String>,
39    /// 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.
40    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
41    pub assistant_id: Option<String>,
42    /// 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.
43    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
44    pub squad_id: Option<String>,
45    /// 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
46    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
47    pub server: Option<Box<models::Server>>,
48    /// These are the digits of the phone number you own on your Twilio.
49    #[serde(rename = "number")]
50    pub number: String,
51    /// This is the Twilio Account SID for the phone number.
52    #[serde(rename = "twilioAccountSid")]
53    pub twilio_account_sid: String,
54    /// This is the Twilio Auth Token for the phone number.
55    #[serde(rename = "twilioAuthToken")]
56    pub twilio_auth_token: String,
57}
58
59impl TwilioPhoneNumber {
60    pub fn new(provider: Provider, id: String, org_id: String, created_at: String, updated_at: String, number: String, twilio_account_sid: String, twilio_auth_token: String) -> TwilioPhoneNumber {
61        TwilioPhoneNumber {
62            fallback_destination: None,
63            provider,
64            id,
65            org_id,
66            created_at,
67            updated_at,
68            status: None,
69            name: None,
70            assistant_id: None,
71            squad_id: None,
72            server: None,
73            number,
74            twilio_account_sid,
75            twilio_auth_token,
76        }
77    }
78}
79/// This is to use numbers bought on Twilio.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum Provider {
82    #[serde(rename = "twilio")]
83    Twilio,
84}
85
86impl Default for Provider {
87    fn default() -> Provider {
88        Self::Twilio
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