vapi_client/models/
assistant_hooks.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 AssistantHooks {
17    /// This is the event that triggers this hook
18    #[serde(rename = "on")]
19    pub on: On,
20    /// This is the set of filters that must match for the hook to trigger
21    #[serde(rename = "filters", skip_serializing_if = "Option::is_none")]
22    pub filters: Option<Vec<models::AssistantHookFilter>>,
23    /// This is the set of actions to perform when the hook triggers
24    #[serde(rename = "do")]
25    pub r#do: Vec<serde_json::Value>,
26}
27
28impl AssistantHooks {
29    pub fn new(on: On, r#do: Vec<serde_json::Value>) -> AssistantHooks {
30        AssistantHooks {
31            on,
32            filters: None,
33            r#do,
34        }
35    }
36}
37/// This is the event that triggers this hook
38#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
39pub enum On {
40    #[serde(rename = "call.ending")]
41    CallPeriodEnding,
42}
43
44impl Default for On {
45    fn default() -> On {
46        Self::CallPeriodEnding
47    }
48}