#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::app_bsky::actor::ProfileViewBasic;
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;
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;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Record<S: BosStr = DefaultStr> {
pub record: StrongRef<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct View<S: BosStr = DefaultStr> {
pub record: ViewUnionRecord<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum ViewUnionRecord<S: BosStr = DefaultStr> {
#[serde(rename = "app.bsky.embed.record#viewRecord")]
ViewRecord(Box<record::ViewRecord<S>>),
#[serde(rename = "app.bsky.embed.record#viewNotFound")]
ViewNotFound(Box<record::ViewNotFound<S>>),
#[serde(rename = "app.bsky.embed.record#viewBlocked")]
ViewBlocked(Box<record::ViewBlocked<S>>),
#[serde(rename = "app.bsky.embed.record#viewDetached")]
ViewDetached(Box<record::ViewDetached<S>>),
#[serde(rename = "app.bsky.feed.defs#generatorView")]
GeneratorView(Box<GeneratorView<S>>),
#[serde(rename = "app.bsky.graph.defs#listView")]
ListView(Box<ListView<S>>),
#[serde(rename = "app.bsky.labeler.defs#labelerView")]
LabelerView(Box<LabelerView<S>>),
#[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")]
StarterPackViewBasic(Box<StarterPackViewBasic<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ViewBlocked<S: BosStr = DefaultStr> {
pub author: BlockedAuthor<S>,
pub blocked: bool,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ViewDetached<S: BosStr = DefaultStr> {
pub detached: bool,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ViewNotFound<S: BosStr = DefaultStr> {
pub not_found: bool,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ViewRecord<S: BosStr = DefaultStr> {
pub author: ProfileViewBasic<S>,
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub embeds: Option<Vec<ViewRecordEmbedsItem<S>>>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<Label<S>>>,
#[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>,
pub uri: AtUri<S>,
pub value: Data<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum ViewRecordEmbedsItem<S: BosStr = DefaultStr> {
#[serde(rename = "app.bsky.embed.images#view")]
ImagesView(Box<images::View<S>>),
#[serde(rename = "app.bsky.embed.video#view")]
VideoView(Box<video::View<S>>),
#[serde(rename = "app.bsky.embed.external#view")]
ExternalView(Box<external::View<S>>),
#[serde(rename = "app.bsky.embed.record#view")]
View(Box<record::View<S>>),
#[serde(rename = "app.bsky.embed.recordWithMedia#view")]
RecordWithMediaView(Box<record_with_media::View<S>>),
}
impl<S: BosStr> LexiconSchema for Record<S> {
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<S: BosStr> LexiconSchema for View<S> {
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<S: BosStr> LexiconSchema for ViewBlocked<S> {
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<S: BosStr> LexiconSchema for ViewDetached<S> {
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<S: BosStr> LexiconSchema for ViewNotFound<S> {
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<S: BosStr> LexiconSchema for ViewRecord<S> {
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::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
}
}
pub struct RecordBuilder<S: BosStr, St: record_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<StrongRef<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Record<S> {
pub fn new() -> RecordBuilder<S, record_state::Empty> {
RecordBuilder::new()
}
}
impl<S: BosStr> RecordBuilder<S, record_state::Empty> {
pub fn new() -> Self {
RecordBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordBuilder<S, St>
where
St: record_state::State,
St::Record: record_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<StrongRef<S>>,
) -> RecordBuilder<S, record_state::SetRecord<St>> {
self._fields.0 = Option::Some(value.into());
RecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordBuilder<S, St>
where
St: record_state::State,
St::Record: record_state::IsSet,
{
pub fn build(self) -> Record<S> {
Record {
record: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Record<S> {
Record {
record: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_embed_record() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
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::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
}
}
pub struct ViewBuilder<S: BosStr, St: view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ViewUnionRecord<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> View<S> {
pub fn new() -> ViewBuilder<S, view_state::Empty> {
ViewBuilder::new()
}
}
impl<S: BosStr> ViewBuilder<S, view_state::Empty> {
pub fn new() -> Self {
ViewBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewBuilder<S, St>
where
St: view_state::State,
St::Record: view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<ViewUnionRecord<S>>,
) -> ViewBuilder<S, view_state::SetRecord<St>> {
self._fields.0 = Option::Some(value.into());
ViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewBuilder<S, St>
where
St: view_state::State,
St::Record: view_state::IsSet,
{
pub fn build(self) -> View<S> {
View {
record: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> View<S> {
View {
record: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_blocked_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBlocked<St> {}
impl<St: State> State for SetBlocked<St> {
type Blocked = Set<members::blocked>;
type Author = St::Author;
type Uri = St::Uri;
}
pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthor<St> {}
impl<St: State> State for SetAuthor<St> {
type Blocked = St::Blocked;
type Author = Set<members::author>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Blocked = St::Blocked;
type Author = St::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<S: BosStr, St: view_blocked_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlockedAuthor<S>>, Option<bool>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ViewBlocked<S> {
pub fn new() -> ViewBlockedBuilder<S, view_blocked_state::Empty> {
ViewBlockedBuilder::new()
}
}
impl<S: BosStr> ViewBlockedBuilder<S, view_blocked_state::Empty> {
pub fn new() -> Self {
ViewBlockedBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewBlockedBuilder<S, St>
where
St: view_blocked_state::State,
St::Author: view_blocked_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<BlockedAuthor<S>>,
) -> ViewBlockedBuilder<S, view_blocked_state::SetAuthor<St>> {
self._fields.0 = Option::Some(value.into());
ViewBlockedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewBlockedBuilder<S, St>
where
St: view_blocked_state::State,
St::Blocked: view_blocked_state::IsUnset,
{
pub fn blocked(
mut self,
value: impl Into<bool>,
) -> ViewBlockedBuilder<S, view_blocked_state::SetBlocked<St>> {
self._fields.1 = Option::Some(value.into());
ViewBlockedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewBlockedBuilder<S, St>
where
St: view_blocked_state::State,
St::Uri: view_blocked_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ViewBlockedBuilder<S, view_blocked_state::SetUri<St>> {
self._fields.2 = Option::Some(value.into());
ViewBlockedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewBlockedBuilder<S, St>
where
St: view_blocked_state::State,
St::Blocked: view_blocked_state::IsSet,
St::Author: view_blocked_state::IsSet,
St::Uri: view_blocked_state::IsSet,
{
pub fn build(self) -> ViewBlocked<S> {
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<SmolStr, Data<S>>) -> ViewBlocked<S> {
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::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDetached<St> {}
impl<St: State> State for SetDetached<St> {
type Detached = Set<members::detached>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Detached = St::Detached;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct detached(());
pub struct uri(());
}
}
pub struct ViewDetachedBuilder<S: BosStr, St: view_detached_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ViewDetached<S> {
pub fn new() -> ViewDetachedBuilder<S, view_detached_state::Empty> {
ViewDetachedBuilder::new()
}
}
impl<S: BosStr> ViewDetachedBuilder<S, view_detached_state::Empty> {
pub fn new() -> Self {
ViewDetachedBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewDetachedBuilder<S, St>
where
St: view_detached_state::State,
St::Detached: view_detached_state::IsUnset,
{
pub fn detached(
mut self,
value: impl Into<bool>,
) -> ViewDetachedBuilder<S, view_detached_state::SetDetached<St>> {
self._fields.0 = Option::Some(value.into());
ViewDetachedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewDetachedBuilder<S, St>
where
St: view_detached_state::State,
St::Uri: view_detached_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ViewDetachedBuilder<S, view_detached_state::SetUri<St>> {
self._fields.1 = Option::Some(value.into());
ViewDetachedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewDetachedBuilder<S, St>
where
St: view_detached_state::State,
St::Detached: view_detached_state::IsSet,
St::Uri: view_detached_state::IsSet,
{
pub fn build(self) -> ViewDetached<S> {
ViewDetached {
detached: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ViewDetached<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type NotFound;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type NotFound = Unset;
type Uri = Unset;
}
pub struct SetNotFound<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetNotFound<St> {}
impl<St: State> State for SetNotFound<St> {
type NotFound = Set<members::not_found>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type NotFound = St::NotFound;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct not_found(());
pub struct uri(());
}
}
pub struct ViewNotFoundBuilder<S: BosStr, St: view_not_found_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ViewNotFound<S> {
pub fn new() -> ViewNotFoundBuilder<S, view_not_found_state::Empty> {
ViewNotFoundBuilder::new()
}
}
impl<S: BosStr> ViewNotFoundBuilder<S, view_not_found_state::Empty> {
pub fn new() -> Self {
ViewNotFoundBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewNotFoundBuilder<S, St>
where
St: view_not_found_state::State,
St::NotFound: view_not_found_state::IsUnset,
{
pub fn not_found(
mut self,
value: impl Into<bool>,
) -> ViewNotFoundBuilder<S, view_not_found_state::SetNotFound<St>> {
self._fields.0 = Option::Some(value.into());
ViewNotFoundBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewNotFoundBuilder<S, St>
where
St: view_not_found_state::State,
St::Uri: view_not_found_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ViewNotFoundBuilder<S, view_not_found_state::SetUri<St>> {
self._fields.1 = Option::Some(value.into());
ViewNotFoundBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewNotFoundBuilder<S, St>
where
St: view_not_found_state::State,
St::NotFound: view_not_found_state::IsSet,
St::Uri: view_not_found_state::IsSet,
{
pub fn build(self) -> ViewNotFound<S> {
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<SmolStr, Data<S>>) -> ViewNotFound<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Cid;
type Author;
type IndexedAt;
type Value;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type Author = Unset;
type IndexedAt = Unset;
type Value = Unset;
type Uri = Unset;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Cid = Set<members::cid>;
type Author = St::Author;
type IndexedAt = St::IndexedAt;
type Value = St::Value;
type Uri = St::Uri;
}
pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthor<St> {}
impl<St: State> State for SetAuthor<St> {
type Cid = St::Cid;
type Author = Set<members::author>;
type IndexedAt = St::IndexedAt;
type Value = St::Value;
type Uri = St::Uri;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Cid = St::Cid;
type Author = St::Author;
type IndexedAt = Set<members::indexed_at>;
type Value = St::Value;
type Uri = St::Uri;
}
pub struct SetValue<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetValue<St> {}
impl<St: State> State for SetValue<St> {
type Cid = St::Cid;
type Author = St::Author;
type IndexedAt = St::IndexedAt;
type Value = Set<members::value>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Cid = St::Cid;
type Author = St::Author;
type IndexedAt = St::IndexedAt;
type Value = St::Value;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct author(());
pub struct indexed_at(());
pub struct value(());
pub struct uri(());
}
}
pub struct ViewRecordBuilder<S: BosStr, St: view_record_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<ProfileViewBasic<S>>,
Option<Cid<S>>,
Option<Vec<ViewRecordEmbedsItem<S>>>,
Option<Datetime>,
Option<Vec<Label<S>>>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<AtUri<S>>,
Option<Data<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ViewRecord<S> {
pub fn new() -> ViewRecordBuilder<S, view_record_state::Empty> {
ViewRecordBuilder::new()
}
}
impl<S: BosStr> ViewRecordBuilder<S, view_record_state::Empty> {
pub fn new() -> Self {
ViewRecordBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewRecordBuilder<S, St>
where
St: view_record_state::State,
St::Author: view_record_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> ViewRecordBuilder<S, view_record_state::SetAuthor<St>> {
self._fields.0 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewRecordBuilder<S, St>
where
St: view_record_state::State,
St::Cid: view_record_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> ViewRecordBuilder<S, view_record_state::SetCid<St>> {
self._fields.1 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: view_record_state::State> ViewRecordBuilder<S, St> {
pub fn embeds(mut self, value: impl Into<Option<Vec<ViewRecordEmbedsItem<S>>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_embeds(mut self, value: Option<Vec<ViewRecordEmbedsItem<S>>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> ViewRecordBuilder<S, St>
where
St: view_record_state::State,
St::IndexedAt: view_record_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ViewRecordBuilder<S, view_record_state::SetIndexedAt<St>> {
self._fields.3 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: view_record_state::State> ViewRecordBuilder<S, St> {
pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: view_record_state::State> ViewRecordBuilder<S, St> {
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<S: BosStr, St: view_record_state::State> ViewRecordBuilder<S, St> {
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<S: BosStr, St: view_record_state::State> ViewRecordBuilder<S, St> {
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<S: BosStr, St: view_record_state::State> ViewRecordBuilder<S, St> {
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<S: BosStr, St> ViewRecordBuilder<S, St>
where
St: view_record_state::State,
St::Uri: view_record_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ViewRecordBuilder<S, view_record_state::SetUri<St>> {
self._fields.9 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewRecordBuilder<S, St>
where
St: view_record_state::State,
St::Value: view_record_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<Data<S>>,
) -> ViewRecordBuilder<S, view_record_state::SetValue<St>> {
self._fields.10 = Option::Some(value.into());
ViewRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewRecordBuilder<S, St>
where
St: view_record_state::State,
St::Cid: view_record_state::IsSet,
St::Author: view_record_state::IsSet,
St::IndexedAt: view_record_state::IsSet,
St::Value: view_record_state::IsSet,
St::Uri: view_record_state::IsSet,
{
pub fn build(self) -> ViewRecord<S> {
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<SmolStr, Data<S>>) -> ViewRecord<S> {
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),
}
}
}