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};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct AnalyticsQueryResult {
19 /// This is the unique key for the query.
20 #[serde(rename = "name")]
21 pub name: String,
22 /// This is the time range for the query.
23 #[serde(rename = "timeRange")]
24 pub time_range: models::TimeRange,
25 /// 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 ]
26 #[serde(rename = "result")]
27 pub result: Vec<serde_json::Value>,
28}
29
30impl AnalyticsQueryResult {
31 pub fn new(
32 name: String,
33 time_range: models::TimeRange,
34 result: Vec<serde_json::Value>,
35 ) -> AnalyticsQueryResult {
36 AnalyticsQueryResult {
37 name,
38 time_range,
39 result,
40 }
41 }
42}