internetdata 2.4.2

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.10.03
 * Contact: support@internetdata.io
 * Generated by: https://openapi-generator.tech
 */

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

/// Database : One database FAMILY, with your organization's license beside it. A license covers the family, while a download names a specific version, so the ids passed to `download` and `checksum` come from `versions`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Database {
    /// The family, e.g. `vpn_ip`. What a license is held against.
    #[serde(rename = "base")]
    pub base: String,
    #[serde(rename = "name")]
    pub name: String,
    /// One line on what the newest version contains.
    #[serde(rename = "summary")]
    pub summary: String,
    #[serde(rename = "standing")]
    pub standing: models::Standing,
    /// What your license permits you to do with the data. Null when there is no license, which is every family with standing `unlicensed`.
    #[serde(rename = "license_type", deserialize_with = "Option::deserialize")]
    pub license_type: Option<LicenseType>,
    #[serde(rename = "starts", deserialize_with = "Option::deserialize")]
    pub starts: 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", deserialize_with = "Option::deserialize")]
    pub expires: 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", deserialize_with = "Option::deserialize")]
    pub renews_at: 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", deserialize_with = "Option::deserialize")]
    pub notice_due_at: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// Every published version of this family, oldest first. Old versions are frozen rather than migrated, so both stay downloadable.
    #[serde(rename = "versions")]
    pub versions: Vec<models::DatabaseVersion>,
}

impl Database {
    /// One database FAMILY, with your organization's license beside it. A license covers the family, while a download names a specific version, so the ids passed to `download` and `checksum` come from `versions`.
    pub fn new(
        base: String,
        name: String,
        summary: String,
        standing: models::Standing,
        license_type: Option<LicenseType>,
        starts: Option<chrono::DateTime<chrono::FixedOffset>>,
        expires: Option<chrono::DateTime<chrono::FixedOffset>>,
        renews_at: Option<chrono::DateTime<chrono::FixedOffset>>,
        notice_due_at: Option<chrono::DateTime<chrono::FixedOffset>>,
        versions: Vec<models::DatabaseVersion>,
    ) -> Database {
        Database {
            base,
            name,
            summary,
            standing,
            license_type,
            starts,
            expires,
            renews_at,
            notice_due_at,
            versions,
        }
    }
}
/// What your license permits you to do with the data. Null when there is no license, which is every family with standing `unlicensed`.
#[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
    }
}