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 DatabaseMetadata {
    #[serde(rename = "id")]
    pub id: String,
    /// How often a new build is published
    #[serde(rename = "update_freq", skip_serializing_if = "Option::is_none")]
    pub update_freq: Option<String>,
    #[serde(rename = "updated", deserialize_with = "crate::dates::date")]
    pub updated: chrono::NaiveDate,
    /// Row count in the current build
    #[serde(rename = "entries")]
    pub entries: i32,
    /// Columns, keyed by format
    #[serde(rename = "schema")]
    pub schema: std::collections::HashMap<String, Vec<models::DatabaseMetadataColumn>>,
    /// A few real rows, keyed by format
    #[serde(
        rename = "sample",
        skip_serializing_if = "Option::is_none",
        default,
        deserialize_with = "crate::objects::option_object_lists"
    )]
    pub sample: Option<std::collections::HashMap<String, Vec<serde_json::Value>>>,
    /// Bytes per format
    #[serde(rename = "size", skip_serializing_if = "Option::is_none")]
    pub size: Option<std::collections::HashMap<String, i64>>,
    /// Bytes per format of the evaluation sample, where one is published
    #[serde(rename = "sample_size", skip_serializing_if = "Option::is_none")]
    pub sample_size: Option<std::collections::HashMap<String, i64>>,
    /// Row count in the evaluation sample
    #[serde(rename = "sample_entries", skip_serializing_if = "Option::is_none")]
    pub sample_entries: Option<i32>,
}

impl DatabaseMetadata {
    pub fn new(
        id: String,
        updated: chrono::NaiveDate,
        entries: i32,
        schema: std::collections::HashMap<String, Vec<models::DatabaseMetadataColumn>>,
    ) -> DatabaseMetadata {
        DatabaseMetadata {
            id,
            update_freq: None,
            updated,
            entries,
            schema,
            sample: None,
            size: None,
            sample_size: None,
            sample_entries: None,
        }
    }
}