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<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 Twilio.
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 Twilio.
52    #[serde(rename = "number")]
53    pub number: String,
54    /// This is the Twilio Account SID for the phone number.
55    #[serde(rename = "twilioAccountSid")]
56    pub twilio_account_sid: String,
57    /// This is the Twilio Auth Token for the phone number.
58    #[serde(rename = "twilioAuthToken")]
59    pub twilio_auth_token: String,
60}
61
62impl TwilioPhoneNumber {
63    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 {
64        TwilioPhoneNumber {
65            fallback_destination: None,
66            hooks: None,
67            provider,
68            id,
69            org_id,
70            created_at,
71            updated_at,
72            status: None,
73            name: None,
74            assistant_id: None,
75            squad_id: None,
76            server: None,
77            number,
78            twilio_account_sid,
79            twilio_auth_token,
80        }
81    }
82}
83/// This is to use numbers bought on Twilio.
84#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
85pub enum Provider {
86    #[serde(rename = "twilio")]
87    Twilio,
88}
89
90impl Default for Provider {
91    fn default() -> Provider {
92        Self::Twilio
93    }
94}
95/// This is the status of the phone number.
96#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum Status {
98    #[serde(rename = "active")]
99    Active,
100    #[serde(rename = "activating")]
101    Activating,
102    #[serde(rename = "blocked")]
103    Blocked,
104}
105
106impl Default for Status {
107    fn default() -> Status {
108        Self::Active
109    }
110}
111