vpndetection 6.2.0

The official Rust client library for the VPNDetection API: anonymity detection covering VPNs, residential proxies, Tor nodes, hosting servers, CDNs and relays.
Documentation
/*
 * VPNDetection API
 *
 * The VPNDetection API: classify any IP address, and download the databases behind the answers.  Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key).  See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
 *
 * The version of the OpenAPI document: 2026.11.20
 * Contact: support@vpndetection.io
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EntitlementUsage {
    /// Requests counted in the current window. The same number the lookup API gates on, and it can lag by a few seconds.
    #[serde(rename = "requests")]
    pub requests: i64,
    /// What the plan includes. Zero on a plan that includes none.
    #[serde(rename = "quota")]
    pub quota: i64,
    /// Where full answers stop: past it, a paid key is answered with Unlimited's fields and `cap_reached: true`, uncharged, until the window ends or the cap is raised. NULL means never, which is the normal state of an uncapped paid plan and is not the same as zero. Above the quota and below this, requests are served and billed as overage.
    #[serde(rename = "hard_limit", deserialize_with = "Option::deserialize")]
    pub hard_limit: Option<i64>,
    /// When the current allowance period began.
    #[serde(rename = "window_start", deserialize_with = "crate::dates::date_time")]
    pub window_start: chrono::DateTime<chrono::FixedOffset>,
    /// When the allowance next resets.
    #[serde(rename = "window_end", deserialize_with = "crate::dates::date_time")]
    pub window_end: chrono::DateTime<chrono::FixedOffset>,
}

impl EntitlementUsage {
    pub fn new(
        requests: i64,
        quota: i64,
        hard_limit: Option<i64>,
        window_start: chrono::DateTime<chrono::FixedOffset>,
        window_end: chrono::DateTime<chrono::FixedOffset>,
    ) -> EntitlementUsage {
        EntitlementUsage { requests, quota, hard_limit, window_start, window_end }
    }
}