vpndetection 1.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 datasets behind the answers.  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.09.09
 * Contact: support@vpndetection.io
 * Generated by: https://openapi-generator.tech
 */

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

/// LicensedDataset : One dataset FAMILY your organization is licensed for. A license covers the family, while a download names a specific version, so the ids you pass to the download and checksum endpoints come from `versions`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LicensedDataset {
    /// The dataset family, e.g. `vpn_ip`. What the license is held against.
    #[serde(rename = "base")]
    pub base: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
    pub summary: Option<String>,
    /// What your license permits you to do with the data.
    #[serde(rename = "license_type")]
    pub license_type: LicenseType,
    #[serde(
        rename = "starts",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub starts: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
    /// A hard stop. Null when the license has no end date, which is the normal case for a rolling agreement, and when there is no license. A rolling license reports its turnover date in renews_at instead.
    #[serde(
        rename = "expires",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub expires: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
    /// When a rolling license next renews. Null when the license has no defined term, when expires sets a hard stop instead, and when there is no license.
    #[serde(
        rename = "renews_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub renews_at: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
    /// The last day notice of non-renewal can be given for the term ending at renews_at. Null whenever renews_at is, and when the agreement records no notice period.
    #[serde(
        rename = "notice_due_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub notice_due_at: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
    /// False when the license has lapsed; downloads are refused.
    #[serde(rename = "in_term")]
    pub in_term: bool,
    /// `licensed` is a live grant, `expired` one whose term has ended, and `unlicensed` a dataset published but never bought.
    #[serde(rename = "standing")]
    pub standing: Standing,
    /// Every published version of this family. The `id` here is what the download and checksum endpoints take.
    #[serde(rename = "versions")]
    pub versions: Vec<models::LicensedVersion>,
}

impl LicensedDataset {
    /// One dataset FAMILY your organization is licensed for. A license covers the family, while a download names a specific version, so the ids you pass to the download and checksum endpoints come from `versions`.
    pub fn new(
        base: String,
        name: String,
        license_type: LicenseType,
        in_term: bool,
        standing: Standing,
        versions: Vec<models::LicensedVersion>,
    ) -> LicensedDataset {
        LicensedDataset {
            base,
            name,
            summary: None,
            license_type,
            starts: None,
            expires: None,
            renews_at: None,
            notice_due_at: None,
            in_term,
            standing,
            versions,
        }
    }
}
/// What your license permits you to do with the data.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LicenseType {
    #[serde(rename = "evaluation")]
    Evaluation,
    #[serde(rename = "standard")]
    Standard,
    #[serde(rename = "redistribute")]
    Redistribute,
}

impl Default for LicenseType {
    fn default() -> LicenseType {
        Self::Evaluation
    }
}
/// `licensed` is a live grant, `expired` one whose term has ended, and `unlicensed` a dataset published but never bought.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Standing {
    #[serde(rename = "expired")]
    Expired,
    #[serde(rename = "licensed")]
    Licensed,
    #[serde(rename = "unlicensed")]
    Unlicensed,
}

impl Default for Standing {
    fn default() -> Standing {
        Self::Expired
    }
}