pub mod collection;
pub mod collection_item;
pub mod post;
pub mod reaction;
pub mod request;
pub mod request_response;
pub mod room_gate;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::actor::ProfileViewBasic;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::tech_tokimeki::kaku;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct AspectRatio<'a> {
pub height: i64,
pub width: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CollectionView<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub description: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_collection_view_is_public")]
pub is_public: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub item_count: Option<i64>,
#[serde(borrow)]
pub name: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PostView<'a> {
#[serde(borrow)]
pub aspect_ratio: kaku::AspectRatio<'a>,
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(borrow)]
pub image: UriValue<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub linked_post: Option<StrongRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub reaction_counts: Option<kaku::ReactionCounts<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub text: Option<CowStr<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub viewer_reaction: Option<kaku::ReactionType<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReactionCounts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_reaction_counts_kami")]
pub kami: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_reaction_counts_kawaii")]
pub kawaii: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_reaction_counts_sugoi")]
pub sugoi: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_reaction_counts_suki")]
pub suki: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_reaction_counts_tasukaru")]
pub tasukaru: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReactionType<'a> {
Suki,
Tasukaru,
Sugoi,
Kawaii,
Kami,
Other(CowStr<'a>),
}
impl<'a> ReactionType<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Suki => "suki",
Self::Tasukaru => "tasukaru",
Self::Sugoi => "sugoi",
Self::Kawaii => "kawaii",
Self::Kami => "kami",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ReactionType<'a> {
fn from(s: &'a str) -> Self {
match s {
"suki" => Self::Suki,
"tasukaru" => Self::Tasukaru,
"sugoi" => Self::Sugoi,
"kawaii" => Self::Kawaii,
"kami" => Self::Kami,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for ReactionType<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"suki" => Self::Suki,
"tasukaru" => Self::Tasukaru,
"sugoi" => Self::Sugoi,
"kawaii" => Self::Kawaii,
"kami" => Self::Kami,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> AsRef<str> for ReactionType<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> core::fmt::Display for ReactionType<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> serde::Serialize for ReactionType<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for ReactionType<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl jacquard_common::IntoStatic for ReactionType<'_> {
type Output = ReactionType<'static>;
fn into_static(self) -> Self::Output {
match self {
ReactionType::Suki => ReactionType::Suki,
ReactionType::Tasukaru => ReactionType::Tasukaru,
ReactionType::Sugoi => ReactionType::Sugoi,
ReactionType::Kawaii => ReactionType::Kawaii,
ReactionType::Kami => ReactionType::Kami,
ReactionType::Other(v) => ReactionType::Other(v.into_static()),
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReplyView<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(borrow)]
pub text: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RequestResponseView<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub message: Option<CowStr<'a>>,
#[serde(borrow)]
pub post: kaku::PostView<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RequestView<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_at: Option<Datetime>,
pub is_open: bool,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub reference_images: Option<Vec<UriValue<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub response_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub target_actor: Option<ProfileViewBasic<'a>>,
#[serde(borrow)]
pub text: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
impl<'a> LexiconSchema for AspectRatio<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"aspectRatio"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.height;
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("height"),
min: 1i64,
actual: *value,
});
}
}
{
let value = &self.width;
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("width"),
min: 1i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for CollectionView<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"collectionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("description"),
max: 500usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.description {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 200usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("description"),
max: 200usize,
actual: count,
});
}
}
}
{
let value = &self.name;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.name;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 50usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("name"),
max: 50usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for PostView<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"postView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.tags {
#[allow(unused_comparisons)]
if value.len() > 8usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("tags"),
max: 8usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.text {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("text"),
max: 1000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.text {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 300usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("text"),
max: 300usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for ReactionCounts<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"reactionCounts"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ReplyView<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"replyView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.text;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 3000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("text"),
max: 3000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.text;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 300usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("text"),
max: 300usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for RequestResponseView<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"requestResponseView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.message {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("message"),
max: 500usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.message {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 150usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("message"),
max: 150usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for RequestView<'a> {
fn nsid() -> &'static str {
"tech.tokimeki.kaku.defs"
}
fn def_name() -> &'static str {
"requestView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tech_tokimeki_kaku_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.reference_images {
#[allow(unused_comparisons)]
if value.len() > 4usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("reference_images"),
max: 4usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.tags {
#[allow(unused_comparisons)]
if value.len() > 8usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("tags"),
max: 8usize,
actual: value.len(),
});
}
}
{
let value = &self.text;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("text"),
max: 1000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.text;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 300usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("text"),
max: 300usize,
actual: count,
});
}
}
}
Ok(())
}
}
pub mod aspect_ratio_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 Height;
type Width;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Height = Unset;
type Width = Unset;
}
pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHeight<S> {}
impl<S: State> State for SetHeight<S> {
type Height = Set<members::height>;
type Width = S::Width;
}
pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetWidth<S> {}
impl<S: State> State for SetWidth<S> {
type Height = S::Height;
type Width = Set<members::width>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct height(());
pub struct width(());
}
}
pub struct AspectRatioBuilder<'a, S: aspect_ratio_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> AspectRatio<'a> {
pub fn new() -> AspectRatioBuilder<'a, aspect_ratio_state::Empty> {
AspectRatioBuilder::new()
}
}
impl<'a> AspectRatioBuilder<'a, aspect_ratio_state::Empty> {
pub fn new() -> Self {
AspectRatioBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> AspectRatioBuilder<'a, S>
where
S: aspect_ratio_state::State,
S::Height: aspect_ratio_state::IsUnset,
{
pub fn height(
mut self,
value: impl Into<i64>,
) -> AspectRatioBuilder<'a, aspect_ratio_state::SetHeight<S>> {
self._fields.0 = Option::Some(value.into());
AspectRatioBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> AspectRatioBuilder<'a, S>
where
S: aspect_ratio_state::State,
S::Width: aspect_ratio_state::IsUnset,
{
pub fn width(
mut self,
value: impl Into<i64>,
) -> AspectRatioBuilder<'a, aspect_ratio_state::SetWidth<S>> {
self._fields.1 = Option::Some(value.into());
AspectRatioBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> AspectRatioBuilder<'a, S>
where
S: aspect_ratio_state::State,
S::Height: aspect_ratio_state::IsSet,
S::Width: aspect_ratio_state::IsSet,
{
pub fn build(self) -> AspectRatio<'a> {
AspectRatio {
height: self._fields.0.unwrap(),
width: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> AspectRatio<'a> {
AspectRatio {
height: self._fields.0.unwrap(),
width: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_tech_tokimeki_kaku_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("tech.tokimeki.kaku.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("aspectRatio"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Width and height representing the aspect ratio of an image",
),
),
required: Some(
vec![SmolStr::new_static("width"), SmolStr::new_static("height")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("height"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("width"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("collectionView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A view of a collection with author profile and item count",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("name"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("CID of the collection record"),
),
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Timestamp when the collection was created",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Collection description"),
),
max_length: Some(500usize),
max_graphemes: Some(200usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Timestamp when the collection was indexed",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isPublic"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("itemCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Collection name")),
max_length: Some(100usize),
max_graphemes: Some(50usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("AT-URI of the collection record"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("postView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A view of a drawing post with author profile and metadata",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("image"),
SmolStr::new_static("aspectRatio"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("aspectRatio"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#aspectRatio"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("CID of the post record"),
),
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Timestamp when the post was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("image"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("URL of the drawing image"),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Timestamp when the post was indexed"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("linkedPost"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactionCounts"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#reactionCounts"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Tags for categorization"),
),
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
max_graphemes: Some(32usize),
..Default::default()
}),
max_length: Some(8usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Optional description or title"),
),
max_length: Some(1000usize),
max_graphemes: Some(300usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("AT-URI of the post record"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerReaction"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#reactionType"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactionCounts"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Counts of each reaction type on a post"),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("kami"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("kawaii"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sugoi"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("suki"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tasukaru"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactionType"),
LexUserType::String(LexString {
description: Some(CowStr::new_static("Type of reaction to a post")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("replyView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("A view of a Bluesky reply to a linked post"),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("text"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("CID of the Bluesky reply"),
),
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Timestamp when the reply was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Reply text content")),
max_length: Some(3000usize),
max_graphemes: Some(300usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("AT-URI of the Bluesky reply"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("requestResponseView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("A view of a response to a drawing request"),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("post"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("CID of the response record"),
),
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Timestamp when the response was created",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("message"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Optional message to the requester"),
),
max_length: Some(500usize),
max_graphemes: Some(150usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("post"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#postView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("AT-URI of the response record"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("requestView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A view of a drawing request with author profile and response count",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("text"),
SmolStr::new_static("isOpen"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("CID of the request record"),
),
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Timestamp when the request was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Timestamp when the request was indexed"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isOpen"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("referenceImages"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"URLs of reference images for the request",
),
),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
max_length: Some(4usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("responseCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Tags for categorization"),
),
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
max_graphemes: Some(32usize),
..Default::default()
}),
max_length: Some(8usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("targetActor"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Description of what to draw"),
),
max_length: Some(1000usize),
max_graphemes: Some(300usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("AT-URI of the request record"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
fn _default_collection_view_is_public() -> Option<bool> {
Some(true)
}
pub mod collection_view_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 Name;
type Uri;
type Cid;
type Author;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type Uri = Unset;
type Cid = Unset;
type Author = Unset;
type CreatedAt = Unset;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Name = Set<members::name>;
type Uri = S::Uri;
type Cid = S::Cid;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Name = S::Name;
type Uri = Set<members::uri>;
type Cid = S::Cid;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Name = S::Name;
type Uri = S::Uri;
type Cid = Set<members::cid>;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Name = S::Name;
type Uri = S::Uri;
type Cid = S::Cid;
type Author = Set<members::author>;
type CreatedAt = S::CreatedAt;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Name = S::Name;
type Uri = S::Uri;
type Cid = S::Cid;
type Author = S::Author;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct uri(());
pub struct cid(());
pub struct author(());
pub struct created_at(());
}
}
pub struct CollectionViewBuilder<'a, S: collection_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<CowStr<'a>>,
Option<Datetime>,
Option<bool>,
Option<i64>,
Option<CowStr<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> CollectionView<'a> {
pub fn new() -> CollectionViewBuilder<'a, collection_view_state::Empty> {
CollectionViewBuilder::new()
}
}
impl<'a> CollectionViewBuilder<'a, collection_view_state::Empty> {
pub fn new() -> Self {
CollectionViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Author: collection_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Cid: collection_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::CreatedAt: collection_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> CollectionViewBuilder<'a, collection_view_state::SetCreatedAt<S>> {
self._fields.2 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn description(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_indexed_at(mut self, value: Option<Datetime>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn is_public(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_is_public(mut self, value: Option<bool>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn item_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_item_count(mut self, value: Option<i64>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Name: collection_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetName<S>> {
self._fields.7 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Uri: collection_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetUri<S>> {
self._fields.8 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Name: collection_view_state::IsSet,
S::Uri: collection_view_state::IsSet,
S::Cid: collection_view_state::IsSet,
S::Author: collection_view_state::IsSet,
S::CreatedAt: collection_view_state::IsSet,
{
pub fn build(self) -> CollectionView<'a> {
CollectionView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
description: self._fields.3,
indexed_at: self._fields.4,
is_public: self._fields.5.or_else(|| Some(true)),
item_count: self._fields.6,
name: self._fields.7.unwrap(),
uri: self._fields.8.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> CollectionView<'a> {
CollectionView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
description: self._fields.3,
indexed_at: self._fields.4,
is_public: self._fields.5.or_else(|| Some(true)),
item_count: self._fields.6,
name: self._fields.7.unwrap(),
uri: self._fields.8.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod post_view_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 Image;
type Author;
type Cid;
type AspectRatio;
type Uri;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Image = Unset;
type Author = Unset;
type Cid = Unset;
type AspectRatio = Unset;
type Uri = Unset;
type CreatedAt = Unset;
}
pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetImage<S> {}
impl<S: State> State for SetImage<S> {
type Image = Set<members::image>;
type Author = S::Author;
type Cid = S::Cid;
type AspectRatio = S::AspectRatio;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Image = S::Image;
type Author = Set<members::author>;
type Cid = S::Cid;
type AspectRatio = S::AspectRatio;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Image = S::Image;
type Author = S::Author;
type Cid = Set<members::cid>;
type AspectRatio = S::AspectRatio;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
}
pub struct SetAspectRatio<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAspectRatio<S> {}
impl<S: State> State for SetAspectRatio<S> {
type Image = S::Image;
type Author = S::Author;
type Cid = S::Cid;
type AspectRatio = Set<members::aspect_ratio>;
type Uri = S::Uri;
type CreatedAt = S::CreatedAt;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Image = S::Image;
type Author = S::Author;
type Cid = S::Cid;
type AspectRatio = S::AspectRatio;
type Uri = Set<members::uri>;
type CreatedAt = S::CreatedAt;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Image = S::Image;
type Author = S::Author;
type Cid = S::Cid;
type AspectRatio = S::AspectRatio;
type Uri = S::Uri;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct image(());
pub struct author(());
pub struct cid(());
pub struct aspect_ratio(());
pub struct uri(());
pub struct created_at(());
}
}
pub struct PostViewBuilder<'a, S: post_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<kaku::AspectRatio<'a>>,
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<UriValue<'a>>,
Option<Datetime>,
Option<StrongRef<'a>>,
Option<kaku::ReactionCounts<'a>>,
Option<Vec<CowStr<'a>>>,
Option<CowStr<'a>>,
Option<AtUri<'a>>,
Option<kaku::ReactionType<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PostView<'a> {
pub fn new() -> PostViewBuilder<'a, post_view_state::Empty> {
PostViewBuilder::new()
}
}
impl<'a> PostViewBuilder<'a, post_view_state::Empty> {
pub fn new() -> Self {
PostViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::AspectRatio: post_view_state::IsUnset,
{
pub fn aspect_ratio(
mut self,
value: impl Into<kaku::AspectRatio<'a>>,
) -> PostViewBuilder<'a, post_view_state::SetAspectRatio<S>> {
self._fields.0 = Option::Some(value.into());
PostViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::Author: post_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> PostViewBuilder<'a, post_view_state::SetAuthor<S>> {
self._fields.1 = Option::Some(value.into());
PostViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::Cid: post_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> PostViewBuilder<'a, post_view_state::SetCid<S>> {
self._fields.2 = Option::Some(value.into());
PostViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::CreatedAt: post_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> PostViewBuilder<'a, post_view_state::SetCreatedAt<S>> {
self._fields.3 = Option::Some(value.into());
PostViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::Image: post_view_state::IsUnset,
{
pub fn image(
mut self,
value: impl Into<UriValue<'a>>,
) -> PostViewBuilder<'a, post_view_state::SetImage<S>> {
self._fields.4 = Option::Some(value.into());
PostViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_indexed_at(mut self, value: Option<Datetime>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
pub fn linked_post(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_linked_post(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
pub fn reaction_counts(
mut self,
value: impl Into<Option<kaku::ReactionCounts<'a>>>,
) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_reaction_counts(
mut self,
value: Option<kaku::ReactionCounts<'a>>,
) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
pub fn text(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_text(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.9 = value;
self
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::Uri: post_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> PostViewBuilder<'a, post_view_state::SetUri<S>> {
self._fields.10 = Option::Some(value.into());
PostViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
pub fn viewer_reaction(
mut self,
value: impl Into<Option<kaku::ReactionType<'a>>>,
) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_viewer_reaction(
mut self,
value: Option<kaku::ReactionType<'a>>,
) -> Self {
self._fields.11 = value;
self
}
}
impl<'a, S> PostViewBuilder<'a, S>
where
S: post_view_state::State,
S::Image: post_view_state::IsSet,
S::Author: post_view_state::IsSet,
S::Cid: post_view_state::IsSet,
S::AspectRatio: post_view_state::IsSet,
S::Uri: post_view_state::IsSet,
S::CreatedAt: post_view_state::IsSet,
{
pub fn build(self) -> PostView<'a> {
PostView {
aspect_ratio: self._fields.0.unwrap(),
author: self._fields.1.unwrap(),
cid: self._fields.2.unwrap(),
created_at: self._fields.3.unwrap(),
image: self._fields.4.unwrap(),
indexed_at: self._fields.5,
linked_post: self._fields.6,
reaction_counts: self._fields.7,
tags: self._fields.8,
text: self._fields.9,
uri: self._fields.10.unwrap(),
viewer_reaction: self._fields.11,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> PostView<'a> {
PostView {
aspect_ratio: self._fields.0.unwrap(),
author: self._fields.1.unwrap(),
cid: self._fields.2.unwrap(),
created_at: self._fields.3.unwrap(),
image: self._fields.4.unwrap(),
indexed_at: self._fields.5,
linked_post: self._fields.6,
reaction_counts: self._fields.7,
tags: self._fields.8,
text: self._fields.9,
uri: self._fields.10.unwrap(),
viewer_reaction: self._fields.11,
extra_data: Some(extra_data),
}
}
}
fn _default_reaction_counts_kami() -> Option<i64> {
Some(0i64)
}
fn _default_reaction_counts_kawaii() -> Option<i64> {
Some(0i64)
}
fn _default_reaction_counts_sugoi() -> Option<i64> {
Some(0i64)
}
fn _default_reaction_counts_suki() -> Option<i64> {
Some(0i64)
}
fn _default_reaction_counts_tasukaru() -> Option<i64> {
Some(0i64)
}
impl Default for ReactionCounts<'_> {
fn default() -> Self {
Self {
kami: Some(0i64),
kawaii: Some(0i64),
sugoi: Some(0i64),
suki: Some(0i64),
tasukaru: Some(0i64),
extra_data: Default::default(),
}
}
}
pub mod reply_view_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 CreatedAt;
type Cid;
type Uri;
type Author;
type Text;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Cid = Unset;
type Uri = Unset;
type Author = Unset;
type Text = Unset;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type CreatedAt = Set<members::created_at>;
type Cid = S::Cid;
type Uri = S::Uri;
type Author = S::Author;
type Text = S::Text;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type CreatedAt = S::CreatedAt;
type Cid = Set<members::cid>;
type Uri = S::Uri;
type Author = S::Author;
type Text = S::Text;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type CreatedAt = S::CreatedAt;
type Cid = S::Cid;
type Uri = Set<members::uri>;
type Author = S::Author;
type Text = S::Text;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type CreatedAt = S::CreatedAt;
type Cid = S::Cid;
type Uri = S::Uri;
type Author = Set<members::author>;
type Text = S::Text;
}
pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetText<S> {}
impl<S: State> State for SetText<S> {
type CreatedAt = S::CreatedAt;
type Cid = S::Cid;
type Uri = S::Uri;
type Author = S::Author;
type Text = Set<members::text>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct cid(());
pub struct uri(());
pub struct author(());
pub struct text(());
}
}
pub struct ReplyViewBuilder<'a, S: reply_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<CowStr<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReplyView<'a> {
pub fn new() -> ReplyViewBuilder<'a, reply_view_state::Empty> {
ReplyViewBuilder::new()
}
}
impl<'a> ReplyViewBuilder<'a, reply_view_state::Empty> {
pub fn new() -> Self {
ReplyViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReplyViewBuilder<'a, S>
where
S: reply_view_state::State,
S::Author: reply_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> ReplyViewBuilder<'a, reply_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
ReplyViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReplyViewBuilder<'a, S>
where
S: reply_view_state::State,
S::Cid: reply_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> ReplyViewBuilder<'a, reply_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
ReplyViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReplyViewBuilder<'a, S>
where
S: reply_view_state::State,
S::CreatedAt: reply_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ReplyViewBuilder<'a, reply_view_state::SetCreatedAt<S>> {
self._fields.2 = Option::Some(value.into());
ReplyViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReplyViewBuilder<'a, S>
where
S: reply_view_state::State,
S::Text: reply_view_state::IsUnset,
{
pub fn text(
mut self,
value: impl Into<CowStr<'a>>,
) -> ReplyViewBuilder<'a, reply_view_state::SetText<S>> {
self._fields.3 = Option::Some(value.into());
ReplyViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReplyViewBuilder<'a, S>
where
S: reply_view_state::State,
S::Uri: reply_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ReplyViewBuilder<'a, reply_view_state::SetUri<S>> {
self._fields.4 = Option::Some(value.into());
ReplyViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReplyViewBuilder<'a, S>
where
S: reply_view_state::State,
S::CreatedAt: reply_view_state::IsSet,
S::Cid: reply_view_state::IsSet,
S::Uri: reply_view_state::IsSet,
S::Author: reply_view_state::IsSet,
S::Text: reply_view_state::IsSet,
{
pub fn build(self) -> ReplyView<'a> {
ReplyView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
text: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ReplyView<'a> {
ReplyView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
text: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod request_response_view_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 CreatedAt;
type Post;
type Uri;
type Cid;
type Author;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Post = Unset;
type Uri = Unset;
type Cid = Unset;
type Author = Unset;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type CreatedAt = Set<members::created_at>;
type Post = S::Post;
type Uri = S::Uri;
type Cid = S::Cid;
type Author = S::Author;
}
pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPost<S> {}
impl<S: State> State for SetPost<S> {
type CreatedAt = S::CreatedAt;
type Post = Set<members::post>;
type Uri = S::Uri;
type Cid = S::Cid;
type Author = S::Author;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type CreatedAt = S::CreatedAt;
type Post = S::Post;
type Uri = Set<members::uri>;
type Cid = S::Cid;
type Author = S::Author;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type CreatedAt = S::CreatedAt;
type Post = S::Post;
type Uri = S::Uri;
type Cid = Set<members::cid>;
type Author = S::Author;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type CreatedAt = S::CreatedAt;
type Post = S::Post;
type Uri = S::Uri;
type Cid = S::Cid;
type Author = Set<members::author>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct post(());
pub struct uri(());
pub struct cid(());
pub struct author(());
}
}
pub struct RequestResponseViewBuilder<'a, S: request_response_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<CowStr<'a>>,
Option<kaku::PostView<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RequestResponseView<'a> {
pub fn new() -> RequestResponseViewBuilder<'a, request_response_view_state::Empty> {
RequestResponseViewBuilder::new()
}
}
impl<'a> RequestResponseViewBuilder<'a, request_response_view_state::Empty> {
pub fn new() -> Self {
RequestResponseViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestResponseViewBuilder<'a, S>
where
S: request_response_view_state::State,
S::Author: request_response_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> RequestResponseViewBuilder<'a, request_response_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
RequestResponseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestResponseViewBuilder<'a, S>
where
S: request_response_view_state::State,
S::Cid: request_response_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> RequestResponseViewBuilder<'a, request_response_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
RequestResponseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestResponseViewBuilder<'a, S>
where
S: request_response_view_state::State,
S::CreatedAt: request_response_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> RequestResponseViewBuilder<'a, request_response_view_state::SetCreatedAt<S>> {
self._fields.2 = Option::Some(value.into());
RequestResponseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: request_response_view_state::State> RequestResponseViewBuilder<'a, S> {
pub fn message(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_message(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> RequestResponseViewBuilder<'a, S>
where
S: request_response_view_state::State,
S::Post: request_response_view_state::IsUnset,
{
pub fn post(
mut self,
value: impl Into<kaku::PostView<'a>>,
) -> RequestResponseViewBuilder<'a, request_response_view_state::SetPost<S>> {
self._fields.4 = Option::Some(value.into());
RequestResponseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestResponseViewBuilder<'a, S>
where
S: request_response_view_state::State,
S::Uri: request_response_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> RequestResponseViewBuilder<'a, request_response_view_state::SetUri<S>> {
self._fields.5 = Option::Some(value.into());
RequestResponseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestResponseViewBuilder<'a, S>
where
S: request_response_view_state::State,
S::CreatedAt: request_response_view_state::IsSet,
S::Post: request_response_view_state::IsSet,
S::Uri: request_response_view_state::IsSet,
S::Cid: request_response_view_state::IsSet,
S::Author: request_response_view_state::IsSet,
{
pub fn build(self) -> RequestResponseView<'a> {
RequestResponseView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
message: self._fields.3,
post: self._fields.4.unwrap(),
uri: self._fields.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RequestResponseView<'a> {
RequestResponseView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
message: self._fields.3,
post: self._fields.4.unwrap(),
uri: self._fields.5.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod request_view_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 Author;
type Uri;
type IsOpen;
type CreatedAt;
type Text;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Author = Unset;
type Uri = Unset;
type IsOpen = Unset;
type CreatedAt = Unset;
type Text = Unset;
type Cid = Unset;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Author = Set<members::author>;
type Uri = S::Uri;
type IsOpen = S::IsOpen;
type CreatedAt = S::CreatedAt;
type Text = S::Text;
type Cid = S::Cid;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Author = S::Author;
type Uri = Set<members::uri>;
type IsOpen = S::IsOpen;
type CreatedAt = S::CreatedAt;
type Text = S::Text;
type Cid = S::Cid;
}
pub struct SetIsOpen<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIsOpen<S> {}
impl<S: State> State for SetIsOpen<S> {
type Author = S::Author;
type Uri = S::Uri;
type IsOpen = Set<members::is_open>;
type CreatedAt = S::CreatedAt;
type Text = S::Text;
type Cid = S::Cid;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Author = S::Author;
type Uri = S::Uri;
type IsOpen = S::IsOpen;
type CreatedAt = Set<members::created_at>;
type Text = S::Text;
type Cid = S::Cid;
}
pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetText<S> {}
impl<S: State> State for SetText<S> {
type Author = S::Author;
type Uri = S::Uri;
type IsOpen = S::IsOpen;
type CreatedAt = S::CreatedAt;
type Text = Set<members::text>;
type Cid = S::Cid;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Author = S::Author;
type Uri = S::Uri;
type IsOpen = S::IsOpen;
type CreatedAt = S::CreatedAt;
type Text = S::Text;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct author(());
pub struct uri(());
pub struct is_open(());
pub struct created_at(());
pub struct text(());
pub struct cid(());
}
}
pub struct RequestViewBuilder<'a, S: request_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<Datetime>,
Option<bool>,
Option<Vec<UriValue<'a>>>,
Option<i64>,
Option<Vec<CowStr<'a>>>,
Option<ProfileViewBasic<'a>>,
Option<CowStr<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RequestView<'a> {
pub fn new() -> RequestViewBuilder<'a, request_view_state::Empty> {
RequestViewBuilder::new()
}
}
impl<'a> RequestViewBuilder<'a, request_view_state::Empty> {
pub fn new() -> Self {
RequestViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::Author: request_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> RequestViewBuilder<'a, request_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::Cid: request_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> RequestViewBuilder<'a, request_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::CreatedAt: request_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> RequestViewBuilder<'a, request_view_state::SetCreatedAt<S>> {
self._fields.2 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_indexed_at(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::IsOpen: request_view_state::IsUnset,
{
pub fn is_open(
mut self,
value: impl Into<bool>,
) -> RequestViewBuilder<'a, request_view_state::SetIsOpen<S>> {
self._fields.4 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
pub fn reference_images(
mut self,
value: impl Into<Option<Vec<UriValue<'a>>>>,
) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_reference_images(mut self, value: Option<Vec<UriValue<'a>>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
pub fn response_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_response_count(mut self, value: Option<i64>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
pub fn target_actor(
mut self,
value: impl Into<Option<ProfileViewBasic<'a>>>,
) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_target_actor(mut self, value: Option<ProfileViewBasic<'a>>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::Text: request_view_state::IsUnset,
{
pub fn text(
mut self,
value: impl Into<CowStr<'a>>,
) -> RequestViewBuilder<'a, request_view_state::SetText<S>> {
self._fields.9 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::Uri: request_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> RequestViewBuilder<'a, request_view_state::SetUri<S>> {
self._fields.10 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::Author: request_view_state::IsSet,
S::Uri: request_view_state::IsSet,
S::IsOpen: request_view_state::IsSet,
S::CreatedAt: request_view_state::IsSet,
S::Text: request_view_state::IsSet,
S::Cid: request_view_state::IsSet,
{
pub fn build(self) -> RequestView<'a> {
RequestView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
indexed_at: self._fields.3,
is_open: self._fields.4.unwrap(),
reference_images: self._fields.5,
response_count: self._fields.6,
tags: self._fields.7,
target_actor: self._fields.8,
text: self._fields.9.unwrap(),
uri: self._fields.10.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RequestView<'a> {
RequestView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
indexed_at: self._fields.3,
is_open: self._fields.4.unwrap(),
reference_images: self._fields.5,
response_count: self._fields.6,
tags: self._fields.7,
target_actor: self._fields.8,
text: self._fields.9.unwrap(),
uri: self._fields.10.unwrap(),
extra_data: Some(extra_data),
}
}
}