internetdata 2.2.1

The official Rust client library for the InternetData API: download and verify the published IP intelligence databases.
Documentation
/*
 * InternetData API
 *
 * The InternetData API: download the databases your organization is licensed for, and manage the account behind them.  See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
 *
 * The version of the OpenAPI document: 2026.09.21
 * Contact: support@internetdata.io
 * Generated by: https://openapi-generator.tech
 */

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

/// DatabaseMetadata : The build document written by the exporter, served through unchanged.
#[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>,
    /// ISO-8601 date (YYYY-MM-DD) the published build was generated on.
    #[serde(rename = "updated")]
    pub updated: chrono::NaiveDate,
    /// Row count in the current build.
    #[serde(rename = "entries")]
    pub entries: i64,
    /// 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")]
    pub sample: Option<std::collections::HashMap<String, Vec<serde_json::Value>>>,
    /// Bytes per format.
    #[serde(rename = "size")]
    pub size: std::collections::HashMap<String, i64>,
}

impl DatabaseMetadata {
    /// The build document written by the exporter, served through unchanged.
    pub fn new(
        id: String,
        updated: chrono::NaiveDate,
        entries: i64,
        schema: std::collections::HashMap<String, Vec<models::DatabaseMetadataColumn>>,
        size: std::collections::HashMap<String, i64>,
    ) -> DatabaseMetadata {
        DatabaseMetadata { id, update_freq: None, updated, entries, schema, sample: None, size }
    }
}