//! GENERATED FILE — DO NOT EDIT. //! Source: packages/core-contracts/schemas/*.schema.json (run `pnpm gen`) #![allow(clippy::all, rustdoc::all, dead_code, unused_imports)] #![allow(clippy::needless_lifetimes)] #![allow(clippy::match_single_binding)] #![allow(clippy::clone_on_copy)] #[doc = "`Actor`"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct Actor { pub id: Id, pub kind: ActorKind, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub name: ::std::option::Option, } #[doc = "Who performed an action. Humans and agents share one actor model so the policy engine treats them uniformly."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum ActorKind { #[serde(rename = "human")] Human, #[serde(rename = "agent")] Agent, #[serde(rename = "system")] System, } impl ::std::fmt::Display for ActorKind { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Human => f.write_str("human"), Self::Agent => f.write_str("agent"), Self::System => f.write_str("system"), } } } impl ::std::str::FromStr for ActorKind { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "human" => Ok(Self::Human), "agent" => Ok(Self::Agent), "system" => Ok(Self::System), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for ActorKind { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ActorKind { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`ActorName`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ActorName(::std::string::String); impl ::std::ops::Deref for ActorName { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ActorName) -> Self { value.0 } } impl ::std::str::FromStr for ActorName { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200usize { return Err("longer than 200 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ActorName { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ActorName { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ActorName { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Time gates of a page or content entry (RFC-0008): the published site shows the node only from `from` (inclusive: an embargo) until `until` (exclusive: an expiry), checked at render time, so the gates hold even when no scheduler runs. Before `from` and from `until` on, the node is absent from every public route, list, feed, sitemap and search output; previews still show it. At least one gate; writers check that `from` is before `until`."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, Default, PartialEq)] #[serde(deny_unknown_fields)] pub struct Availability { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub from: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub until: ::std::option::Option, } #[doc = "One top-level block of a markdown body in the store's index (RFC-0014 §3). Written by the store only: a client's values are replaced on every write. `by`, `via` and `at` say who last changed the block's content, through which channel and when; they are absent for content written before the index existed."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct BodyBlock { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub at: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub by: ::std::option::Option, #[doc = "SHA-256 (hex) of the block's markdown without trailing whitespace."] pub hash: BodyBlockHash, #[doc = "Stable across writes that keep the block's content or its place among unchanged blocks."] pub id: BodyBlockId, #[doc = "The channel of that change."] #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub via: ::std::option::Option, } #[doc = "SHA-256 (hex) of the block's markdown without trailing whitespace."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct BodyBlockHash(::std::string::String); impl ::std::ops::Deref for BodyBlockHash { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: BodyBlockHash) -> Self { value.0 } } impl ::std::str::FromStr for BodyBlockHash { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[0-9a-f]{64}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[0-9a-f]{64}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for BodyBlockHash { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for BodyBlockHash { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for BodyBlockHash { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Stable across writes that keep the block's content or its place among unchanged blocks."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct BodyBlockId(::std::string::String); impl ::std::ops::Deref for BodyBlockId { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: BodyBlockId) -> Self { value.0 } } impl ::std::str::FromStr for BodyBlockId { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^blk_[0-9A-Za-z]{8,24}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^blk_[0-9A-Za-z]{8,24}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for BodyBlockId { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for BodyBlockId { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for BodyBlockId { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "The channel of that change."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum BodyBlockVia { #[serde(rename = "studio")] Studio, #[serde(rename = "mcp")] Mcp, #[serde(rename = "api")] Api, #[serde(rename = "import")] Import, #[serde(rename = "ai-command")] AiCommand, #[serde(rename = "proposal")] Proposal, } impl ::std::fmt::Display for BodyBlockVia { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Studio => f.write_str("studio"), Self::Mcp => f.write_str("mcp"), Self::Api => f.write_str("api"), Self::Import => f.write_str("import"), Self::AiCommand => f.write_str("ai-command"), Self::Proposal => f.write_str("proposal"), } } } impl ::std::str::FromStr for BodyBlockVia { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "studio" => Ok(Self::Studio), "mcp" => Ok(Self::Mcp), "api" => Ok(Self::Api), "import" => Ok(Self::Import), "ai-command" => Ok(Self::AiCommand), "proposal" => Ok(Self::Proposal), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for BodyBlockVia { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for BodyBlockVia { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "A markdown body's block index, in body order (RFC-0014 §3). Absent means not indexed (yet, or an HTML body), never empty."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct BodyBlocks(pub ::std::vec::Vec); impl ::std::ops::Deref for BodyBlocks { type Target = ::std::vec::Vec; fn deref(&self) -> &::std::vec::Vec { &self.0 } } impl ::std::convert::From for ::std::vec::Vec { fn from(value: BodyBlocks) -> Self { value.0 } } impl ::std::convert::From<::std::vec::Vec> for BodyBlocks { fn from(value: ::std::vec::Vec) -> Self { Self(value) } } #[doc = "The markdown dialect a body follows (RFC-0014 §1): 1 = Cloudhal Markdown v1 (CommonMark + GFM + `asset:` + directives; raw HTML escaped). Set by the store on markdown bodies."] #[derive(:: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct BodyProfile(i64); impl ::std::ops::Deref for BodyProfile { type Target = i64; fn deref(&self) -> &i64 { &self.0 } } impl ::std::convert::From for i64 { fn from(value: BodyProfile) -> Self { value.0 } } impl ::std::convert::TryFrom for BodyProfile { type Error = self::error::ConversionError; fn try_from(value: i64) -> ::std::result::Result { if ![1_i64].contains(&value) { Err("invalid value".into()) } else { Ok(Self(value)) } } } impl<'de> ::serde::Deserialize<'de> for BodyProfile { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { Self::try_from(::deserialize(deserializer)?) .map_err(|e| ::custom(e.to_string())) } } #[doc = "RFC-0042: one condition on a typed field of the listed collection. `value` is read by the field's type: a number, YYYY-MM-DD, an RFC 3339 instant, true/false, an option value, or `now`. `values` only with `in`."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct FieldCondition { #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] pub field: FieldConditionField, pub op: FieldConditionOp, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub value: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub values: ::std::option::Option<::std::vec::Vec>, } #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldConditionField(::std::string::String); impl ::std::ops::Deref for FieldConditionField { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldConditionField) -> Self { value.0 } } impl ::std::str::FromStr for FieldConditionField { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z][A-Za-z0-9]{0,39}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][A-Za-z0-9]{0,39}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldConditionField { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionField { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldConditionField { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`FieldConditionOp`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum FieldConditionOp { #[serde(rename = "eq")] Eq, #[serde(rename = "ne")] Ne, #[serde(rename = "lt")] Lt, #[serde(rename = "lte")] Lte, #[serde(rename = "gt")] Gt, #[serde(rename = "gte")] Gte, #[serde(rename = "in")] In, #[serde(rename = "set")] Set, #[serde(rename = "unset")] Unset, } impl ::std::fmt::Display for FieldConditionOp { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Eq => f.write_str("eq"), Self::Ne => f.write_str("ne"), Self::Lt => f.write_str("lt"), Self::Lte => f.write_str("lte"), Self::Gt => f.write_str("gt"), Self::Gte => f.write_str("gte"), Self::In => f.write_str("in"), Self::Set => f.write_str("set"), Self::Unset => f.write_str("unset"), } } } impl ::std::str::FromStr for FieldConditionOp { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "eq" => Ok(Self::Eq), "ne" => Ok(Self::Ne), "lt" => Ok(Self::Lt), "lte" => Ok(Self::Lte), "gt" => Ok(Self::Gt), "gte" => Ok(Self::Gte), "in" => Ok(Self::In), "set" => Ok(Self::Set), "unset" => Ok(Self::Unset), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for FieldConditionOp { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionOp { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`FieldConditionValue`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldConditionValue(::std::string::String); impl ::std::ops::Deref for FieldConditionValue { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldConditionValue) -> Self { value.0 } } impl ::std::str::FromStr for FieldConditionValue { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 100usize { return Err("longer than 100 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldConditionValue { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionValue { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldConditionValue { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`FieldConditionValuesItem`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldConditionValuesItem(::std::string::String); impl ::std::ops::Deref for FieldConditionValuesItem { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldConditionValuesItem) -> Self { value.0 } } impl ::std::str::FromStr for FieldConditionValuesItem { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 100usize { return Err("longer than 100 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldConditionValuesItem { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldConditionValuesItem { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldConditionValuesItem { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct FieldOrder { pub direction: FieldOrderDirection, #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] pub field: FieldOrderField, } #[doc = "`FieldOrderDirection`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum FieldOrderDirection { #[serde(rename = "asc")] Asc, #[serde(rename = "desc")] Desc, } impl ::std::fmt::Display for FieldOrderDirection { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Asc => f.write_str("asc"), Self::Desc => f.write_str("desc"), } } } impl ::std::str::FromStr for FieldOrderDirection { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "asc" => Ok(Self::Asc), "desc" => Ok(Self::Desc), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for FieldOrderDirection { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldOrderDirection { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "A field key (site.schema.json FieldKey's pattern, repeated)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct FieldOrderField(::std::string::String); impl ::std::ops::Deref for FieldOrderField { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: FieldOrderField) -> Self { value.0 } } impl ::std::str::FromStr for FieldOrderField { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z][A-Za-z0-9]{0,39}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][A-Za-z0-9]{0,39}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for FieldOrderField { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for FieldOrderField { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for FieldOrderField { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Prefixed, URL-safe identifier, e.g. site_01HZX8K3Q9. The prefix names the entity kind; agents and the MCP server pass these as opaque handles."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct Id(::std::string::String); impl ::std::ops::Deref for Id { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: Id) -> Self { value.0 } } impl ::std::str::FromStr for Id { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 48usize { return Err("longer than 48 characters".into()); } if value.chars().count() < 8usize { return Err("shorter than 8 characters".into()); } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z]+_[A-Za-z0-9]{6,32}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z]+_[A-Za-z0-9]{6,32}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for Id { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for Id { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for Id { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Reference to an image. With `assetId` the image is an Asset node (RFC-0004): the store writes its media URL into `src`, and its size into `width` and `height`, as a fallback for readers that do not resolve assets. Without it, `src` is a relative path or an absolute URL, as before."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct ImageRef { pub alt: ImageRefAlt, #[doc = "The Asset node shown (RFC-0004). Renderers that know assets resolve it and ignore `src`."] #[serde( rename = "assetId", skip_serializing_if = "::std::option::Option::is_none" )] pub asset_id: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub height: ::std::option::Option<::std::num::NonZeroU64>, pub src: ImageRefSrc, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub width: ::std::option::Option<::std::num::NonZeroU64>, } #[doc = "`ImageRefAlt`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ImageRefAlt(::std::string::String); impl ::std::ops::Deref for ImageRefAlt { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ImageRefAlt) -> Self { value.0 } } impl ::std::str::FromStr for ImageRefAlt { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 500usize { return Err("longer than 500 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ImageRefAlt { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ImageRefAlt { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ImageRefAlt { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`ImageRefSrc`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct ImageRefSrc(::std::string::String); impl ::std::ops::Deref for ImageRefSrc { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: ImageRefSrc) -> Self { value.0 } } impl ::std::str::FromStr for ImageRefSrc { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 2048usize { return Err("longer than 2048 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for ImageRefSrc { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for ImageRefSrc { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for ImageRefSrc { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`Link`"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct Link { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub external: ::std::option::Option, pub href: LinkHref, pub label: LinkLabel, } #[doc = "`LinkHref`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct LinkHref(::std::string::String); impl ::std::ops::Deref for LinkHref { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: LinkHref) -> Self { value.0 } } impl ::std::str::FromStr for LinkHref { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 2048usize { return Err("longer than 2048 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for LinkHref { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for LinkHref { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for LinkHref { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`LinkLabel`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct LinkLabel(::std::string::String); impl ::std::ops::Deref for LinkLabel { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: LinkLabel) -> Self { value.0 } } impl ::std::str::FromStr for LinkLabel { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200usize { return Err("longer than 200 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for LinkLabel { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for LinkLabel { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for LinkLabel { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "BCP 47 language tag, e.g. en, tr, en-US."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct Locale(::std::string::String); impl ::std::ops::Deref for Locale { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: Locale) -> Self { value.0 } } impl ::std::str::FromStr for Locale { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for Locale { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for Locale { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for Locale { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Free-form string-to-string map for extensions. Keys should be namespaced (e.g. cloudhal.source)."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct Metadata(pub ::std::collections::HashMap<::std::string::String, ::std::string::String>); impl ::std::ops::Deref for Metadata { type Target = ::std::collections::HashMap<::std::string::String, ::std::string::String>; fn deref(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { &self.0 } } impl ::std::convert::From for ::std::collections::HashMap<::std::string::String, ::std::string::String> { fn from(value: Metadata) -> Self { value.0 } } impl ::std::convert::From<::std::collections::HashMap<::std::string::String, ::std::string::String>> for Metadata { fn from( value: ::std::collections::HashMap<::std::string::String, ::std::string::String>, ) -> Self { Self(value) } } #[doc = "How much a page may move (RFC-0024 §1); the reader's reduced-motion preference and pause control can only lower it."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum MotionLevel { #[serde(rename = "none")] None, #[serde(rename = "subtle")] Subtle, #[serde(rename = "standard")] Standard, #[serde(rename = "expressive")] Expressive, } impl ::std::fmt::Display for MotionLevel { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::None => f.write_str("none"), Self::Subtle => f.write_str("subtle"), Self::Standard => f.write_str("standard"), Self::Expressive => f.write_str("expressive"), } } } impl ::std::str::FromStr for MotionLevel { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "none" => Ok(Self::None), "subtle" => Ok(Self::Subtle), "standard" => Ok(Self::Standard), "expressive" => Ok(Self::Expressive), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for MotionLevel { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for MotionLevel { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "A routable page of a site: a path, editorial status and an ordered list of sections. Sections are embedded (not separate nodes) so a page is the unit of locking, snapshotting and diffing."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct Page { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub availability: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub chrome: ::std::option::Option, #[serde(rename = "createdAt")] pub created_at: Timestamp, pub id: Id, pub locale: Locale, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub metadata: ::std::option::Option, #[doc = "Overrides the site's motion level for this page, up or down (RFC-0024 §1); absent follows the site."] #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub motion: ::std::option::Option, #[doc = "Absolute URL path, starting with '/', no trailing slash except root."] pub path: PagePath, pub rev: Revision, #[serde(rename = "schemaVersion")] pub schema_version: SchemaVersion, pub sections: ::std::vec::Vec
, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub seo: ::std::option::Option, #[serde(rename = "siteId")] pub site_id: Id, pub status: PublishStatus, pub title: PageTitle, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub translation: ::std::option::Option, #[serde(rename = "updatedAt")] pub updated_at: Timestamp, } #[doc = "This page's own header and footer (RFC-0025 §1): a landing page without the menu, a checkout without the footer."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, Default, PartialEq)] #[serde(deny_unknown_fields)] pub struct PageChrome { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub footer: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub header: ::std::option::Option, } #[doc = "`PageChromeFooter`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum PageChromeFooter { #[serde(rename = "default")] Default, #[serde(rename = "minimal")] Minimal, #[serde(rename = "hidden")] Hidden, } impl ::std::fmt::Display for PageChromeFooter { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Default => f.write_str("default"), Self::Minimal => f.write_str("minimal"), Self::Hidden => f.write_str("hidden"), } } } impl ::std::str::FromStr for PageChromeFooter { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "default" => Ok(Self::Default), "minimal" => Ok(Self::Minimal), "hidden" => Ok(Self::Hidden), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for PageChromeFooter { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for PageChromeFooter { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`PageChromeHeader`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum PageChromeHeader { #[serde(rename = "default")] Default, #[serde(rename = "transparent")] Transparent, #[serde(rename = "hidden")] Hidden, } impl ::std::fmt::Display for PageChromeHeader { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Default => f.write_str("default"), Self::Transparent => f.write_str("transparent"), Self::Hidden => f.write_str("hidden"), } } } impl ::std::str::FromStr for PageChromeHeader { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "default" => Ok(Self::Default), "transparent" => Ok(Self::Transparent), "hidden" => Ok(Self::Hidden), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for PageChromeHeader { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for PageChromeHeader { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "Absolute URL path, starting with '/', no trailing slash except root."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct PagePath(::std::string::String); impl ::std::ops::Deref for PagePath { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: PagePath) -> Self { value.0 } } impl ::std::str::FromStr for PagePath { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 1024usize { return Err("longer than 1024 characters".into()); } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new( "^/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$", ) .unwrap() }); if PATTERN.find(value).is_none() { return Err ("doesn't match pattern \"^/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$\"" . into ()) ; } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for PagePath { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for PagePath { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for PagePath { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`PageTitle`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct PageTitle(::std::string::String); impl ::std::ops::Deref for PageTitle { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: PageTitle) -> Self { value.0 } } impl ::std::str::FromStr for PageTitle { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 300usize { return Err("longer than 300 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for PageTitle { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for PageTitle { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for PageTitle { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Editorial lifecycle of a page or content entry."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum PublishStatus { #[serde(rename = "draft")] Draft, #[serde(rename = "review")] Review, #[serde(rename = "published")] Published, #[serde(rename = "archived")] Archived, } impl ::std::fmt::Display for PublishStatus { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Draft => f.write_str("draft"), Self::Review => f.write_str("review"), Self::Published => f.write_str("published"), Self::Archived => f.write_str("archived"), } } } impl ::std::str::FromStr for PublishStatus { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "draft" => Ok(Self::Draft), "review" => Ok(Self::Review), "published" => Ok(Self::Published), "archived" => Ok(Self::Archived), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for PublishStatus { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for PublishStatus { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "Monotonic per-node revision used for optimistic locking (compare-and-swap on write)."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct Revision(pub u64); impl ::std::ops::Deref for Revision { type Target = u64; fn deref(&self) -> &u64 { &self.0 } } impl ::std::convert::From for u64 { fn from(value: Revision) -> Self { value.0 } } impl ::std::convert::From for Revision { fn from(value: u64) -> Self { Self(value) } } impl ::std::fmt::Display for Revision { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { self.0.fmt(f) } } impl ::std::str::FromStr for Revision { type Err = ::Err; fn from_str(value: &str) -> ::std::result::Result { Ok(Self(value.parse()?)) } } impl ::std::convert::TryFrom<&str> for Revision { type Error = ::Err; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom for Revision { type Error = ::Err; fn try_from(value: String) -> ::std::result::Result { value.parse() } } #[doc = "Version of this contract. Readers reject unknown versions; migrations move documents forward one version at a time."] #[derive(:: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct SchemaVersion(i64); impl ::std::ops::Deref for SchemaVersion { type Target = i64; fn deref(&self) -> &i64 { &self.0 } } impl ::std::convert::From for i64 { fn from(value: SchemaVersion) -> Self { value.0 } } impl ::std::convert::TryFrom for SchemaVersion { type Error = self::error::ConversionError; fn try_from(value: i64) -> ::std::result::Result { if ![1_i64].contains(&value) { Err("invalid value".into()) } else { Ok(Self(value)) } } } impl<'de> ::serde::Deserialize<'de> for SchemaVersion { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { Self::try_from(::deserialize(deserializer)?) .map_err(|e| ::custom(e.to_string())) } } #[doc = "A block inside a page, discriminated by `kind`. Variants are written inline (not via $ref) and `kind` is a single-value string enum so that TypeScript gets a literal union and Rust gets a serde internally-tagged enum."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(tag = "kind", deny_unknown_fields)] pub enum Section { #[doc = "HeroSection"] #[serde(rename = "hero")] Hero { #[serde(skip_serializing_if = "::std::option::Option::is_none")] cta: ::std::option::Option, heading: SectionHeading, id: Id, #[serde(skip_serializing_if = "::std::option::Option::is_none")] image: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] subheading: ::std::option::Option, }, #[doc = "RichTextSection"] #[serde(rename = "richText")] RichText { #[serde(skip_serializing_if = "::std::option::Option::is_none")] blocks: ::std::option::Option, body: SectionBody, format: SectionFormat, id: Id, #[serde(skip_serializing_if = "::std::option::Option::is_none")] profile: ::std::option::Option, }, #[doc = "ImageSection"] #[serde(rename = "image")] Image { #[serde(skip_serializing_if = "::std::option::Option::is_none")] caption: ::std::option::Option, id: Id, image: ImageRef, }, #[doc = "ContentListSection\n\nRenders the newest entries of a content collection (e.g. blog posts)."] #[serde(rename = "contentList")] ContentList { collection: Slug, #[doc = "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'."] #[serde(skip_serializing_if = "::std::option::Option::is_none")] filter: ::std::option::Option, id: Id, limit: ::std::num::NonZeroU64, #[serde( rename = "orderBy", skip_serializing_if = "::std::option::Option::is_none" )] order_by: ::std::option::Option, sort: SectionSort, #[doc = "RFC-0042: conditions on the collection's list fields, ANDed."] #[serde( rename = "where", default, skip_serializing_if = "::std::vec::Vec::is_empty" )] where_: ::std::vec::Vec, }, #[doc = "ComponentSection\n\nA typed block from the block registry (RFC-0015): `type` names a registered block type (one global namespace of English names), `props` follow that type's props schema, which the store validates."] #[serde(rename = "component")] Component { id: Id, #[doc = "Validated against the type's props schema by the store, not by this contract."] props: ::serde_json::Map<::std::string::String, ::serde_json::Value>, #[serde(rename = "type")] type_: SectionType, }, #[doc = "SurfaceSection\n\nA generative UI surface (RFC-0020): a flat list of catalog components with a `root`, plus a data model their props may bind to. Written and streamed by agents as data, never code; the store checks the tree, the catalog and the limits."] #[serde(rename = "surface")] Surface { #[doc = "The catalog the surface was written for: `@` (RFC-0018 manifest)."] catalog: SectionCatalog, components: ::std::vec::Vec, #[doc = "The surface's data model: JSON its components bind to with `{path}` (at most 64 KB serialized; the store enforces the size)."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] data: ::serde_json::Map<::std::string::String, ::serde_json::Value>, id: Id, }, } #[doc = "`SectionBody`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionBody(::std::string::String); impl ::std::ops::Deref for SectionBody { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionBody) -> Self { value.0 } } impl ::std::str::FromStr for SectionBody { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200000usize { return Err("longer than 200000 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionBody { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionBody { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionBody { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`SectionCaption`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionCaption(::std::string::String); impl ::std::ops::Deref for SectionCaption { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionCaption) -> Self { value.0 } } impl ::std::str::FromStr for SectionCaption { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 1000usize { return Err("longer than 1000 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionCaption { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionCaption { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionCaption { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "The catalog the surface was written for: `@` (RFC-0018 manifest)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionCatalog(::std::string::String); impl ::std::ops::Deref for SectionCatalog { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionCatalog) -> Self { value.0 } } impl ::std::str::FromStr for SectionCatalog { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z][a-z0-9-]{0,40}@[0-9]{1,4}$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][a-z0-9-]{0,40}@[0-9]{1,4}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionCatalog { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionCatalog { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionCatalog { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionFilter(::std::string::String); impl ::std::ops::Deref for SectionFilter { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionFilter) -> Self { value.0 } } impl ::std::str::FromStr for SectionFilter { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 512usize { return Err("longer than 512 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionFilter { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionFilter { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionFilter { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`SectionFormat`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum SectionFormat { #[serde(rename = "markdown")] Markdown, #[serde(rename = "html")] Html, } impl ::std::fmt::Display for SectionFormat { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Markdown => f.write_str("markdown"), Self::Html => f.write_str("html"), } } } impl ::std::str::FromStr for SectionFormat { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "markdown" => Ok(Self::Markdown), "html" => Ok(Self::Html), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for SectionFormat { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionFormat { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`SectionHeading`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionHeading(::std::string::String); impl ::std::ops::Deref for SectionHeading { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionHeading) -> Self { value.0 } } impl ::std::str::FromStr for SectionHeading { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 300usize { return Err("longer than 300 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionHeading { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionHeading { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionHeading { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`SectionSort`"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum SectionSort { #[serde(rename = "newest")] Newest, #[serde(rename = "oldest")] Oldest, #[serde(rename = "title")] Title, } impl ::std::fmt::Display for SectionSort { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Newest => f.write_str("newest"), Self::Oldest => f.write_str("oldest"), Self::Title => f.write_str("title"), } } } impl ::std::str::FromStr for SectionSort { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "newest" => Ok(Self::Newest), "oldest" => Ok(Self::Oldest), "title" => Ok(Self::Title), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for SectionSort { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionSort { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "`SectionSubheading`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionSubheading(::std::string::String); impl ::std::ops::Deref for SectionSubheading { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionSubheading) -> Self { value.0 } } impl ::std::str::FromStr for SectionSubheading { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 1000usize { return Err("longer than 1000 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionSubheading { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionSubheading { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionSubheading { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`SectionType`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SectionType(::std::string::String); impl ::std::ops::Deref for SectionType { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SectionType) -> Self { value.0 } } impl ::std::str::FromStr for SectionType { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-z][a-z0-9-]{1,40}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][a-z0-9-]{1,40}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SectionType { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SectionType { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SectionType { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Search and social metadata of a routable node (page, term archive)."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, Default, PartialEq)] #[serde(deny_unknown_fields)] pub struct Seo { #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub canonical: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub noindex: ::std::option::Option, #[serde( rename = "ogImage", skip_serializing_if = "::std::option::Option::is_none" )] pub og_image: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub title: ::std::option::Option, } #[doc = "`SeoCanonical`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SeoCanonical(::std::string::String); impl ::std::ops::Deref for SeoCanonical { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SeoCanonical) -> Self { value.0 } } impl ::std::str::FromStr for SeoCanonical { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 2048usize { return Err("longer than 2048 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SeoCanonical { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SeoCanonical { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SeoCanonical { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`SeoDescription`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SeoDescription(::std::string::String); impl ::std::ops::Deref for SeoDescription { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SeoDescription) -> Self { value.0 } } impl ::std::str::FromStr for SeoDescription { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 500usize { return Err("longer than 500 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SeoDescription { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SeoDescription { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SeoDescription { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`SeoTitle`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SeoTitle(::std::string::String); impl ::std::ops::Deref for SeoTitle { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SeoTitle) -> Self { value.0 } } impl ::std::str::FromStr for SeoTitle { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 300usize { return Err("longer than 300 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SeoTitle { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SeoTitle { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SeoTitle { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "Lower-case URL segment."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct Slug(::std::string::String); impl ::std::ops::Deref for Slug { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: Slug) -> Self { value.0 } } impl ::std::str::FromStr for Slug { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 128usize { return Err("longer than 128 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^[a-z0-9]+(?:-[a-z0-9]+)*$").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z0-9]+(?:-[a-z0-9]+)*$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for Slug { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for Slug { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for Slug { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "One element of a generative UI surface (RFC-0020 §1), in a flat list: `component` names a catalog entry (a PascalCase built-in primitive such as `Stack`, or a registry block type such as `callout`), `children` refer to other ids of the same surface, and `props` follow the entry's schema, which the store checks. Field names follow A2UI v0.9."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct SurfaceComponent { #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] pub children: ::std::vec::Vec, pub component: SurfaceComponentComponent, pub id: SurfaceComponentId, #[doc = "Motion presets for this component (RFC-0024 §2): `reveal`, `hover`, `speed`, `delay`, `stagger`, `replay` and later `scroll`, `loop`; enums and clamped numbers only, validated by the store against the catalog. The renderer turns them into CSS; agents never write CSS."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub motion: ::serde_json::Map<::std::string::String, ::serde_json::Value>, #[doc = "Literal values, `{path}` bindings into the surface's data, or `{call}` named functions; validated by the store against the catalog, not by this contract."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub props: ::serde_json::Map<::std::string::String, ::serde_json::Value>, #[doc = "A visibility condition over the surface's data (`eq`, `ne`, `gt`, `lt`, `and`, `or`, `not`); validated by the store."] #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub visible: ::serde_json::Map<::std::string::String, ::serde_json::Value>, } #[doc = "`SurfaceComponentComponent`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SurfaceComponentComponent(::std::string::String); impl ::std::ops::Deref for SurfaceComponentComponent { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SurfaceComponentComponent) -> Self { value.0 } } impl ::std::str::FromStr for SurfaceComponentComponent { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { ::regress::Regex::new("^(?:[A-Z][A-Za-z0-9]{1,40}|[a-z][a-z0-9-]{1,40})$").unwrap() }); if PATTERN.find(value).is_none() { return Err( "doesn't match pattern \"^(?:[A-Z][A-Za-z0-9]{1,40}|[a-z][a-z0-9-]{1,40})$\"" .into(), ); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SurfaceComponentComponent { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SurfaceComponentComponent { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SurfaceComponentComponent { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "A component's id, unique within its surface; `root` is the tree's root (RFC-0020 §1)."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct SurfaceComponentId(::std::string::String); impl ::std::ops::Deref for SurfaceComponentId { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: SurfaceComponentId) -> Self { value.0 } } impl ::std::str::FromStr for SurfaceComponentId { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-z][a-z0-9-]{0,40}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-z][a-z0-9-]{0,40}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for SurfaceComponentId { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for SurfaceComponentId { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for SurfaceComponentId { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "RFC 3339 / ISO 8601 instant in UTC."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(transparent)] pub struct Timestamp(pub ::chrono::DateTime<::chrono::offset::Utc>); impl ::std::ops::Deref for Timestamp { type Target = ::chrono::DateTime<::chrono::offset::Utc>; fn deref(&self) -> &::chrono::DateTime<::chrono::offset::Utc> { &self.0 } } impl ::std::convert::From for ::chrono::DateTime<::chrono::offset::Utc> { fn from(value: Timestamp) -> Self { value.0 } } impl ::std::convert::From<::chrono::DateTime<::chrono::offset::Utc>> for Timestamp { fn from(value: ::chrono::DateTime<::chrono::offset::Utc>) -> Self { Self(value) } } impl ::std::fmt::Display for Timestamp { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { self.0.fmt(f) } } impl ::std::str::FromStr for Timestamp { type Err = <::chrono::DateTime<::chrono::offset::Utc> as ::std::str::FromStr>::Err; fn from_str(value: &str) -> ::std::result::Result { Ok(Self(value.parse()?)) } } impl ::std::convert::TryFrom<&str> for Timestamp { type Error = <::chrono::DateTime<::chrono::offset::Utc> as ::std::str::FromStr>::Err; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom for Timestamp { type Error = <::chrono::DateTime<::chrono::offset::Utc> as ::std::str::FromStr>::Err; fn try_from(value: String) -> ::std::result::Result { value.parse() } } #[doc = "Links a page or entry to the other language versions of the same work (RFC-0033 §2). Staleness is computed: the source's current hash differs from source.hash."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct Translation { #[doc = "The group's id: the original node's id, shared by every translation. May cross sites in one project."] pub group: Id, #[doc = "linked: the original's structural changes propagate to this translation as drafts (RFC-0033 §4a); independent: nothing propagates. Absent means linked."] #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub layout: ::std::option::Option, pub method: TranslationMethod, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub provenance: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub review: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub source: ::std::option::Option, } #[doc = "linked: the original's structural changes propagate to this translation as drafts (RFC-0033 §4a); independent: nothing propagates. Absent means linked."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum TranslationLayout { #[serde(rename = "linked")] Linked, #[serde(rename = "independent")] Independent, } impl ::std::fmt::Display for TranslationLayout { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Linked => f.write_str("linked"), Self::Independent => f.write_str("independent"), } } } impl ::std::str::FromStr for TranslationLayout { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "linked" => Ok(Self::Linked), "independent" => Ok(Self::Independent), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for TranslationLayout { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for TranslationLayout { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "How a page's or entry's text came to be (RFC-0033). 'original' marks the source of a translation group; 'machine-reviewed' is machine output a person has reviewed."] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum TranslationMethod { #[serde(rename = "original")] Original, #[serde(rename = "human")] Human, #[serde(rename = "machine")] Machine, #[serde(rename = "machine-reviewed")] MachineReviewed, } impl ::std::fmt::Display for TranslationMethod { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::Original => f.write_str("original"), Self::Human => f.write_str("human"), Self::Machine => f.write_str("machine"), Self::MachineReviewed => f.write_str("machine-reviewed"), } } } impl ::std::str::FromStr for TranslationMethod { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { "original" => Ok(Self::Original), "human" => Ok(Self::Human), "machine" => Ok(Self::Machine), "machine-reviewed" => Ok(Self::MachineReviewed), _ => Err("invalid value".into()), } } } impl ::std::convert::TryFrom<&str> for TranslationMethod { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for TranslationMethod { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } #[doc = "The machine-translation record: engine, glossary revision, checks run, quality score. Required when method is machine or machine-reviewed."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct TranslationProvenance { pub at: Timestamp, #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] pub checks: ::std::vec::Vec, pub engine: TranslationProvenanceEngine, #[serde( rename = "glossaryRev", skip_serializing_if = "::std::option::Option::is_none" )] pub glossary_rev: ::std::option::Option, #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub score: ::std::option::Option, } #[doc = "`TranslationProvenanceChecksItem`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct TranslationProvenanceChecksItem(::std::string::String); impl ::std::ops::Deref for TranslationProvenanceChecksItem { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: TranslationProvenanceChecksItem) -> Self { value.0 } } impl ::std::str::FromStr for TranslationProvenanceChecksItem { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 100usize { return Err("longer than 100 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for TranslationProvenanceChecksItem { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for TranslationProvenanceChecksItem { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for TranslationProvenanceChecksItem { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "`TranslationProvenanceEngine`"] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct TranslationProvenanceEngine(::std::string::String); impl ::std::ops::Deref for TranslationProvenanceEngine { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: TranslationProvenanceEngine) -> Self { value.0 } } impl ::std::str::FromStr for TranslationProvenanceEngine { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { if value.chars().count() > 200usize { return Err("longer than 200 characters".into()); } if value.chars().count() < 1usize { return Err("shorter than 1 characters".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for TranslationProvenanceEngine { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for TranslationProvenanceEngine { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for TranslationProvenanceEngine { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = "The person who reviewed this translation and when. Only humans set it."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct TranslationReview { pub at: Timestamp, pub by: Actor, } #[doc = "The node and revision this translation was made from. Absent on the original."] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)] #[serde(deny_unknown_fields)] pub struct TranslationSource { #[doc = "Lower-case hex SHA-256 of the source node's canonical JSON at that revision."] pub hash: TranslationSourceHash, pub id: Id, pub locale: Locale, pub rev: Revision, #[doc = "The source's site when it is another site of the same project (a language edition). Absent means this site."] #[serde( rename = "siteId", skip_serializing_if = "::std::option::Option::is_none" )] pub site_id: ::std::option::Option, } #[doc = "Lower-case hex SHA-256 of the source node's canonical JSON at that revision."] #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] pub struct TranslationSourceHash(::std::string::String); impl ::std::ops::Deref for TranslationSourceHash { type Target = ::std::string::String; fn deref(&self) -> &::std::string::String { &self.0 } } impl ::std::convert::From for ::std::string::String { fn from(value: TranslationSourceHash) -> Self { value.0 } } impl ::std::str::FromStr for TranslationSourceHash { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[0-9a-f]{64}$").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[0-9a-f]{64}$\"".into()); } Ok(Self(value.to_string())) } } impl ::std::convert::TryFrom<&str> for TranslationSourceHash { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } impl ::std::convert::TryFrom<::std::string::String> for TranslationSourceHash { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, ) -> ::std::result::Result { value.parse() } } impl<'de> ::serde::Deserialize<'de> for TranslationSourceHash { fn deserialize(deserializer: D) -> ::std::result::Result where D: ::serde::Deserializer<'de>, { ::std::string::String::deserialize(deserializer)? .parse() .map_err(|e: self::error::ConversionError| { ::custom(e.to_string()) }) } } #[doc = " Error types."] pub mod error { #[doc = r" Error from a `TryFrom` or `FromStr` implementation."] pub struct ConversionError(::std::borrow::Cow<'static, str>); impl ::std::error::Error for ConversionError {} impl ::std::fmt::Display for ConversionError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { ::std::fmt::Display::fmt(&self.0, f) } } impl ::std::fmt::Debug for ConversionError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { ::std::fmt::Debug::fmt(&self.0, f) } } impl From<&'static str> for ConversionError { fn from(value: &'static str) -> Self { Self(value.into()) } } impl From for ConversionError { fn from(value: String) -> Self { Self(value.into()) } } }