cat_gateway/service/common/objects/legacy/
block.rsuse poem_openapi::{types::Example, NewType, Object};
#[derive(NewType)]
#[oai(example = true)]
pub(crate) struct Epoch(pub u32);
impl Example for Epoch {
fn example() -> Self {
Self(123_456)
}
}
#[derive(NewType)]
#[oai(example = true)]
pub(crate) struct Slot(pub u32);
impl Example for Slot {
fn example() -> Self {
Self(987_654)
}
}
#[derive(Object)]
#[oai(example = true)]
pub(crate) struct BlockDate {
#[oai(validator(minimum(value = "0"), maximum(value = "4294967295")))]
pub epoch: Epoch,
#[oai(validator(minimum(value = "0"), maximum(value = "4294967295")))]
pub slot_id: Slot,
}
impl Example for BlockDate {
fn example() -> Self {
Self {
epoch: Epoch(1),
slot_id: Slot(5),
}
}
}