use serde::{Deserialize, Serialize};
use vantage_vista::{NoExtras, VistaSpec};
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ApiTableExtras {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub api: Option<ApiTableBlock>,
}
impl ApiTableExtras {
pub fn new(block: ApiTableBlock) -> Self {
Self { api: Some(block) }
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ApiTableBlock {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub endpoint: Option<String>,
}
impl ApiTableBlock {
pub fn with_endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
}
pub type ApiColumnExtras = NoExtras;
pub type ApiReferenceExtras = NoExtras;
pub type RestApiVistaSpec = VistaSpec<ApiTableExtras, ApiColumnExtras, ApiReferenceExtras>;