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: Table,
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<GroupBy>>,
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<Box<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(table: Table, name: String, operations: Vec<models::AnalyticsOperation>) -> AnalyticsQuery {
35        AnalyticsQuery {
36            table,
37            group_by: None,
38            name,
39            time_range: None,
40            operations,
41        }
42    }
43}
44/// This is the table you want to query.
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum Table {
47    #[serde(rename = "call")]
48    Call,
49    #[serde(rename = "subscription")]
50    Subscription,
51}
52
53impl Default for Table {
54    fn default() -> Table {
55        Self::Call
56    }
57}
58/// This is the list of columns you want to group by.
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum GroupBy {
61    #[serde(rename = "type")]
62    Type,
63    #[serde(rename = "assistantId")]
64    AssistantId,
65    #[serde(rename = "endedReason")]
66    EndedReason,
67    #[serde(rename = "analysis.successEvaluation")]
68    AnalysisPeriodSuccessEvaluation,
69    #[serde(rename = "status")]
70    Status,
71}
72
73impl Default for GroupBy {
74    fn default() -> GroupBy {
75        Self::Type
76    }
77}
78