vapi_client/models/
telnyx_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 TelnyxPhoneNumber {
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 Telnyx.
25    #[serde(rename = "provider")]
26    pub provider: ProviderTrue,
27    /// This is the unique identifier for the phone number.
28    #[serde(rename = "id")]
29    pub id: String,
30    /// This is the unique identifier for the org that this phone number belongs to.
31    #[serde(rename = "orgId")]
32    pub org_id: String,
33    /// This is the ISO 8601 date-time string of when the phone number was created.
34    #[serde(rename = "createdAt")]
35    pub created_at: String,
36    /// This is the ISO 8601 date-time string of when the phone number was last updated.
37    #[serde(rename = "updatedAt")]
38    pub updated_at: String,
39    /// This is the status of the phone number.
40    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
41    pub status: Option<StatusTrue>,
42    /// This is the name of the phone number. This is just for your own reference.
43    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
44    pub name: Option<String>,
45    /// 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.
46    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
47    pub assistant_id: Option<String>,
48    /// 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.
49    #[serde(rename = "workflowId", skip_serializing_if = "Option::is_none")]
50    pub workflow_id: Option<String>,
51    /// 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.
52    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
53    pub squad_id: Option<String>,
54    /// 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
55    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
56    pub server: Option<models::Server>,
57    /// These are the digits of the phone number you own on your Telnyx.
58    #[serde(rename = "number")]
59    pub number: String,
60    /// 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.
61    #[serde(rename = "credentialId")]
62    pub credential_id: String,
63}
64
65impl TelnyxPhoneNumber {
66    pub fn new(
67        provider: ProviderTrue,
68        id: String,
69        org_id: String,
70        created_at: String,
71        updated_at: String,
72        number: String,
73        credential_id: String,
74    ) -> TelnyxPhoneNumber {
75        TelnyxPhoneNumber {
76            fallback_destination: None,
77            hooks: None,
78            provider,
79            id,
80            org_id,
81            created_at,
82            updated_at,
83            status: None,
84            name: None,
85            assistant_id: None,
86            workflow_id: None,
87            squad_id: None,
88            server: None,
89            number,
90            credential_id,
91        }
92    }
93}
94/// This is to use numbers bought on Telnyx.
95#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
96pub enum ProviderTrue {
97    #[serde(rename = "telnyx")]
98    Telnyx,
99}
100
101impl Default for ProviderTrue {
102    fn default() -> ProviderTrue {
103        Self::Telnyx
104    }
105}
106/// This is the status of the phone number.
107#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
108pub enum StatusTrue {
109    #[serde(rename = "active")]
110    Active,
111    #[serde(rename = "activating")]
112    Activating,
113    #[serde(rename = "blocked")]
114    Blocked,
115}
116
117impl Default for StatusTrue {
118    fn default() -> StatusTrue {
119        Self::Active
120    }
121}