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