vpndetection 5.9.2

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

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

/// Location : Where the address is, to the country: the fields of our IP Country database. Free and paid plans. Each field is present whenever the object is, so an address in no country, or a private one, answers empty strings.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Location {
    /// Continent code: AF, AN (Antarctica), AS, EU, NA, OC or SA.
    #[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 of the address.
    #[serde(rename = "timezone")]
    pub timezone: String,
    /// ISO 4217 code of the country's currency, where there is one.
    #[serde(rename = "currency_code")]
    pub currency_code: String,
    /// Name of the country's currency, where there is one.
    #[serde(rename = "currency_name")]
    pub currency_name: String,
    /// Symbol of the country's currency, where known.
    #[serde(rename = "currency_symbol")]
    pub currency_symbol: String,
    /// The country's flag, as an emoji.
    #[serde(rename = "flag_emoji")]
    pub flag_emoji: String,
    /// The Unicode code points of the flag emoji.
    #[serde(rename = "flag_unicode")]
    pub flag_unicode: String,
}

impl Location {
    /// Where the address is, to the country: the fields of our IP Country database. Free and paid plans. Each field is present whenever the object is, so an address in no country, or a private one, answers empty strings.
    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,
        }
    }
}