/*
* VPNDetection API
*
* The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). 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.11.20
* Contact: support@vpndetection.io
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// ApikeyDetail : Key METADATA. Never the key itself.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ApikeyDetail {
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "name")]
pub name: String,
/// The leading, non-secret part, so a key is recognizable without storing it.
#[serde(rename = "key_prefix")]
pub key_prefix: String,
#[serde(rename = "created", deserialize_with = "crate::dates::date_time")]
pub created: chrono::DateTime<chrono::FixedOffset>,
#[serde(
rename = "expires",
default,
deserialize_with = "crate::dates::double_option_date_time",
serialize_with = "::serde_with::rust::double_option::serialize",
skip_serializing_if = "Option::is_none"
)]
pub expires: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
#[serde(
rename = "last_used_at",
default,
deserialize_with = "crate::dates::double_option_date_time",
serialize_with = "::serde_with::rust::double_option::serialize",
skip_serializing_if = "Option::is_none"
)]
pub last_used_at: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
#[serde(
rename = "revoked_at",
default,
deserialize_with = "crate::dates::double_option_date_time",
serialize_with = "::serde_with::rust::double_option::serialize",
skip_serializing_if = "Option::is_none"
)]
pub revoked_at: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
/// Source-IP allowlist. EMPTY MEANS UNRESTRICTED, not deny-all.
#[serde(rename = "allowed_cidrs", skip_serializing_if = "Option::is_none")]
pub allowed_cidrs: Option<Vec<String>>,
#[serde(rename = "allowed_scopes", skip_serializing_if = "Option::is_none")]
pub allowed_scopes: Option<Vec<String>>,
/// Whether this key's secret can still be read back. False permanently for a key issued before secrets were stored recoverably.
#[serde(rename = "retrievable", skip_serializing_if = "Option::is_none")]
pub retrievable: Option<bool>,
}
impl ApikeyDetail {
/// Key METADATA. Never the key itself.
pub fn new(
id: uuid::Uuid,
name: String,
key_prefix: String,
created: chrono::DateTime<chrono::FixedOffset>,
) -> ApikeyDetail {
ApikeyDetail {
id,
name,
key_prefix,
created,
expires: None,
last_used_at: None,
revoked_at: None,
allowed_cidrs: None,
allowed_scopes: None,
retrievable: None,
}
}
}