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::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::blob::BlobRef;
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::social_showcase;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ActivitySettings<S: BosStr = DefaultStr> {
#[serde(default = "_default_activity_settings_retention_days")]
pub retention_days: i64,
pub share_activity: ActivitySettingsShareActivity<S>,
pub share_new_items: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ActivitySettingsShareActivity<S: BosStr = DefaultStr> {
All,
Followers,
None,
Other(S),
}
impl<S: BosStr> ActivitySettingsShareActivity<S> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Followers => "followers",
Self::None => "none",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"all" => Self::All,
"followers" => Self::Followers,
"none" => Self::None,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ActivitySettingsShareActivity<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ActivitySettingsShareActivity<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ActivitySettingsShareActivity<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ActivitySettingsShareActivity<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for ActivitySettingsShareActivity<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ActivitySettingsShareActivity<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ActivitySettingsShareActivity<S::Output>;
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())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct AspectRatio<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct CollectionItem<S: BosStr = DefaultStr> {
pub added_at: Datetime,
pub order: i64,
pub uri: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct CollectionView<S: BosStr = DefaultStr> {
pub author: social_showcase::ProfileView<S>,
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cover_image: Option<BlobRef<S>>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub item_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<social_showcase::ItemView<S>>>,
pub name: S,
pub tags: Vec<S>,
pub r#type: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
pub uri: AtUri<S>,
pub visibility: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct DisplaySettings<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub grid_layout: Option<DisplaySettingsGridLayout<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub theme: Option<DisplaySettingsTheme<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DisplaySettingsGridLayout<S: BosStr = DefaultStr> {
Compact,
Spacious,
Other(S),
}
impl<S: BosStr> DisplaySettingsGridLayout<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Compact => "compact",
Self::Spacious => "spacious",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"compact" => Self::Compact,
"spacious" => Self::Spacious,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for DisplaySettingsGridLayout<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for DisplaySettingsGridLayout<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for DisplaySettingsGridLayout<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for DisplaySettingsGridLayout<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for DisplaySettingsGridLayout<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for DisplaySettingsGridLayout<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = DisplaySettingsGridLayout<S::Output>;
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<S: BosStr = DefaultStr> {
Light,
Dark,
Auto,
Other(S),
}
impl<S: BosStr> DisplaySettingsTheme<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Light => "light",
Self::Dark => "dark",
Self::Auto => "auto",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"light" => Self::Light,
"dark" => Self::Dark,
"auto" => Self::Auto,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for DisplaySettingsTheme<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for DisplaySettingsTheme<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for DisplaySettingsTheme<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for DisplaySettingsTheme<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for DisplaySettingsTheme<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for DisplaySettingsTheme<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = DisplaySettingsTheme<S::Output>;
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()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ItemImage<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub alt: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<social_showcase::AspectRatio<S>>,
pub blob: BlobRef<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ItemView<S: BosStr = DefaultStr> {
pub author: social_showcase::ProfileView<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub category: Option<S>,
pub cid: Cid<S>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub external_link: Option<UriValue<S>>,
pub images: Vec<social_showcase::ItemImage<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Data<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reaction_count: Option<i64>,
pub tags: Vec<S>,
pub title: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
pub uri: AtUri<S>,
pub visibility: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct NotificationSettings<S: BosStr = DefaultStr> {
pub comments: bool,
pub follows: bool,
pub reactions: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct PrivacySettings<S: BosStr = DefaultStr> {
pub allow_comments: bool,
pub allow_reactions: bool,
pub indexable: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ProfileView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<BlobRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub banner: Option<BlobRef<S>>,
pub did: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<S>,
pub handle: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ReactionSubject<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ReactionView<S: BosStr = DefaultStr> {
pub actor: social_showcase::ProfileView<S>,
pub created_at: Datetime,
pub subject: social_showcase::ReactionSubject<S>,
pub r#type: S,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ShowcaseItem<S: BosStr = DefaultStr> {
pub added_at: Datetime,
pub order: i64,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct VisibilitySettings<S: BosStr = DefaultStr> {
pub default_collection_visibility: VisibilitySettingsDefaultCollectionVisibility<S>,
pub default_item_visibility: VisibilitySettingsDefaultItemVisibility<S>,
pub profile_visibility: VisibilitySettingsProfileVisibility<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VisibilitySettingsDefaultCollectionVisibility<S: BosStr = DefaultStr> {
Public,
Private,
Other(S),
}
impl<S: BosStr> VisibilitySettingsDefaultCollectionVisibility<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Private => "private",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"public" => Self::Public,
"private" => Self::Private,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for VisibilitySettingsDefaultCollectionVisibility<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for VisibilitySettingsDefaultCollectionVisibility<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for VisibilitySettingsDefaultCollectionVisibility<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for VisibilitySettingsDefaultCollectionVisibility<S>
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for VisibilitySettingsDefaultCollectionVisibility<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for VisibilitySettingsDefaultCollectionVisibility<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = VisibilitySettingsDefaultCollectionVisibility<S::Output>;
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<S: BosStr = DefaultStr> {
Public,
Unlisted,
Private,
Other(S),
}
impl<S: BosStr> VisibilitySettingsDefaultItemVisibility<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Unlisted => "unlisted",
Self::Private => "private",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
"private" => Self::Private,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for VisibilitySettingsDefaultItemVisibility<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for VisibilitySettingsDefaultItemVisibility<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for VisibilitySettingsDefaultItemVisibility<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for VisibilitySettingsDefaultItemVisibility<S>
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for VisibilitySettingsDefaultItemVisibility<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for VisibilitySettingsDefaultItemVisibility<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = VisibilitySettingsDefaultItemVisibility<S::Output>;
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<S: BosStr = DefaultStr> {
Public,
Unlisted,
Private,
Other(S),
}
impl<S: BosStr> VisibilitySettingsProfileVisibility<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Unlisted => "unlisted",
Self::Private => "private",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
"private" => Self::Private,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for VisibilitySettingsProfileVisibility<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for VisibilitySettingsProfileVisibility<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for VisibilitySettingsProfileVisibility<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for VisibilitySettingsProfileVisibility<S>
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for VisibilitySettingsProfileVisibility<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for VisibilitySettingsProfileVisibility<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = VisibilitySettingsProfileVisibility<S::Output>;
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<S: BosStr> LexiconSchema for ActivitySettings<S> {
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<S: BosStr> LexiconSchema for AspectRatio<S> {
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<S: BosStr> LexiconSchema for CollectionItem<S> {
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<S: BosStr> LexiconSchema for CollectionView<S> {
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<S: BosStr> LexiconSchema for DisplaySettings<S> {
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<S: BosStr> LexiconSchema for ItemImage<S> {
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<S: BosStr> LexiconSchema for ItemView<S> {
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<S: BosStr> LexiconSchema for NotificationSettings<S> {
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<S: BosStr> LexiconSchema for PrivacySettings<S> {
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<S: BosStr> LexiconSchema for ProfileView<S> {
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<S: BosStr> LexiconSchema for ReactionSubject<S> {
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<S: BosStr> LexiconSchema for ReactionView<S> {
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<S: BosStr> LexiconSchema for ShowcaseItem<S> {
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<S: BosStr> LexiconSchema for VisibilitySettings<S> {
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::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRetentionDays<St> {}
impl<St: State> State for SetRetentionDays<St> {
type RetentionDays = Set<members::retention_days>;
type ShareNewItems = St::ShareNewItems;
type ShareActivity = St::ShareActivity;
}
pub struct SetShareNewItems<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetShareNewItems<St> {}
impl<St: State> State for SetShareNewItems<St> {
type RetentionDays = St::RetentionDays;
type ShareNewItems = Set<members::share_new_items>;
type ShareActivity = St::ShareActivity;
}
pub struct SetShareActivity<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetShareActivity<St> {}
impl<St: State> State for SetShareActivity<St> {
type RetentionDays = St::RetentionDays;
type ShareNewItems = St::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<S: BosStr, St: activity_settings_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<i64>,
Option<ActivitySettingsShareActivity<S>>,
Option<bool>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ActivitySettings<S> {
pub fn new() -> ActivitySettingsBuilder<S, activity_settings_state::Empty> {
ActivitySettingsBuilder::new()
}
}
impl<S: BosStr> ActivitySettingsBuilder<S, activity_settings_state::Empty> {
pub fn new() -> Self {
ActivitySettingsBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySettingsBuilder<S, St>
where
St: activity_settings_state::State,
St::RetentionDays: activity_settings_state::IsUnset,
{
pub fn retention_days(
mut self,
value: impl Into<i64>,
) -> ActivitySettingsBuilder<S, activity_settings_state::SetRetentionDays<St>> {
self._fields.0 = Option::Some(value.into());
ActivitySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySettingsBuilder<S, St>
where
St: activity_settings_state::State,
St::ShareActivity: activity_settings_state::IsUnset,
{
pub fn share_activity(
mut self,
value: impl Into<ActivitySettingsShareActivity<S>>,
) -> ActivitySettingsBuilder<S, activity_settings_state::SetShareActivity<St>> {
self._fields.1 = Option::Some(value.into());
ActivitySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySettingsBuilder<S, St>
where
St: activity_settings_state::State,
St::ShareNewItems: activity_settings_state::IsUnset,
{
pub fn share_new_items(
mut self,
value: impl Into<bool>,
) -> ActivitySettingsBuilder<S, activity_settings_state::SetShareNewItems<St>> {
self._fields.2 = Option::Some(value.into());
ActivitySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ActivitySettingsBuilder<S, St>
where
St: activity_settings_state::State,
St::RetentionDays: activity_settings_state::IsSet,
St::ShareNewItems: activity_settings_state::IsSet,
St::ShareActivity: activity_settings_state::IsSet,
{
pub fn build(self) -> ActivitySettings<S> {
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<SmolStr, Data<S>>) -> ActivitySettings<S> {
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> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Uri;
type AddedAt;
type Order;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type AddedAt = Unset;
type Order = Unset;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Uri = Set<members::uri>;
type AddedAt = St::AddedAt;
type Order = St::Order;
}
pub struct SetAddedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAddedAt<St> {}
impl<St: State> State for SetAddedAt<St> {
type Uri = St::Uri;
type AddedAt = Set<members::added_at>;
type Order = St::Order;
}
pub struct SetOrder<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetOrder<St> {}
impl<St: State> State for SetOrder<St> {
type Uri = St::Uri;
type AddedAt = St::AddedAt;
type Order = Set<members::order>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct added_at(());
pub struct order(());
}
}
pub struct CollectionItemBuilder<S: BosStr, St: collection_item_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Datetime>, Option<i64>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> CollectionItem<S> {
pub fn new() -> CollectionItemBuilder<S, collection_item_state::Empty> {
CollectionItemBuilder::new()
}
}
impl<S: BosStr> CollectionItemBuilder<S, collection_item_state::Empty> {
pub fn new() -> Self {
CollectionItemBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionItemBuilder<S, St>
where
St: collection_item_state::State,
St::AddedAt: collection_item_state::IsUnset,
{
pub fn added_at(
mut self,
value: impl Into<Datetime>,
) -> CollectionItemBuilder<S, collection_item_state::SetAddedAt<St>> {
self._fields.0 = Option::Some(value.into());
CollectionItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionItemBuilder<S, St>
where
St: collection_item_state::State,
St::Order: collection_item_state::IsUnset,
{
pub fn order(
mut self,
value: impl Into<i64>,
) -> CollectionItemBuilder<S, collection_item_state::SetOrder<St>> {
self._fields.1 = Option::Some(value.into());
CollectionItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionItemBuilder<S, St>
where
St: collection_item_state::State,
St::Uri: collection_item_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<S>,
) -> CollectionItemBuilder<S, collection_item_state::SetUri<St>> {
self._fields.2 = Option::Some(value.into());
CollectionItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionItemBuilder<S, St>
where
St: collection_item_state::State,
St::Uri: collection_item_state::IsSet,
St::AddedAt: collection_item_state::IsSet,
St::Order: collection_item_state::IsSet,
{
pub fn build(self) -> CollectionItem<S> {
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<SmolStr, Data<S>>) -> CollectionItem<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Visibility;
type Tags;
type Type;
type CreatedAt;
type Uri;
type Name;
type Cid;
type Author;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Visibility = Unset;
type Tags = Unset;
type Type = Unset;
type CreatedAt = Unset;
type Uri = Unset;
type Name = Unset;
type Cid = Unset;
type Author = Unset;
}
pub struct SetVisibility<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetVisibility<St> {}
impl<St: State> State for SetVisibility<St> {
type Visibility = Set<members::visibility>;
type Tags = St::Tags;
type Type = St::Type;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
type Name = St::Name;
type Cid = St::Cid;
type Author = St::Author;
}
pub struct SetTags<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTags<St> {}
impl<St: State> State for SetTags<St> {
type Visibility = St::Visibility;
type Tags = Set<members::tags>;
type Type = St::Type;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
type Name = St::Name;
type Cid = St::Cid;
type Author = St::Author;
}
pub struct SetType<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetType<St> {}
impl<St: State> State for SetType<St> {
type Visibility = St::Visibility;
type Tags = St::Tags;
type Type = Set<members::r#type>;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
type Name = St::Name;
type Cid = St::Cid;
type Author = St::Author;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Visibility = St::Visibility;
type Tags = St::Tags;
type Type = St::Type;
type CreatedAt = Set<members::created_at>;
type Uri = St::Uri;
type Name = St::Name;
type Cid = St::Cid;
type Author = St::Author;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Visibility = St::Visibility;
type Tags = St::Tags;
type Type = St::Type;
type CreatedAt = St::CreatedAt;
type Uri = Set<members::uri>;
type Name = St::Name;
type Cid = St::Cid;
type Author = St::Author;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type Visibility = St::Visibility;
type Tags = St::Tags;
type Type = St::Type;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
type Name = Set<members::name>;
type Cid = St::Cid;
type Author = St::Author;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Visibility = St::Visibility;
type Tags = St::Tags;
type Type = St::Type;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
type Name = St::Name;
type Cid = Set<members::cid>;
type Author = St::Author;
}
pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthor<St> {}
impl<St: State> State for SetAuthor<St> {
type Visibility = St::Visibility;
type Tags = St::Tags;
type Type = St::Type;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
type Name = St::Name;
type Cid = St::Cid;
type Author = Set<members::author>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct visibility(());
pub struct tags(());
pub struct r#type(());
pub struct created_at(());
pub struct uri(());
pub struct name(());
pub struct cid(());
pub struct author(());
}
}
pub struct CollectionViewBuilder<S: BosStr, St: collection_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<social_showcase::ProfileView<S>>,
Option<Cid<S>>,
Option<BlobRef<S>>,
Option<Datetime>,
Option<S>,
Option<i64>,
Option<Vec<social_showcase::ItemView<S>>>,
Option<S>,
Option<Vec<S>>,
Option<S>,
Option<Datetime>,
Option<AtUri<S>>,
Option<S>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> CollectionView<S> {
pub fn new() -> CollectionViewBuilder<S, collection_view_state::Empty> {
CollectionViewBuilder::new()
}
}
impl<S: BosStr> CollectionViewBuilder<S, 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,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Author: collection_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<social_showcase::ProfileView<S>>,
) -> CollectionViewBuilder<S, collection_view_state::SetAuthor<St>> {
self._fields.0 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Cid: collection_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> CollectionViewBuilder<S, collection_view_state::SetCid<St>> {
self._fields.1 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: collection_view_state::State> CollectionViewBuilder<S, St> {
pub fn cover_image(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_cover_image(mut self, value: Option<BlobRef<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::CreatedAt: collection_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> CollectionViewBuilder<S, collection_view_state::SetCreatedAt<St>> {
self._fields.3 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: collection_view_state::State> CollectionViewBuilder<S, St> {
pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<S>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: collection_view_state::State> CollectionViewBuilder<S, St> {
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<S: BosStr, St: collection_view_state::State> CollectionViewBuilder<S, St> {
pub fn items(mut self, value: impl Into<Option<Vec<social_showcase::ItemView<S>>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_items(mut self, value: Option<Vec<social_showcase::ItemView<S>>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Name: collection_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<S>,
) -> CollectionViewBuilder<S, collection_view_state::SetName<St>> {
self._fields.7 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Tags: collection_view_state::IsUnset,
{
pub fn tags(
mut self,
value: impl Into<Vec<S>>,
) -> CollectionViewBuilder<S, collection_view_state::SetTags<St>> {
self._fields.8 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Type: collection_view_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<S>,
) -> CollectionViewBuilder<S, collection_view_state::SetType<St>> {
self._fields.9 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: collection_view_state::State> CollectionViewBuilder<S, St> {
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<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Uri: collection_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> CollectionViewBuilder<S, collection_view_state::SetUri<St>> {
self._fields.11 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Visibility: collection_view_state::IsUnset,
{
pub fn visibility(
mut self,
value: impl Into<S>,
) -> CollectionViewBuilder<S, collection_view_state::SetVisibility<St>> {
self._fields.12 = Option::Some(value.into());
CollectionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollectionViewBuilder<S, St>
where
St: collection_view_state::State,
St::Visibility: collection_view_state::IsSet,
St::Tags: collection_view_state::IsSet,
St::Type: collection_view_state::IsSet,
St::CreatedAt: collection_view_state::IsSet,
St::Uri: collection_view_state::IsSet,
St::Name: collection_view_state::IsSet,
St::Cid: collection_view_state::IsSet,
St::Author: collection_view_state::IsSet,
{
pub fn build(self) -> CollectionView<S> {
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<SmolStr, Data<S>>) -> CollectionView<S> {
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::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBlob<St> {}
impl<St: State> State for SetBlob<St> {
type Blob = Set<members::blob>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct blob(());
}
}
pub struct ItemImageBuilder<S: BosStr, St: item_image_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<social_showcase::AspectRatio<S>>,
Option<BlobRef<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ItemImage<S> {
pub fn new() -> ItemImageBuilder<S, item_image_state::Empty> {
ItemImageBuilder::new()
}
}
impl<S: BosStr> ItemImageBuilder<S, item_image_state::Empty> {
pub fn new() -> Self {
ItemImageBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: item_image_state::State> ItemImageBuilder<S, St> {
pub fn alt(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: item_image_state::State> ItemImageBuilder<S, St> {
pub fn aspect_ratio(
mut self,
value: impl Into<Option<social_showcase::AspectRatio<S>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_aspect_ratio(mut self, value: Option<social_showcase::AspectRatio<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> ItemImageBuilder<S, St>
where
St: item_image_state::State,
St::Blob: item_image_state::IsUnset,
{
pub fn blob(
mut self,
value: impl Into<BlobRef<S>>,
) -> ItemImageBuilder<S, item_image_state::SetBlob<St>> {
self._fields.2 = Option::Some(value.into());
ItemImageBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ItemImageBuilder<S, St>
where
St: item_image_state::State,
St::Blob: item_image_state::IsSet,
{
pub fn build(self) -> ItemImage<S> {
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<SmolStr, Data<S>>) -> ItemImage<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Visibility;
type Author;
type Uri;
type Title;
type Images;
type Tags;
type Cid;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Visibility = Unset;
type Author = Unset;
type Uri = Unset;
type Title = Unset;
type Images = Unset;
type Tags = Unset;
type Cid = Unset;
type CreatedAt = Unset;
}
pub struct SetVisibility<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetVisibility<St> {}
impl<St: State> State for SetVisibility<St> {
type Visibility = Set<members::visibility>;
type Author = St::Author;
type Uri = St::Uri;
type Title = St::Title;
type Images = St::Images;
type Tags = St::Tags;
type Cid = St::Cid;
type CreatedAt = St::CreatedAt;
}
pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthor<St> {}
impl<St: State> State for SetAuthor<St> {
type Visibility = St::Visibility;
type Author = Set<members::author>;
type Uri = St::Uri;
type Title = St::Title;
type Images = St::Images;
type Tags = St::Tags;
type Cid = St::Cid;
type CreatedAt = St::CreatedAt;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Visibility = St::Visibility;
type Author = St::Author;
type Uri = Set<members::uri>;
type Title = St::Title;
type Images = St::Images;
type Tags = St::Tags;
type Cid = St::Cid;
type CreatedAt = St::CreatedAt;
}
pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTitle<St> {}
impl<St: State> State for SetTitle<St> {
type Visibility = St::Visibility;
type Author = St::Author;
type Uri = St::Uri;
type Title = Set<members::title>;
type Images = St::Images;
type Tags = St::Tags;
type Cid = St::Cid;
type CreatedAt = St::CreatedAt;
}
pub struct SetImages<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetImages<St> {}
impl<St: State> State for SetImages<St> {
type Visibility = St::Visibility;
type Author = St::Author;
type Uri = St::Uri;
type Title = St::Title;
type Images = Set<members::images>;
type Tags = St::Tags;
type Cid = St::Cid;
type CreatedAt = St::CreatedAt;
}
pub struct SetTags<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTags<St> {}
impl<St: State> State for SetTags<St> {
type Visibility = St::Visibility;
type Author = St::Author;
type Uri = St::Uri;
type Title = St::Title;
type Images = St::Images;
type Tags = Set<members::tags>;
type Cid = St::Cid;
type CreatedAt = St::CreatedAt;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Visibility = St::Visibility;
type Author = St::Author;
type Uri = St::Uri;
type Title = St::Title;
type Images = St::Images;
type Tags = St::Tags;
type Cid = Set<members::cid>;
type CreatedAt = St::CreatedAt;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Visibility = St::Visibility;
type Author = St::Author;
type Uri = St::Uri;
type Title = St::Title;
type Images = St::Images;
type Tags = St::Tags;
type Cid = St::Cid;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct visibility(());
pub struct author(());
pub struct uri(());
pub struct title(());
pub struct images(());
pub struct tags(());
pub struct cid(());
pub struct created_at(());
}
}
pub struct ItemViewBuilder<S: BosStr, St: item_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<social_showcase::ProfileView<S>>,
Option<S>,
Option<Cid<S>>,
Option<Datetime>,
Option<S>,
Option<UriValue<S>>,
Option<Vec<social_showcase::ItemImage<S>>>,
Option<Data<S>>,
Option<i64>,
Option<Vec<S>>,
Option<S>,
Option<Datetime>,
Option<AtUri<S>>,
Option<S>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ItemView<S> {
pub fn new() -> ItemViewBuilder<S, item_view_state::Empty> {
ItemViewBuilder::new()
}
}
impl<S: BosStr> ItemViewBuilder<S, 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,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Author: item_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<social_showcase::ProfileView<S>>,
) -> ItemViewBuilder<S, item_view_state::SetAuthor<St>> {
self._fields.0 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: item_view_state::State> ItemViewBuilder<S, St> {
pub fn category(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_category(mut self, value: Option<S>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Cid: item_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> ItemViewBuilder<S, item_view_state::SetCid<St>> {
self._fields.2 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::CreatedAt: item_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ItemViewBuilder<S, item_view_state::SetCreatedAt<St>> {
self._fields.3 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: item_view_state::State> ItemViewBuilder<S, St> {
pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<S>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: item_view_state::State> ItemViewBuilder<S, St> {
pub fn external_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_external_link(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Images: item_view_state::IsUnset,
{
pub fn images(
mut self,
value: impl Into<Vec<social_showcase::ItemImage<S>>>,
) -> ItemViewBuilder<S, item_view_state::SetImages<St>> {
self._fields.6 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: item_view_state::State> ItemViewBuilder<S, St> {
pub fn metadata(mut self, value: impl Into<Option<Data<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_metadata(mut self, value: Option<Data<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St: item_view_state::State> ItemViewBuilder<S, St> {
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<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Tags: item_view_state::IsUnset,
{
pub fn tags(
mut self,
value: impl Into<Vec<S>>,
) -> ItemViewBuilder<S, item_view_state::SetTags<St>> {
self._fields.9 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Title: item_view_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> ItemViewBuilder<S, item_view_state::SetTitle<St>> {
self._fields.10 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: item_view_state::State> ItemViewBuilder<S, St> {
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<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Uri: item_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ItemViewBuilder<S, item_view_state::SetUri<St>> {
self._fields.12 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Visibility: item_view_state::IsUnset,
{
pub fn visibility(
mut self,
value: impl Into<S>,
) -> ItemViewBuilder<S, item_view_state::SetVisibility<St>> {
self._fields.13 = Option::Some(value.into());
ItemViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ItemViewBuilder<S, St>
where
St: item_view_state::State,
St::Visibility: item_view_state::IsSet,
St::Author: item_view_state::IsSet,
St::Uri: item_view_state::IsSet,
St::Title: item_view_state::IsSet,
St::Images: item_view_state::IsSet,
St::Tags: item_view_state::IsSet,
St::Cid: item_view_state::IsSet,
St::CreatedAt: item_view_state::IsSet,
{
pub fn build(self) -> ItemView<S> {
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<SmolStr, Data<S>>) -> ItemView<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Reactions;
type Comments;
type Follows;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Reactions = Unset;
type Comments = Unset;
type Follows = Unset;
}
pub struct SetReactions<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReactions<St> {}
impl<St: State> State for SetReactions<St> {
type Reactions = Set<members::reactions>;
type Comments = St::Comments;
type Follows = St::Follows;
}
pub struct SetComments<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetComments<St> {}
impl<St: State> State for SetComments<St> {
type Reactions = St::Reactions;
type Comments = Set<members::comments>;
type Follows = St::Follows;
}
pub struct SetFollows<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFollows<St> {}
impl<St: State> State for SetFollows<St> {
type Reactions = St::Reactions;
type Comments = St::Comments;
type Follows = Set<members::follows>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct reactions(());
pub struct comments(());
pub struct follows(());
}
}
pub struct NotificationSettingsBuilder<S: BosStr, St: notification_settings_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<bool>, Option<bool>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> NotificationSettings<S> {
pub fn new() -> NotificationSettingsBuilder<S, notification_settings_state::Empty> {
NotificationSettingsBuilder::new()
}
}
impl<S: BosStr> NotificationSettingsBuilder<S, notification_settings_state::Empty> {
pub fn new() -> Self {
NotificationSettingsBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationSettingsBuilder<S, St>
where
St: notification_settings_state::State,
St::Comments: notification_settings_state::IsUnset,
{
pub fn comments(
mut self,
value: impl Into<bool>,
) -> NotificationSettingsBuilder<S, notification_settings_state::SetComments<St>> {
self._fields.0 = Option::Some(value.into());
NotificationSettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationSettingsBuilder<S, St>
where
St: notification_settings_state::State,
St::Follows: notification_settings_state::IsUnset,
{
pub fn follows(
mut self,
value: impl Into<bool>,
) -> NotificationSettingsBuilder<S, notification_settings_state::SetFollows<St>> {
self._fields.1 = Option::Some(value.into());
NotificationSettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationSettingsBuilder<S, St>
where
St: notification_settings_state::State,
St::Reactions: notification_settings_state::IsUnset,
{
pub fn reactions(
mut self,
value: impl Into<bool>,
) -> NotificationSettingsBuilder<S, notification_settings_state::SetReactions<St>> {
self._fields.2 = Option::Some(value.into());
NotificationSettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationSettingsBuilder<S, St>
where
St: notification_settings_state::State,
St::Reactions: notification_settings_state::IsSet,
St::Comments: notification_settings_state::IsSet,
St::Follows: notification_settings_state::IsSet,
{
pub fn build(self) -> NotificationSettings<S> {
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<SmolStr, Data<S>>,
) -> NotificationSettings<S> {
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::{IsSet, IsUnset, Set, Unset};
#[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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexable<St> {}
impl<St: State> State for SetIndexable<St> {
type Indexable = Set<members::indexable>;
type AllowReactions = St::AllowReactions;
type AllowComments = St::AllowComments;
}
pub struct SetAllowReactions<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAllowReactions<St> {}
impl<St: State> State for SetAllowReactions<St> {
type Indexable = St::Indexable;
type AllowReactions = Set<members::allow_reactions>;
type AllowComments = St::AllowComments;
}
pub struct SetAllowComments<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAllowComments<St> {}
impl<St: State> State for SetAllowComments<St> {
type Indexable = St::Indexable;
type AllowReactions = St::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<S: BosStr, St: privacy_settings_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<bool>, Option<bool>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> PrivacySettings<S> {
pub fn new() -> PrivacySettingsBuilder<S, privacy_settings_state::Empty> {
PrivacySettingsBuilder::new()
}
}
impl<S: BosStr> PrivacySettingsBuilder<S, privacy_settings_state::Empty> {
pub fn new() -> Self {
PrivacySettingsBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PrivacySettingsBuilder<S, St>
where
St: privacy_settings_state::State,
St::AllowComments: privacy_settings_state::IsUnset,
{
pub fn allow_comments(
mut self,
value: impl Into<bool>,
) -> PrivacySettingsBuilder<S, privacy_settings_state::SetAllowComments<St>> {
self._fields.0 = Option::Some(value.into());
PrivacySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PrivacySettingsBuilder<S, St>
where
St: privacy_settings_state::State,
St::AllowReactions: privacy_settings_state::IsUnset,
{
pub fn allow_reactions(
mut self,
value: impl Into<bool>,
) -> PrivacySettingsBuilder<S, privacy_settings_state::SetAllowReactions<St>> {
self._fields.1 = Option::Some(value.into());
PrivacySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PrivacySettingsBuilder<S, St>
where
St: privacy_settings_state::State,
St::Indexable: privacy_settings_state::IsUnset,
{
pub fn indexable(
mut self,
value: impl Into<bool>,
) -> PrivacySettingsBuilder<S, privacy_settings_state::SetIndexable<St>> {
self._fields.2 = Option::Some(value.into());
PrivacySettingsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PrivacySettingsBuilder<S, St>
where
St: privacy_settings_state::State,
St::Indexable: privacy_settings_state::IsSet,
St::AllowReactions: privacy_settings_state::IsSet,
St::AllowComments: privacy_settings_state::IsSet,
{
pub fn build(self) -> PrivacySettings<S> {
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<SmolStr, Data<S>>) -> PrivacySettings<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Uri;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Cid = Unset;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Uri = Set<members::uri>;
type Cid = St::Cid;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Uri = St::Uri;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct cid(());
}
}
pub struct ReactionSubjectBuilder<S: BosStr, St: reaction_subject_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Cid<S>>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReactionSubject<S> {
pub fn new() -> ReactionSubjectBuilder<S, reaction_subject_state::Empty> {
ReactionSubjectBuilder::new()
}
}
impl<S: BosStr> ReactionSubjectBuilder<S, reaction_subject_state::Empty> {
pub fn new() -> Self {
ReactionSubjectBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionSubjectBuilder<S, St>
where
St: reaction_subject_state::State,
St::Cid: reaction_subject_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> ReactionSubjectBuilder<S, reaction_subject_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
ReactionSubjectBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionSubjectBuilder<S, St>
where
St: reaction_subject_state::State,
St::Uri: reaction_subject_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ReactionSubjectBuilder<S, reaction_subject_state::SetUri<St>> {
self._fields.1 = Option::Some(value.into());
ReactionSubjectBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionSubjectBuilder<S, St>
where
St: reaction_subject_state::State,
St::Uri: reaction_subject_state::IsSet,
St::Cid: reaction_subject_state::IsSet,
{
pub fn build(self) -> ReactionSubject<S> {
ReactionSubject {
cid: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReactionSubject<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type CreatedAt;
type Actor;
type Type;
type Uri;
type Subject;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Actor = Unset;
type Type = Unset;
type Uri = Unset;
type Subject = Unset;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type CreatedAt = Set<members::created_at>;
type Actor = St::Actor;
type Type = St::Type;
type Uri = St::Uri;
type Subject = St::Subject;
}
pub struct SetActor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetActor<St> {}
impl<St: State> State for SetActor<St> {
type CreatedAt = St::CreatedAt;
type Actor = Set<members::actor>;
type Type = St::Type;
type Uri = St::Uri;
type Subject = St::Subject;
}
pub struct SetType<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetType<St> {}
impl<St: State> State for SetType<St> {
type CreatedAt = St::CreatedAt;
type Actor = St::Actor;
type Type = Set<members::r#type>;
type Uri = St::Uri;
type Subject = St::Subject;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type CreatedAt = St::CreatedAt;
type Actor = St::Actor;
type Type = St::Type;
type Uri = Set<members::uri>;
type Subject = St::Subject;
}
pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubject<St> {}
impl<St: State> State for SetSubject<St> {
type CreatedAt = St::CreatedAt;
type Actor = St::Actor;
type Type = St::Type;
type Uri = St::Uri;
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct actor(());
pub struct r#type(());
pub struct uri(());
pub struct subject(());
}
}
pub struct ReactionViewBuilder<S: BosStr, St: reaction_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<social_showcase::ProfileView<S>>,
Option<Datetime>,
Option<social_showcase::ReactionSubject<S>>,
Option<S>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReactionView<S> {
pub fn new() -> ReactionViewBuilder<S, reaction_view_state::Empty> {
ReactionViewBuilder::new()
}
}
impl<S: BosStr> ReactionViewBuilder<S, reaction_view_state::Empty> {
pub fn new() -> Self {
ReactionViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionViewBuilder<S, St>
where
St: reaction_view_state::State,
St::Actor: reaction_view_state::IsUnset,
{
pub fn actor(
mut self,
value: impl Into<social_showcase::ProfileView<S>>,
) -> ReactionViewBuilder<S, reaction_view_state::SetActor<St>> {
self._fields.0 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionViewBuilder<S, St>
where
St: reaction_view_state::State,
St::CreatedAt: reaction_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ReactionViewBuilder<S, reaction_view_state::SetCreatedAt<St>> {
self._fields.1 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionViewBuilder<S, St>
where
St: reaction_view_state::State,
St::Subject: reaction_view_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<social_showcase::ReactionSubject<S>>,
) -> ReactionViewBuilder<S, reaction_view_state::SetSubject<St>> {
self._fields.2 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionViewBuilder<S, St>
where
St: reaction_view_state::State,
St::Type: reaction_view_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<S>,
) -> ReactionViewBuilder<S, reaction_view_state::SetType<St>> {
self._fields.3 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionViewBuilder<S, St>
where
St: reaction_view_state::State,
St::Uri: reaction_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ReactionViewBuilder<S, reaction_view_state::SetUri<St>> {
self._fields.4 = Option::Some(value.into());
ReactionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReactionViewBuilder<S, St>
where
St: reaction_view_state::State,
St::CreatedAt: reaction_view_state::IsSet,
St::Actor: reaction_view_state::IsSet,
St::Type: reaction_view_state::IsSet,
St::Uri: reaction_view_state::IsSet,
St::Subject: reaction_view_state::IsSet,
{
pub fn build(self) -> ReactionView<S> {
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<SmolStr, Data<S>>) -> ReactionView<S> {
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::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Order;
type Uri;
type AddedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Order = Unset;
type Uri = Unset;
type AddedAt = Unset;
}
pub struct SetOrder<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetOrder<St> {}
impl<St: State> State for SetOrder<St> {
type Order = Set<members::order>;
type Uri = St::Uri;
type AddedAt = St::AddedAt;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Order = St::Order;
type Uri = Set<members::uri>;
type AddedAt = St::AddedAt;
}
pub struct SetAddedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAddedAt<St> {}
impl<St: State> State for SetAddedAt<St> {
type Order = St::Order;
type Uri = St::Uri;
type AddedAt = Set<members::added_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct order(());
pub struct uri(());
pub struct added_at(());
}
}
pub struct ShowcaseItemBuilder<S: BosStr, St: showcase_item_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Datetime>, Option<i64>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ShowcaseItem<S> {
pub fn new() -> ShowcaseItemBuilder<S, showcase_item_state::Empty> {
ShowcaseItemBuilder::new()
}
}
impl<S: BosStr> ShowcaseItemBuilder<S, showcase_item_state::Empty> {
pub fn new() -> Self {
ShowcaseItemBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ShowcaseItemBuilder<S, St>
where
St: showcase_item_state::State,
St::AddedAt: showcase_item_state::IsUnset,
{
pub fn added_at(
mut self,
value: impl Into<Datetime>,
) -> ShowcaseItemBuilder<S, showcase_item_state::SetAddedAt<St>> {
self._fields.0 = Option::Some(value.into());
ShowcaseItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ShowcaseItemBuilder<S, St>
where
St: showcase_item_state::State,
St::Order: showcase_item_state::IsUnset,
{
pub fn order(
mut self,
value: impl Into<i64>,
) -> ShowcaseItemBuilder<S, showcase_item_state::SetOrder<St>> {
self._fields.1 = Option::Some(value.into());
ShowcaseItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ShowcaseItemBuilder<S, St>
where
St: showcase_item_state::State,
St::Uri: showcase_item_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ShowcaseItemBuilder<S, showcase_item_state::SetUri<St>> {
self._fields.2 = Option::Some(value.into());
ShowcaseItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ShowcaseItemBuilder<S, St>
where
St: showcase_item_state::State,
St::Order: showcase_item_state::IsSet,
St::Uri: showcase_item_state::IsSet,
St::AddedAt: showcase_item_state::IsSet,
{
pub fn build(self) -> ShowcaseItem<S> {
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<SmolStr, Data<S>>) -> ShowcaseItem<S> {
ShowcaseItem {
added_at: self._fields.0.unwrap(),
order: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}