#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct LifeEvent<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub end_date: std::option::Option<jacquard_common::types::string::Datetime>,
pub start_date: jacquard_common::types::string::Datetime,
#[serde(borrow)]
pub title: jacquard_common::CowStr<'a>,
}
pub mod life_event_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 StartDate;
type Title;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type StartDate = Unset;
type Title = Unset;
}
pub struct SetStartDate<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetStartDate<S> {}
impl<S: State> State for SetStartDate<S> {
type StartDate = Set<members::start_date>;
type Title = S::Title;
}
pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTitle<S> {}
impl<S: State> State for SetTitle<S> {
type StartDate = S::StartDate;
type Title = Set<members::title>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct start_date(());
pub struct title(());
}
}
pub struct LifeEventBuilder<'a, S: life_event_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> LifeEvent<'a> {
pub fn new() -> LifeEventBuilder<'a, life_event_state::Empty> {
LifeEventBuilder::new()
}
}
impl<'a> LifeEventBuilder<'a, life_event_state::Empty> {
pub fn new() -> Self {
LifeEventBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: life_event_state::State> LifeEventBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: life_event_state::State> LifeEventBuilder<'a, S> {
pub fn end_date(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_end_date(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> LifeEventBuilder<'a, S>
where
S: life_event_state::State,
S::StartDate: life_event_state::IsUnset,
{
pub fn start_date(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> LifeEventBuilder<'a, life_event_state::SetStartDate<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
LifeEventBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> LifeEventBuilder<'a, S>
where
S: life_event_state::State,
S::Title: life_event_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> LifeEventBuilder<'a, life_event_state::SetTitle<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
LifeEventBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> LifeEventBuilder<'a, S>
where
S: life_event_state::State,
S::StartDate: life_event_state::IsSet,
S::Title: life_event_state::IsSet,
{
pub fn build(self) -> LifeEvent<'a> {
LifeEvent {
description: self.__unsafe_private_named.0,
end_date: self.__unsafe_private_named.1,
start_date: self.__unsafe_private_named.2.unwrap(),
title: self.__unsafe_private_named.3.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>,
>,
) -> LifeEvent<'a> {
LifeEvent {
description: self.__unsafe_private_named.0,
end_date: self.__unsafe_private_named.1,
start_date: self.__unsafe_private_named.2.unwrap(),
title: self.__unsafe_private_named.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_st_lifepo_profile() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("st.lifepo.profile"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("lifeEvent"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A single life event entry.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("title"),
::jacquard_common::deps::smol_str::SmolStr::new_static("startDate")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"endDate",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"startDate",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"title",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
description: None,
parameters: Some(
::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("actor")
],
),
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"actor",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The DID or handle of the user.",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
),
output: None,
errors: None,
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LifeEvent<'a> {
fn nsid() -> &'static str {
"st.lifepo.profile"
}
fn def_name() -> &'static str {
"lifeEvent"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_st_lifepo_profile()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Profile<'a> {
#[serde(borrow)]
pub actor: jacquard_common::CowStr<'a>,
}
pub mod profile_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 Actor;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Actor = Unset;
}
pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetActor<S> {}
impl<S: State> State for SetActor<S> {
type Actor = Set<members::actor>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct actor(());
}
}
pub struct ProfileBuilder<'a, S: profile_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<jacquard_common::CowStr<'a>>,),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Profile<'a> {
pub fn new() -> ProfileBuilder<'a, profile_state::Empty> {
ProfileBuilder::new()
}
}
impl<'a> ProfileBuilder<'a, profile_state::Empty> {
pub fn new() -> Self {
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::Actor: profile_state::IsUnset,
{
pub fn actor(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ProfileBuilder<'a, profile_state::SetActor<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::Actor: profile_state::IsSet,
{
pub fn build(self) -> Profile<'a> {
Profile {
actor: self.__unsafe_private_named.0.unwrap(),
}
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ProfileOutput<'a> {
#[serde(borrow)]
pub bio: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub handle: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub life_events: Vec<crate::st_lifepo::profile::LifeEvent<'a>>,
}
pub struct ProfileResponse;
impl jacquard_common::xrpc::XrpcResp for ProfileResponse {
const NSID: &'static str = "st.lifepo.profile";
const ENCODING: &'static str = "application/json";
type Output<'de> = ProfileOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for Profile<'a> {
const NSID: &'static str = "st.lifepo.profile";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = ProfileResponse;
}
pub struct ProfileRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ProfileRequest {
const PATH: &'static str = "/xrpc/st.lifepo.profile";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = Profile<'de>;
type Response = ProfileResponse;
}