vapi_client/models/
analytics_query_result.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 AnalyticsQueryResult {
17    /// This is the unique key for the query.
18    #[serde(rename = "name")]
19    pub name: String,
20    /// This is the time range for the query.
21    #[serde(rename = "timeRange")]
22    pub time_range: models::TimeRange,
23    /// This is the result of the query, a list of unique groups with result of their aggregations.  Example: \"result\": [   { \"date\": \"2023-01-01\", \"assistantId\": \"123\", \"endedReason\": \"customer-ended-call\", \"sumDuration\": 120, \"avgCost\": 10.5 },   { \"date\": \"2023-01-02\", \"assistantId\": \"123\", \"endedReason\": \"customer-did-not-give-microphone-permission\", \"sumDuration\": 0, \"avgCost\": 0 },   // Additional results ]
24    #[serde(rename = "result")]
25    pub result: Vec<serde_json::Value>,
26}
27
28impl AnalyticsQueryResult {
29    pub fn new(
30        name: String,
31        time_range: models::TimeRange,
32        result: Vec<serde_json::Value>,
33    ) -> AnalyticsQueryResult {
34        AnalyticsQueryResult {
35            name,
36            time_range,
37            result,
38        }
39    }
40}