vapi_client/models/
vapi_cost.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 VapiCost {
16    /// This is the type of cost, always 'vapi' for this class.
17    #[serde(rename = "type")]
18    pub r#type: TypeTrue,
19    /// This is the sub type of the cost.
20    #[serde(rename = "subType")]
21    pub sub_type: SubTypeTrue,
22    /// This is the minutes of Vapi usage. This should match `call.endedAt` - `call.startedAt`.
23    #[serde(rename = "minutes")]
24    pub minutes: f64,
25    /// This is the cost of the component in USD.
26    #[serde(rename = "cost")]
27    pub cost: f64,
28}
29
30impl VapiCost {
31    pub fn new(r#type: TypeTrue, sub_type: SubTypeTrue, minutes: f64, cost: f64) -> VapiCost {
32        VapiCost {
33            r#type,
34            sub_type,
35            minutes,
36            cost,
37        }
38    }
39}
40/// This is the type of cost, always 'vapi' for this class.
41#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
42pub enum TypeTrue {
43    #[serde(rename = "vapi")]
44    Vapi,
45}
46
47impl Default for TypeTrue {
48    fn default() -> TypeTrue {
49        Self::Vapi
50    }
51}
52/// This is the sub type of the cost.
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum SubTypeTrue {
55    #[serde(rename = "normal")]
56    Normal,
57    #[serde(rename = "overage")]
58    Overage,
59}
60
61impl Default for SubTypeTrue {
62    fn default() -> SubTypeTrue {
63        Self::Normal
64    }
65}