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