vapi_client/models/
create_text_editor_tool_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 CreateTextEditorToolDto {
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. \"textEditor\" for Text Editor 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    /// The name of the tool, fixed to 'str_replace_editor'
29    #[serde(rename = "name")]
30    pub name: Name,
31    /// 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.
32    #[serde(rename = "function", skip_serializing_if = "Option::is_none")]
33    pub function: Option<Box<models::OpenAiFunction>>,
34    /// 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.
35    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
36    pub server: Option<Box<models::Server>>,
37}
38
39impl CreateTextEditorToolDto {
40    pub fn new(r#type: Type, sub_type: SubType, name: Name) -> CreateTextEditorToolDto {
41        CreateTextEditorToolDto {
42            r#async: None,
43            messages: None,
44            r#type,
45            sub_type,
46            name,
47            function: None,
48            server: None,
49        }
50    }
51}
52/// The type of tool. \"textEditor\" for Text Editor tool.
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum Type {
55    #[serde(rename = "textEditor")]
56    TextEditor,
57}
58
59impl Default for Type {
60    fn default() -> Type {
61        Self::TextEditor
62    }
63}
64/// The sub type of tool.
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum SubType {
67    #[serde(rename = "text_editor_20241022")]
68    TextEditor20241022,
69}
70
71impl Default for SubType {
72    fn default() -> SubType {
73        Self::TextEditor20241022
74    }
75}
76/// The name of the tool, fixed to 'str_replace_editor'
77#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
78pub enum Name {
79    #[serde(rename = "str_replace_editor")]
80    StrReplaceEditor,
81}
82
83impl Default for Name {
84    fn default() -> Name {
85        Self::StrReplaceEditor
86    }
87}
88