pub mod badge;
pub mod branding;
pub mod broadcast;
pub mod chat;
pub mod graph;
pub mod ingest;
pub mod key;
pub mod live;
pub mod livestream;
pub mod metadata;
pub mod moderation;
pub mod multistream;
pub mod playback;
pub mod richtext;
pub mod segment;
pub mod server;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, 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;
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::graph::block::Block;
use crate::place_stream;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct BlockView<S: BosStr = DefaultStr> {
pub blocker: ProfileViewBasic<S>,
pub cid: Cid<S>,
pub indexed_at: Datetime,
pub record: Block<S>,
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, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Rendition<S: BosStr = DefaultStr> {
pub name: 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 Renditions<S: BosStr = DefaultStr> {
pub renditions: Vec<place_stream::Rendition<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for BlockView<S> {
fn nsid() -> &'static str {
"place.stream.defs"
}
fn def_name() -> &'static str {
"blockView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Rendition<S> {
fn nsid() -> &'static str {
"place.stream.defs"
}
fn def_name() -> &'static str {
"rendition"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Renditions<S> {
fn nsid() -> &'static str {
"place.stream.defs"
}
fn def_name() -> &'static str {
"renditions"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod block_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 Uri;
type Record;
type IndexedAt;
type Cid;
type Blocker;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Record = Unset;
type IndexedAt = Unset;
type Cid = Unset;
type Blocker = Unset;
}
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 Uri = Set<members::uri>;
type Record = St::Record;
type IndexedAt = St::IndexedAt;
type Cid = St::Cid;
type Blocker = St::Blocker;
}
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 Uri = St::Uri;
type Record = Set<members::record>;
type IndexedAt = St::IndexedAt;
type Cid = St::Cid;
type Blocker = St::Blocker;
}
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 Uri = St::Uri;
type Record = St::Record;
type IndexedAt = Set<members::indexed_at>;
type Cid = St::Cid;
type Blocker = St::Blocker;
}
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 Uri = St::Uri;
type Record = St::Record;
type IndexedAt = St::IndexedAt;
type Cid = Set<members::cid>;
type Blocker = St::Blocker;
}
pub struct SetBlocker<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBlocker<St> {}
impl<St: State> State for SetBlocker<St> {
type Uri = St::Uri;
type Record = St::Record;
type IndexedAt = St::IndexedAt;
type Cid = St::Cid;
type Blocker = Set<members::blocker>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct record(());
pub struct indexed_at(());
pub struct cid(());
pub struct blocker(());
}
}
pub struct BlockViewBuilder<S: BosStr, St: block_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<ProfileViewBasic<S>>,
Option<Cid<S>>,
Option<Datetime>,
Option<Block<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> BlockView<S> {
pub fn new() -> BlockViewBuilder<S, block_view_state::Empty> {
BlockViewBuilder::new()
}
}
impl<S: BosStr> BlockViewBuilder<S, block_view_state::Empty> {
pub fn new() -> Self {
BlockViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BlockViewBuilder<S, St>
where
St: block_view_state::State,
St::Blocker: block_view_state::IsUnset,
{
pub fn blocker(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> BlockViewBuilder<S, block_view_state::SetBlocker<St>> {
self._fields.0 = Option::Some(value.into());
BlockViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BlockViewBuilder<S, St>
where
St: block_view_state::State,
St::Cid: block_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> BlockViewBuilder<S, block_view_state::SetCid<St>> {
self._fields.1 = Option::Some(value.into());
BlockViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BlockViewBuilder<S, St>
where
St: block_view_state::State,
St::IndexedAt: block_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> BlockViewBuilder<S, block_view_state::SetIndexedAt<St>> {
self._fields.2 = Option::Some(value.into());
BlockViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BlockViewBuilder<S, St>
where
St: block_view_state::State,
St::Record: block_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Block<S>>,
) -> BlockViewBuilder<S, block_view_state::SetRecord<St>> {
self._fields.3 = Option::Some(value.into());
BlockViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BlockViewBuilder<S, St>
where
St: block_view_state::State,
St::Uri: block_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> BlockViewBuilder<S, block_view_state::SetUri<St>> {
self._fields.4 = Option::Some(value.into());
BlockViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BlockViewBuilder<S, St>
where
St: block_view_state::State,
St::Uri: block_view_state::IsSet,
St::Record: block_view_state::IsSet,
St::IndexedAt: block_view_state::IsSet,
St::Cid: block_view_state::IsSet,
St::Blocker: block_view_state::IsSet,
{
pub fn build(self) -> BlockView<S> {
BlockView {
blocker: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> BlockView<S> {
BlockView {
blocker: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_place_stream_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("place.stream.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blockView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("blocker"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blocker"),
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("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("app.bsky.graph.block"),
..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("rendition"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("name")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("renditions"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("renditions")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("renditions"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#rendition"),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod renditions_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 Renditions;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Renditions = Unset;
}
pub struct SetRenditions<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRenditions<St> {}
impl<St: State> State for SetRenditions<St> {
type Renditions = Set<members::renditions>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct renditions(());
}
}
pub struct RenditionsBuilder<S: BosStr, St: renditions_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Vec<place_stream::Rendition<S>>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Renditions<S> {
pub fn new() -> RenditionsBuilder<S, renditions_state::Empty> {
RenditionsBuilder::new()
}
}
impl<S: BosStr> RenditionsBuilder<S, renditions_state::Empty> {
pub fn new() -> Self {
RenditionsBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RenditionsBuilder<S, St>
where
St: renditions_state::State,
St::Renditions: renditions_state::IsUnset,
{
pub fn renditions(
mut self,
value: impl Into<Vec<place_stream::Rendition<S>>>,
) -> RenditionsBuilder<S, renditions_state::SetRenditions<St>> {
self._fields.0 = Option::Some(value.into());
RenditionsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RenditionsBuilder<S, St>
where
St: renditions_state::State,
St::Renditions: renditions_state::IsSet,
{
pub fn build(self) -> Renditions<S> {
Renditions {
renditions: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> Renditions<S> {
Renditions {
renditions: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}