use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LookupResponse {
#[serde(rename = "ip")]
pub ip: String,
#[serde(rename = "is_bogon")]
pub is_bogon: bool,
#[serde(rename = "is_vpn", skip_serializing_if = "Option::is_none")]
pub is_vpn: Option<bool>,
#[serde(rename = "is_tor")]
pub is_tor: bool,
#[serde(rename = "is_relay")]
pub is_relay: bool,
#[serde(rename = "is_resproxy", skip_serializing_if = "Option::is_none")]
pub is_resproxy: Option<bool>,
#[serde(rename = "is_dcproxy", skip_serializing_if = "Option::is_none")]
pub is_dcproxy: Option<bool>,
#[serde(rename = "is_mobproxy", skip_serializing_if = "Option::is_none")]
pub is_mobproxy: Option<bool>,
#[serde(rename = "is_pubproxy", skip_serializing_if = "Option::is_none")]
pub is_pubproxy: Option<bool>,
#[serde(rename = "is_hosting", skip_serializing_if = "Option::is_none")]
pub is_hosting: Option<bool>,
#[serde(rename = "is_cdn", skip_serializing_if = "Option::is_none")]
pub is_cdn: Option<bool>,
#[serde(rename = "is_anycast")]
pub is_anycast: bool,
#[serde(rename = "is_carrier")]
pub is_carrier: bool,
#[serde(rename = "is_satellite")]
pub is_satellite: bool,
#[serde(rename = "is_ssh")]
pub is_ssh: bool,
#[serde(rename = "is_smtp")]
pub is_smtp: bool,
#[serde(rename = "is_web")]
pub is_web: bool,
#[serde(rename = "is_dns_resolver")]
pub is_dns_resolver: bool,
#[serde(rename = "is_bittorrent")]
pub is_bittorrent: bool,
#[serde(rename = "vpn", skip_serializing_if = "Option::is_none")]
pub vpn: Option<Box<models::ClassDetail>>,
#[serde(rename = "tor")]
pub tor: Box<models::ClassDetail>,
#[serde(rename = "relay")]
pub relay: Box<models::ClassDetail>,
#[serde(rename = "resproxy", skip_serializing_if = "Option::is_none")]
pub resproxy: Option<Box<models::ProxyDetail>>,
#[serde(rename = "dcproxy", skip_serializing_if = "Option::is_none")]
pub dcproxy: Option<Box<models::ProxyDetail>>,
#[serde(rename = "mobproxy", skip_serializing_if = "Option::is_none")]
pub mobproxy: Option<Box<models::ProxyDetail>>,
#[serde(rename = "pubproxy", skip_serializing_if = "Option::is_none")]
pub pubproxy: Option<Box<models::PubproxyDetail>>,
#[serde(rename = "hosting", skip_serializing_if = "Option::is_none")]
pub hosting: Option<Box<models::ClassDetail>>,
#[serde(rename = "cdn", skip_serializing_if = "Option::is_none")]
pub cdn: Option<Box<models::ClassDetail>>,
#[serde(rename = "carrier", skip_serializing_if = "Option::is_none")]
pub carrier: Option<Box<models::CarrierDetail>>,
#[serde(rename = "satellite", skip_serializing_if = "Option::is_none")]
pub satellite: Option<Box<models::SatelliteDetail>>,
#[serde(rename = "ssh", skip_serializing_if = "Option::is_none")]
pub ssh: Option<Box<models::SshDetail>>,
#[serde(rename = "smtp", skip_serializing_if = "Option::is_none")]
pub smtp: Option<Box<models::SmtpDetail>>,
#[serde(rename = "web", skip_serializing_if = "Option::is_none")]
pub web: Option<Vec<models::WebDetail>>,
#[serde(rename = "dns_resolver", skip_serializing_if = "Option::is_none")]
pub dns_resolver: Option<Box<models::DnsResolverDetail>>,
#[serde(rename = "bittorrent", skip_serializing_if = "Option::is_none")]
pub bittorrent: Option<Box<models::BitTorrentDetail>>,
#[serde(rename = "location")]
pub location: Box<models::Location>,
#[serde(rename = "asn")]
pub asn: Box<models::Asn>,
#[serde(rename = "company")]
pub company: Box<models::Company>,
#[serde(rename = "hostname")]
pub hostname: String,
#[serde(rename = "abuse")]
pub abuse: Box<models::AbuseContact>,
#[serde(rename = "whois", skip_serializing_if = "Option::is_none")]
pub whois: Option<Box<models::Whois>>,
#[serde(rename = "rwhois", skip_serializing_if = "Option::is_none")]
pub rwhois: Option<Box<models::Rwhois>>,
#[serde(rename = "hosted_domains", skip_serializing_if = "Option::is_none")]
pub hosted_domains: Option<Box<models::HostedDomains>>,
#[serde(rename = "trial_expired", skip_serializing_if = "Option::is_none")]
pub trial_expired: Option<bool>,
}
impl LookupResponse {
pub fn new(
ip: String,
is_bogon: bool,
is_tor: bool,
is_relay: bool,
is_anycast: bool,
is_carrier: bool,
is_satellite: bool,
is_ssh: bool,
is_smtp: bool,
is_web: bool,
is_dns_resolver: bool,
is_bittorrent: bool,
tor: models::ClassDetail,
relay: models::ClassDetail,
location: models::Location,
asn: models::Asn,
company: models::Company,
hostname: String,
abuse: models::AbuseContact,
) -> LookupResponse {
LookupResponse {
ip,
is_bogon,
is_vpn: None,
is_tor,
is_relay,
is_resproxy: None,
is_dcproxy: None,
is_mobproxy: None,
is_pubproxy: None,
is_hosting: None,
is_cdn: None,
is_anycast,
is_carrier,
is_satellite,
is_ssh,
is_smtp,
is_web,
is_dns_resolver,
is_bittorrent,
vpn: None,
tor: Box::new(tor),
relay: Box::new(relay),
resproxy: None,
dcproxy: None,
mobproxy: None,
pubproxy: None,
hosting: None,
cdn: None,
carrier: None,
satellite: None,
ssh: None,
smtp: None,
web: None,
dns_resolver: None,
bittorrent: None,
location: Box::new(location),
asn: Box::new(asn),
company: Box::new(company),
hostname,
abuse: Box::new(abuse),
whois: None,
rwhois: None,
hosted_domains: None,
trial_expired: None,
}
}
}