#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Timestamp<'a> {
pub value: jacquard_common::types::string::Datetime,
}
pub mod timestamp_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Value = Unset;
}
pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetValue<S> {}
impl<S: State> State for SetValue<S> {
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct value(());
}
}
pub struct TimestampBuilder<'a, S: timestamp_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Timestamp<'a> {
pub fn new() -> TimestampBuilder<'a, timestamp_state::Empty> {
TimestampBuilder::new()
}
}
impl<'a> TimestampBuilder<'a, timestamp_state::Empty> {
pub fn new() -> Self {
TimestampBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TimestampBuilder<'a, S>
where
S: timestamp_state::State,
S::Value: timestamp_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> TimestampBuilder<'a, timestamp_state::SetValue<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
TimestampBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TimestampBuilder<'a, S>
where
S: timestamp_state::State,
S::Value: timestamp_state::IsSet,
{
pub fn build(self) -> Timestamp<'a> {
Timestamp {
value: self.__unsafe_private_named.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Timestamp<'a> {
Timestamp {
value: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct TimestampOutput<'a> {
#[serde(flatten)]
#[serde(borrow)]
pub value: crate::at_inlay::Response<'a>,
}
pub struct TimestampResponse;
impl jacquard_common::xrpc::XrpcResp for TimestampResponse {
const NSID: &'static str = "org.atsui.Timestamp";
const ENCODING: &'static str = "application/json";
type Output<'de> = TimestampOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for Timestamp<'a> {
const NSID: &'static str = "org.atsui.Timestamp";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = TimestampResponse;
}
pub struct TimestampRequest;
impl jacquard_common::xrpc::XrpcEndpoint for TimestampRequest {
const PATH: &'static str = "/xrpc/org.atsui.Timestamp";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<'de> = Timestamp<'de>;
type Response = TimestampResponse;
}