vapi_client/models/
analytics_operation.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 AnalyticsOperation {
17    /// This is the aggregation operation you want to perform.
18    #[serde(rename = "operation")]
19    pub operation: Operation,
20    /// This is the columns you want to perform the aggregation operation on.
21    #[serde(rename = "column")]
22    pub column: Column,
23    /// This is the alias for column name returned. Defaults to `${operation}${column}`.
24    #[serde(rename = "alias", skip_serializing_if = "Option::is_none")]
25    pub alias: Option<String>,
26}
27
28impl AnalyticsOperation {
29    pub fn new(operation: Operation, column: Column) -> AnalyticsOperation {
30        AnalyticsOperation {
31            operation,
32            column,
33            alias: None,
34        }
35    }
36}
37/// This is the aggregation operation you want to perform.
38#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
39pub enum Operation {
40    #[serde(rename = "sum")]
41    Sum,
42    #[serde(rename = "avg")]
43    Avg,
44    #[serde(rename = "count")]
45    Count,
46    #[serde(rename = "min")]
47    Min,
48    #[serde(rename = "max")]
49    Max,
50    #[serde(rename = "history")]
51    History,
52}
53
54impl Default for Operation {
55    fn default() -> Operation {
56        Self::Sum
57    }
58}
59/// This is the columns you want to perform the aggregation operation on.
60#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
61pub enum Column {
62    #[serde(rename = "id")]
63    Id,
64    #[serde(rename = "cost")]
65    Cost,
66    #[serde(rename = "costBreakdown.llm")]
67    CostBreakdownPeriodLlm,
68    #[serde(rename = "costBreakdown.stt")]
69    CostBreakdownPeriodStt,
70    #[serde(rename = "costBreakdown.tts")]
71    CostBreakdownPeriodTts,
72    #[serde(rename = "costBreakdown.vapi")]
73    CostBreakdownPeriodVapi,
74    #[serde(rename = "costBreakdown.ttsCharacters")]
75    CostBreakdownPeriodTtsCharacters,
76    #[serde(rename = "costBreakdown.llmPromptTokens")]
77    CostBreakdownPeriodLlmPromptTokens,
78    #[serde(rename = "costBreakdown.llmCompletionTokens")]
79    CostBreakdownPeriodLlmCompletionTokens,
80    #[serde(rename = "duration")]
81    Duration,
82    #[serde(rename = "concurrency")]
83    Concurrency,
84    #[serde(rename = "minutesUsed")]
85    MinutesUsed,
86}
87
88impl Default for Column {
89    fn default() -> Column {
90        Self::Id
91    }
92}