vapi_client/models/handoff_step.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};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct HandoffStep {
17 #[serde(rename = "block", skip_serializing_if = "Option::is_none")]
18 pub block: Option<models::HandoffStepBlock>,
19 /// This is a step that takes a handoff from the previous step. This means it won't return to the calling step. The workflow execution will continue linearly. Use case: - You want to collect information linearly (e.g. a form, provide information, etc).
20 #[serde(rename = "type")]
21 pub r#type: Type,
22 /// These are the destinations that the step can go to after it's done.
23 #[serde(rename = "destinations", skip_serializing_if = "Option::is_none")]
24 pub destinations: Option<Vec<models::HandoffStepDestinationsInner>>,
25 /// This is the name of the step.
26 #[serde(rename = "name")]
27 pub name: String,
28 /// This is the id of the block to use. To use a transient block, use `block`.
29 #[serde(rename = "blockId", skip_serializing_if = "Option::is_none")]
30 pub block_id: Option<String>,
31 /// This is the input to the block. You can use any key-value map as input to the block. Example: { \"name\": \"John Doe\", \"age\": 20 } You can reference any variable in the context of the current block: - \"{{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 Example: { \"name\": \"{{my-tool-call-step.output.name}}\", \"age\": \"{{my-tool-call-step.input.age}}\", \"date\": \"{{workflow.input.date}}\" } You can dynamically change the key name. Example: { \"{{my-tool-call-step.output.key-name-for-name}}\": \"{{name}}\", \"{{my-tool-call-step.input.key-name-for-age}}\": \"{{age}}\", \"{{workflow.input.key-name-for-date}}\": \"{{date}}\" } You can represent the value as a string, number, boolean, array, or object. Example: { \"name\": \"john\", \"age\": 20, \"date\": \"2021-01-01\", \"metadata\": { \"unique-key\": \"{{my-tool-call-step.output.unique-key}}\" }, \"array\": [\"A\", \"B\", \"C\"], } 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.
32 #[serde(rename = "input", skip_serializing_if = "Option::is_none")]
33 pub input: Option<serde_json::Value>,
34}
35
36impl HandoffStep {
37 pub fn new(r#type: Type, name: String) -> HandoffStep {
38 HandoffStep {
39 block: None,
40 r#type,
41 destinations: None,
42 name,
43 block_id: None,
44 input: None,
45 }
46 }
47}
48/// This is a step that takes a handoff from the previous step. This means it won't return to the calling step. The workflow execution will continue linearly. Use case: - You want to collect information linearly (e.g. a form, provide information, etc).
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
50pub enum Type {
51 #[serde(rename = "handoff")]
52 Handoff,
53}
54
55impl Default for Type {
56 fn default() -> Type {
57 Self::Handoff
58 }
59}