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