vapi_client/models/rule_based_condition.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::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct RuleBasedCondition {
19 /// This condition is based on a strict rule.
20 #[serde(rename = "type")]
21 pub r#type: Type,
22 /// This is the operator you want to use to compare the left side and right side. The operation becomes `(leftSide) operator (rightSide)`.
23 #[serde(rename = "operator")]
24 pub operator: Operator,
25 /// This is the left side of the operation. You can reference any variable in the context of the current block execution (step): - \"{{output.your-property-name}}\" for current step's output - \"{{input.your-property-name}}\" for current step's input - \"{{your-step-name.output.your-property-name}}\" for another step's output (in the same workflow; read caveat #1) - \"{{your-step-name.input.your-property-name}}\" for another step's input (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) - \"{{your-block-name.input.your-property-name}}\" for another block's input (in the same workflow; read caveat #2) - \"{{workflow.input.your-property-name}}\" for the current workflow's input - \"{{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.input/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.input/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 with steps.
26 #[serde(rename = "leftSide")]
27 pub left_side: String,
28 /// This is the right side of the operation. You can reference any variable in the context of the current block execution (step): - \"{{output.your-property-name}}\" for current step's output - \"{{input.your-property-name}}\" for current step's input - \"{{your-step-name.output.your-property-name}}\" for another step's output (in the same workflow; read caveat #1) - \"{{your-step-name.input.your-property-name}}\" for another step's input (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) - \"{{your-block-name.input.your-property-name}}\" for another block's input (in the same workflow; read caveat #2) - \"{{workflow.input.your-property-name}}\" for the current workflow's input - \"{{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.input/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.input/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 with steps.
29 #[serde(rename = "rightSide")]
30 pub right_side: String,
31}
32
33impl RuleBasedCondition {
34 pub fn new(
35 r#type: Type,
36 operator: Operator,
37 left_side: String,
38 right_side: String,
39 ) -> RuleBasedCondition {
40 RuleBasedCondition {
41 r#type,
42 operator,
43 left_side,
44 right_side,
45 }
46 }
47}
48/// This condition is based on a strict rule.
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
50pub enum Type {
51 #[serde(rename = "rule-based")]
52 RuleBased,
53}
54
55impl Default for Type {
56 fn default() -> Type {
57 Self::RuleBased
58 }
59}
60/// This is the operator you want to use to compare the left side and right side. The operation becomes `(leftSide) operator (rightSide)`.
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
62pub enum Operator {
63 #[serde(rename = "eq")]
64 Eq,
65 #[serde(rename = "neq")]
66 Neq,
67 #[serde(rename = "gt")]
68 Gt,
69 #[serde(rename = "gte")]
70 Gte,
71 #[serde(rename = "lt")]
72 Lt,
73 #[serde(rename = "lte")]
74 Lte,
75}
76
77impl Default for Operator {
78 fn default() -> Operator {
79 Self::Eq
80 }
81}