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(
17        rename = "fallbackDestination",
18        skip_serializing_if = "Option::is_none"
19    )]
20    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
21    /// This is the hooks that will be used for incoming calls to this phone number.
22    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
23    pub hooks: Option<Vec<models::ImportTwilioPhoneNumberDtoHooksInner>>,
24    /// This is to use numbers bought on Twilio.
25    #[serde(rename = "provider")]
26    pub provider: ProviderTrue,
27    /// Controls whether Vapi sets the messaging webhook URL on the Twilio number during import.  If set to `false`, Vapi will not update the Twilio messaging URL, leaving it as is. If `true` or omitted (default), Vapi will configure both the voice and messaging URLs.  @default true
28    #[serde(rename = "smsEnabled", skip_serializing_if = "Option::is_none")]
29    pub sms_enabled: Option<bool>,
30    /// This is the unique identifier for the phone number.
31    #[serde(rename = "id")]
32    pub id: String,
33    /// This is the unique identifier for the org that this phone number belongs to.
34    #[serde(rename = "orgId")]
35    pub org_id: String,
36    /// This is the ISO 8601 date-time string of when the phone number was created.
37    #[serde(rename = "createdAt")]
38    pub created_at: String,
39    /// This is the ISO 8601 date-time string of when the phone number was last updated.
40    #[serde(rename = "updatedAt")]
41    pub updated_at: String,
42    /// This is the status of the phone number.
43    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
44    pub status: Option<StatusTrue>,
45    /// This is the Twilio Auth Token for the phone number.
46    #[serde(rename = "twilioAuthToken", skip_serializing_if = "Option::is_none")]
47    pub twilio_auth_token: Option<String>,
48    /// This is the Twilio API Key for the phone number.
49    #[serde(rename = "twilioApiKey", skip_serializing_if = "Option::is_none")]
50    pub twilio_api_key: Option<String>,
51    /// This is the Twilio API Secret for the phone number.
52    #[serde(rename = "twilioApiSecret", skip_serializing_if = "Option::is_none")]
53    pub twilio_api_secret: Option<String>,
54    /// This is the name of the phone number. This is just for your own reference.
55    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
56    pub name: Option<String>,
57    /// 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.
58    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
59    pub assistant_id: Option<String>,
60    /// 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.
61    #[serde(rename = "workflowId", skip_serializing_if = "Option::is_none")]
62    pub workflow_id: Option<String>,
63    /// 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.
64    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
65    pub squad_id: Option<String>,
66    /// 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
67    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
68    pub server: Option<models::Server>,
69    /// These are the digits of the phone number you own on your Twilio.
70    #[serde(rename = "number")]
71    pub number: String,
72    /// This is the Twilio Account SID for the phone number.
73    #[serde(rename = "twilioAccountSid")]
74    pub twilio_account_sid: String,
75}
76
77impl TwilioPhoneNumber {
78    pub fn new(
79        provider: ProviderTrue,
80        id: String,
81        org_id: String,
82        created_at: String,
83        updated_at: String,
84        number: String,
85        twilio_account_sid: String,
86    ) -> TwilioPhoneNumber {
87        TwilioPhoneNumber {
88            fallback_destination: None,
89            hooks: None,
90            provider,
91            sms_enabled: None,
92            id,
93            org_id,
94            created_at,
95            updated_at,
96            status: None,
97            twilio_auth_token: None,
98            twilio_api_key: None,
99            twilio_api_secret: None,
100            name: None,
101            assistant_id: None,
102            workflow_id: None,
103            squad_id: None,
104            server: None,
105            number,
106            twilio_account_sid,
107        }
108    }
109}
110/// This is to use numbers bought on Twilio.
111#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
112pub enum ProviderTrue {
113    #[serde(rename = "twilio")]
114    Twilio,
115}
116
117impl Default for ProviderTrue {
118    fn default() -> ProviderTrue {
119        Self::Twilio
120    }
121}
122/// This is the status of the phone number.
123#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
124pub enum StatusTrue {
125    #[serde(rename = "active")]
126    Active,
127    #[serde(rename = "activating")]
128    Activating,
129    #[serde(rename = "blocked")]
130    Blocked,
131}
132
133impl Default for StatusTrue {
134    fn default() -> StatusTrue {
135        Self::Active
136    }
137}