vapi_client/models/
create_vapi_phone_number_dto.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct CreateVapiPhoneNumberDto {
19    #[serde(
20        rename = "fallbackDestination",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
24    /// This is to create free SIP phone numbers on Vapi.
25    #[serde(rename = "provider")]
26    pub provider: Provider,
27    /// This is the area code of the phone number to purchase.
28    #[serde(
29        rename = "numberDesiredAreaCode",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub number_desired_area_code: Option<String>,
33    /// This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer.  This is case-insensitive.
34    #[serde(rename = "sipUri", skip_serializing_if = "Option::is_none")]
35    pub sip_uri: Option<String>,
36    /// This enables authentication for incoming SIP INVITE requests to the `sipUri`.  If not set, any username/password to the 401 challenge of the SIP INVITE will be accepted.
37    #[serde(rename = "authentication", skip_serializing_if = "Option::is_none")]
38    pub authentication: Option<models::SipAuthentication>,
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}
52
53impl CreateVapiPhoneNumberDto {
54    pub fn new(provider: Provider) -> CreateVapiPhoneNumberDto {
55        CreateVapiPhoneNumberDto {
56            fallback_destination: None,
57            provider,
58            number_desired_area_code: None,
59            sip_uri: None,
60            authentication: None,
61            name: None,
62            assistant_id: None,
63            squad_id: None,
64            server: None,
65        }
66    }
67}
68/// This is to create free SIP phone numbers on Vapi.
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
70pub enum Provider {
71    #[serde(rename = "vapi")]
72    Vapi,
73}
74
75impl Default for Provider {
76    fn default() -> Provider {
77        Self::Vapi
78    }
79}