vapi_client/models/
analytics_query.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AnalyticsQuery {
16    /// This is the table you want to query.
17    #[serde(rename = "table")]
18    pub table: TableTrue,
19    /// This is the list of columns you want to group by.
20    #[serde(rename = "groupBy", skip_serializing_if = "Option::is_none")]
21    pub group_by: Option<Vec<GroupByTrue>>,
22    /// This is the name of the query. This will be used to identify the query in the response.
23    #[serde(rename = "name")]
24    pub name: String,
25    /// This is the time range for the query.
26    #[serde(rename = "timeRange", skip_serializing_if = "Option::is_none")]
27    pub time_range: Option<models::TimeRange>,
28    /// This is the list of operations you want to perform.
29    #[serde(rename = "operations")]
30    pub operations: Vec<models::AnalyticsOperation>,
31}
32
33impl AnalyticsQuery {
34    pub fn new(
35        table: TableTrue,
36        name: String,
37        operations: Vec<models::AnalyticsOperation>,
38    ) -> AnalyticsQuery {
39        AnalyticsQuery {
40            table,
41            group_by: None,
42            name,
43            time_range: None,
44            operations,
45        }
46    }
47}
48/// This is the table you want to query.
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
50pub enum TableTrue {
51    #[serde(rename = "call")]
52    Call,
53    #[serde(rename = "subscription")]
54    Subscription,
55}
56
57impl Default for TableTrue {
58    fn default() -> TableTrue {
59        Self::Call
60    }
61}
62/// This is the list of columns you want to group by.
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum GroupByTrue {
65    #[serde(rename = "type")]
66    Type,
67    #[serde(rename = "assistantId")]
68    AssistantId,
69    #[serde(rename = "endedReason")]
70    EndedReason,
71    #[serde(rename = "analysis.successEvaluation")]
72    AnalysisPeriodSuccessEvaluation,
73    #[serde(rename = "status")]
74    Status,
75}
76
77impl Default for GroupByTrue {
78    fn default() -> GroupByTrue {
79        Self::Type
80    }
81}