vpndetection 6.2.0

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.  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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceAuthorization {
    /// Yours. Poll with it; never show it to anyone.
    #[serde(rename = "device_code")]
    pub device_code: String,
    /// Short and typable. This is what the person confirms.
    #[serde(rename = "user_code")]
    pub user_code: String,
    #[serde(rename = "verification_uri")]
    pub verification_uri: String,
    /// The same page with the code already filled in.
    #[serde(rename = "verification_uri_complete", skip_serializing_if = "Option::is_none")]
    pub verification_uri_complete: Option<String>,
    /// Seconds until both codes expire.
    #[serde(rename = "expires_in")]
    pub expires_in: i32,
    /// Seconds between polls.
    #[serde(rename = "interval")]
    pub interval: i32,
}

impl DeviceAuthorization {
    pub fn new(
        device_code: String,
        user_code: String,
        verification_uri: String,
        expires_in: i32,
        interval: i32,
    ) -> DeviceAuthorization {
        DeviceAuthorization {
            device_code,
            user_code,
            verification_uri,
            verification_uri_complete: None,
            expires_in,
            interval,
        }
    }
}