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

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

/// Location : Where the address is.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Location {
    /// Continent code.
    #[serde(rename = "continent")]
    pub continent: String,
    /// Continent name.
    #[serde(rename = "continent_name")]
    pub continent_name: String,
    /// ISO 3166-1 alpha-2 country code.
    #[serde(rename = "country")]
    pub country: String,
    /// Country name.
    #[serde(rename = "country_name")]
    pub country_name: String,
    /// IANA timezone.
    #[serde(rename = "timezone")]
    pub timezone: String,
    /// ISO 4217 code.
    #[serde(rename = "currency_code")]
    pub currency_code: String,
    /// Currency name.
    #[serde(rename = "currency_name")]
    pub currency_name: String,
    /// Currency symbol.
    #[serde(rename = "currency_symbol")]
    pub currency_symbol: String,
    /// The country's flag.
    #[serde(rename = "flag_emoji")]
    pub flag_emoji: String,
    /// Its code points, `U+1F1E6 U+1F1F9`.
    #[serde(rename = "flag_unicode")]
    pub flag_unicode: String,
    /// Region (state or province). Paid plans and the trial.
    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// ISO 3166-2 region code. Paid plans and the trial.
    #[serde(rename = "region_code", skip_serializing_if = "Option::is_none")]
    pub region_code: Option<String>,
    /// City. Paid plans and the trial.
    #[serde(rename = "city", skip_serializing_if = "Option::is_none")]
    pub city: Option<String>,
    /// Postal code. Paid plans and the trial.
    #[serde(rename = "postal_code", skip_serializing_if = "Option::is_none")]
    pub postal_code: Option<String>,
    /// Latitude of the city. Paid plans and the trial.
    #[serde(rename = "latitude", skip_serializing_if = "Option::is_none")]
    pub latitude: Option<f64>,
    /// Longitude of the city. Paid plans and the trial.
    #[serde(rename = "longitude", skip_serializing_if = "Option::is_none")]
    pub longitude: Option<f64>,
    /// Radius in km holding the true location with 67% confidence. Paid plans and the trial.
    #[serde(rename = "accuracy_radius", skip_serializing_if = "Option::is_none")]
    pub accuracy_radius: Option<i32>,
    /// GeoNames ID of the city. Paid plans and the trial.
    #[serde(rename = "geoname_id", skip_serializing_if = "Option::is_none")]
    pub geoname_id: Option<String>,
    /// US TV market (DMA) code. Paid plans and the trial.
    #[serde(rename = "dma_code", skip_serializing_if = "Option::is_none")]
    pub dma_code: Option<String>,
    /// The day the range's location last changed. Paid plans and the trial.
    #[serde(rename = "last_changed", skip_serializing_if = "Option::is_none")]
    pub last_changed: Option<String>,
}

impl Location {
    /// Where the address is.
    pub fn new(
        continent: String,
        continent_name: String,
        country: String,
        country_name: String,
        timezone: String,
        currency_code: String,
        currency_name: String,
        currency_symbol: String,
        flag_emoji: String,
        flag_unicode: String,
    ) -> Location {
        Location {
            continent,
            continent_name,
            country,
            country_name,
            timezone,
            currency_code,
            currency_name,
            currency_symbol,
            flag_emoji,
            flag_unicode,
            region: None,
            region_code: None,
            city: None,
            postal_code: None,
            latitude: None,
            longitude: None,
            accuracy_radius: None,
            geoname_id: None,
            dma_code: None,
            last_changed: None,
        }
    }
}