artifact-keeper-client 1.2.1

Rust client for the Artifact Keeper REST API
Documentation
/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RepositoryResponse {
    /// Whether anonymous (unauthenticated) downloads are allowed. This is always equal to `is_public` and provided as a convenience alias so the semantics are clear for remote (pull-through cache) repositories.
    #[serde(rename = "allow_anonymous_access")]
    pub allow_anonymous_access: bool,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "format")]
    pub format: String,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "is_public")]
    pub is_public: bool,
    #[serde(rename = "key")]
    pub key: String,
    #[serde(rename = "name")]
    pub name: String,
    /// When true, direct user uploads are rejected; artifacts must be promoted.
    #[serde(rename = "promotion_only")]
    pub promotion_only: bool,
    /// Configured quarantine hold duration in minutes, read back from `repository_config` (#1770 B). `None` when unset.
    #[serde(rename = "quarantine_duration_minutes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub quarantine_duration_minutes: Option<Option<i64>>,
    /// Whether the Package Age / quarantine policy is enabled for this repository, read back from `repository_config` (#1770 B). `None` when the repository has no explicit setting (the global default applies).
    #[serde(rename = "quarantine_enabled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub quarantine_enabled: Option<Option<bool>>,
    #[serde(rename = "quota_bytes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub quota_bytes: Option<Option<i64>>,
    #[serde(rename = "repo_type")]
    pub repo_type: String,
    #[serde(rename = "storage_used_bytes")]
    pub storage_used_bytes: i64,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "upstream_auth_configured")]
    pub upstream_auth_configured: bool,
    #[serde(rename = "upstream_auth_type", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub upstream_auth_type: Option<Option<String>>,
    #[serde(rename = "upstream_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub upstream_url: Option<Option<String>>,
}

impl RepositoryResponse {
    pub fn new(allow_anonymous_access: bool, created_at: String, format: String, id: uuid::Uuid, is_public: bool, key: String, name: String, promotion_only: bool, repo_type: String, storage_used_bytes: i64, updated_at: String, upstream_auth_configured: bool) -> RepositoryResponse {
        RepositoryResponse {
            allow_anonymous_access,
            created_at,
            description: None,
            format,
            id,
            is_public,
            key,
            name,
            promotion_only,
            quarantine_duration_minutes: None,
            quarantine_enabled: None,
            quota_bytes: None,
            repo_type,
            storage_used_bytes,
            updated_at,
            upstream_auth_configured,
            upstream_auth_type: None,
            upstream_url: None,
        }
    }
}