vapi_client/models/create_vapi_phone_number_dto.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 CreateVapiPhoneNumberDto {
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 create free SIP phone numbers on Vapi.
25 #[serde(rename = "provider")]
26 pub provider: ProviderTrue,
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`, `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.
43 #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
44 pub assistant_id: Option<String>,
45 /// 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.
46 #[serde(rename = "workflowId", skip_serializing_if = "Option::is_none")]
47 pub workflow_id: Option<String>,
48 /// 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.
49 #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
50 pub squad_id: Option<String>,
51 /// 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
52 #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
53 pub server: Option<models::Server>,
54}
55
56impl CreateVapiPhoneNumberDto {
57 pub fn new(provider: ProviderTrue) -> CreateVapiPhoneNumberDto {
58 CreateVapiPhoneNumberDto {
59 fallback_destination: None,
60 hooks: None,
61 provider,
62 number_desired_area_code: None,
63 sip_uri: None,
64 authentication: None,
65 name: None,
66 assistant_id: None,
67 workflow_id: None,
68 squad_id: None,
69 server: None,
70 }
71 }
72}
73/// This is to create free SIP phone numbers on Vapi.
74#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
75pub enum ProviderTrue {
76 #[serde(rename = "vapi")]
77 Vapi,
78}
79
80impl Default for ProviderTrue {
81 fn default() -> ProviderTrue {
82 Self::Vapi
83 }
84}