#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, lexicon, open_union};
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::app_bsky::feed::BlockedAuthor;
use crate::app_bsky::feed::GeneratorView;
use crate::app_bsky::graph::ListView;
use crate::app_bsky::graph::StarterPackViewBasic;
use crate::app_bsky::labeler::LabelerView;
use crate::com_atproto::label::Label;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::app_bsky::embed::external;
use crate::app_bsky::embed::images;
use crate::app_bsky::embed::record;
use crate::app_bsky::embed::record_with_media;
use crate::app_bsky::embed::video;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Record<'a> {
#[serde(borrow)]
pub record: StrongRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct View<'a> {
#[serde(borrow)]
pub record: ViewUnionRecord<'a>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
pub enum ViewUnionRecord<'a> {
#[serde(rename = "app.bsky.embed.record#viewRecord")]
ViewRecord(Box<record::ViewRecord<'a>>),
#[serde(rename = "app.bsky.embed.record#viewNotFound")]
ViewNotFound(Box<record::ViewNotFound<'a>>),
#[serde(rename = "app.bsky.embed.record#viewBlocked")]
ViewBlocked(Box<record::ViewBlocked<'a>>),
#[serde(rename = "app.bsky.embed.record#viewDetached")]
ViewDetached(Box<record::ViewDetached<'a>>),
#[serde(rename = "app.bsky.feed.defs#generatorView")]
GeneratorView(Box<GeneratorView<'a>>),
#[serde(rename = "app.bsky.graph.defs#listView")]
ListView(Box<ListView<'a>>),
#[serde(rename = "app.bsky.labeler.defs#labelerView")]
LabelerView(Box<LabelerView<'a>>),
#[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")]
StarterPackViewBasic(Box<StarterPackViewBasic<'a>>),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ViewBlocked<'a> {
#[serde(borrow)]
pub author: BlockedAuthor<'a>,
pub blocked: bool,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ViewDetached<'a> {
pub detached: bool,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ViewNotFound<'a> {
pub not_found: bool,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ViewRecord<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub embeds: Option<Vec<ViewRecordEmbedsItem<'a>>>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub labels: Option<Vec<Label<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub quote_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub repost_count: Option<i64>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(borrow)]
pub value: Data<'a>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
pub enum ViewRecordEmbedsItem<'a> {
#[serde(rename = "app.bsky.embed.images#view")]
ImagesView(Box<images::View<'a>>),
#[serde(rename = "app.bsky.embed.video#view")]
VideoView(Box<video::View<'a>>),
#[serde(rename = "app.bsky.embed.external#view")]
ExternalView(Box<external::View<'a>>),
#[serde(rename = "app.bsky.embed.record#view")]
View(Box<record::View<'a>>),
#[serde(rename = "app.bsky.embed.recordWithMedia#view")]
RecordWithMediaView(Box<record_with_media::View<'a>>),
}
impl<'a> LexiconSchema for Record<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.record"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_record()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for View<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.record"
}
fn def_name() -> &'static str {
"view"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_record()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ViewBlocked<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.record"
}
fn def_name() -> &'static str {
"viewBlocked"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_record()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ViewDetached<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.record"
}
fn def_name() -> &'static str {
"viewDetached"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_record()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ViewNotFound<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.record"
}
fn def_name() -> &'static str {
"viewNotFound"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_record()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ViewRecord<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.record"
}
fn def_name() -> &'static str {
"viewRecord"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_record()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod record_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 Record;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
}
}
pub struct RecordBuilder<'a, S: record_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<StrongRef<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Record<'a> {
pub fn new() -> RecordBuilder<'a, record_state::Empty> {
RecordBuilder::new()
}
}
impl<'a> RecordBuilder<'a, record_state::Empty> {
pub fn new() -> Self {
RecordBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecordBuilder<'a, S>
where
S: record_state::State,
S::Record: record_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<StrongRef<'a>>,
) -> RecordBuilder<'a, record_state::SetRecord<S>> {
self._fields.0 = Option::Some(value.into());
RecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecordBuilder<'a, S>
where
S: record_state::State,
S::Record: record_state::IsSet,
{
pub fn build(self) -> Record<'a> {
Record {
record: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> Record<'a> {
Record {
record: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_embed_record() -> 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("app.bsky.embed.record"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("record")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("view"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("record")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#viewRecord"),
CowStr::new_static("#viewNotFound"),
CowStr::new_static("#viewBlocked"),
CowStr::new_static("#viewDetached"),
CowStr::new_static("app.bsky.feed.defs#generatorView"),
CowStr::new_static("app.bsky.graph.defs#listView"),
CowStr::new_static("app.bsky.labeler.defs#labelerView"),
CowStr::new_static("app.bsky.graph.defs#starterPackViewBasic")
],
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewBlocked"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("blocked"),
SmolStr::new_static("author")
],
),
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.feed.defs#blockedAuthor",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("blocked"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewDetached"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("detached")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("detached"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewNotFound"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("notFound")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("notFound"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewRecord"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("value"),
SmolStr::new_static("indexedAt")
],
),
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 {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("embeds"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Union(LexRefUnion {
refs: vec![
CowStr::new_static("app.bsky.embed.images#view"),
CowStr::new_static("app.bsky.embed.video#view"),
CowStr::new_static("app.bsky.embed.external#view"),
CowStr::new_static("app.bsky.embed.record#view"),
CowStr::new_static("app.bsky.embed.recordWithMedia#view")
],
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labels"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.label.defs#label"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("quoteCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("replyCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repostCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod 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 Record;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
}
}
pub struct ViewBuilder<'a, S: view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ViewUnionRecord<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> View<'a> {
pub fn new() -> ViewBuilder<'a, view_state::Empty> {
ViewBuilder::new()
}
}
impl<'a> ViewBuilder<'a, view_state::Empty> {
pub fn new() -> Self {
ViewBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewBuilder<'a, S>
where
S: view_state::State,
S::Record: view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<ViewUnionRecord<'a>>,
) -> ViewBuilder<'a, view_state::SetRecord<S>> {
self._fields.0 = Option::Some(value.into());
ViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewBuilder<'a, S>
where
S: view_state::State,
S::Record: view_state::IsSet,
{
pub fn build(self) -> View<'a> {
View {
record: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> View<'a> {
View {
record: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_blocked_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 Blocked;
type Author;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Blocked = Unset;
type Author = Unset;
type Uri = Unset;
}
pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlocked<S> {}
impl<S: State> State for SetBlocked<S> {
type Blocked = Set<members::blocked>;
type Author = S::Author;
type Uri = S::Uri;
}
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 Blocked = S::Blocked;
type Author = Set<members::author>;
type Uri = S::Uri;
}
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 Blocked = S::Blocked;
type Author = S::Author;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct blocked(());
pub struct author(());
pub struct uri(());
}
}
pub struct ViewBlockedBuilder<'a, S: view_blocked_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<BlockedAuthor<'a>>, Option<bool>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ViewBlocked<'a> {
pub fn new() -> ViewBlockedBuilder<'a, view_blocked_state::Empty> {
ViewBlockedBuilder::new()
}
}
impl<'a> ViewBlockedBuilder<'a, view_blocked_state::Empty> {
pub fn new() -> Self {
ViewBlockedBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewBlockedBuilder<'a, S>
where
S: view_blocked_state::State,
S::Author: view_blocked_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<BlockedAuthor<'a>>,
) -> ViewBlockedBuilder<'a, view_blocked_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
ViewBlockedBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewBlockedBuilder<'a, S>
where
S: view_blocked_state::State,
S::Blocked: view_blocked_state::IsUnset,
{
pub fn blocked(
mut self,
value: impl Into<bool>,
) -> ViewBlockedBuilder<'a, view_blocked_state::SetBlocked<S>> {
self._fields.1 = Option::Some(value.into());
ViewBlockedBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewBlockedBuilder<'a, S>
where
S: view_blocked_state::State,
S::Uri: view_blocked_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ViewBlockedBuilder<'a, view_blocked_state::SetUri<S>> {
self._fields.2 = Option::Some(value.into());
ViewBlockedBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewBlockedBuilder<'a, S>
where
S: view_blocked_state::State,
S::Blocked: view_blocked_state::IsSet,
S::Author: view_blocked_state::IsSet,
S::Uri: view_blocked_state::IsSet,
{
pub fn build(self) -> ViewBlocked<'a> {
ViewBlocked {
author: self._fields.0.unwrap(),
blocked: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ViewBlocked<'a> {
ViewBlocked {
author: self._fields.0.unwrap(),
blocked: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_detached_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 Detached;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Detached = Unset;
type Uri = Unset;
}
pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDetached<S> {}
impl<S: State> State for SetDetached<S> {
type Detached = Set<members::detached>;
type Uri = S::Uri;
}
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 Detached = S::Detached;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct detached(());
pub struct uri(());
}
}
pub struct ViewDetachedBuilder<'a, S: view_detached_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ViewDetached<'a> {
pub fn new() -> ViewDetachedBuilder<'a, view_detached_state::Empty> {
ViewDetachedBuilder::new()
}
}
impl<'a> ViewDetachedBuilder<'a, view_detached_state::Empty> {
pub fn new() -> Self {
ViewDetachedBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewDetachedBuilder<'a, S>
where
S: view_detached_state::State,
S::Detached: view_detached_state::IsUnset,
{
pub fn detached(
mut self,
value: impl Into<bool>,
) -> ViewDetachedBuilder<'a, view_detached_state::SetDetached<S>> {
self._fields.0 = Option::Some(value.into());
ViewDetachedBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewDetachedBuilder<'a, S>
where
S: view_detached_state::State,
S::Uri: view_detached_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ViewDetachedBuilder<'a, view_detached_state::SetUri<S>> {
self._fields.1 = Option::Some(value.into());
ViewDetachedBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewDetachedBuilder<'a, S>
where
S: view_detached_state::State,
S::Detached: view_detached_state::IsSet,
S::Uri: view_detached_state::IsSet,
{
pub fn build(self) -> ViewDetached<'a> {
ViewDetached {
detached: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ViewDetached<'a> {
ViewDetached {
detached: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_not_found_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 Uri;
type NotFound;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type NotFound = Unset;
}
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 Uri = Set<members::uri>;
type NotFound = S::NotFound;
}
pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetNotFound<S> {}
impl<S: State> State for SetNotFound<S> {
type Uri = S::Uri;
type NotFound = Set<members::not_found>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct not_found(());
}
}
pub struct ViewNotFoundBuilder<'a, S: view_not_found_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ViewNotFound<'a> {
pub fn new() -> ViewNotFoundBuilder<'a, view_not_found_state::Empty> {
ViewNotFoundBuilder::new()
}
}
impl<'a> ViewNotFoundBuilder<'a, view_not_found_state::Empty> {
pub fn new() -> Self {
ViewNotFoundBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewNotFoundBuilder<'a, S>
where
S: view_not_found_state::State,
S::NotFound: view_not_found_state::IsUnset,
{
pub fn not_found(
mut self,
value: impl Into<bool>,
) -> ViewNotFoundBuilder<'a, view_not_found_state::SetNotFound<S>> {
self._fields.0 = Option::Some(value.into());
ViewNotFoundBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewNotFoundBuilder<'a, S>
where
S: view_not_found_state::State,
S::Uri: view_not_found_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ViewNotFoundBuilder<'a, view_not_found_state::SetUri<S>> {
self._fields.1 = Option::Some(value.into());
ViewNotFoundBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewNotFoundBuilder<'a, S>
where
S: view_not_found_state::State,
S::Uri: view_not_found_state::IsSet,
S::NotFound: view_not_found_state::IsSet,
{
pub fn build(self) -> ViewNotFound<'a> {
ViewNotFound {
not_found: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ViewNotFound<'a> {
ViewNotFound {
not_found: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_record_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 Cid;
type IndexedAt;
type Uri;
type Author;
type Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type IndexedAt = Unset;
type Uri = Unset;
type Author = Unset;
type Value = Unset;
}
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 Cid = Set<members::cid>;
type IndexedAt = S::IndexedAt;
type Uri = S::Uri;
type Author = S::Author;
type Value = S::Value;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type Cid = S::Cid;
type IndexedAt = Set<members::indexed_at>;
type Uri = S::Uri;
type Author = S::Author;
type Value = S::Value;
}
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 Cid = S::Cid;
type IndexedAt = S::IndexedAt;
type Uri = Set<members::uri>;
type Author = S::Author;
type Value = S::Value;
}
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 Cid = S::Cid;
type IndexedAt = S::IndexedAt;
type Uri = S::Uri;
type Author = Set<members::author>;
type Value = S::Value;
}
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 Cid = S::Cid;
type IndexedAt = S::IndexedAt;
type Uri = S::Uri;
type Author = S::Author;
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct indexed_at(());
pub struct uri(());
pub struct author(());
pub struct value(());
}
}
pub struct ViewRecordBuilder<'a, S: view_record_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Vec<ViewRecordEmbedsItem<'a>>>,
Option<Datetime>,
Option<Vec<Label<'a>>>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<AtUri<'a>>,
Option<Data<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ViewRecord<'a> {
pub fn new() -> ViewRecordBuilder<'a, view_record_state::Empty> {
ViewRecordBuilder::new()
}
}
impl<'a> ViewRecordBuilder<'a, view_record_state::Empty> {
pub fn new() -> Self {
ViewRecordBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewRecordBuilder<'a, S>
where
S: view_record_state::State,
S::Author: view_record_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> ViewRecordBuilder<'a, view_record_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewRecordBuilder<'a, S>
where
S: view_record_state::State,
S::Cid: view_record_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> ViewRecordBuilder<'a, view_record_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
pub fn embeds(
mut self,
value: impl Into<Option<Vec<ViewRecordEmbedsItem<'a>>>>,
) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_embeds(mut self, value: Option<Vec<ViewRecordEmbedsItem<'a>>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> ViewRecordBuilder<'a, S>
where
S: view_record_state::State,
S::IndexedAt: view_record_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ViewRecordBuilder<'a, view_record_state::SetIndexedAt<S>> {
self._fields.3 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
pub fn labels(mut self, value: impl Into<Option<Vec<Label<'a>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_labels(mut self, value: Option<Vec<Label<'a>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
pub fn quote_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_quote_count(mut self, value: Option<i64>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
pub fn reply_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_reply_count(mut self, value: Option<i64>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
pub fn repost_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_repost_count(mut self, value: Option<i64>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S> ViewRecordBuilder<'a, S>
where
S: view_record_state::State,
S::Uri: view_record_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ViewRecordBuilder<'a, view_record_state::SetUri<S>> {
self._fields.9 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewRecordBuilder<'a, S>
where
S: view_record_state::State,
S::Value: view_record_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<Data<'a>>,
) -> ViewRecordBuilder<'a, view_record_state::SetValue<S>> {
self._fields.10 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ViewRecordBuilder<'a, S>
where
S: view_record_state::State,
S::Cid: view_record_state::IsSet,
S::IndexedAt: view_record_state::IsSet,
S::Uri: view_record_state::IsSet,
S::Author: view_record_state::IsSet,
S::Value: view_record_state::IsSet,
{
pub fn build(self) -> ViewRecord<'a> {
ViewRecord {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
embeds: self._fields.2,
indexed_at: self._fields.3.unwrap(),
labels: self._fields.4,
like_count: self._fields.5,
quote_count: self._fields.6,
reply_count: self._fields.7,
repost_count: self._fields.8,
uri: self._fields.9.unwrap(),
value: self._fields.10.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ViewRecord<'a> {
ViewRecord {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
embeds: self._fields.2,
indexed_at: self._fields.3.unwrap(),
labels: self._fields.4,
like_count: self._fields.5,
quote_count: self._fields.6,
reply_count: self._fields.7,
repost_count: self._fields.8,
uri: self._fields.9.unwrap(),
value: self._fields.10.unwrap(),
extra_data: Some(extra_data),
}
}
}