hotdata 0.1.2

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for datasets, queries, and analytics.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: developers@hotdata.dev
 * Generated by: https://openapi-generator.tech
 */

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

/// CreateDatabaseResponse : Response body for POST /databases
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateDatabaseResponse {
    /// Name the database's default catalog answers to inside its query scope (`default` unless overridden at create time).
    #[serde(rename = "default_catalog")]
    pub default_catalog: String,
    /// Internal id of the connection that backs this database's `default` catalog. Workspace-level connection endpoints (list, get, health, delete, cache purge) refuse to act on this id — it is exposed only for the managed-tables load endpoint (`POST /v1/connections/{id}/schemas/{s}/tables/{t}/loads`) so callers can publish parquet into tables declared at database-create time. Addressing it directly in SQL is not the recommended path — use `default` inside an `X-Database-Id` scope instead.
    #[serde(rename = "default_connection_id")]
    pub default_connection_id: String,
    /// When this database expires.
    #[serde(
        rename = "expires_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub expires_at: Option<Option<String>>,
    #[serde(rename = "id")]
    pub id: String,
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
}

impl CreateDatabaseResponse {
    /// Response body for POST /databases
    pub fn new(
        default_catalog: String,
        default_connection_id: String,
        id: String,
    ) -> CreateDatabaseResponse {
        CreateDatabaseResponse {
            default_catalog,
            default_connection_id,
            expires_at: None,
            id,
            name: None,
        }
    }
}