vapi_client/models/
gather.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 Gather {
19    #[serde(rename = "type")]
20    pub r#type: Type,
21    #[serde(rename = "output")]
22    pub output: models::JsonSchema,
23    /// This is whether or not the workflow should read back the gathered data to the user, and ask about its correctness.
24    #[serde(rename = "confirmContent", skip_serializing_if = "Option::is_none")]
25    pub confirm_content: Option<bool>,
26    /// This is a list of hooks for a task. Each hook is a list of tasks to run on a trigger (such as on start, on failure, etc). Only Say is supported for now.
27    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
28    pub hooks: Option<Vec<models::Hook>>,
29    /// This is the number of times we should try to gather the information from the user before we failover to the fail path. An example of this would be a user refusing to give their phone number for privacy reasons, and then going down a different path on account of this
30    #[serde(rename = "maxRetries", skip_serializing_if = "Option::is_none")]
31    pub max_retries: Option<f64>,
32    /// This is a liquid templating string. On the first call to Gather, the template will be filled out with variables from the context, and will be spoken verbatim to the user. An example would be \"Base on your zipcode, it looks like you could be in one of these counties: {{ counties | join: \", \" }}. Which one do you live in?\"
33    #[serde(rename = "literalTemplate", skip_serializing_if = "Option::is_none")]
34    pub literal_template: Option<String>,
35    #[serde(rename = "name")]
36    pub name: String,
37    /// This is for metadata you want to store on the task.
38    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
39    pub metadata: Option<serde_json::Value>,
40}
41
42impl Gather {
43    pub fn new(r#type: Type, output: models::JsonSchema, name: String) -> Gather {
44        Gather {
45            r#type,
46            output,
47            confirm_content: None,
48            hooks: None,
49            max_retries: None,
50            literal_template: None,
51            name,
52            metadata: None,
53        }
54    }
55}
56///
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
58pub enum Type {
59    #[serde(rename = "gather")]
60    Gather,
61}
62
63impl Default for Type {
64    fn default() -> Type {
65        Self::Gather
66    }
67}