pub mod entry;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct BlobMetadata<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub alt: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub blobref: jacquard_common::types::blob::BlobRef<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub labels: std::option::Option<crate::app_greengale::blog::SelfLabels<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub name: std::option::Option<jacquard_common::CowStr<'a>>,
}
pub mod blob_metadata_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 Blobref;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Blobref = Unset;
}
pub struct SetBlobref<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlobref<S> {}
impl<S: State> State for SetBlobref<S> {
type Blobref = Set<members::blobref>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct blobref(());
}
}
pub struct BlobMetadataBuilder<'a, S: blob_metadata_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
::core::option::Option<crate::app_greengale::blog::SelfLabels<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> BlobMetadata<'a> {
pub fn new() -> BlobMetadataBuilder<'a, blob_metadata_state::Empty> {
BlobMetadataBuilder::new()
}
}
impl<'a> BlobMetadataBuilder<'a, blob_metadata_state::Empty> {
pub fn new() -> Self {
BlobMetadataBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: blob_metadata_state::State> BlobMetadataBuilder<'a, S> {
pub fn alt(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> BlobMetadataBuilder<'a, S>
where
S: blob_metadata_state::State,
S::Blobref: blob_metadata_state::IsUnset,
{
pub fn blobref(
mut self,
value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
) -> BlobMetadataBuilder<'a, blob_metadata_state::SetBlobref<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
BlobMetadataBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: blob_metadata_state::State> BlobMetadataBuilder<'a, S> {
pub fn labels(
mut self,
value: impl Into<Option<crate::app_greengale::blog::SelfLabels<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_labels(
mut self,
value: Option<crate::app_greengale::blog::SelfLabels<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: blob_metadata_state::State> BlobMetadataBuilder<'a, S> {
pub fn name(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S> BlobMetadataBuilder<'a, S>
where
S: blob_metadata_state::State,
S::Blobref: blob_metadata_state::IsSet,
{
pub fn build(self) -> BlobMetadata<'a> {
BlobMetadata {
alt: self.__unsafe_private_named.0,
blobref: self.__unsafe_private_named.1.unwrap(),
labels: self.__unsafe_private_named.2,
name: self.__unsafe_private_named.3,
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>,
>,
) -> BlobMetadata<'a> {
BlobMetadata {
alt: self.__unsafe_private_named.0,
blobref: self.__unsafe_private_named.1.unwrap(),
labels: self.__unsafe_private_named.2,
name: self.__unsafe_private_named.3,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_greengale_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("app.greengale.blog.defs"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("blobMetadata"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Metadata for uploaded binary content",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("blobref")
],
),
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 for accessibility",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(1000usize),
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(
"blobref",
),
::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(
"labels",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#selfLabels"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Original filename"),
),
format: None,
default: None,
min_length: None,
max_length: Some(256usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("customColors"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Custom color values (CSS color strings)",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"accent",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Accent/link color"),
),
format: None,
default: None,
min_length: None,
max_length: Some(64usize),
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(
"background",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Background color"),
),
format: None,
default: None,
min_length: None,
max_length: Some(64usize),
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(
"codeBackground",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Code block background color",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(64usize),
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(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Primary text color"),
),
format: None,
default: None,
min_length: None,
max_length: Some(64usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("ogp"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Open Graph Protocol metadata for social sharing",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("url")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"height",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"url",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"URL of the OGP image",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Uri,
),
default: None,
min_length: None,
max_length: Some(2048usize),
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(
"width",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("selfLabel"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Metadata tag on an atproto resource, published by the author",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("val")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"val",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The short string name of the value or type of this label",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(128usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("selfLabels"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Metadata tags on an atproto resource, published by the author",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("values")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"values",
),
::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("#selfLabel"),
}),
min_length: None,
max_length: Some(10usize),
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("theme"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Theme configuration for a blog entry",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"custom",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"#customColors",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"preset",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Predefined color theme",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(32usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("voiceTheme"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Voice theme configuration for TTS playback",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"pitch",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"speed",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"voice",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Voice ID for TTS (e.g., 'af_heart', 'am_adam')",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(32usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BlobMetadata<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"blobMetadata"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.alt {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"alt",
),
max: 1000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.blobref;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["*/*"];
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(
"blobref",
),
accepted: vec!["*/*".to_string()],
actual: mime.to_string(),
});
}
}
}
if let Some(ref value) = self.name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"name",
),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct CustomColors<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub accent: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub background: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub code_background: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub text: std::option::Option<jacquard_common::CowStr<'a>>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CustomColors<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"customColors"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.accent {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"accent",
),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.background {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"background",
),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.code_background {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"code_background",
),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.text {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Ogp<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub height: std::option::Option<i64>,
#[serde(borrow)]
pub url: jacquard_common::types::string::UriValue<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub width: std::option::Option<i64>,
}
pub mod ogp_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 Url;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Url = Unset;
}
pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUrl<S> {}
impl<S: State> State for SetUrl<S> {
type Url = Set<members::url>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct url(());
}
}
pub struct OgpBuilder<'a, S: ogp_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<i64>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Ogp<'a> {
pub fn new() -> OgpBuilder<'a, ogp_state::Empty> {
OgpBuilder::new()
}
}
impl<'a> OgpBuilder<'a, ogp_state::Empty> {
pub fn new() -> Self {
OgpBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: ogp_state::State> OgpBuilder<'a, S> {
pub fn height(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_height(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> OgpBuilder<'a, S>
where
S: ogp_state::State,
S::Url: ogp_state::IsUnset,
{
pub fn url(
mut self,
value: impl Into<jacquard_common::types::string::UriValue<'a>>,
) -> OgpBuilder<'a, ogp_state::SetUrl<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
OgpBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: ogp_state::State> OgpBuilder<'a, S> {
pub fn width(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_width(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> OgpBuilder<'a, S>
where
S: ogp_state::State,
S::Url: ogp_state::IsSet,
{
pub fn build(self) -> Ogp<'a> {
Ogp {
height: self.__unsafe_private_named.0,
url: self.__unsafe_private_named.1.unwrap(),
width: self.__unsafe_private_named.2,
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>,
>,
) -> Ogp<'a> {
Ogp {
height: self.__unsafe_private_named.0,
url: self.__unsafe_private_named.1.unwrap(),
width: self.__unsafe_private_named.2,
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Ogp<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"ogp"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.url;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2048usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"url",
),
max: 2048usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct SelfLabel<'a> {
#[serde(borrow)]
pub val: jacquard_common::CowStr<'a>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SelfLabel<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"selfLabel"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.val;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"val",
),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct SelfLabels<'a> {
#[serde(borrow)]
pub values: Vec<crate::app_greengale::blog::SelfLabel<'a>>,
}
pub mod self_labels_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 Values;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Values = Unset;
}
pub struct SetValues<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetValues<S> {}
impl<S: State> State for SetValues<S> {
type Values = Set<members::values>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct values(());
}
}
pub struct SelfLabelsBuilder<'a, S: self_labels_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::app_greengale::blog::SelfLabel<'a>>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> SelfLabels<'a> {
pub fn new() -> SelfLabelsBuilder<'a, self_labels_state::Empty> {
SelfLabelsBuilder::new()
}
}
impl<'a> SelfLabelsBuilder<'a, self_labels_state::Empty> {
pub fn new() -> Self {
SelfLabelsBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SelfLabelsBuilder<'a, S>
where
S: self_labels_state::State,
S::Values: self_labels_state::IsUnset,
{
pub fn values(
mut self,
value: impl Into<Vec<crate::app_greengale::blog::SelfLabel<'a>>>,
) -> SelfLabelsBuilder<'a, self_labels_state::SetValues<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
SelfLabelsBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SelfLabelsBuilder<'a, S>
where
S: self_labels_state::State,
S::Values: self_labels_state::IsSet,
{
pub fn build(self) -> SelfLabels<'a> {
SelfLabels {
values: 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>,
>,
) -> SelfLabels<'a> {
SelfLabels {
values: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SelfLabels<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"selfLabels"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.values;
#[allow(unused_comparisons)]
if value.len() > 10usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"values",
),
max: 10usize,
actual: value.len(),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct Theme<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub custom: std::option::Option<crate::app_greengale::blog::CustomColors<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub preset: std::option::Option<jacquard_common::CowStr<'a>>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"theme"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.preset {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"preset",
),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct VoiceTheme<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub pitch: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub speed: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub voice: std::option::Option<jacquard_common::CowStr<'a>>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VoiceTheme<'a> {
fn nsid() -> &'static str {
"app.greengale.blog.defs"
}
fn def_name() -> &'static str {
"voiceTheme"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_greengale_blog_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.voice {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"voice",
),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}