#[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::blob::BlobRef;
use jacquard_common::types::string::{Datetime, UriValue};
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::com_atproto::label::Label;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::app_bsky::embed::external;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ColorRgb<S: BosStr = DefaultStr> {
pub b: i64,
pub g: i64,
pub r: i64,
#[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 External<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub associated_refs: Option<Vec<StrongRef<S>>>,
pub description: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb: Option<BlobRef<S>>,
pub title: S,
pub uri: UriValue<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 ExternalRecord<S: BosStr = DefaultStr> {
pub external: external::External<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 external: external::ViewExternal<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 ViewExternal<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub associated_profiles: Option<Vec<ProfileViewBasic<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub associated_refs: Option<Vec<StrongRef<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<Datetime>,
pub description: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<Label<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reading_time: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<external::ViewExternalSource<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb: Option<UriValue<S>>,
pub title: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
pub uri: UriValue<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 ViewExternalSource<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub icon: Option<UriValue<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub theme: Option<external::ViewExternalSourceTheme<S>>,
pub title: S,
pub uri: UriValue<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 ViewExternalSourceTheme<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub accent_foreground_rgb: Option<external::ColorRgb<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub accent_rgb: Option<external::ColorRgb<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub background_rgb: Option<external::ColorRgb<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub foreground_rgb: Option<external::ColorRgb<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for ColorRgb<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"colorRGB"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.b;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("b"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.b;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("b"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.g;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("g"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.g;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("g"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.r;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("r"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.r;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("r"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for External<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"external"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.thumb {
{
let size = value.blob().size;
if size > 1000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("thumb"),
max: 1000000usize,
actual: size,
});
}
}
}
if let Some(ref value) = self.thumb {
{
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(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("thumb"),
accepted: vec!["image/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ExternalRecord<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for View<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"view"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ViewExternal<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"viewExternal"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ViewExternalSource<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"viewExternalSource"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ViewExternalSourceTheme<S> {
fn nsid() -> &'static str {
"app.bsky.embed.external"
}
fn def_name() -> &'static str {
"viewExternalSourceTheme"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_embed_external()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod color_rgb_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 B;
type G;
type R;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type B = Unset;
type G = Unset;
type R = Unset;
}
pub struct SetB<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetB<St> {}
impl<St: State> State for SetB<St> {
type B = Set<members::b>;
type G = St::G;
type R = St::R;
}
pub struct SetG<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetG<St> {}
impl<St: State> State for SetG<St> {
type B = St::B;
type G = Set<members::g>;
type R = St::R;
}
pub struct SetR<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetR<St> {}
impl<St: State> State for SetR<St> {
type B = St::B;
type G = St::G;
type R = Set<members::r>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct b(());
pub struct g(());
pub struct r(());
}
}
pub struct ColorRgbBuilder<St: color_rgb_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl ColorRgb<DefaultStr> {
pub fn new() -> ColorRgbBuilder<color_rgb_state::Empty, DefaultStr> {
ColorRgbBuilder::new()
}
}
impl<S: BosStr> ColorRgb<S> {
pub fn builder() -> ColorRgbBuilder<color_rgb_state::Empty, S> {
ColorRgbBuilder::builder()
}
}
impl ColorRgbBuilder<color_rgb_state::Empty, DefaultStr> {
pub fn new() -> Self {
ColorRgbBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ColorRgbBuilder<color_rgb_state::Empty, S> {
pub fn builder() -> Self {
ColorRgbBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorRgbBuilder<St, S>
where
St: color_rgb_state::State,
St::B: color_rgb_state::IsUnset,
{
pub fn b(
mut self,
value: impl Into<i64>,
) -> ColorRgbBuilder<color_rgb_state::SetB<St>, S> {
self._fields.0 = Option::Some(value.into());
ColorRgbBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorRgbBuilder<St, S>
where
St: color_rgb_state::State,
St::G: color_rgb_state::IsUnset,
{
pub fn g(
mut self,
value: impl Into<i64>,
) -> ColorRgbBuilder<color_rgb_state::SetG<St>, S> {
self._fields.1 = Option::Some(value.into());
ColorRgbBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorRgbBuilder<St, S>
where
St: color_rgb_state::State,
St::R: color_rgb_state::IsUnset,
{
pub fn r(
mut self,
value: impl Into<i64>,
) -> ColorRgbBuilder<color_rgb_state::SetR<St>, S> {
self._fields.2 = Option::Some(value.into());
ColorRgbBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorRgbBuilder<St, S>
where
St: color_rgb_state::State,
St::B: color_rgb_state::IsSet,
St::G: color_rgb_state::IsSet,
St::R: color_rgb_state::IsSet,
{
pub fn build(self) -> ColorRgb<S> {
ColorRgb {
b: self._fields.0.unwrap(),
g: self._fields.1.unwrap(),
r: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ColorRgb<S> {
ColorRgb {
b: self._fields.0.unwrap(),
g: self._fields.1.unwrap(),
r: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_embed_external() -> 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.external"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("colorRGB"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"RGB color definition, inspired by site.standard.theme.color#rgb",
),
),
required: Some(
vec![
SmolStr::new_static("r"), SmolStr::new_static("g"),
SmolStr::new_static("b")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("b"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("g"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("r"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("external"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("title"),
SmolStr::new_static("description")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("associatedRefs"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"StrongRefs (uri+cid) of the Atmosphere records that backed this view.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("thumb"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).",
),
),
required: Some(vec![SmolStr::new_static("external")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("external"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#external"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("view"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("external")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("external"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#viewExternal"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewExternal"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("title"),
SmolStr::new_static("description")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("associatedProfiles"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Profiles of the owners of the Atmosphere records that backed this view.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("associatedRefs"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"StrongRefs (uri+cid) of the Atmosphere records that backed this view.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the external content was created, if available. Example: a publication date, for an article.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString { ..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("readingTime"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#viewExternalSource"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("thumb"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the external content was updated, if available.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewExternalSource"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"The source of an external embed, such as a standard.site publication.",
),
),
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("title")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("icon"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Fully-qualified URL where an icon representing the source can be fetched. For example, CDN location provided by the App View.",
),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("theme"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#viewExternalSourceTheme"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"URI of the source, if available. Example: the https:// URL of a site.standard.publication record.",
),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewExternalSourceTheme"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"The theme colors of an external source, such as a site.standard.publication. These colors may be used when rendering an embed from that source.",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("accentForegroundRGB"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#colorRGB"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("accentRGB"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#colorRGB"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("backgroundRGB"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#colorRGB"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("foregroundRGB"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#colorRGB"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod external_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 Description;
type Title;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Description = Unset;
type Title = Unset;
type Uri = Unset;
}
pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDescription<St> {}
impl<St: State> State for SetDescription<St> {
type Description = Set<members::description>;
type Title = St::Title;
type Uri = St::Uri;
}
pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTitle<St> {}
impl<St: State> State for SetTitle<St> {
type Description = St::Description;
type Title = Set<members::title>;
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 Description = St::Description;
type Title = St::Title;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct description(());
pub struct title(());
pub struct uri(());
}
}
pub struct ExternalBuilder<St: external_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<StrongRef<S>>>,
Option<S>,
Option<BlobRef<S>>,
Option<S>,
Option<UriValue<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl External<DefaultStr> {
pub fn new() -> ExternalBuilder<external_state::Empty, DefaultStr> {
ExternalBuilder::new()
}
}
impl<S: BosStr> External<S> {
pub fn builder() -> ExternalBuilder<external_state::Empty, S> {
ExternalBuilder::builder()
}
}
impl ExternalBuilder<external_state::Empty, DefaultStr> {
pub fn new() -> Self {
ExternalBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ExternalBuilder<external_state::Empty, S> {
pub fn builder() -> Self {
ExternalBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St: external_state::State, S: BosStr> ExternalBuilder<St, S> {
pub fn associated_refs(
mut self,
value: impl Into<Option<Vec<StrongRef<S>>>>,
) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_associated_refs(mut self, value: Option<Vec<StrongRef<S>>>) -> Self {
self._fields.0 = value;
self
}
}
impl<St, S: BosStr> ExternalBuilder<St, S>
where
St: external_state::State,
St::Description: external_state::IsUnset,
{
pub fn description(
mut self,
value: impl Into<S>,
) -> ExternalBuilder<external_state::SetDescription<St>, S> {
self._fields.1 = Option::Some(value.into());
ExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: external_state::State, S: BosStr> ExternalBuilder<St, S> {
pub fn thumb(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_thumb(mut self, value: Option<BlobRef<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<St, S: BosStr> ExternalBuilder<St, S>
where
St: external_state::State,
St::Title: external_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> ExternalBuilder<external_state::SetTitle<St>, S> {
self._fields.3 = Option::Some(value.into());
ExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ExternalBuilder<St, S>
where
St: external_state::State,
St::Uri: external_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<UriValue<S>>,
) -> ExternalBuilder<external_state::SetUri<St>, S> {
self._fields.4 = Option::Some(value.into());
ExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ExternalBuilder<St, S>
where
St: external_state::State,
St::Description: external_state::IsSet,
St::Title: external_state::IsSet,
St::Uri: external_state::IsSet,
{
pub fn build(self) -> External<S> {
External {
associated_refs: self._fields.0,
description: self._fields.1.unwrap(),
thumb: self._fields.2,
title: 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>>) -> External<S> {
External {
associated_refs: self._fields.0,
description: self._fields.1.unwrap(),
thumb: self._fields.2,
title: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod external_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 External;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type External = Unset;
}
pub struct SetExternal<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetExternal<St> {}
impl<St: State> State for SetExternal<St> {
type External = Set<members::external>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct external(());
}
}
pub struct ExternalRecordBuilder<
St: external_record_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<external::External<S>>,),
_type: PhantomData<fn() -> S>,
}
impl ExternalRecord<DefaultStr> {
pub fn new() -> ExternalRecordBuilder<external_record_state::Empty, DefaultStr> {
ExternalRecordBuilder::new()
}
}
impl<S: BosStr> ExternalRecord<S> {
pub fn builder() -> ExternalRecordBuilder<external_record_state::Empty, S> {
ExternalRecordBuilder::builder()
}
}
impl ExternalRecordBuilder<external_record_state::Empty, DefaultStr> {
pub fn new() -> Self {
ExternalRecordBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr> ExternalRecordBuilder<external_record_state::Empty, S> {
pub fn builder() -> Self {
ExternalRecordBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ExternalRecordBuilder<St, S>
where
St: external_record_state::State,
St::External: external_record_state::IsUnset,
{
pub fn external(
mut self,
value: impl Into<external::External<S>>,
) -> ExternalRecordBuilder<external_record_state::SetExternal<St>, S> {
self._fields.0 = Option::Some(value.into());
ExternalRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ExternalRecordBuilder<St, S>
where
St: external_record_state::State,
St::External: external_record_state::IsSet,
{
pub fn build(self) -> ExternalRecord<S> {
ExternalRecord {
external: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ExternalRecord<S> {
ExternalRecord {
external: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
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 External;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type External = Unset;
}
pub struct SetExternal<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetExternal<St> {}
impl<St: State> State for SetExternal<St> {
type External = Set<members::external>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct external(());
}
}
pub struct ViewBuilder<St: view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<external::ViewExternal<S>>,),
_type: PhantomData<fn() -> S>,
}
impl View<DefaultStr> {
pub fn new() -> ViewBuilder<view_state::Empty, DefaultStr> {
ViewBuilder::new()
}
}
impl<S: BosStr> View<S> {
pub fn builder() -> ViewBuilder<view_state::Empty, S> {
ViewBuilder::builder()
}
}
impl ViewBuilder<view_state::Empty, DefaultStr> {
pub fn new() -> Self {
ViewBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr> ViewBuilder<view_state::Empty, S> {
pub fn builder() -> Self {
ViewBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewBuilder<St, S>
where
St: view_state::State,
St::External: view_state::IsUnset,
{
pub fn external(
mut self,
value: impl Into<external::ViewExternal<S>>,
) -> ViewBuilder<view_state::SetExternal<St>, S> {
self._fields.0 = Option::Some(value.into());
ViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewBuilder<St, S>
where
St: view_state::State,
St::External: view_state::IsSet,
{
pub fn build(self) -> View<S> {
View {
external: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> View<S> {
View {
external: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_external_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 Description;
type Title;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Description = Unset;
type Title = Unset;
type Uri = Unset;
}
pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDescription<St> {}
impl<St: State> State for SetDescription<St> {
type Description = Set<members::description>;
type Title = St::Title;
type Uri = St::Uri;
}
pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTitle<St> {}
impl<St: State> State for SetTitle<St> {
type Description = St::Description;
type Title = Set<members::title>;
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 Description = St::Description;
type Title = St::Title;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct description(());
pub struct title(());
pub struct uri(());
}
}
pub struct ViewExternalBuilder<St: view_external_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<ProfileViewBasic<S>>>,
Option<Vec<StrongRef<S>>>,
Option<Datetime>,
Option<S>,
Option<Vec<Label<S>>>,
Option<i64>,
Option<external::ViewExternalSource<S>>,
Option<UriValue<S>>,
Option<S>,
Option<Datetime>,
Option<UriValue<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl ViewExternal<DefaultStr> {
pub fn new() -> ViewExternalBuilder<view_external_state::Empty, DefaultStr> {
ViewExternalBuilder::new()
}
}
impl<S: BosStr> ViewExternal<S> {
pub fn builder() -> ViewExternalBuilder<view_external_state::Empty, S> {
ViewExternalBuilder::builder()
}
}
impl ViewExternalBuilder<view_external_state::Empty, DefaultStr> {
pub fn new() -> Self {
ViewExternalBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ViewExternalBuilder<view_external_state::Empty, S> {
pub fn builder() -> Self {
ViewExternalBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn associated_profiles(
mut self,
value: impl Into<Option<Vec<ProfileViewBasic<S>>>>,
) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_associated_profiles(
mut self,
value: Option<Vec<ProfileViewBasic<S>>>,
) -> Self {
self._fields.0 = value;
self
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn associated_refs(
mut self,
value: impl Into<Option<Vec<StrongRef<S>>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_associated_refs(mut self, value: Option<Vec<StrongRef<S>>>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<St, S: BosStr> ViewExternalBuilder<St, S>
where
St: view_external_state::State,
St::Description: view_external_state::IsUnset,
{
pub fn description(
mut self,
value: impl Into<S>,
) -> ViewExternalBuilder<view_external_state::SetDescription<St>, S> {
self._fields.3 = Option::Some(value.into());
ViewExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
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<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn reading_time(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_reading_time(mut self, value: Option<i64>) -> Self {
self._fields.5 = value;
self
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn source(
mut self,
value: impl Into<Option<external::ViewExternalSource<S>>>,
) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_source(
mut self,
value: Option<external::ViewExternalSource<S>>,
) -> Self {
self._fields.6 = value;
self
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn thumb(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_thumb(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<St, S: BosStr> ViewExternalBuilder<St, S>
where
St: view_external_state::State,
St::Title: view_external_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> ViewExternalBuilder<view_external_state::SetTitle<St>, S> {
self._fields.8 = Option::Some(value.into());
ViewExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: view_external_state::State, S: BosStr> ViewExternalBuilder<St, S> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.9 = value;
self
}
}
impl<St, S: BosStr> ViewExternalBuilder<St, S>
where
St: view_external_state::State,
St::Uri: view_external_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<UriValue<S>>,
) -> ViewExternalBuilder<view_external_state::SetUri<St>, S> {
self._fields.10 = Option::Some(value.into());
ViewExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewExternalBuilder<St, S>
where
St: view_external_state::State,
St::Description: view_external_state::IsSet,
St::Title: view_external_state::IsSet,
St::Uri: view_external_state::IsSet,
{
pub fn build(self) -> ViewExternal<S> {
ViewExternal {
associated_profiles: self._fields.0,
associated_refs: self._fields.1,
created_at: self._fields.2,
description: self._fields.3.unwrap(),
labels: self._fields.4,
reading_time: self._fields.5,
source: self._fields.6,
thumb: self._fields.7,
title: self._fields.8.unwrap(),
updated_at: self._fields.9,
uri: self._fields.10.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ViewExternal<S> {
ViewExternal {
associated_profiles: self._fields.0,
associated_refs: self._fields.1,
created_at: self._fields.2,
description: self._fields.3.unwrap(),
labels: self._fields.4,
reading_time: self._fields.5,
source: self._fields.6,
thumb: self._fields.7,
title: self._fields.8.unwrap(),
updated_at: self._fields.9,
uri: self._fields.10.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod view_external_source_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 Title;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Title = Unset;
type Uri = Unset;
}
pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTitle<St> {}
impl<St: State> State for SetTitle<St> {
type Title = Set<members::title>;
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 Title = St::Title;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct title(());
pub struct uri(());
}
}
pub struct ViewExternalSourceBuilder<
St: view_external_source_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<UriValue<S>>,
Option<external::ViewExternalSourceTheme<S>>,
Option<S>,
Option<UriValue<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl ViewExternalSource<DefaultStr> {
pub fn new() -> ViewExternalSourceBuilder<
view_external_source_state::Empty,
DefaultStr,
> {
ViewExternalSourceBuilder::new()
}
}
impl<S: BosStr> ViewExternalSource<S> {
pub fn builder() -> ViewExternalSourceBuilder<view_external_source_state::Empty, S> {
ViewExternalSourceBuilder::builder()
}
}
impl ViewExternalSourceBuilder<view_external_source_state::Empty, DefaultStr> {
pub fn new() -> Self {
ViewExternalSourceBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ViewExternalSourceBuilder<view_external_source_state::Empty, S> {
pub fn builder() -> Self {
ViewExternalSourceBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St: view_external_source_state::State, S: BosStr> ViewExternalSourceBuilder<St, S> {
pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<St: view_external_source_state::State, S: BosStr> ViewExternalSourceBuilder<St, S> {
pub fn icon(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_icon(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: view_external_source_state::State, S: BosStr> ViewExternalSourceBuilder<St, S> {
pub fn theme(
mut self,
value: impl Into<Option<external::ViewExternalSourceTheme<S>>>,
) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_theme(
mut self,
value: Option<external::ViewExternalSourceTheme<S>>,
) -> Self {
self._fields.2 = value;
self
}
}
impl<St, S: BosStr> ViewExternalSourceBuilder<St, S>
where
St: view_external_source_state::State,
St::Title: view_external_source_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> ViewExternalSourceBuilder<view_external_source_state::SetTitle<St>, S> {
self._fields.3 = Option::Some(value.into());
ViewExternalSourceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewExternalSourceBuilder<St, S>
where
St: view_external_source_state::State,
St::Uri: view_external_source_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<UriValue<S>>,
) -> ViewExternalSourceBuilder<view_external_source_state::SetUri<St>, S> {
self._fields.4 = Option::Some(value.into());
ViewExternalSourceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewExternalSourceBuilder<St, S>
where
St: view_external_source_state::State,
St::Title: view_external_source_state::IsSet,
St::Uri: view_external_source_state::IsSet,
{
pub fn build(self) -> ViewExternalSource<S> {
ViewExternalSource {
description: self._fields.0,
icon: self._fields.1,
theme: self._fields.2,
title: 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>>,
) -> ViewExternalSource<S> {
ViewExternalSource {
description: self._fields.0,
icon: self._fields.1,
theme: self._fields.2,
title: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}