#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct BoardConfig<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub aspect_ratio: std::option::Option<BoardConfigAspectRatio<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub background_color: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub background_grayscale: std::option::Option<bool>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub background_iframe_url: std::option::Option<
jacquard_common::types::string::UriValue<'a>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub background_image: std::option::Option<BoardConfigBackgroundImage<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub background_opacity: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub background_type: std::option::Option<BoardConfigBackgroundType<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub border_color: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub grayscale_images: std::option::Option<bool>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub image_shape: std::option::Option<BoardConfigImageShape<'a>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum BoardConfigAspectRatio<'a> {
_169,
_43,
_11,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> BoardConfigAspectRatio<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::_169 => "16:9",
Self::_43 => "4:3",
Self::_11 => "1:1",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for BoardConfigAspectRatio<'a> {
fn from(s: &'a str) -> Self {
match s {
"16:9" => Self::_169,
"4:3" => Self::_43,
"1:1" => Self::_11,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for BoardConfigAspectRatio<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"16:9" => Self::_169,
"4:3" => Self::_43,
"1:1" => Self::_11,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for BoardConfigAspectRatio<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for BoardConfigAspectRatio<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for BoardConfigAspectRatio<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for BoardConfigAspectRatio<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for BoardConfigAspectRatio<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for BoardConfigAspectRatio<'_> {
type Output = BoardConfigAspectRatio<'static>;
fn into_static(self) -> Self::Output {
match self {
BoardConfigAspectRatio::_169 => BoardConfigAspectRatio::_169,
BoardConfigAspectRatio::_43 => BoardConfigAspectRatio::_43,
BoardConfigAspectRatio::_11 => BoardConfigAspectRatio::_11,
BoardConfigAspectRatio::Other(v) => {
BoardConfigAspectRatio::Other(v.into_static())
}
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum BoardConfigBackgroundImage<'a> {
#[serde(rename = "org.hypercerts.defs#uri")]
Uri(Box<crate::org_hypercerts::Uri<'a>>),
#[serde(rename = "org.hypercerts.defs#smallImage")]
SmallImage(Box<crate::org_hypercerts::SmallImage<'a>>),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum BoardConfigBackgroundType<'a> {
Image,
Iframe,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> BoardConfigBackgroundType<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Image => "image",
Self::Iframe => "iframe",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for BoardConfigBackgroundType<'a> {
fn from(s: &'a str) -> Self {
match s {
"image" => Self::Image,
"iframe" => Self::Iframe,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for BoardConfigBackgroundType<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"image" => Self::Image,
"iframe" => Self::Iframe,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for BoardConfigBackgroundType<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for BoardConfigBackgroundType<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for BoardConfigBackgroundType<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for BoardConfigBackgroundType<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for BoardConfigBackgroundType<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for BoardConfigBackgroundType<'_> {
type Output = BoardConfigBackgroundType<'static>;
fn into_static(self) -> Self::Output {
match self {
BoardConfigBackgroundType::Image => BoardConfigBackgroundType::Image,
BoardConfigBackgroundType::Iframe => BoardConfigBackgroundType::Iframe,
BoardConfigBackgroundType::Other(v) => {
BoardConfigBackgroundType::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum BoardConfigImageShape<'a> {
Circular,
Square,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> BoardConfigImageShape<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Circular => "circular",
Self::Square => "square",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for BoardConfigImageShape<'a> {
fn from(s: &'a str) -> Self {
match s {
"circular" => Self::Circular,
"square" => Self::Square,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for BoardConfigImageShape<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"circular" => Self::Circular,
"square" => Self::Square,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for BoardConfigImageShape<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for BoardConfigImageShape<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for BoardConfigImageShape<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for BoardConfigImageShape<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for BoardConfigImageShape<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for BoardConfigImageShape<'_> {
type Output = BoardConfigImageShape<'static>;
fn into_static(self) -> Self::Output {
match self {
BoardConfigImageShape::Circular => BoardConfigImageShape::Circular,
BoardConfigImageShape::Square => BoardConfigImageShape::Square,
BoardConfigImageShape::Other(v) => {
BoardConfigImageShape::Other(v.into_static())
}
}
}
}
fn lexicon_doc_org_hyperboards_board() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("org.hyperboards.board"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("boardConfig"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Visual configuration for a hyperboard's background, colors, and layout.",
),
),
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(
"aspectRatio",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Display aspect ratio of the board.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(10usize),
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(
"backgroundColor",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Background color as a hex string (e.g. '#ffffff').",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(20usize),
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(
"backgroundGrayscale",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"backgroundIframeUrl",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"URI of the background iframe.",
),
),
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(
"backgroundImage",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Background image as a URI or image blob.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("org.hypercerts.defs#uri"),
::jacquard_common::CowStr::new_static("org.hypercerts.defs#smallImage")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"backgroundOpacity",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: Some(100i64),
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"backgroundType",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Type of background content.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(10usize),
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(
"borderColor",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Border color as a hex string (e.g. '#000000').",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(20usize),
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(
"grayscaleImages",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"imageShape",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Shape used to crop contributor images on this board.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(20usize),
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(
"contributorConfig",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Configuration for a specific contributor within a board. Values serve as fallbacks when the contributor has not defined them on their profile. It can also be used to override contributor settings on this board without changing their global profile.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("contributor")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"contributor",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Identifies the contributor being styled. A strong reference to an org.hypercerts.claim.contributorInformation record, or a contributorIdentity (DID or identifier string) for contributors without a dedicated record.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("com.atproto.repo.strongRef"),
::jacquard_common::CowStr::new_static("org.hypercerts.claim.activity#contributorIdentity")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"displayName",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Display name for this contributor on this board.",
),
),
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(
"hoverIframeUrl",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Iframe overlay shown when hovering over this contributor.",
),
),
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(
"hoverImage",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Image overlay shown when hovering over this contributor, as a URI or image blob.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("org.hypercerts.defs#uri"),
::jacquard_common::CowStr::new_static("org.hypercerts.defs#smallImage")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"image",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Avatar or face image for this contributor on this board, as a URI or image blob.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("org.hypercerts.defs#uri"),
::jacquard_common::CowStr::new_static("org.hypercerts.defs#smallImage")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"override",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: 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(
"Click-through link URL for this contributor.",
),
),
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(
"video",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Video for this contributor, as a URI (embed/direct link) or uploaded video blob.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("org.hypercerts.defs#uri"),
::jacquard_common::CowStr::new_static("org.hypercerts.defs#smallVideo")
],
closed: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: Some(
::jacquard_common::CowStr::new_static(
"Configuration record for a hyperboard, wrapping an underlying activity or collection with visual presentation settings. Stored in the creator's PDS.",
),
),
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("subject"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"config",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#boardConfig"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"contributorConfigs",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Per-contributor configuration entries for this board.",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"#contributorConfig",
),
}),
min_length: None,
max_length: Some(1000usize),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Client-declared timestamp when this record was originally created.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
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(
"subject",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map
},
}),
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BoardConfig<'a> {
fn nsid() -> &'static str {
"org.hyperboards.board"
}
fn def_name() -> &'static str {
"boardConfig"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_org_hyperboards_board()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.aspect_ratio {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"aspect_ratio",
),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.background_color {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 20usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"background_color",
),
max: 20usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.background_iframe_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(
"background_iframe_url",
),
max: 2048usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.background_opacity {
if *value > 100i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Maximum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"background_opacity",
),
max: 100i64,
actual: *value,
});
}
}
if let Some(ref value) = self.background_opacity {
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"background_opacity",
),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.background_type {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"background_type",
),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.border_color {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 20usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"border_color",
),
max: 20usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.image_shape {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 20usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image_shape",
),
max: 20usize,
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 ContributorConfig<'a> {
#[serde(borrow)]
pub contributor: ContributorConfigContributor<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub display_name: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub hover_iframe_url: std::option::Option<
jacquard_common::types::string::UriValue<'a>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub hover_image: std::option::Option<ContributorConfigHoverImage<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub image: std::option::Option<ContributorConfigImage<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub r#override: std::option::Option<bool>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub url: std::option::Option<jacquard_common::types::string::UriValue<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub video: std::option::Option<ContributorConfigVideo<'a>>,
}
pub mod contributor_config_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 Contributor;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Contributor = Unset;
}
pub struct SetContributor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContributor<S> {}
impl<S: State> State for SetContributor<S> {
type Contributor = Set<members::contributor>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct contributor(());
}
}
pub struct ContributorConfigBuilder<'a, S: contributor_config_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<ContributorConfigContributor<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<ContributorConfigHoverImage<'a>>,
::core::option::Option<ContributorConfigImage<'a>>,
::core::option::Option<bool>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<ContributorConfigVideo<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> ContributorConfig<'a> {
pub fn new() -> ContributorConfigBuilder<'a, contributor_config_state::Empty> {
ContributorConfigBuilder::new()
}
}
impl<'a> ContributorConfigBuilder<'a, contributor_config_state::Empty> {
pub fn new() -> Self {
ContributorConfigBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ContributorConfigBuilder<'a, S>
where
S: contributor_config_state::State,
S::Contributor: contributor_config_state::IsUnset,
{
pub fn contributor(
mut self,
value: impl Into<ContributorConfigContributor<'a>>,
) -> ContributorConfigBuilder<'a, contributor_config_state::SetContributor<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ContributorConfigBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn display_name(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_display_name(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn hover_iframe_url(
mut self,
value: impl Into<Option<jacquard_common::types::string::UriValue<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_hover_iframe_url(
mut self,
value: Option<jacquard_common::types::string::UriValue<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn hover_image(
mut self,
value: impl Into<Option<ContributorConfigHoverImage<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_hover_image(
mut self,
value: Option<ContributorConfigHoverImage<'a>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn image(
mut self,
value: impl Into<Option<ContributorConfigImage<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_image(mut self, value: Option<ContributorConfigImage<'a>>) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn r#override(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_override(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn url(
mut self,
value: impl Into<Option<jacquard_common::types::string::UriValue<'a>>>,
) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_url(
mut self,
value: Option<jacquard_common::types::string::UriValue<'a>>,
) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S: contributor_config_state::State> ContributorConfigBuilder<'a, S> {
pub fn video(
mut self,
value: impl Into<Option<ContributorConfigVideo<'a>>>,
) -> Self {
self.__unsafe_private_named.7 = value.into();
self
}
pub fn maybe_video(mut self, value: Option<ContributorConfigVideo<'a>>) -> Self {
self.__unsafe_private_named.7 = value;
self
}
}
impl<'a, S> ContributorConfigBuilder<'a, S>
where
S: contributor_config_state::State,
S::Contributor: contributor_config_state::IsSet,
{
pub fn build(self) -> ContributorConfig<'a> {
ContributorConfig {
contributor: self.__unsafe_private_named.0.unwrap(),
display_name: self.__unsafe_private_named.1,
hover_iframe_url: self.__unsafe_private_named.2,
hover_image: self.__unsafe_private_named.3,
image: self.__unsafe_private_named.4,
r#override: self.__unsafe_private_named.5,
url: self.__unsafe_private_named.6,
video: self.__unsafe_private_named.7,
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>,
>,
) -> ContributorConfig<'a> {
ContributorConfig {
contributor: self.__unsafe_private_named.0.unwrap(),
display_name: self.__unsafe_private_named.1,
hover_iframe_url: self.__unsafe_private_named.2,
hover_image: self.__unsafe_private_named.3,
image: self.__unsafe_private_named.4,
r#override: self.__unsafe_private_named.5,
url: self.__unsafe_private_named.6,
video: self.__unsafe_private_named.7,
extra_data: Some(extra_data),
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ContributorConfigContributor<'a> {
#[serde(rename = "com.atproto.repo.strongRef")]
StrongRef(Box<crate::com_atproto::repo::strong_ref::StrongRef<'a>>),
#[serde(rename = "org.hypercerts.claim.activity#contributorIdentity")]
ActivityContributorIdentity(
Box<crate::org_hypercerts::claim::activity::ContributorIdentity<'a>>,
),
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ContributorConfigHoverImage<'a> {
#[serde(rename = "org.hypercerts.defs#uri")]
Uri(Box<crate::org_hypercerts::Uri<'a>>),
#[serde(rename = "org.hypercerts.defs#smallImage")]
SmallImage(Box<crate::org_hypercerts::SmallImage<'a>>),
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ContributorConfigImage<'a> {
#[serde(rename = "org.hypercerts.defs#uri")]
Uri(Box<crate::org_hypercerts::Uri<'a>>),
#[serde(rename = "org.hypercerts.defs#smallImage")]
SmallImage(Box<crate::org_hypercerts::SmallImage<'a>>),
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ContributorConfigVideo<'a> {
#[serde(rename = "org.hypercerts.defs#uri")]
Uri(Box<crate::org_hypercerts::Uri<'a>>),
#[serde(rename = "org.hypercerts.defs#smallVideo")]
SmallVideo(Box<crate::org_hypercerts::SmallVideo<'a>>),
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContributorConfig<'a> {
fn nsid() -> &'static str {
"org.hyperboards.board"
}
fn def_name() -> &'static str {
"contributorConfig"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_org_hyperboards_board()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.display_name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 640usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"display_name",
),
max: 640usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.display_name {
{
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(
"display_name",
),
max: 64usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.hover_iframe_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(
"hover_iframe_url",
),
max: 2048usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref 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
)]
#[serde(rename_all = "camelCase")]
pub struct Board<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub config: std::option::Option<crate::org_hyperboards::board::BoardConfig<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub contributor_configs: std::option::Option<
Vec<crate::org_hyperboards::board::ContributorConfig<'a>>,
>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(borrow)]
pub subject: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
}
pub mod board_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 CreatedAt;
type Subject;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Subject = Unset;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type CreatedAt = Set<members::created_at>;
type Subject = S::Subject;
}
pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSubject<S> {}
impl<S: State> State for SetSubject<S> {
type CreatedAt = S::CreatedAt;
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct subject(());
}
}
pub struct BoardBuilder<'a, S: board_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::org_hyperboards::board::BoardConfig<'a>>,
::core::option::Option<
Vec<crate::org_hyperboards::board::ContributorConfig<'a>>,
>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Board<'a> {
pub fn new() -> BoardBuilder<'a, board_state::Empty> {
BoardBuilder::new()
}
}
impl<'a> BoardBuilder<'a, board_state::Empty> {
pub fn new() -> Self {
BoardBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: board_state::State> BoardBuilder<'a, S> {
pub fn config(
mut self,
value: impl Into<Option<crate::org_hyperboards::board::BoardConfig<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_config(
mut self,
value: Option<crate::org_hyperboards::board::BoardConfig<'a>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: board_state::State> BoardBuilder<'a, S> {
pub fn contributor_configs(
mut self,
value: impl Into<
Option<Vec<crate::org_hyperboards::board::ContributorConfig<'a>>>,
>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_contributor_configs(
mut self,
value: Option<Vec<crate::org_hyperboards::board::ContributorConfig<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> BoardBuilder<'a, S>
where
S: board_state::State,
S::CreatedAt: board_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> BoardBuilder<'a, board_state::SetCreatedAt<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
BoardBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> BoardBuilder<'a, S>
where
S: board_state::State,
S::Subject: board_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> BoardBuilder<'a, board_state::SetSubject<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
BoardBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> BoardBuilder<'a, S>
where
S: board_state::State,
S::CreatedAt: board_state::IsSet,
S::Subject: board_state::IsSet,
{
pub fn build(self) -> Board<'a> {
Board {
config: self.__unsafe_private_named.0,
contributor_configs: self.__unsafe_private_named.1,
created_at: self.__unsafe_private_named.2.unwrap(),
subject: self.__unsafe_private_named.3.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>,
>,
) -> Board<'a> {
Board {
config: self.__unsafe_private_named.0,
contributor_configs: self.__unsafe_private_named.1,
created_at: self.__unsafe_private_named.2.unwrap(),
subject: self.__unsafe_private_named.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> Board<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, BoardRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct BoardGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Board<'a>,
}
impl From<BoardGetRecordOutput<'_>> for Board<'_> {
fn from(output: BoardGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Board<'_> {
const NSID: &'static str = "org.hyperboards.board";
type Record = BoardRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct BoardRecord;
impl jacquard_common::xrpc::XrpcResp for BoardRecord {
const NSID: &'static str = "org.hyperboards.board";
const ENCODING: &'static str = "application/json";
type Output<'de> = BoardGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for BoardRecord {
const NSID: &'static str = "org.hyperboards.board";
type Record = BoardRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Board<'a> {
fn nsid() -> &'static str {
"org.hyperboards.board"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_org_hyperboards_board()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.contributor_configs {
#[allow(unused_comparisons)]
if value.len() > 1000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"contributor_configs",
),
max: 1000usize,
actual: value.len(),
});
}
}
Ok(())
}
}