vapi_client/models/computer_tool.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 ComputerTool {
16    /// This determines if the tool is async.  If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.  If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.  Defaults to synchronous (`false`).
17    #[serde(rename = "async", skip_serializing_if = "Option::is_none")]
18    pub r#async: Option<bool>,
19    /// These are the messages that will be spoken to the user as the tool is running.  For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
20    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
21    pub messages: Option<Vec<models::CreateDtmfToolDtoMessagesInner>>,
22    /// The type of tool. \"computer\" for Computer tool.
23    #[serde(rename = "type")]
24    pub r#type: Type,
25    /// The sub type of tool.
26    #[serde(rename = "subType")]
27    pub sub_type: SubType,
28    /// This is the unique identifier for the tool.
29    #[serde(rename = "id")]
30    pub id: String,
31    /// This is the unique identifier for the organization that this tool belongs to.
32    #[serde(rename = "orgId")]
33    pub org_id: String,
34    /// This is the ISO 8601 date-time string of when the tool was created.
35    #[serde(rename = "createdAt")]
36    pub created_at: String,
37    /// This is the ISO 8601 date-time string of when the tool was last updated.
38    #[serde(rename = "updatedAt")]
39    pub updated_at: String,
40    /// This is the function definition of the tool.  For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.  An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument \"reason\". Then, in `messages` array, you can have many \"request-complete\" messages. One of these messages will be triggered if the `messages[].conditions` matches the \"reason\" argument.
41    #[serde(rename = "function", skip_serializing_if = "Option::is_none")]
42    pub function: Option<Box<models::OpenAiFunction>>,
43    /// This is the server that will be hit when this tool is requested by the model.  All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.  This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
44    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
45    pub server: Option<Box<models::Server>>,
46    /// The name of the tool, fixed to 'computer'
47    #[serde(rename = "name")]
48    pub name: Name,
49    /// The display width in pixels
50    #[serde(rename = "displayWidthPx")]
51    pub display_width_px: f64,
52    /// The display height in pixels
53    #[serde(rename = "displayHeightPx")]
54    pub display_height_px: f64,
55    /// Optional display number
56    #[serde(rename = "displayNumber", skip_serializing_if = "Option::is_none")]
57    pub display_number: Option<f64>,
58}
59
60impl ComputerTool {
61    pub fn new(r#type: Type, sub_type: SubType, id: String, org_id: String, created_at: String, updated_at: String, name: Name, display_width_px: f64, display_height_px: f64) -> ComputerTool {
62        ComputerTool {
63            r#async: None,
64            messages: None,
65            r#type,
66            sub_type,
67            id,
68            org_id,
69            created_at,
70            updated_at,
71            function: None,
72            server: None,
73            name,
74            display_width_px,
75            display_height_px,
76            display_number: None,
77        }
78    }
79}
80/// The type of tool. \"computer\" for Computer tool.
81#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
82pub enum Type {
83    #[serde(rename = "computer")]
84    Computer,
85}
86
87impl Default for Type {
88    fn default() -> Type {
89        Self::Computer
90    }
91}
92/// The sub type of tool.
93#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
94pub enum SubType {
95    #[serde(rename = "computer_20241022")]
96    Computer20241022,
97}
98
99impl Default for SubType {
100    fn default() -> SubType {
101        Self::Computer20241022
102    }
103}
104/// The name of the tool, fixed to 'computer'
105#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
106pub enum Name {
107    #[serde(rename = "computer")]
108    Computer,
109}
110
111impl Default for Name {
112    fn default() -> Name {
113        Self::Computer
114    }
115}
116