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