pub mod collection;
pub mod feed;
pub mod graph;
pub mod library;
pub mod profile;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::blob::BlobRef;
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::social_showcase;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ActivitySettings<'a> {
#[serde(default = "_default_activity_settings_retention_days")]
pub retention_days: i64,
#[serde(borrow)]
pub share_activity: ActivitySettingsShareActivity<'a>,
pub share_new_items: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ActivitySettingsShareActivity<'a> {
All,
Followers,
None,
Other(CowStr<'a>),
}
impl<'a> ActivitySettingsShareActivity<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Followers => "followers",
Self::None => "none",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ActivitySettingsShareActivity<'a> {
fn from(s: &'a str) -> Self {
match s {
"all" => Self::All,
"followers" => Self::Followers,
"none" => Self::None,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for ActivitySettingsShareActivity<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"all" => Self::All,
"followers" => Self::Followers,
"none" => Self::None,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ActivitySettingsShareActivity<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ActivitySettingsShareActivity<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ActivitySettingsShareActivity<'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 ActivitySettingsShareActivity<'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 ActivitySettingsShareActivity<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ActivitySettingsShareActivity<'_> {
type Output = ActivitySettingsShareActivity<'static>;
fn into_static(self) -> Self::Output {
match self {
ActivitySettingsShareActivity::All => ActivitySettingsShareActivity::All,
ActivitySettingsShareActivity::Followers => {
ActivitySettingsShareActivity::Followers
}
ActivitySettingsShareActivity::None => ActivitySettingsShareActivity::None,
ActivitySettingsShareActivity::Other(v) => {
ActivitySettingsShareActivity::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct AspectRatio<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CollectionItem<'a> {
pub added_at: Datetime,
pub order: i64,
#[serde(borrow)]
pub uri: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CollectionView<'a> {
#[serde(borrow)]
pub author: social_showcase::ProfileView<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub cover_image: Option<BlobRef<'a>>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub description: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub item_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub items: Option<Vec<social_showcase::ItemView<'a>>>,
#[serde(borrow)]
pub name: CowStr<'a>,
#[serde(borrow)]
pub tags: Vec<CowStr<'a>>,
#[serde(borrow)]
pub r#type: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(borrow)]
pub visibility: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct DisplaySettings<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub grid_layout: Option<DisplaySettingsGridLayout<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub theme: Option<DisplaySettingsTheme<'a>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DisplaySettingsGridLayout<'a> {
Compact,
Spacious,
Other(CowStr<'a>),
}
impl<'a> DisplaySettingsGridLayout<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Compact => "compact",
Self::Spacious => "spacious",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for DisplaySettingsGridLayout<'a> {
fn from(s: &'a str) -> Self {
match s {
"compact" => Self::Compact,
"spacious" => Self::Spacious,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for DisplaySettingsGridLayout<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"compact" => Self::Compact,
"spacious" => Self::Spacious,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for DisplaySettingsGridLayout<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for DisplaySettingsGridLayout<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for DisplaySettingsGridLayout<'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 DisplaySettingsGridLayout<'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 DisplaySettingsGridLayout<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for DisplaySettingsGridLayout<'_> {
type Output = DisplaySettingsGridLayout<'static>;
fn into_static(self) -> Self::Output {
match self {
DisplaySettingsGridLayout::Compact => DisplaySettingsGridLayout::Compact,
DisplaySettingsGridLayout::Spacious => DisplaySettingsGridLayout::Spacious,
DisplaySettingsGridLayout::Other(v) => {
DisplaySettingsGridLayout::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DisplaySettingsTheme<'a> {
Light,
Dark,
Auto,
Other(CowStr<'a>),
}
impl<'a> DisplaySettingsTheme<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Light => "light",
Self::Dark => "dark",
Self::Auto => "auto",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for DisplaySettingsTheme<'a> {
fn from(s: &'a str) -> Self {
match s {
"light" => Self::Light,
"dark" => Self::Dark,
"auto" => Self::Auto,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for DisplaySettingsTheme<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"light" => Self::Light,
"dark" => Self::Dark,
"auto" => Self::Auto,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for DisplaySettingsTheme<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for DisplaySettingsTheme<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for DisplaySettingsTheme<'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 DisplaySettingsTheme<'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 DisplaySettingsTheme<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for DisplaySettingsTheme<'_> {
type Output = DisplaySettingsTheme<'static>;
fn into_static(self) -> Self::Output {
match self {
DisplaySettingsTheme::Light => DisplaySettingsTheme::Light,
DisplaySettingsTheme::Dark => DisplaySettingsTheme::Dark,
DisplaySettingsTheme::Auto => DisplaySettingsTheme::Auto,
DisplaySettingsTheme::Other(v) => {
DisplaySettingsTheme::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ItemImage<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub alt: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub aspect_ratio: Option<social_showcase::AspectRatio<'a>>,
#[serde(borrow)]
pub blob: BlobRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ItemView<'a> {
#[serde(borrow)]
pub author: social_showcase::ProfileView<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub category: Option<CowStr<'a>>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub description: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub external_link: Option<UriValue<'a>>,
#[serde(borrow)]
pub images: Vec<social_showcase::ItemImage<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub metadata: Option<Data<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reaction_count: Option<i64>,
#[serde(borrow)]
pub tags: Vec<CowStr<'a>>,
#[serde(borrow)]
pub title: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(borrow)]
pub visibility: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct NotificationSettings<'a> {
pub comments: bool,
pub follows: bool,
pub reactions: bool,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PrivacySettings<'a> {
pub allow_comments: bool,
pub allow_reactions: bool,
pub indexable: bool,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ProfileView<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub avatar: Option<BlobRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub banner: Option<BlobRef<'a>>,
#[serde(borrow)]
pub did: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub display_name: Option<CowStr<'a>>,
#[serde(borrow)]
pub handle: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<Vec<CowStr<'a>>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReactionSubject<'a> {
#[serde(borrow)]
pub cid: Cid<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReactionView<'a> {
#[serde(borrow)]
pub actor: social_showcase::ProfileView<'a>,
pub created_at: Datetime,
#[serde(borrow)]
pub subject: social_showcase::ReactionSubject<'a>,
#[serde(borrow)]
pub r#type: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ShowcaseItem<'a> {
pub added_at: Datetime,
pub order: i64,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct VisibilitySettings<'a> {
#[serde(borrow)]
pub default_collection_visibility: VisibilitySettingsDefaultCollectionVisibility<'a>,
#[serde(borrow)]
pub default_item_visibility: VisibilitySettingsDefaultItemVisibility<'a>,
#[serde(borrow)]
pub profile_visibility: VisibilitySettingsProfileVisibility<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VisibilitySettingsDefaultCollectionVisibility<'a> {
Public,
Private,
Other(CowStr<'a>),
}
impl<'a> VisibilitySettingsDefaultCollectionVisibility<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Private => "private",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for VisibilitySettingsDefaultCollectionVisibility<'a> {
fn from(s: &'a str) -> Self {
match s {
"public" => Self::Public,
"private" => Self::Private,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for VisibilitySettingsDefaultCollectionVisibility<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"public" => Self::Public,
"private" => Self::Private,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for VisibilitySettingsDefaultCollectionVisibility<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for VisibilitySettingsDefaultCollectionVisibility<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for VisibilitySettingsDefaultCollectionVisibility<'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 VisibilitySettingsDefaultCollectionVisibility<'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 VisibilitySettingsDefaultCollectionVisibility<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for VisibilitySettingsDefaultCollectionVisibility<'_> {
type Output = VisibilitySettingsDefaultCollectionVisibility<'static>;
fn into_static(self) -> Self::Output {
match self {
VisibilitySettingsDefaultCollectionVisibility::Public => {
VisibilitySettingsDefaultCollectionVisibility::Public
}
VisibilitySettingsDefaultCollectionVisibility::Private => {
VisibilitySettingsDefaultCollectionVisibility::Private
}
VisibilitySettingsDefaultCollectionVisibility::Other(v) => {
VisibilitySettingsDefaultCollectionVisibility::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VisibilitySettingsDefaultItemVisibility<'a> {
Public,
Unlisted,
Private,
Other(CowStr<'a>),
}
impl<'a> VisibilitySettingsDefaultItemVisibility<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Unlisted => "unlisted",
Self::Private => "private",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for VisibilitySettingsDefaultItemVisibility<'a> {
fn from(s: &'a str) -> Self {
match s {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
"private" => Self::Private,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for VisibilitySettingsDefaultItemVisibility<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
"private" => Self::Private,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for VisibilitySettingsDefaultItemVisibility<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for VisibilitySettingsDefaultItemVisibility<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for VisibilitySettingsDefaultItemVisibility<'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 VisibilitySettingsDefaultItemVisibility<'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 VisibilitySettingsDefaultItemVisibility<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for VisibilitySettingsDefaultItemVisibility<'_> {
type Output = VisibilitySettingsDefaultItemVisibility<'static>;
fn into_static(self) -> Self::Output {
match self {
VisibilitySettingsDefaultItemVisibility::Public => {
VisibilitySettingsDefaultItemVisibility::Public
}
VisibilitySettingsDefaultItemVisibility::Unlisted => {
VisibilitySettingsDefaultItemVisibility::Unlisted
}
VisibilitySettingsDefaultItemVisibility::Private => {
VisibilitySettingsDefaultItemVisibility::Private
}
VisibilitySettingsDefaultItemVisibility::Other(v) => {
VisibilitySettingsDefaultItemVisibility::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VisibilitySettingsProfileVisibility<'a> {
Public,
Unlisted,
Private,
Other(CowStr<'a>),
}
impl<'a> VisibilitySettingsProfileVisibility<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Unlisted => "unlisted",
Self::Private => "private",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for VisibilitySettingsProfileVisibility<'a> {
fn from(s: &'a str) -> Self {
match s {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
"private" => Self::Private,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for VisibilitySettingsProfileVisibility<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
"private" => Self::Private,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for VisibilitySettingsProfileVisibility<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for VisibilitySettingsProfileVisibility<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for VisibilitySettingsProfileVisibility<'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 VisibilitySettingsProfileVisibility<'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 VisibilitySettingsProfileVisibility<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for VisibilitySettingsProfileVisibility<'_> {
type Output = VisibilitySettingsProfileVisibility<'static>;
fn into_static(self) -> Self::Output {
match self {
VisibilitySettingsProfileVisibility::Public => {
VisibilitySettingsProfileVisibility::Public
}
VisibilitySettingsProfileVisibility::Unlisted => {
VisibilitySettingsProfileVisibility::Unlisted
}
VisibilitySettingsProfileVisibility::Private => {
VisibilitySettingsProfileVisibility::Private
}
VisibilitySettingsProfileVisibility::Other(v) => {
VisibilitySettingsProfileVisibility::Other(v.into_static())
}
}
}
}
impl<'a> LexiconSchema for ActivitySettings<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"activitySettings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.share_activity;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("share_activity"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for AspectRatio<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"aspectRatio"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.height {
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("height"),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.width {
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("width"),
min: 1i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for CollectionItem<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"collectionItem"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.uri;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 8192usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("uri"),
max: 8192usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for CollectionView<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"collectionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("description"),
max: 1000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.name;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 200usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 200usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.r#type;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 20usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("type"),
max: 20usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.visibility;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("visibility"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DisplaySettings<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"displaySettings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.grid_layout {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("grid_layout"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.theme {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("theme"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for ItemImage<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"itemImage"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.alt {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 300usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("alt"),
max: 300usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.blob;
{
let size = value.blob().size;
if size > 5000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("blob"),
max: 5000000usize,
actual: size,
});
}
}
}
{
let value = &self.blob;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/png", "image/jpeg", "image/webp"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("blob"),
accepted: vec![
"image/png".to_string(), "image/jpeg".to_string(),
"image/webp".to_string()
],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for ItemView<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"itemView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.category {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("category"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 3000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("description"),
max: 3000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.external_link {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2048usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("external_link"),
max: 2048usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 300usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("title"),
max: 300usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.visibility;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("visibility"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for NotificationSettings<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"notificationSettings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for PrivacySettings<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"privacySettings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ProfileView<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"profileView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.did;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2048usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("did"),
max: 2048usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.display_name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("display_name"),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.handle;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 253usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("handle"),
max: 253usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for ReactionSubject<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"reactionSubject"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ReactionView<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"reactionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.r#type;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("type"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for ShowcaseItem<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"showcaseItem"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for VisibilitySettings<'a> {
fn nsid() -> &'static str {
"social.showcase.defs"
}
fn def_name() -> &'static str {
"visibilitySettings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_showcase_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.default_collection_visibility;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("default_collection_visibility"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.default_item_visibility;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("default_item_visibility"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.profile_visibility;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("profile_visibility"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
fn _default_activity_settings_retention_days() -> i64 {
90i64
}
pub mod activity_settings_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 RetentionDays;
type ShareNewItems;
type ShareActivity;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type RetentionDays = Unset;
type ShareNewItems = Unset;
type ShareActivity = Unset;
}
pub struct SetRetentionDays<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRetentionDays<S> {}
impl<S: State> State for SetRetentionDays<S> {
type RetentionDays = Set<members::retention_days>;
type ShareNewItems = S::ShareNewItems;
type ShareActivity = S::ShareActivity;
}
pub struct SetShareNewItems<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetShareNewItems<S> {}
impl<S: State> State for SetShareNewItems<S> {
type RetentionDays = S::RetentionDays;
type ShareNewItems = Set<members::share_new_items>;
type ShareActivity = S::ShareActivity;
}
pub struct SetShareActivity<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetShareActivity<S> {}
impl<S: State> State for SetShareActivity<S> {
type RetentionDays = S::RetentionDays;
type ShareNewItems = S::ShareNewItems;
type ShareActivity = Set<members::share_activity>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct retention_days(());
pub struct share_new_items(());
pub struct share_activity(());
}
}
pub struct ActivitySettingsBuilder<'a, S: activity_settings_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<ActivitySettingsShareActivity<'a>>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ActivitySettings<'a> {
pub fn new() -> ActivitySettingsBuilder<'a, activity_settings_state::Empty> {
ActivitySettingsBuilder::new()
}
}
impl<'a> ActivitySettingsBuilder<'a, activity_settings_state::Empty> {
pub fn new() -> Self {
ActivitySettingsBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySettingsBuilder<'a, S>
where
S: activity_settings_state::State,
S::RetentionDays: activity_settings_state::IsUnset,
{
pub fn retention_days(
mut self,
value: impl Into<i64>,
) -> ActivitySettingsBuilder<'a, activity_settings_state::SetRetentionDays<S>> {
self._fields.0 = Option::Some(value.into());
ActivitySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySettingsBuilder<'a, S>
where
S: activity_settings_state::State,
S::ShareActivity: activity_settings_state::IsUnset,
{
pub fn share_activity(
mut self,
value: impl Into<ActivitySettingsShareActivity<'a>>,
) -> ActivitySettingsBuilder<'a, activity_settings_state::SetShareActivity<S>> {
self._fields.1 = Option::Some(value.into());
ActivitySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySettingsBuilder<'a, S>
where
S: activity_settings_state::State,
S::ShareNewItems: activity_settings_state::IsUnset,
{
pub fn share_new_items(
mut self,
value: impl Into<bool>,
) -> ActivitySettingsBuilder<'a, activity_settings_state::SetShareNewItems<S>> {
self._fields.2 = Option::Some(value.into());
ActivitySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ActivitySettingsBuilder<'a, S>
where
S: activity_settings_state::State,
S::RetentionDays: activity_settings_state::IsSet,
S::ShareNewItems: activity_settings_state::IsSet,
S::ShareActivity: activity_settings_state::IsSet,
{
pub fn build(self) -> ActivitySettings<'a> {
ActivitySettings {
retention_days: self._fields.0.unwrap(),
share_activity: self._fields.1.unwrap(),
share_new_items: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ActivitySettings<'a> {
ActivitySettings {
retention_days: self._fields.0.unwrap(),
share_activity: self._fields.1.unwrap(),
share_new_items: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_social_showcase_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("social.showcase.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("activitySettings"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Activity sharing preferences"),
),
required: Some(
vec![
SmolStr::new_static("shareNewItems"),
SmolStr::new_static("shareActivity"),
SmolStr::new_static("retentionDays")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("retentionDays"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("shareActivity"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Who sees your activity feed"),
),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("shareNewItems"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("aspectRatio"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Image aspect ratio")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("height"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("width"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("collectionItem"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Reference to an item in a collection"),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("addedAt"),
SmolStr::new_static("order")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("addedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("order"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI reference to item (always shows latest version)",
),
),
max_length: Some(8192usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("collectionView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("View of a collection with items"),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("name"), SmolStr::new_static("tags"),
SmolStr::new_static("type"),
SmolStr::new_static("visibility"),
SmolStr::new_static("author"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#profileView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("coverImage"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString {
max_length: Some(1000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("itemCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("items"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#itemView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
max_length: Some(200usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
LexObjectProperty::String(LexString {
max_length: Some(20usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("visibility"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("displaySettings"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Display preferences")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("gridLayout"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("theme"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("itemImage"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Image embedded in an item")),
required: Some(vec![SmolStr::new_static("blob")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Alt text for accessibility"),
),
max_length: Some(300usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("aspectRatio"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#aspectRatio"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("blob"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("itemView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("View of an item with metadata"),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("title"), SmolStr::new_static("tags"),
SmolStr::new_static("images"),
SmolStr::new_static("visibility"),
SmolStr::new_static("author"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#profileView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("category"),
LexObjectProperty::String(LexString {
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString {
max_length: Some(3000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("externalLink"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
max_length: Some(2048usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("images"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#itemImage"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("metadata"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactionCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString {
max_length: Some(300usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("visibility"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notificationSettings"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Notification preferences")),
required: Some(
vec![
SmolStr::new_static("reactions"),
SmolStr::new_static("follows"),
SmolStr::new_static("comments")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("comments"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("follows"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactions"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("privacySettings"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Privacy preferences")),
required: Some(
vec![
SmolStr::new_static("allowReactions"),
SmolStr::new_static("allowComments"),
SmolStr::new_static("indexable")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("allowComments"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("allowReactions"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexable"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("profileView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("View of a user profile")),
required: Some(
vec![SmolStr::new_static("did"), SmolStr::new_static("handle")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("avatar"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("banner"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
max_length: Some(2048usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("displayName"),
LexObjectProperty::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("handle"),
LexObjectProperty::String(LexString {
max_length: Some(253usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactionSubject"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Subject of a reaction")),
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reactionView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("View of a reaction to content"),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("actor"),
SmolStr::new_static("subject"), SmolStr::new_static("type"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("actor"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#profileView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subject"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#reactionSubject"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Emoji shortcode")),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("showcaseItem"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A reference to an item featured in a user's showcase (hydrated at read time)",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("addedAt"),
SmolStr::new_static("order")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("addedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("order"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI reference to the item (e.g., at://did:plc:.../social.showcase.library.item/abc123)",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("visibilitySettings"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Visibility preferences")),
required: Some(
vec![
SmolStr::new_static("profileVisibility"),
SmolStr::new_static("defaultItemVisibility"),
SmolStr::new_static("defaultCollectionVisibility")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("defaultCollectionVisibility"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("defaultItemVisibility"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("profileVisibility"),
LexObjectProperty::String(LexString {
max_length: Some(10usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod collection_item_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 Order;
type AddedAt;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Order = Unset;
type AddedAt = Unset;
type Uri = Unset;
}
pub struct SetOrder<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetOrder<S> {}
impl<S: State> State for SetOrder<S> {
type Order = Set<members::order>;
type AddedAt = S::AddedAt;
type Uri = S::Uri;
}
pub struct SetAddedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAddedAt<S> {}
impl<S: State> State for SetAddedAt<S> {
type Order = S::Order;
type AddedAt = Set<members::added_at>;
type Uri = S::Uri;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Order = S::Order;
type AddedAt = S::AddedAt;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct order(());
pub struct added_at(());
pub struct uri(());
}
}
pub struct CollectionItemBuilder<'a, S: collection_item_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>, Option<i64>, Option<CowStr<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> CollectionItem<'a> {
pub fn new() -> CollectionItemBuilder<'a, collection_item_state::Empty> {
CollectionItemBuilder::new()
}
}
impl<'a> CollectionItemBuilder<'a, collection_item_state::Empty> {
pub fn new() -> Self {
CollectionItemBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionItemBuilder<'a, S>
where
S: collection_item_state::State,
S::AddedAt: collection_item_state::IsUnset,
{
pub fn added_at(
mut self,
value: impl Into<Datetime>,
) -> CollectionItemBuilder<'a, collection_item_state::SetAddedAt<S>> {
self._fields.0 = Option::Some(value.into());
CollectionItemBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionItemBuilder<'a, S>
where
S: collection_item_state::State,
S::Order: collection_item_state::IsUnset,
{
pub fn order(
mut self,
value: impl Into<i64>,
) -> CollectionItemBuilder<'a, collection_item_state::SetOrder<S>> {
self._fields.1 = Option::Some(value.into());
CollectionItemBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionItemBuilder<'a, S>
where
S: collection_item_state::State,
S::Uri: collection_item_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<CowStr<'a>>,
) -> CollectionItemBuilder<'a, collection_item_state::SetUri<S>> {
self._fields.2 = Option::Some(value.into());
CollectionItemBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionItemBuilder<'a, S>
where
S: collection_item_state::State,
S::Order: collection_item_state::IsSet,
S::AddedAt: collection_item_state::IsSet,
S::Uri: collection_item_state::IsSet,
{
pub fn build(self) -> CollectionItem<'a> {
CollectionItem {
added_at: self._fields.0.unwrap(),
order: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> CollectionItem<'a> {
CollectionItem {
added_at: self._fields.0.unwrap(),
order: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod collection_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Name;
type Type;
type Uri;
type Cid;
type Tags;
type Author;
type CreatedAt;
type Visibility;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type Type = Unset;
type Uri = Unset;
type Cid = Unset;
type Tags = Unset;
type Author = Unset;
type CreatedAt = Unset;
type Visibility = Unset;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Name = Set<members::name>;
type Type = S::Type;
type Uri = S::Uri;
type Cid = S::Cid;
type Tags = S::Tags;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
type Visibility = S::Visibility;
}
pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetType<S> {}
impl<S: State> State for SetType<S> {
type Name = S::Name;
type Type = Set<members::r#type>;
type Uri = S::Uri;
type Cid = S::Cid;
type Tags = S::Tags;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
type Visibility = S::Visibility;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Name = S::Name;
type Type = S::Type;
type Uri = Set<members::uri>;
type Cid = S::Cid;
type Tags = S::Tags;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
type Visibility = S::Visibility;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Name = S::Name;
type Type = S::Type;
type Uri = S::Uri;
type Cid = Set<members::cid>;
type Tags = S::Tags;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
type Visibility = S::Visibility;
}
pub struct SetTags<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTags<S> {}
impl<S: State> State for SetTags<S> {
type Name = S::Name;
type Type = S::Type;
type Uri = S::Uri;
type Cid = S::Cid;
type Tags = Set<members::tags>;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
type Visibility = S::Visibility;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Name = S::Name;
type Type = S::Type;
type Uri = S::Uri;
type Cid = S::Cid;
type Tags = S::Tags;
type Author = Set<members::author>;
type CreatedAt = S::CreatedAt;
type Visibility = S::Visibility;
}
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 Name = S::Name;
type Type = S::Type;
type Uri = S::Uri;
type Cid = S::Cid;
type Tags = S::Tags;
type Author = S::Author;
type CreatedAt = Set<members::created_at>;
type Visibility = S::Visibility;
}
pub struct SetVisibility<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetVisibility<S> {}
impl<S: State> State for SetVisibility<S> {
type Name = S::Name;
type Type = S::Type;
type Uri = S::Uri;
type Cid = S::Cid;
type Tags = S::Tags;
type Author = S::Author;
type CreatedAt = S::CreatedAt;
type Visibility = Set<members::visibility>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct r#type(());
pub struct uri(());
pub struct cid(());
pub struct tags(());
pub struct author(());
pub struct created_at(());
pub struct visibility(());
}
}
pub struct CollectionViewBuilder<'a, S: collection_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<social_showcase::ProfileView<'a>>,
Option<Cid<'a>>,
Option<BlobRef<'a>>,
Option<Datetime>,
Option<CowStr<'a>>,
Option<i64>,
Option<Vec<social_showcase::ItemView<'a>>>,
Option<CowStr<'a>>,
Option<Vec<CowStr<'a>>>,
Option<CowStr<'a>>,
Option<Datetime>,
Option<AtUri<'a>>,
Option<CowStr<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> CollectionView<'a> {
pub fn new() -> CollectionViewBuilder<'a, collection_view_state::Empty> {
CollectionViewBuilder::new()
}
}
impl<'a> CollectionViewBuilder<'a, collection_view_state::Empty> {
pub fn new() -> Self {
CollectionViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Author: collection_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<social_showcase::ProfileView<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Cid: collection_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn cover_image(mut self, value: impl Into<Option<BlobRef<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_cover_image(mut self, value: Option<BlobRef<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::CreatedAt: collection_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> CollectionViewBuilder<'a, collection_view_state::SetCreatedAt<S>> {
self._fields.3 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn description(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn item_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_item_count(mut self, value: Option<i64>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn items(
mut self,
value: impl Into<Option<Vec<social_showcase::ItemView<'a>>>>,
) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_items(
mut self,
value: Option<Vec<social_showcase::ItemView<'a>>>,
) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Name: collection_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetName<S>> {
self._fields.7 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Tags: collection_view_state::IsUnset,
{
pub fn tags(
mut self,
value: impl Into<Vec<CowStr<'a>>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetTags<S>> {
self._fields.8 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Type: collection_view_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<CowStr<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetType<S>> {
self._fields.9 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.10 = value;
self
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Uri: collection_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetUri<S>> {
self._fields.11 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Visibility: collection_view_state::IsUnset,
{
pub fn visibility(
mut self,
value: impl Into<CowStr<'a>>,
) -> CollectionViewBuilder<'a, collection_view_state::SetVisibility<S>> {
self._fields.12 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CollectionViewBuilder<'a, S>
where
S: collection_view_state::State,
S::Name: collection_view_state::IsSet,
S::Type: collection_view_state::IsSet,
S::Uri: collection_view_state::IsSet,
S::Cid: collection_view_state::IsSet,
S::Tags: collection_view_state::IsSet,
S::Author: collection_view_state::IsSet,
S::CreatedAt: collection_view_state::IsSet,
S::Visibility: collection_view_state::IsSet,
{
pub fn build(self) -> CollectionView<'a> {
CollectionView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
cover_image: self._fields.2,
created_at: self._fields.3.unwrap(),
description: self._fields.4,
item_count: self._fields.5,
items: self._fields.6,
name: self._fields.7.unwrap(),
tags: self._fields.8.unwrap(),
r#type: self._fields.9.unwrap(),
updated_at: self._fields.10,
uri: self._fields.11.unwrap(),
visibility: self._fields.12.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> CollectionView<'a> {
CollectionView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
cover_image: self._fields.2,
created_at: self._fields.3.unwrap(),
description: self._fields.4,
item_count: self._fields.5,
items: self._fields.6,
name: self._fields.7.unwrap(),
tags: self._fields.8.unwrap(),
r#type: self._fields.9.unwrap(),
updated_at: self._fields.10,
uri: self._fields.11.unwrap(),
visibility: self._fields.12.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod item_image_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Blob;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Blob = Unset;
}
pub struct SetBlob<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlob<S> {}
impl<S: State> State for SetBlob<S> {
type Blob = Set<members::blob>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct blob(());
}
}
pub struct ItemImageBuilder<'a, S: item_image_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<CowStr<'a>>,
Option<social_showcase::AspectRatio<'a>>,
Option<BlobRef<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ItemImage<'a> {
pub fn new() -> ItemImageBuilder<'a, item_image_state::Empty> {
ItemImageBuilder::new()
}
}
impl<'a> ItemImageBuilder<'a, item_image_state::Empty> {
pub fn new() -> Self {
ItemImageBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: item_image_state::State> ItemImageBuilder<'a, S> {
pub fn alt(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S: item_image_state::State> ItemImageBuilder<'a, S> {
pub fn aspect_ratio(
mut self,
value: impl Into<Option<social_showcase::AspectRatio<'a>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_aspect_ratio(
mut self,
value: Option<social_showcase::AspectRatio<'a>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> ItemImageBuilder<'a, S>
where
S: item_image_state::State,
S::Blob: item_image_state::IsUnset,
{
pub fn blob(
mut self,
value: impl Into<BlobRef<'a>>,
) -> ItemImageBuilder<'a, item_image_state::SetBlob<S>> {
self._fields.2 = Option::Some(value.into());
ItemImageBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ItemImageBuilder<'a, S>
where
S: item_image_state::State,
S::Blob: item_image_state::IsSet,
{
pub fn build(self) -> ItemImage<'a> {
ItemImage {
alt: self._fields.0,
aspect_ratio: self._fields.1,
blob: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ItemImage<'a> {
ItemImage {
alt: self._fields.0,
aspect_ratio: self._fields.1,
blob: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod item_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Visibility;
type Images;
type Author;
type Cid;
type Tags;
type Uri;
type Title;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Visibility = Unset;
type Images = Unset;
type Author = Unset;
type Cid = Unset;
type Tags = Unset;
type Uri = Unset;
type Title = Unset;
type CreatedAt = Unset;
}
pub struct SetVisibility<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetVisibility<S> {}
impl<S: State> State for SetVisibility<S> {
type Visibility = Set<members::visibility>;
type Images = S::Images;
type Author = S::Author;
type Cid = S::Cid;
type Tags = S::Tags;
type Uri = S::Uri;
type Title = S::Title;
type CreatedAt = S::CreatedAt;
}
pub struct SetImages<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetImages<S> {}
impl<S: State> State for SetImages<S> {
type Visibility = S::Visibility;
type Images = Set<members::images>;
type Author = S::Author;
type Cid = S::Cid;
type Tags = S::Tags;
type Uri = S::Uri;
type Title = S::Title;
type CreatedAt = S::CreatedAt;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Visibility = S::Visibility;
type Images = S::Images;
type Author = Set<members::author>;
type Cid = S::Cid;
type Tags = S::Tags;
type Uri = S::Uri;
type Title = S::Title;
type CreatedAt = S::CreatedAt;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Visibility = S::Visibility;
type Images = S::Images;
type Author = S::Author;
type Cid = Set<members::cid>;
type Tags = S::Tags;
type Uri = S::Uri;
type Title = S::Title;
type CreatedAt = S::CreatedAt;
}
pub struct SetTags<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTags<S> {}
impl<S: State> State for SetTags<S> {
type Visibility = S::Visibility;
type Images = S::Images;
type Author = S::Author;
type Cid = S::Cid;
type Tags = Set<members::tags>;
type Uri = S::Uri;
type Title = S::Title;
type CreatedAt = S::CreatedAt;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Visibility = S::Visibility;
type Images = S::Images;
type Author = S::Author;
type Cid = S::Cid;
type Tags = S::Tags;
type Uri = Set<members::uri>;
type Title = S::Title;
type CreatedAt = S::CreatedAt;
}
pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTitle<S> {}
impl<S: State> State for SetTitle<S> {
type Visibility = S::Visibility;
type Images = S::Images;
type Author = S::Author;
type Cid = S::Cid;
type Tags = S::Tags;
type Uri = S::Uri;
type Title = Set<members::title>;
type CreatedAt = S::CreatedAt;
}
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 Visibility = S::Visibility;
type Images = S::Images;
type Author = S::Author;
type Cid = S::Cid;
type Tags = S::Tags;
type Uri = S::Uri;
type Title = S::Title;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct visibility(());
pub struct images(());
pub struct author(());
pub struct cid(());
pub struct tags(());
pub struct uri(());
pub struct title(());
pub struct created_at(());
}
}
pub struct ItemViewBuilder<'a, S: item_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<social_showcase::ProfileView<'a>>,
Option<CowStr<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<CowStr<'a>>,
Option<UriValue<'a>>,
Option<Vec<social_showcase::ItemImage<'a>>>,
Option<Data<'a>>,
Option<i64>,
Option<Vec<CowStr<'a>>>,
Option<CowStr<'a>>,
Option<Datetime>,
Option<AtUri<'a>>,
Option<CowStr<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ItemView<'a> {
pub fn new() -> ItemViewBuilder<'a, item_view_state::Empty> {
ItemViewBuilder::new()
}
}
impl<'a> ItemViewBuilder<'a, item_view_state::Empty> {
pub fn new() -> Self {
ItemViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Author: item_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<social_showcase::ProfileView<'a>>,
) -> ItemViewBuilder<'a, item_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: item_view_state::State> ItemViewBuilder<'a, S> {
pub fn category(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_category(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Cid: item_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> ItemViewBuilder<'a, item_view_state::SetCid<S>> {
self._fields.2 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::CreatedAt: item_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ItemViewBuilder<'a, item_view_state::SetCreatedAt<S>> {
self._fields.3 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: item_view_state::State> ItemViewBuilder<'a, S> {
pub fn description(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: item_view_state::State> ItemViewBuilder<'a, S> {
pub fn external_link(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_external_link(mut self, value: Option<UriValue<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Images: item_view_state::IsUnset,
{
pub fn images(
mut self,
value: impl Into<Vec<social_showcase::ItemImage<'a>>>,
) -> ItemViewBuilder<'a, item_view_state::SetImages<S>> {
self._fields.6 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: item_view_state::State> ItemViewBuilder<'a, S> {
pub fn metadata(mut self, value: impl Into<Option<Data<'a>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_metadata(mut self, value: Option<Data<'a>>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: item_view_state::State> ItemViewBuilder<'a, S> {
pub fn reaction_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_reaction_count(mut self, value: Option<i64>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Tags: item_view_state::IsUnset,
{
pub fn tags(
mut self,
value: impl Into<Vec<CowStr<'a>>>,
) -> ItemViewBuilder<'a, item_view_state::SetTags<S>> {
self._fields.9 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Title: item_view_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<CowStr<'a>>,
) -> ItemViewBuilder<'a, item_view_state::SetTitle<S>> {
self._fields.10 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: item_view_state::State> ItemViewBuilder<'a, S> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.11 = value;
self
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Uri: item_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ItemViewBuilder<'a, item_view_state::SetUri<S>> {
self._fields.12 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Visibility: item_view_state::IsUnset,
{
pub fn visibility(
mut self,
value: impl Into<CowStr<'a>>,
) -> ItemViewBuilder<'a, item_view_state::SetVisibility<S>> {
self._fields.13 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ItemViewBuilder<'a, S>
where
S: item_view_state::State,
S::Visibility: item_view_state::IsSet,
S::Images: item_view_state::IsSet,
S::Author: item_view_state::IsSet,
S::Cid: item_view_state::IsSet,
S::Tags: item_view_state::IsSet,
S::Uri: item_view_state::IsSet,
S::Title: item_view_state::IsSet,
S::CreatedAt: item_view_state::IsSet,
{
pub fn build(self) -> ItemView<'a> {
ItemView {
author: self._fields.0.unwrap(),
category: self._fields.1,
cid: self._fields.2.unwrap(),
created_at: self._fields.3.unwrap(),
description: self._fields.4,
external_link: self._fields.5,
images: self._fields.6.unwrap(),
metadata: self._fields.7,
reaction_count: self._fields.8,
tags: self._fields.9.unwrap(),
title: self._fields.10.unwrap(),
updated_at: self._fields.11,
uri: self._fields.12.unwrap(),
visibility: self._fields.13.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ItemView<'a> {
ItemView {
author: self._fields.0.unwrap(),
category: self._fields.1,
cid: self._fields.2.unwrap(),
created_at: self._fields.3.unwrap(),
description: self._fields.4,
external_link: self._fields.5,
images: self._fields.6.unwrap(),
metadata: self._fields.7,
reaction_count: self._fields.8,
tags: self._fields.9.unwrap(),
title: self._fields.10.unwrap(),
updated_at: self._fields.11,
uri: self._fields.12.unwrap(),
visibility: self._fields.13.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod notification_settings_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 Follows;
type Reactions;
type Comments;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Follows = Unset;
type Reactions = Unset;
type Comments = Unset;
}
pub struct SetFollows<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFollows<S> {}
impl<S: State> State for SetFollows<S> {
type Follows = Set<members::follows>;
type Reactions = S::Reactions;
type Comments = S::Comments;
}
pub struct SetReactions<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetReactions<S> {}
impl<S: State> State for SetReactions<S> {
type Follows = S::Follows;
type Reactions = Set<members::reactions>;
type Comments = S::Comments;
}
pub struct SetComments<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetComments<S> {}
impl<S: State> State for SetComments<S> {
type Follows = S::Follows;
type Reactions = S::Reactions;
type Comments = Set<members::comments>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct follows(());
pub struct reactions(());
pub struct comments(());
}
}
pub struct NotificationSettingsBuilder<'a, S: notification_settings_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<bool>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> NotificationSettings<'a> {
pub fn new() -> NotificationSettingsBuilder<'a, notification_settings_state::Empty> {
NotificationSettingsBuilder::new()
}
}
impl<'a> NotificationSettingsBuilder<'a, notification_settings_state::Empty> {
pub fn new() -> Self {
NotificationSettingsBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationSettingsBuilder<'a, S>
where
S: notification_settings_state::State,
S::Comments: notification_settings_state::IsUnset,
{
pub fn comments(
mut self,
value: impl Into<bool>,
) -> NotificationSettingsBuilder<'a, notification_settings_state::SetComments<S>> {
self._fields.0 = Option::Some(value.into());
NotificationSettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationSettingsBuilder<'a, S>
where
S: notification_settings_state::State,
S::Follows: notification_settings_state::IsUnset,
{
pub fn follows(
mut self,
value: impl Into<bool>,
) -> NotificationSettingsBuilder<'a, notification_settings_state::SetFollows<S>> {
self._fields.1 = Option::Some(value.into());
NotificationSettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationSettingsBuilder<'a, S>
where
S: notification_settings_state::State,
S::Reactions: notification_settings_state::IsUnset,
{
pub fn reactions(
mut self,
value: impl Into<bool>,
) -> NotificationSettingsBuilder<'a, notification_settings_state::SetReactions<S>> {
self._fields.2 = Option::Some(value.into());
NotificationSettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationSettingsBuilder<'a, S>
where
S: notification_settings_state::State,
S::Follows: notification_settings_state::IsSet,
S::Reactions: notification_settings_state::IsSet,
S::Comments: notification_settings_state::IsSet,
{
pub fn build(self) -> NotificationSettings<'a> {
NotificationSettings {
comments: self._fields.0.unwrap(),
follows: self._fields.1.unwrap(),
reactions: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> NotificationSettings<'a> {
NotificationSettings {
comments: self._fields.0.unwrap(),
follows: self._fields.1.unwrap(),
reactions: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod privacy_settings_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 Indexable;
type AllowReactions;
type AllowComments;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Indexable = Unset;
type AllowReactions = Unset;
type AllowComments = Unset;
}
pub struct SetIndexable<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexable<S> {}
impl<S: State> State for SetIndexable<S> {
type Indexable = Set<members::indexable>;
type AllowReactions = S::AllowReactions;
type AllowComments = S::AllowComments;
}
pub struct SetAllowReactions<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAllowReactions<S> {}
impl<S: State> State for SetAllowReactions<S> {
type Indexable = S::Indexable;
type AllowReactions = Set<members::allow_reactions>;
type AllowComments = S::AllowComments;
}
pub struct SetAllowComments<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAllowComments<S> {}
impl<S: State> State for SetAllowComments<S> {
type Indexable = S::Indexable;
type AllowReactions = S::AllowReactions;
type AllowComments = Set<members::allow_comments>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct indexable(());
pub struct allow_reactions(());
pub struct allow_comments(());
}
}
pub struct PrivacySettingsBuilder<'a, S: privacy_settings_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<bool>, Option<bool>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PrivacySettings<'a> {
pub fn new() -> PrivacySettingsBuilder<'a, privacy_settings_state::Empty> {
PrivacySettingsBuilder::new()
}
}
impl<'a> PrivacySettingsBuilder<'a, privacy_settings_state::Empty> {
pub fn new() -> Self {
PrivacySettingsBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PrivacySettingsBuilder<'a, S>
where
S: privacy_settings_state::State,
S::AllowComments: privacy_settings_state::IsUnset,
{
pub fn allow_comments(
mut self,
value: impl Into<bool>,
) -> PrivacySettingsBuilder<'a, privacy_settings_state::SetAllowComments<S>> {
self._fields.0 = Option::Some(value.into());
PrivacySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PrivacySettingsBuilder<'a, S>
where
S: privacy_settings_state::State,
S::AllowReactions: privacy_settings_state::IsUnset,
{
pub fn allow_reactions(
mut self,
value: impl Into<bool>,
) -> PrivacySettingsBuilder<'a, privacy_settings_state::SetAllowReactions<S>> {
self._fields.1 = Option::Some(value.into());
PrivacySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PrivacySettingsBuilder<'a, S>
where
S: privacy_settings_state::State,
S::Indexable: privacy_settings_state::IsUnset,
{
pub fn indexable(
mut self,
value: impl Into<bool>,
) -> PrivacySettingsBuilder<'a, privacy_settings_state::SetIndexable<S>> {
self._fields.2 = Option::Some(value.into());
PrivacySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PrivacySettingsBuilder<'a, S>
where
S: privacy_settings_state::State,
S::Indexable: privacy_settings_state::IsSet,
S::AllowReactions: privacy_settings_state::IsSet,
S::AllowComments: privacy_settings_state::IsSet,
{
pub fn build(self) -> PrivacySettings<'a> {
PrivacySettings {
allow_comments: self._fields.0.unwrap(),
allow_reactions: self._fields.1.unwrap(),
indexable: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> PrivacySettings<'a> {
PrivacySettings {
allow_comments: self._fields.0.unwrap(),
allow_reactions: self._fields.1.unwrap(),
indexable: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reaction_subject_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 Cid;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type Uri = Unset;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Cid = Set<members::cid>;
type Uri = S::Uri;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Cid = S::Cid;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct uri(());
}
}
pub struct ReactionSubjectBuilder<'a, S: reaction_subject_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Cid<'a>>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReactionSubject<'a> {
pub fn new() -> ReactionSubjectBuilder<'a, reaction_subject_state::Empty> {
ReactionSubjectBuilder::new()
}
}
impl<'a> ReactionSubjectBuilder<'a, reaction_subject_state::Empty> {
pub fn new() -> Self {
ReactionSubjectBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionSubjectBuilder<'a, S>
where
S: reaction_subject_state::State,
S::Cid: reaction_subject_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> ReactionSubjectBuilder<'a, reaction_subject_state::SetCid<S>> {
self._fields.0 = Option::Some(value.into());
ReactionSubjectBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionSubjectBuilder<'a, S>
where
S: reaction_subject_state::State,
S::Uri: reaction_subject_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ReactionSubjectBuilder<'a, reaction_subject_state::SetUri<S>> {
self._fields.1 = Option::Some(value.into());
ReactionSubjectBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionSubjectBuilder<'a, S>
where
S: reaction_subject_state::State,
S::Cid: reaction_subject_state::IsSet,
S::Uri: reaction_subject_state::IsSet,
{
pub fn build(self) -> ReactionSubject<'a> {
ReactionSubject {
cid: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ReactionSubject<'a> {
ReactionSubject {
cid: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reaction_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Uri;
type Actor;
type CreatedAt;
type Subject;
type Type;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Actor = Unset;
type CreatedAt = Unset;
type Subject = Unset;
type Type = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
type Actor = S::Actor;
type CreatedAt = S::CreatedAt;
type Subject = S::Subject;
type Type = S::Type;
}
pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetActor<S> {}
impl<S: State> State for SetActor<S> {
type Uri = S::Uri;
type Actor = Set<members::actor>;
type CreatedAt = S::CreatedAt;
type Subject = S::Subject;
type Type = S::Type;
}
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 Uri = S::Uri;
type Actor = S::Actor;
type CreatedAt = Set<members::created_at>;
type Subject = S::Subject;
type Type = S::Type;
}
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 Uri = S::Uri;
type Actor = S::Actor;
type CreatedAt = S::CreatedAt;
type Subject = Set<members::subject>;
type Type = S::Type;
}
pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetType<S> {}
impl<S: State> State for SetType<S> {
type Uri = S::Uri;
type Actor = S::Actor;
type CreatedAt = S::CreatedAt;
type Subject = S::Subject;
type Type = Set<members::r#type>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct actor(());
pub struct created_at(());
pub struct subject(());
pub struct r#type(());
}
}
pub struct ReactionViewBuilder<'a, S: reaction_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<social_showcase::ProfileView<'a>>,
Option<Datetime>,
Option<social_showcase::ReactionSubject<'a>>,
Option<CowStr<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReactionView<'a> {
pub fn new() -> ReactionViewBuilder<'a, reaction_view_state::Empty> {
ReactionViewBuilder::new()
}
}
impl<'a> ReactionViewBuilder<'a, reaction_view_state::Empty> {
pub fn new() -> Self {
ReactionViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionViewBuilder<'a, S>
where
S: reaction_view_state::State,
S::Actor: reaction_view_state::IsUnset,
{
pub fn actor(
mut self,
value: impl Into<social_showcase::ProfileView<'a>>,
) -> ReactionViewBuilder<'a, reaction_view_state::SetActor<S>> {
self._fields.0 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionViewBuilder<'a, S>
where
S: reaction_view_state::State,
S::CreatedAt: reaction_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ReactionViewBuilder<'a, reaction_view_state::SetCreatedAt<S>> {
self._fields.1 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionViewBuilder<'a, S>
where
S: reaction_view_state::State,
S::Subject: reaction_view_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<social_showcase::ReactionSubject<'a>>,
) -> ReactionViewBuilder<'a, reaction_view_state::SetSubject<S>> {
self._fields.2 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionViewBuilder<'a, S>
where
S: reaction_view_state::State,
S::Type: reaction_view_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<CowStr<'a>>,
) -> ReactionViewBuilder<'a, reaction_view_state::SetType<S>> {
self._fields.3 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionViewBuilder<'a, S>
where
S: reaction_view_state::State,
S::Uri: reaction_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ReactionViewBuilder<'a, reaction_view_state::SetUri<S>> {
self._fields.4 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReactionViewBuilder<'a, S>
where
S: reaction_view_state::State,
S::Uri: reaction_view_state::IsSet,
S::Actor: reaction_view_state::IsSet,
S::CreatedAt: reaction_view_state::IsSet,
S::Subject: reaction_view_state::IsSet,
S::Type: reaction_view_state::IsSet,
{
pub fn build(self) -> ReactionView<'a> {
ReactionView {
actor: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
subject: self._fields.2.unwrap(),
r#type: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ReactionView<'a> {
ReactionView {
actor: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
subject: self._fields.2.unwrap(),
r#type: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod showcase_item_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 Uri;
type Order;
type AddedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Order = Unset;
type AddedAt = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
type Order = S::Order;
type AddedAt = S::AddedAt;
}
pub struct SetOrder<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetOrder<S> {}
impl<S: State> State for SetOrder<S> {
type Uri = S::Uri;
type Order = Set<members::order>;
type AddedAt = S::AddedAt;
}
pub struct SetAddedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAddedAt<S> {}
impl<S: State> State for SetAddedAt<S> {
type Uri = S::Uri;
type Order = S::Order;
type AddedAt = Set<members::added_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct order(());
pub struct added_at(());
}
}
pub struct ShowcaseItemBuilder<'a, S: showcase_item_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>, Option<i64>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ShowcaseItem<'a> {
pub fn new() -> ShowcaseItemBuilder<'a, showcase_item_state::Empty> {
ShowcaseItemBuilder::new()
}
}
impl<'a> ShowcaseItemBuilder<'a, showcase_item_state::Empty> {
pub fn new() -> Self {
ShowcaseItemBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ShowcaseItemBuilder<'a, S>
where
S: showcase_item_state::State,
S::AddedAt: showcase_item_state::IsUnset,
{
pub fn added_at(
mut self,
value: impl Into<Datetime>,
) -> ShowcaseItemBuilder<'a, showcase_item_state::SetAddedAt<S>> {
self._fields.0 = Option::Some(value.into());
ShowcaseItemBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ShowcaseItemBuilder<'a, S>
where
S: showcase_item_state::State,
S::Order: showcase_item_state::IsUnset,
{
pub fn order(
mut self,
value: impl Into<i64>,
) -> ShowcaseItemBuilder<'a, showcase_item_state::SetOrder<S>> {
self._fields.1 = Option::Some(value.into());
ShowcaseItemBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ShowcaseItemBuilder<'a, S>
where
S: showcase_item_state::State,
S::Uri: showcase_item_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> ShowcaseItemBuilder<'a, showcase_item_state::SetUri<S>> {
self._fields.2 = Option::Some(value.into());
ShowcaseItemBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ShowcaseItemBuilder<'a, S>
where
S: showcase_item_state::State,
S::Uri: showcase_item_state::IsSet,
S::Order: showcase_item_state::IsSet,
S::AddedAt: showcase_item_state::IsSet,
{
pub fn build(self) -> ShowcaseItem<'a> {
ShowcaseItem {
added_at: self._fields.0.unwrap(),
order: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> ShowcaseItem<'a> {
ShowcaseItem {
added_at: self._fields.0.unwrap(),
order: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}