#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct RecordWithMedia<'a> {
#[serde(borrow)]
pub media: RecordWithMediaMedia<'a>,
#[serde(borrow)]
pub record: crate::app_bsky::embed::record::Record<'a>,
}
pub mod record_with_media_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 Media;
type Record;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Media = Unset;
type Record = Unset;
}
pub struct SetMedia<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMedia<S> {}
impl<S: State> State for SetMedia<S> {
type Media = Set<members::media>;
type Record = S::Record;
}
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 Media = S::Media;
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct media(());
pub struct record(());
}
}
pub struct RecordWithMediaBuilder<'a, S: record_with_media_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<RecordWithMediaMedia<'a>>,
::core::option::Option<crate::app_bsky::embed::record::Record<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> RecordWithMedia<'a> {
pub fn new() -> RecordWithMediaBuilder<'a, record_with_media_state::Empty> {
RecordWithMediaBuilder::new()
}
}
impl<'a> RecordWithMediaBuilder<'a, record_with_media_state::Empty> {
pub fn new() -> Self {
RecordWithMediaBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> RecordWithMediaBuilder<'a, S>
where
S: record_with_media_state::State,
S::Media: record_with_media_state::IsUnset,
{
pub fn media(
mut self,
value: impl Into<RecordWithMediaMedia<'a>>,
) -> RecordWithMediaBuilder<'a, record_with_media_state::SetMedia<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
RecordWithMediaBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> RecordWithMediaBuilder<'a, S>
where
S: record_with_media_state::State,
S::Record: record_with_media_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<crate::app_bsky::embed::record::Record<'a>>,
) -> RecordWithMediaBuilder<'a, record_with_media_state::SetRecord<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
RecordWithMediaBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> RecordWithMediaBuilder<'a, S>
where
S: record_with_media_state::State,
S::Media: record_with_media_state::IsSet,
S::Record: record_with_media_state::IsSet,
{
pub fn build(self) -> RecordWithMedia<'a> {
RecordWithMedia {
media: self.__unsafe_private_named.0.unwrap(),
record: self.__unsafe_private_named.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RecordWithMedia<'a> {
RecordWithMedia {
media: self.__unsafe_private_named.0.unwrap(),
record: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum RecordWithMediaMedia<'a> {
#[serde(rename = "app.bsky.embed.images")]
Images(Box<crate::app_bsky::embed::images::Images<'a>>),
#[serde(rename = "app.bsky.embed.video")]
Video(Box<crate::app_bsky::embed::video::Video<'a>>),
#[serde(rename = "app.bsky.embed.external")]
External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>),
}
fn lexicon_doc_app_bsky_embed_recordWithMedia() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("app.bsky.embed.recordWithMedia"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("record"),
::jacquard_common::deps::smol_str::SmolStr::new_static("media")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"media",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: None,
refs: vec![
::jacquard_common::CowStr::new_static("app.bsky.embed.images"),
::jacquard_common::CowStr::new_static("app.bsky.embed.video"),
::jacquard_common::CowStr::new_static("app.bsky.embed.external")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"record",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"app.bsky.embed.record",
),
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("view"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("record"),
::jacquard_common::deps::smol_str::SmolStr::new_static("media")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"media",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: None,
refs: vec![
::jacquard_common::CowStr::new_static("app.bsky.embed.images#view"),
::jacquard_common::CowStr::new_static("app.bsky.embed.video#view"),
::jacquard_common::CowStr::new_static("app.bsky.embed.external#view")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"record",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"app.bsky.embed.record#view",
),
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordWithMedia<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.recordWithMedia"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_recordWithMedia()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct View<'a> {
#[serde(borrow)]
pub media: ViewMedia<'a>,
#[serde(borrow)]
pub record: crate::app_bsky::embed::record::View<'a>,
}
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 Media;
type Record;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Media = Unset;
type Record = Unset;
}
pub struct SetMedia<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMedia<S> {}
impl<S: State> State for SetMedia<S> {
type Media = Set<members::media>;
type Record = S::Record;
}
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 Media = S::Media;
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct media(());
pub struct record(());
}
}
pub struct ViewBuilder<'a, S: view_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<ViewMedia<'a>>,
::core::option::Option<crate::app_bsky::embed::record::View<'a>>,
),
_phantom: ::core::marker::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 {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ViewBuilder<'a, S>
where
S: view_state::State,
S::Media: view_state::IsUnset,
{
pub fn media(
mut self,
value: impl Into<ViewMedia<'a>>,
) -> ViewBuilder<'a, view_state::SetMedia<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ViewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::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<crate::app_bsky::embed::record::View<'a>>,
) -> ViewBuilder<'a, view_state::SetRecord<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ViewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ViewBuilder<'a, S>
where
S: view_state::State,
S::Media: view_state::IsSet,
S::Record: view_state::IsSet,
{
pub fn build(self) -> View<'a> {
View {
media: self.__unsafe_private_named.0.unwrap(),
record: self.__unsafe_private_named.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> View<'a> {
View {
media: self.__unsafe_private_named.0.unwrap(),
record: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ViewMedia<'a> {
#[serde(rename = "app.bsky.embed.images#view")]
ImagesView(Box<crate::app_bsky::embed::images::View<'a>>),
#[serde(rename = "app.bsky.embed.video#view")]
VideoView(Box<crate::app_bsky::embed::video::View<'a>>),
#[serde(rename = "app.bsky.embed.external#view")]
ExternalView(Box<crate::app_bsky::embed::external::View<'a>>),
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> {
fn nsid() -> &'static str {
"app.bsky.embed.recordWithMedia"
}
fn def_name() -> &'static str {
"view"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_recordWithMedia()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}