vapi-client 0.4.2

Unofficial crate for Vapi - Voice AI for developers.
Documentation
/*
 * Vapi API
 *
 * Voice AI for developers.
 *
 * The version of the OpenAPI document: 1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Subscription {
    /// This is the unique identifier for the subscription.
    #[serde(rename = "id")]
    pub id: String,
    /// This is the timestamp when the subscription was created.
    #[serde(rename = "createdAt")]
    pub created_at: String,
    /// This is the timestamp when the subscription was last updated.
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    /// This is the type / tier of the subscription.
    #[serde(rename = "type")]
    pub r#type: TypeTrue,
    /// This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.
    #[serde(rename = "status")]
    pub status: StatusTrue,
    /// This is the number of credits the subscription currently has.  Note: This is a string to avoid floating point precision issues.
    #[serde(rename = "credits")]
    pub credits: String,
    /// This is the total number of active calls (concurrency) across all orgs under this subscription.
    #[serde(rename = "concurrencyCounter")]
    pub concurrency_counter: f64,
    /// This is the default concurrency limit for the subscription.
    #[serde(rename = "concurrencyLimitIncluded")]
    pub concurrency_limit_included: f64,
    /// This is the number of free phone numbers the subscription has
    #[serde(
        rename = "phoneNumbersCounter",
        skip_serializing_if = "Option::is_none"
    )]
    pub phone_numbers_counter: Option<f64>,
    /// This is the maximum number of free phone numbers the subscription can have
    #[serde(
        rename = "phoneNumbersIncluded",
        skip_serializing_if = "Option::is_none"
    )]
    pub phone_numbers_included: Option<f64>,
    /// This is the purchased add-on concurrency limit for the subscription.
    #[serde(rename = "concurrencyLimitPurchased")]
    pub concurrency_limit_purchased: f64,
    /// This is the ID of the monthly job that charges for subscription add ons and phone numbers.
    #[serde(
        rename = "monthlyChargeScheduleId",
        skip_serializing_if = "Option::is_none"
    )]
    pub monthly_charge_schedule_id: Option<f64>,
    /// This is the ID of the monthly job that checks whether the credit balance of the subscription is sufficient for the monthly charge.
    #[serde(
        rename = "monthlyCreditCheckScheduleId",
        skip_serializing_if = "Option::is_none"
    )]
    pub monthly_credit_check_schedule_id: Option<f64>,
    /// This is the Stripe customer ID.
    #[serde(rename = "stripeCustomerId", skip_serializing_if = "Option::is_none")]
    pub stripe_customer_id: Option<String>,
    /// This is the Stripe payment ID.
    #[serde(
        rename = "stripePaymentMethodId",
        skip_serializing_if = "Option::is_none"
    )]
    pub stripe_payment_method_id: Option<String>,
    /// If this flag is true, then the user has purchased slack support.
    #[serde(
        rename = "slackSupportEnabled",
        skip_serializing_if = "Option::is_none"
    )]
    pub slack_support_enabled: Option<bool>,
    /// If this subscription has a slack support subscription, the slack channel's ID will be stored here.
    #[serde(rename = "slackChannelId", skip_serializing_if = "Option::is_none")]
    pub slack_channel_id: Option<String>,
    /// This is the HIPAA enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable HIPAA compliance.
    #[serde(rename = "hipaaEnabled", skip_serializing_if = "Option::is_none")]
    pub hipaa_enabled: Option<bool>,
    /// This is the ID for the Common Paper agreement outlining the HIPAA contract.
    #[serde(
        rename = "hipaaCommonPaperAgreementId",
        skip_serializing_if = "Option::is_none"
    )]
    pub hipaa_common_paper_agreement_id: Option<String>,
    /// 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.
    #[serde(
        rename = "stripePaymentMethodFingerprint",
        skip_serializing_if = "Option::is_none"
    )]
    pub stripe_payment_method_fingerprint: Option<String>,
    /// This is the customer's email on Stripe.
    #[serde(
        rename = "stripeCustomerEmail",
        skip_serializing_if = "Option::is_none"
    )]
    pub stripe_customer_email: Option<String>,
    /// This is the email of the referrer for the subscription.
    #[serde(rename = "referredByEmail", skip_serializing_if = "Option::is_none")]
    pub referred_by_email: Option<String>,
    /// This is the auto reload plan configured for the subscription.
    #[serde(rename = "autoReloadPlan", skip_serializing_if = "Option::is_none")]
    pub auto_reload_plan: Option<models::AutoReloadPlan>,
    /// The number of minutes included in the subscription.
    #[serde(rename = "minutesIncluded", skip_serializing_if = "Option::is_none")]
    pub minutes_included: Option<f64>,
    /// The number of minutes used in the subscription.
    #[serde(rename = "minutesUsed", skip_serializing_if = "Option::is_none")]
    pub minutes_used: Option<f64>,
    /// This is the timestamp at which the number of monthly free minutes is scheduled to reset at.
    #[serde(
        rename = "minutesUsedNextResetAt",
        skip_serializing_if = "Option::is_none"
    )]
    pub minutes_used_next_reset_at: Option<String>,
    /// The per minute charge on minutes that exceed the included minutes. Enterprise only.
    #[serde(rename = "minutesOverageCost", skip_serializing_if = "Option::is_none")]
    pub minutes_overage_cost: Option<f64>,
    /// The list of providers included in the subscription. Enterprise only.
    #[serde(rename = "providersIncluded", skip_serializing_if = "Option::is_none")]
    pub providers_included: Option<Vec<String>>,
    /// The maximum number of outbound calls this subscription may make in a day. Resets every night.
    #[serde(
        rename = "outboundCallsDailyLimit",
        skip_serializing_if = "Option::is_none"
    )]
    pub outbound_calls_daily_limit: Option<f64>,
    /// The current number of outbound calls the subscription has made in the current day.
    #[serde(
        rename = "outboundCallsCounter",
        skip_serializing_if = "Option::is_none"
    )]
    pub outbound_calls_counter: Option<f64>,
    /// This is the timestamp at which the outbound calls counter is scheduled to reset at.
    #[serde(
        rename = "outboundCallsCounterNextResetAt",
        skip_serializing_if = "Option::is_none"
    )]
    pub outbound_calls_counter_next_reset_at: Option<String>,
    /// This is the IDs of the coupons applicable to this subscription.
    #[serde(rename = "couponIds", skip_serializing_if = "Option::is_none")]
    pub coupon_ids: Option<Vec<String>>,
    /// This is the number of credits left obtained from a coupon.
    #[serde(rename = "couponUsageLeft", skip_serializing_if = "Option::is_none")]
    pub coupon_usage_left: Option<String>,
    /// This is the invoice plan for the subscription.
    #[serde(rename = "invoicePlan", skip_serializing_if = "Option::is_none")]
    pub invoice_plan: Option<models::InvoicePlan>,
    /// This is the PCI enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable PCI compliance.
    #[serde(rename = "pciEnabled", skip_serializing_if = "Option::is_none")]
    pub pci_enabled: Option<bool>,
    /// This is the ID for the Common Paper agreement outlining the PCI contract.
    #[serde(
        rename = "pciCommonPaperAgreementId",
        skip_serializing_if = "Option::is_none"
    )]
    pub pci_common_paper_agreement_id: Option<String>,
}

impl Subscription {
    pub fn new(
        id: String,
        created_at: String,
        updated_at: String,
        r#type: TypeTrue,
        status: StatusTrue,
        credits: String,
        concurrency_counter: f64,
        concurrency_limit_included: f64,
        concurrency_limit_purchased: f64,
    ) -> Subscription {
        Subscription {
            id,
            created_at,
            updated_at,
            r#type,
            status,
            credits,
            concurrency_counter,
            concurrency_limit_included,
            phone_numbers_counter: None,
            phone_numbers_included: None,
            concurrency_limit_purchased,
            monthly_charge_schedule_id: None,
            monthly_credit_check_schedule_id: None,
            stripe_customer_id: None,
            stripe_payment_method_id: None,
            slack_support_enabled: None,
            slack_channel_id: None,
            hipaa_enabled: None,
            hipaa_common_paper_agreement_id: None,
            stripe_payment_method_fingerprint: None,
            stripe_customer_email: None,
            referred_by_email: None,
            auto_reload_plan: None,
            minutes_included: None,
            minutes_used: None,
            minutes_used_next_reset_at: None,
            minutes_overage_cost: None,
            providers_included: None,
            outbound_calls_daily_limit: None,
            outbound_calls_counter: None,
            outbound_calls_counter_next_reset_at: None,
            coupon_ids: None,
            coupon_usage_left: None,
            invoice_plan: None,
            pci_enabled: None,
            pci_common_paper_agreement_id: None,
        }
    }
}
/// This is the type / tier of the subscription.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TypeTrue {
    #[serde(rename = "trial")]
    Trial,
    #[serde(rename = "pay-as-you-go")]
    PayAsYouGo,
    #[serde(rename = "enterprise")]
    Enterprise,
    #[serde(rename = "agency")]
    Agency,
    #[serde(rename = "startup")]
    Startup,
    #[serde(rename = "growth")]
    Growth,
    #[serde(rename = "scale")]
    Scale,
}

impl Default for TypeTrue {
    fn default() -> TypeTrue {
        Self::Trial
    }
}
/// This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StatusTrue {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "frozen")]
    Frozen,
}

impl Default for StatusTrue {
    fn default() -> StatusTrue {
        Self::Active
    }
}