internetdata 3.1.0

The official Rust client library for the InternetData API: look up IP addresses, AS numbers and domains, and download the IP intelligence databases.
Documentation
/*
 * InternetData API
 *
 * The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, 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.11.17
 * 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", deserialize_with = "crate::dates::date")]
    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",
        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")]
    pub size: 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 {
    /// 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,
            sample_size: None,
            sample_entries: None,
        }
    }
}