vapi_client/models/
assignment_mutation.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 AssignmentMutation {
19    /// This is an optional array of conditions that must be met for this mutation to be triggered.
20    #[serde(rename = "conditions", skip_serializing_if = "Option::is_none")]
21    pub conditions: Option<Vec<models::BlockStartMessageConditionsInner>>,
22    /// This mutation assigns a new value to an existing or new variable.
23    #[serde(rename = "type")]
24    pub r#type: Type,
25    /// This is the variable to assign a new value to.  You can reference any variable in the context of the current block execution (step): - \"output.your-property-name\" for current step's output - \"your-step-name.output.your-property-name\" for another step's output (in the same workflow; read caveat #1) - \"your-block-name.output.your-property-name\" for another block's output (in the same workflow; read caveat #2) - \"global.your-property-name\" for the global context  This needs to be the key path of the variable. If you use {{}}, it'll dereference that to the value of the variable before assignment. This can be useful if the path is dynamic. Example: - \"global.{{my-tool-call-step.output.my-key-name}}\"  You can also string interpolate multiple variables to get the key name: - \"global.{{my-tool-call-step.output.my-key-name-suffix}}-{{my-tool-call-step.output.my-key-name}}\"  The path to the new variable is created if it doesn't exist. Example: - \"global.this-does-not-exist.neither-does-this\" will create `this-does-not-exist` object with `neither-does-this` as a key  Caveats: 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
26    #[serde(rename = "variable")]
27    pub variable: String,
28    /// The value to assign to the variable.  You can reference any variable in the context of the current block execution (step): - \"{{output.your-property-name}}\" for current step's output - \"{{your-step-name.output.your-property-name}}\" for another step's output (in the same workflow; read caveat #1) - \"{{your-block-name.output.your-property-name}}\" for another block's output (in the same workflow; read caveat #2) - \"{{global.your-property-name}}\" for the global context  Or, you can use a constant: - \"1\" - \"text\" - \"true\" - \"false\"  Or, you can mix and match with string interpolation: - \"{{your-property-name}}-{{input.your-property-name-2}}-1\"  Caveats: 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step. 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
29    #[serde(rename = "value")]
30    pub value: String,
31}
32
33impl AssignmentMutation {
34    pub fn new(r#type: Type, variable: String, value: String) -> AssignmentMutation {
35        AssignmentMutation {
36            conditions: None,
37            r#type,
38            variable,
39            value,
40        }
41    }
42}
43/// This mutation assigns a new value to an existing or new variable.
44#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
45pub enum Type {
46    #[serde(rename = "assignment")]
47    Assignment,
48}
49
50impl Default for Type {
51    fn default() -> Type {
52        Self::Assignment
53    }
54}