vapi_client/models/
analytics_query.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 AnalyticsQuery {
17    /// This is the table you want to query.
18    #[serde(rename = "table")]
19    pub table: Table,
20    /// This is the list of columns you want to group by.
21    #[serde(rename = "groupBy", skip_serializing_if = "Option::is_none")]
22    pub group_by: Option<Vec<GroupBy>>,
23    /// This is the name of the query. This will be used to identify the query in the response.
24    #[serde(rename = "name")]
25    pub name: String,
26    /// This is the time range for the query.
27    #[serde(rename = "timeRange", skip_serializing_if = "Option::is_none")]
28    pub time_range: Option<models::TimeRange>,
29    /// This is the list of operations you want to perform.
30    #[serde(rename = "operations")]
31    pub operations: Vec<models::AnalyticsOperation>,
32}
33
34impl AnalyticsQuery {
35    pub fn new(
36        table: Table,
37        name: String,
38        operations: Vec<models::AnalyticsOperation>,
39    ) -> AnalyticsQuery {
40        AnalyticsQuery {
41            table,
42            group_by: None,
43            name,
44            time_range: None,
45            operations,
46        }
47    }
48}
49/// This is the table you want to query.
50#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
51pub enum Table {
52    #[serde(rename = "call")]
53    Call,
54    #[serde(rename = "subscription")]
55    Subscription,
56}
57
58impl Default for Table {
59    fn default() -> Table {
60        Self::Call
61    }
62}
63/// This is the list of columns you want to group by.
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum GroupBy {
66    #[serde(rename = "type")]
67    Type,
68    #[serde(rename = "assistantId")]
69    AssistantId,
70    #[serde(rename = "endedReason")]
71    EndedReason,
72    #[serde(rename = "analysis.successEvaluation")]
73    AnalysisPeriodSuccessEvaluation,
74    #[serde(rename = "status")]
75    Status,
76}
77
78impl Default for GroupBy {
79    fn default() -> GroupBy {
80        Self::Type
81    }
82}