#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Image<'a> {
#[serde(borrow)]
pub alt: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub aspect_ratio: std::option::Option<crate::app_bsky::embed::AspectRatio<'a>>,
#[serde(borrow)]
pub image: jacquard_common::types::blob::BlobRef<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub image_hash: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub tombstone: std::option::Option<crate::art_cllctv::embed::Tombstone<'a>>,
}
pub mod image_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 Alt;
type Image;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Alt = Unset;
type Image = Unset;
}
pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAlt<S> {}
impl<S: State> State for SetAlt<S> {
type Alt = Set<members::alt>;
type Image = S::Image;
}
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 Alt = S::Alt;
type Image = Set<members::image>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct alt(());
pub struct image(());
}
}
pub struct ImageBuilder<'a, S: image_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<crate::app_bsky::embed::AspectRatio<'a>>,
::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<crate::art_cllctv::embed::Tombstone<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Image<'a> {
pub fn new() -> ImageBuilder<'a, image_state::Empty> {
ImageBuilder::new()
}
}
impl<'a> ImageBuilder<'a, image_state::Empty> {
pub fn new() -> Self {
ImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ImageBuilder<'a, S>
where
S: image_state::State,
S::Alt: image_state::IsUnset,
{
pub fn alt(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ImageBuilder<'a, image_state::SetAlt<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: image_state::State> ImageBuilder<'a, S> {
pub fn aspect_ratio(
mut self,
value: impl Into<Option<crate::app_bsky::embed::AspectRatio<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_aspect_ratio(
mut self,
value: Option<crate::app_bsky::embed::AspectRatio<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> ImageBuilder<'a, S>
where
S: image_state::State,
S::Image: image_state::IsUnset,
{
pub fn image(
mut self,
value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
) -> ImageBuilder<'a, image_state::SetImage<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
ImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: image_state::State> ImageBuilder<'a, S> {
pub fn image_hash(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_image_hash(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: image_state::State> ImageBuilder<'a, S> {
pub fn tombstone(
mut self,
value: impl Into<Option<crate::art_cllctv::embed::Tombstone<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_tombstone(
mut self,
value: Option<crate::art_cllctv::embed::Tombstone<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> ImageBuilder<'a, S>
where
S: image_state::State,
S::Alt: image_state::IsSet,
S::Image: image_state::IsSet,
{
pub fn build(self) -> Image<'a> {
Image {
alt: self.__unsafe_private_named.0.unwrap(),
aspect_ratio: self.__unsafe_private_named.1,
image: self.__unsafe_private_named.2.unwrap(),
image_hash: self.__unsafe_private_named.3,
tombstone: self.__unsafe_private_named.4,
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>,
>,
) -> Image<'a> {
Image {
alt: self.__unsafe_private_named.0.unwrap(),
aspect_ratio: self.__unsafe_private_named.1,
image: self.__unsafe_private_named.2.unwrap(),
image_hash: self.__unsafe_private_named.3,
tombstone: self.__unsafe_private_named.4,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_art_cllctv_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("art.cllctv.embed.images"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("image"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("image"),
::jacquard_common::deps::smol_str::SmolStr::new_static("alt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"alt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Alt text description of the image, for accessibility.",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"aspectRatio",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"app.bsky.embed.defs#aspectRatio",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"image",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
description: None,
accept: None,
max_size: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"imageHash",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: Some(640usize),
min_graphemes: None,
max_graphemes: Some(64usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"tombstone",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"art.cllctv.embed.defs#tombstone",
),
}),
);
map
},
}),
);
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("images")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"images",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#image"),
}),
min_length: None,
max_length: Some(9usize),
}),
);
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("images")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"images",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#viewImage"),
}),
min_length: None,
max_length: Some(9usize),
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("viewImage"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("thumb"),
::jacquard_common::deps::smol_str::SmolStr::new_static("fullsize"),
::jacquard_common::deps::smol_str::SmolStr::new_static("alt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"alt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Alt text description of the image, for accessibility.",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"aspectRatio",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"app.bsky.embed.defs#aspectRatio",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"fullsize",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Uri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"thumb",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Uri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"tombstone",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"art.cllctv.embed.defs#tombstone",
),
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> {
fn nsid() -> &'static str {
"art.cllctv.embed.images"
}
fn def_name() -> &'static str {
"image"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_art_cllctv_embed_images()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.image;
{
let size = value.blob().size;
if size > 50000000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobTooLarge {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image",
),
max: 50000000usize,
actual: size,
});
}
}
}
{
let value = &self.image;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/*"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobMimeTypeNotAccepted {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image",
),
accepted: vec!["image/*".to_string()],
actual: mime.to_string(),
});
}
}
}
if let Some(ref value) = self.image_hash {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 640usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image_hash",
),
max: 640usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.image_hash {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image_hash",
),
max: 64usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Images<'a> {
#[serde(borrow)]
pub images: Vec<crate::art_cllctv::embed::images::Image<'a>>,
}
pub mod images_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 Images;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Images = Unset;
}
pub struct SetImages<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetImages<S> {}
impl<S: State> State for SetImages<S> {
type Images = Set<members::images>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct images(());
}
}
pub struct ImagesBuilder<'a, S: images_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::art_cllctv::embed::images::Image<'a>>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Images<'a> {
pub fn new() -> ImagesBuilder<'a, images_state::Empty> {
ImagesBuilder::new()
}
}
impl<'a> ImagesBuilder<'a, images_state::Empty> {
pub fn new() -> Self {
ImagesBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ImagesBuilder<'a, S>
where
S: images_state::State,
S::Images: images_state::IsUnset,
{
pub fn images(
mut self,
value: impl Into<Vec<crate::art_cllctv::embed::images::Image<'a>>>,
) -> ImagesBuilder<'a, images_state::SetImages<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ImagesBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ImagesBuilder<'a, S>
where
S: images_state::State,
S::Images: images_state::IsSet,
{
pub fn build(self) -> Images<'a> {
Images {
images: self.__unsafe_private_named.0.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>,
>,
) -> Images<'a> {
Images {
images: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Images<'a> {
fn nsid() -> &'static str {
"art.cllctv.embed.images"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_art_cllctv_embed_images()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.images;
#[allow(unused_comparisons)]
if value.len() > 9usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"images",
),
max: 9usize,
actual: value.len(),
});
}
}
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 images: Vec<crate::art_cllctv::embed::images::ViewImage<'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 Images;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Images = Unset;
}
pub struct SetImages<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetImages<S> {}
impl<S: State> State for SetImages<S> {
type Images = Set<members::images>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct images(());
}
}
pub struct ViewBuilder<'a, S: view_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::art_cllctv::embed::images::ViewImage<'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,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ViewBuilder<'a, S>
where
S: view_state::State,
S::Images: view_state::IsUnset,
{
pub fn images(
mut self,
value: impl Into<Vec<crate::art_cllctv::embed::images::ViewImage<'a>>>,
) -> ViewBuilder<'a, view_state::SetImages<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::Images: view_state::IsSet,
{
pub fn build(self) -> View<'a> {
View {
images: self.__unsafe_private_named.0.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 {
images: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> {
fn nsid() -> &'static str {
"art.cllctv.embed.images"
}
fn def_name() -> &'static str {
"view"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_art_cllctv_embed_images()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.images;
#[allow(unused_comparisons)]
if value.len() > 9usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"images",
),
max: 9usize,
actual: value.len(),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ViewImage<'a> {
#[serde(borrow)]
pub alt: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub aspect_ratio: std::option::Option<crate::app_bsky::embed::AspectRatio<'a>>,
#[serde(borrow)]
pub fullsize: jacquard_common::types::string::UriValue<'a>,
#[serde(borrow)]
pub thumb: jacquard_common::types::string::UriValue<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub tombstone: std::option::Option<crate::art_cllctv::embed::Tombstone<'a>>,
}
pub mod view_image_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 Thumb;
type Fullsize;
type Alt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Thumb = Unset;
type Fullsize = Unset;
type Alt = Unset;
}
pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetThumb<S> {}
impl<S: State> State for SetThumb<S> {
type Thumb = Set<members::thumb>;
type Fullsize = S::Fullsize;
type Alt = S::Alt;
}
pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFullsize<S> {}
impl<S: State> State for SetFullsize<S> {
type Thumb = S::Thumb;
type Fullsize = Set<members::fullsize>;
type Alt = S::Alt;
}
pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAlt<S> {}
impl<S: State> State for SetAlt<S> {
type Thumb = S::Thumb;
type Fullsize = S::Fullsize;
type Alt = Set<members::alt>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct thumb(());
pub struct fullsize(());
pub struct alt(());
}
}
pub struct ViewImageBuilder<'a, S: view_image_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<crate::app_bsky::embed::AspectRatio<'a>>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<crate::art_cllctv::embed::Tombstone<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> ViewImage<'a> {
pub fn new() -> ViewImageBuilder<'a, view_image_state::Empty> {
ViewImageBuilder::new()
}
}
impl<'a> ViewImageBuilder<'a, view_image_state::Empty> {
pub fn new() -> Self {
ViewImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ViewImageBuilder<'a, S>
where
S: view_image_state::State,
S::Alt: view_image_state::IsUnset,
{
pub fn alt(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ViewImageBuilder<'a, view_image_state::SetAlt<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ViewImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: view_image_state::State> ViewImageBuilder<'a, S> {
pub fn aspect_ratio(
mut self,
value: impl Into<Option<crate::app_bsky::embed::AspectRatio<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_aspect_ratio(
mut self,
value: Option<crate::app_bsky::embed::AspectRatio<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> ViewImageBuilder<'a, S>
where
S: view_image_state::State,
S::Fullsize: view_image_state::IsUnset,
{
pub fn fullsize(
mut self,
value: impl Into<jacquard_common::types::string::UriValue<'a>>,
) -> ViewImageBuilder<'a, view_image_state::SetFullsize<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
ViewImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ViewImageBuilder<'a, S>
where
S: view_image_state::State,
S::Thumb: view_image_state::IsUnset,
{
pub fn thumb(
mut self,
value: impl Into<jacquard_common::types::string::UriValue<'a>>,
) -> ViewImageBuilder<'a, view_image_state::SetThumb<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
ViewImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: view_image_state::State> ViewImageBuilder<'a, S> {
pub fn tombstone(
mut self,
value: impl Into<Option<crate::art_cllctv::embed::Tombstone<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_tombstone(
mut self,
value: Option<crate::art_cllctv::embed::Tombstone<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> ViewImageBuilder<'a, S>
where
S: view_image_state::State,
S::Thumb: view_image_state::IsSet,
S::Fullsize: view_image_state::IsSet,
S::Alt: view_image_state::IsSet,
{
pub fn build(self) -> ViewImage<'a> {
ViewImage {
alt: self.__unsafe_private_named.0.unwrap(),
aspect_ratio: self.__unsafe_private_named.1,
fullsize: self.__unsafe_private_named.2.unwrap(),
thumb: self.__unsafe_private_named.3.unwrap(),
tombstone: self.__unsafe_private_named.4,
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>,
>,
) -> ViewImage<'a> {
ViewImage {
alt: self.__unsafe_private_named.0.unwrap(),
aspect_ratio: self.__unsafe_private_named.1,
fullsize: self.__unsafe_private_named.2.unwrap(),
thumb: self.__unsafe_private_named.3.unwrap(),
tombstone: self.__unsafe_private_named.4,
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewImage<'a> {
fn nsid() -> &'static str {
"art.cllctv.embed.images"
}
fn def_name() -> &'static str {
"viewImage"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_art_cllctv_embed_images()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}