vapi_client/models/
subscription.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 Subscription {
19    /// This is the unique identifier for the subscription.
20    #[serde(rename = "id")]
21    pub id: String,
22    /// This is the timestamp when the subscription was created.
23    #[serde(rename = "createdAt")]
24    pub created_at: String,
25    /// This is the timestamp when the subscription was last updated.
26    #[serde(rename = "updatedAt")]
27    pub updated_at: String,
28    /// This is the type / tier of the subscription.
29    #[serde(rename = "type")]
30    pub r#type: Type,
31    /// This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.
32    #[serde(rename = "status")]
33    pub status: Status,
34    /// This is the number of credits the subscription currently has.  Note: This is a string to avoid floating point precision issues.
35    #[serde(rename = "credits")]
36    pub credits: String,
37    /// This is the total number of active calls (concurrency) across all orgs under this subscription.
38    #[serde(rename = "concurrencyCounter")]
39    pub concurrency_counter: f64,
40    /// This is the default concurrency limit for the subscription.
41    #[serde(rename = "concurrencyLimitIncluded")]
42    pub concurrency_limit_included: f64,
43    /// This is the number of free phone numbers the subscription has
44    #[serde(
45        rename = "phoneNumbersCounter",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub phone_numbers_counter: Option<f64>,
49    /// This is the maximum number of free phone numbers the subscription can have
50    #[serde(
51        rename = "phoneNumbersIncluded",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub phone_numbers_included: Option<f64>,
55    /// This is the purchased add-on concurrency limit for the subscription.
56    #[serde(rename = "concurrencyLimitPurchased")]
57    pub concurrency_limit_purchased: f64,
58    /// This is the ID of the monthly job that charges for subscription add ons and phone numbers.
59    #[serde(
60        rename = "monthlyChargeScheduleId",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub monthly_charge_schedule_id: Option<f64>,
64    /// This is the ID of the monthly job that checks whether the credit balance of the subscription is sufficient for the monthly charge.
65    #[serde(
66        rename = "monthlyCreditCheckScheduleId",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub monthly_credit_check_schedule_id: Option<f64>,
70    /// This is the Stripe customer ID.
71    #[serde(rename = "stripeCustomerId", skip_serializing_if = "Option::is_none")]
72    pub stripe_customer_id: Option<String>,
73    /// This is the Stripe payment ID.
74    #[serde(
75        rename = "stripePaymentMethodId",
76        skip_serializing_if = "Option::is_none"
77    )]
78    pub stripe_payment_method_id: Option<String>,
79    /// If this flag is true, then the user has purchased slack support.
80    #[serde(
81        rename = "slackSupportEnabled",
82        skip_serializing_if = "Option::is_none"
83    )]
84    pub slack_support_enabled: Option<bool>,
85    /// If this subscription has a slack support subscription, the slack channel's ID will be stored here.
86    #[serde(rename = "slackChannelId", skip_serializing_if = "Option::is_none")]
87    pub slack_channel_id: Option<String>,
88    /// This is the HIPAA enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable HIPAA compliance.
89    #[serde(rename = "hipaaEnabled", skip_serializing_if = "Option::is_none")]
90    pub hipaa_enabled: Option<bool>,
91    /// This is the ID for the Common Paper agreement outlining the HIPAA contract.
92    #[serde(
93        rename = "hipaaCommonPaperAgreementId",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub hipaa_common_paper_agreement_id: Option<String>,
97    /// This is the Stripe fingerprint of the payment method (card). It allows us to detect users who try to abuse our system through multiple sign-ups.
98    #[serde(
99        rename = "stripePaymentMethodFingerprint",
100        skip_serializing_if = "Option::is_none"
101    )]
102    pub stripe_payment_method_fingerprint: Option<String>,
103    /// This is the customer's email on Stripe.
104    #[serde(
105        rename = "stripeCustomerEmail",
106        skip_serializing_if = "Option::is_none"
107    )]
108    pub stripe_customer_email: Option<String>,
109    /// This is the email of the referrer for the subscription.
110    #[serde(rename = "referredByEmail", skip_serializing_if = "Option::is_none")]
111    pub referred_by_email: Option<String>,
112    /// This is the auto reload plan configured for the subscription.
113    #[serde(rename = "autoReloadPlan", skip_serializing_if = "Option::is_none")]
114    pub auto_reload_plan: Option<models::AutoReloadPlan>,
115    /// The number of minutes included in the subscription.
116    #[serde(rename = "minutesIncluded", skip_serializing_if = "Option::is_none")]
117    pub minutes_included: Option<f64>,
118    /// The number of minutes used in the subscription.
119    #[serde(rename = "minutesUsed", skip_serializing_if = "Option::is_none")]
120    pub minutes_used: Option<f64>,
121    /// This is the timestamp at which the number of monthly free minutes is scheduled to reset at.
122    #[serde(
123        rename = "minutesUsedNextResetAt",
124        skip_serializing_if = "Option::is_none"
125    )]
126    pub minutes_used_next_reset_at: Option<String>,
127    /// The per minute charge on minutes that exceed the included minutes. Enterprise only.
128    #[serde(rename = "minutesOverageCost", skip_serializing_if = "Option::is_none")]
129    pub minutes_overage_cost: Option<f64>,
130    /// The list of providers included in the subscription. Enterprise only.
131    #[serde(rename = "providersIncluded", skip_serializing_if = "Option::is_none")]
132    pub providers_included: Option<Vec<String>>,
133    /// The maximum number of outbound calls this subscription may make in a day. Resets every night.
134    #[serde(
135        rename = "outboundCallsDailyLimit",
136        skip_serializing_if = "Option::is_none"
137    )]
138    pub outbound_calls_daily_limit: Option<f64>,
139    /// The current number of outbound calls the subscription has made in the current day.
140    #[serde(
141        rename = "outboundCallsCounter",
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub outbound_calls_counter: Option<f64>,
145    /// This is the timestamp at which the outbound calls counter is scheduled to reset at.
146    #[serde(
147        rename = "outboundCallsCounterNextResetAt",
148        skip_serializing_if = "Option::is_none"
149    )]
150    pub outbound_calls_counter_next_reset_at: Option<String>,
151    /// This is the IDs of the coupons applicable to this subscription.
152    #[serde(rename = "couponIds", skip_serializing_if = "Option::is_none")]
153    pub coupon_ids: Option<Vec<String>>,
154    /// This is the number of credits left obtained from a coupon.
155    #[serde(rename = "couponUsageLeft", skip_serializing_if = "Option::is_none")]
156    pub coupon_usage_left: Option<String>,
157    /// This is the invoice plan for the subscription.
158    #[serde(rename = "invoicePlan", skip_serializing_if = "Option::is_none")]
159    pub invoice_plan: Option<models::InvoicePlan>,
160}
161
162impl Subscription {
163    pub fn new(
164        id: String,
165        created_at: String,
166        updated_at: String,
167        r#type: Type,
168        status: Status,
169        credits: String,
170        concurrency_counter: f64,
171        concurrency_limit_included: f64,
172        concurrency_limit_purchased: f64,
173    ) -> Subscription {
174        Subscription {
175            id,
176            created_at,
177            updated_at,
178            r#type,
179            status,
180            credits,
181            concurrency_counter,
182            concurrency_limit_included,
183            phone_numbers_counter: None,
184            phone_numbers_included: None,
185            concurrency_limit_purchased,
186            monthly_charge_schedule_id: None,
187            monthly_credit_check_schedule_id: None,
188            stripe_customer_id: None,
189            stripe_payment_method_id: None,
190            slack_support_enabled: None,
191            slack_channel_id: None,
192            hipaa_enabled: None,
193            hipaa_common_paper_agreement_id: None,
194            stripe_payment_method_fingerprint: None,
195            stripe_customer_email: None,
196            referred_by_email: None,
197            auto_reload_plan: None,
198            minutes_included: None,
199            minutes_used: None,
200            minutes_used_next_reset_at: None,
201            minutes_overage_cost: None,
202            providers_included: None,
203            outbound_calls_daily_limit: None,
204            outbound_calls_counter: None,
205            outbound_calls_counter_next_reset_at: None,
206            coupon_ids: None,
207            coupon_usage_left: None,
208            invoice_plan: None,
209        }
210    }
211}
212/// This is the type / tier of the subscription.
213#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
214pub enum Type {
215    #[serde(rename = "trial")]
216    Trial,
217    #[serde(rename = "pay-as-you-go")]
218    PayAsYouGo,
219    #[serde(rename = "enterprise")]
220    Enterprise,
221}
222
223impl Default for Type {
224    fn default() -> Type {
225        Self::Trial
226    }
227}
228/// This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.
229#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
230pub enum Status {
231    #[serde(rename = "active")]
232    Active,
233    #[serde(rename = "frozen")]
234    Frozen,
235}
236
237impl Default for Status {
238    fn default() -> Status {
239        Self::Active
240    }
241}