rdap-types 0.1.0

RDAP protocol types and error definitions (RFC 9083)
Documentation
//! Normalised RDAP Autonomous System Number response type.
//!
//! Follows RFC 9083 ยง5.5 (Autonomous System Number Object Class).

use serde::{Deserialize, Serialize};

use crate::common::{RdapEntity, RdapEvent, RdapLink, RdapRemark, RdapStatus, ResponseMeta};

/// Normalised RDAP response for an ASN query.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AsnResponse {
    /// The original query value (numeric ASN).
    pub query: u32,

    /// Registry handle.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handle: Option<String>,

    /// First ASN in the assigned range.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start_autnum: Option<u32>,

    /// Last ASN in the assigned range.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub end_autnum: Option<u32>,

    /// Human-readable name of the AS (e.g., "GOOGLE").
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,

    /// Type of the autonomous system number assignment.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub autnum_type: Option<String>,

    /// ISO 3166-1 alpha-2 country code of the registrant.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub country: Option<String>,

    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub status: Vec<RdapStatus>,

    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub entities: Vec<RdapEntity>,

    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub events: Vec<RdapEvent>,

    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub links: Vec<RdapLink>,

    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub remarks: Vec<RdapRemark>,

    pub meta: ResponseMeta,
}