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