pub mod authors;
pub mod book;
pub mod chapter;
pub mod colour_scheme;
pub mod entry;
pub mod get_book_entry;
pub mod get_chapter;
pub mod get_continue_reading;
pub mod get_entry;
pub mod get_entry_by_title;
pub mod get_entry_detail;
pub mod get_entry_feed;
pub mod get_entry_notebooks;
pub mod get_notebook;
pub mod get_notebook_by_title;
pub mod get_notebook_chapters;
pub mod get_notebook_detail;
pub mod get_notebook_feed;
pub mod get_page;
pub mod get_published_versions;
pub mod get_reading_history;
pub mod get_similar_notebooks;
pub mod get_suggested_notebooks;
pub mod page;
pub mod resolve_entry;
pub mod resolve_notebook;
pub mod resolve_version_conflict;
pub mod search_entries;
pub mod search_notebooks;
pub mod theme;
pub mod update_reading_progress;
#[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, Did};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::sh_weaver::actor::ProfileDataView;
use crate::sh_weaver::actor::ProfileViewBasic;
use crate::sh_weaver::notebook;
#[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 AuthorListView<S: BosStr = DefaultStr> {
pub index: i64,
pub record: ProfileDataView<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub uri: Option<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 BookEntryRef<S: BosStr = DefaultStr> {
pub entry: notebook::EntryView<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 BookEntryView<S: BosStr = DefaultStr> {
pub entry: notebook::EntryView<S>,
pub index: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<notebook::BookEntryRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prev: Option<notebook::BookEntryRef<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 ChapterEntryView<S: BosStr = DefaultStr> {
pub entry: notebook::EntryView<S>,
pub index: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub next: Option<notebook::BookEntryRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prev: Option<notebook::BookEntryRef<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 ChapterView<S: BosStr = DefaultStr> {
pub authors: Vec<notebook::AuthorListView<S>>,
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_count: Option<i64>,
pub indexed_at: Datetime,
pub notebook: notebook::NotebookView<S>,
pub record: Data<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<notebook::Tags<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<notebook::Title<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 ContentFormat<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_content_format_markdown")]
pub markdown: Option<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 ContentRating<S: BosStr = DefaultStr> {
General,
Teen,
Mature,
Explicit,
Other(S),
}
impl<S: BosStr> ContentRating<S> {
pub fn as_str(&self) -> &str {
match self {
Self::General => "general",
Self::Teen => "teen",
Self::Mature => "mature",
Self::Explicit => "explicit",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"general" => Self::General,
"teen" => Self::Teen,
"mature" => Self::Mature,
"explicit" => Self::Explicit,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> AsRef<str> for ContentRating<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> core::fmt::Display for ContentRating<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> Serialize for ContentRating<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 ContentRating<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> jacquard_common::IntoStatic for ContentRating<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ContentRating<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ContentRating::General => ContentRating::General,
ContentRating::Teen => ContentRating::Teen,
ContentRating::Mature => ContentRating::Mature,
ContentRating::Explicit => ContentRating::Explicit,
ContentRating::Other(v) => ContentRating::Other(v.into_static()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContentWarning<S: BosStr = DefaultStr> {
Violence,
GraphicViolence,
Death,
MajorCharacterDeath,
SexualContent,
ExplicitSexualContent,
Language,
SubstanceUse,
SelfHarm,
Abuse,
DisturbingImagery,
Other(S),
}
impl<S: BosStr> ContentWarning<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Violence => "violence",
Self::GraphicViolence => "graphic-violence",
Self::Death => "death",
Self::MajorCharacterDeath => "major-character-death",
Self::SexualContent => "sexual-content",
Self::ExplicitSexualContent => "explicit-sexual-content",
Self::Language => "language",
Self::SubstanceUse => "substance-use",
Self::SelfHarm => "self-harm",
Self::Abuse => "abuse",
Self::DisturbingImagery => "disturbing-imagery",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"violence" => Self::Violence,
"graphic-violence" => Self::GraphicViolence,
"death" => Self::Death,
"major-character-death" => Self::MajorCharacterDeath,
"sexual-content" => Self::SexualContent,
"explicit-sexual-content" => Self::ExplicitSexualContent,
"language" => Self::Language,
"substance-use" => Self::SubstanceUse,
"self-harm" => Self::SelfHarm,
"abuse" => Self::Abuse,
"disturbing-imagery" => Self::DisturbingImagery,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> AsRef<str> for ContentWarning<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> core::fmt::Display for ContentWarning<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> Serialize for ContentWarning<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 ContentWarning<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> jacquard_common::IntoStatic for ContentWarning<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ContentWarning<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ContentWarning::Violence => ContentWarning::Violence,
ContentWarning::GraphicViolence => ContentWarning::GraphicViolence,
ContentWarning::Death => ContentWarning::Death,
ContentWarning::MajorCharacterDeath => ContentWarning::MajorCharacterDeath,
ContentWarning::SexualContent => ContentWarning::SexualContent,
ContentWarning::ExplicitSexualContent => ContentWarning::ExplicitSexualContent,
ContentWarning::Language => ContentWarning::Language,
ContentWarning::SubstanceUse => ContentWarning::SubstanceUse,
ContentWarning::SelfHarm => ContentWarning::SelfHarm,
ContentWarning::Abuse => ContentWarning::Abuse,
ContentWarning::DisturbingImagery => ContentWarning::DisturbingImagery,
ContentWarning::Other(v) => ContentWarning::Other(v.into_static()),
}
}
}
pub type ContentWarnings<S = DefaultStr> = Vec<notebook::ContentWarning<S>>;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct EntryView<S: BosStr = DefaultStr> {
pub authors: Vec<notebook::AuthorListView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bookmark_count: Option<i64>,
pub cid: Cid<S>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<notebook::Path<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<notebook::PermissionsState<S>>,
pub record: Data<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rendered_view: Option<notebook::RenderedView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<notebook::Tags<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<notebook::Title<S>>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_bookmark: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_like: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_reading_progress: Option<notebook::ReadingProgress<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 FeedEntryView<S: BosStr = DefaultStr> {
pub entry: notebook::EntryView<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub notebook_context: Option<notebook::FeedNotebookContext<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<notebook::FeedReason<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 FeedNotebookContext<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<S>,
pub title: S,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum FeedReason<S: BosStr = DefaultStr> {
#[serde(rename = "sh.weaver.notebook.defs#reasonLike")]
ReasonLike(Box<notebook::ReasonLike<S>>),
#[serde(rename = "sh.weaver.notebook.defs#reasonBookmark")]
ReasonBookmark(Box<notebook::ReasonBookmark<S>>),
#[serde(rename = "sh.weaver.notebook.defs#reasonSubscription")]
ReasonSubscription(Box<notebook::ReasonSubscription<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct NotebookView<S: BosStr = DefaultStr> {
pub authors: Vec<notebook::AuthorListView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bookmark_count: Option<i64>,
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_count: Option<i64>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<notebook::Path<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<notebook::PermissionsState<S>>,
pub record: Data<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscriber_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<notebook::Tags<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<notebook::Title<S>>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_bookmark: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_like: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_reading_progress: Option<notebook::ReadingProgress<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_subscription: Option<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 PageView<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub entry_count: Option<i64>,
pub indexed_at: Datetime,
pub notebook: notebook::NotebookView<S>,
pub record: Data<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<notebook::Tags<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<notebook::Title<S>>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub type Path<S = DefaultStr> = S;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct PermissionGrant<S: BosStr = DefaultStr> {
pub did: Did<S>,
pub granted_at: Datetime,
pub scope: PermissionGrantScope<S>,
pub source: AtUri<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 PermissionGrantScope<S: BosStr = DefaultStr> {
Direct,
Inherited,
Other(S),
}
impl<S: BosStr> PermissionGrantScope<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Direct => "direct",
Self::Inherited => "inherited",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"direct" => Self::Direct,
"inherited" => Self::Inherited,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for PermissionGrantScope<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for PermissionGrantScope<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for PermissionGrantScope<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 PermissionGrantScope<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 PermissionGrantScope<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for PermissionGrantScope<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = PermissionGrantScope<S::Output>;
fn into_static(self) -> Self::Output {
match self {
PermissionGrantScope::Direct => PermissionGrantScope::Direct,
PermissionGrantScope::Inherited => PermissionGrantScope::Inherited,
PermissionGrantScope::Other(v) => PermissionGrantScope::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct PermissionsState<S: BosStr = DefaultStr> {
pub editors: Vec<notebook::PermissionGrant<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewers: Option<Vec<notebook::PermissionGrant<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 PublishedVersionView<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub diverged_from: Option<StrongRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_canonical: Option<bool>,
pub published_at: Datetime,
pub publisher: ProfileViewBasic<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
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 ReadingProgress<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub current_entry: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub finished_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_read_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub percent_complete: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub started_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<ReadingProgressStatus<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 ReadingProgressStatus<S: BosStr = DefaultStr> {
Reading,
Finished,
Abandoned,
WantToRead,
Other(S),
}
impl<S: BosStr> ReadingProgressStatus<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Reading => "reading",
Self::Finished => "finished",
Self::Abandoned => "abandoned",
Self::WantToRead => "want-to-read",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"reading" => Self::Reading,
"finished" => Self::Finished,
"abandoned" => Self::Abandoned,
"want-to-read" => Self::WantToRead,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ReadingProgressStatus<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ReadingProgressStatus<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ReadingProgressStatus<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 ReadingProgressStatus<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 ReadingProgressStatus<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ReadingProgressStatus<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ReadingProgressStatus<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ReadingProgressStatus::Reading => ReadingProgressStatus::Reading,
ReadingProgressStatus::Finished => ReadingProgressStatus::Finished,
ReadingProgressStatus::Abandoned => ReadingProgressStatus::Abandoned,
ReadingProgressStatus::WantToRead => ReadingProgressStatus::WantToRead,
ReadingProgressStatus::Other(v) => ReadingProgressStatus::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ReasonBookmark<S: BosStr = DefaultStr> {
pub by: ProfileViewBasic<S>,
pub indexed_at: Datetime,
#[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 ReasonLike<S: BosStr = DefaultStr> {
pub by: ProfileViewBasic<S>,
pub indexed_at: Datetime,
#[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 ReasonSubscription<S: BosStr = DefaultStr> {
pub indexed_at: Datetime,
#[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 RenderedView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub css: Option<BlobRef<S>>,
pub html: BlobRef<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub type Tags<S = DefaultStr> = Vec<S>;
pub type Title<S = DefaultStr> = S;
impl<S: BosStr> LexiconSchema for AuthorListView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"authorListView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for BookEntryRef<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"bookEntryRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for BookEntryView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"bookEntryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ChapterEntryView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"chapterEntryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ChapterView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"chapterView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ContentFormat<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"contentFormat"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for EntryView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"entryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for FeedEntryView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"feedEntryView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for FeedNotebookContext<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"feedNotebookContext"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for NotebookView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"notebookView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PageView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"pageView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PermissionGrant<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"permissionGrant"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PermissionsState<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"permissionsState"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PublishedVersionView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"publishedVersionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ReadingProgress<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"readingProgress"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.percent_complete {
if *value > 100i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("percent_complete"),
max: 100i64,
actual: *value,
});
}
}
if let Some(ref value) = self.percent_complete {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("percent_complete"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ReasonBookmark<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"reasonBookmark"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ReasonLike<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"reasonLike"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ReasonSubscription<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"reasonSubscription"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for RenderedView<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.defs"
}
fn def_name() -> &'static str {
"renderedView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.css {
{
let size = value.blob().size;
if size > 1000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("css"),
max: 1000000usize,
actual: size,
});
}
}
}
if let Some(ref value) = self.css {
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["text/css"];
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("css"),
accepted: vec!["text/css".to_string()],
actual: mime.to_string(),
});
}
}
}
{
let value = &self.html;
{
let size = value.blob().size;
if size > 1000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("html"),
max: 1000000usize,
actual: size,
});
}
}
}
{
let value = &self.html;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["text/html"];
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("html"),
accepted: vec!["text/html".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
pub mod author_list_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 Record;
type Index;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
type Index = Unset;
}
pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Record = Set<members::record>;
type Index = St::Index;
}
pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndex<St> {}
impl<St: State> State for SetIndex<St> {
type Record = St::Record;
type Index = Set<members::index>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
pub struct index(());
}
}
pub struct AuthorListViewBuilder<S: BosStr, St: author_list_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<ProfileDataView<S>>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> AuthorListView<S> {
pub fn new() -> AuthorListViewBuilder<S, author_list_view_state::Empty> {
AuthorListViewBuilder::new()
}
}
impl<S: BosStr> AuthorListViewBuilder<S, author_list_view_state::Empty> {
pub fn new() -> Self {
AuthorListViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AuthorListViewBuilder<S, St>
where
St: author_list_view_state::State,
St::Index: author_list_view_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<i64>,
) -> AuthorListViewBuilder<S, author_list_view_state::SetIndex<St>> {
self._fields.0 = Option::Some(value.into());
AuthorListViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AuthorListViewBuilder<S, St>
where
St: author_list_view_state::State,
St::Record: author_list_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<ProfileDataView<S>>,
) -> AuthorListViewBuilder<S, author_list_view_state::SetRecord<St>> {
self._fields.1 = Option::Some(value.into());
AuthorListViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: author_list_view_state::State> AuthorListViewBuilder<S, St> {
pub fn uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> AuthorListViewBuilder<S, St>
where
St: author_list_view_state::State,
St::Record: author_list_view_state::IsSet,
St::Index: author_list_view_state::IsSet,
{
pub fn build(self) -> AuthorListView<S> {
AuthorListView {
index: self._fields.0.unwrap(),
record: self._fields.1.unwrap(),
uri: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> AuthorListView<S> {
AuthorListView {
index: self._fields.0.unwrap(),
record: self._fields.1.unwrap(),
uri: self._fields.2,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_weaver_notebook_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("sh.weaver.notebook.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authorListView"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("record"),
SmolStr::new_static("index"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("sh.weaver.actor.defs#profileDataView"),
..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("bookEntryRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("entry")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#entryView"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bookEntryView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("An ordered entry in a Weaver notebook.")),
required: Some(vec![
SmolStr::new_static("entry"),
SmolStr::new_static("index"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#entryView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("next"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("prev"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("chapterEntryView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("An entry within a chapter context.")),
required: Some(vec![
SmolStr::new_static("entry"),
SmolStr::new_static("index"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#entryView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("next"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("prev"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#bookEntryRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("chapterView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Hydrated view of a chapter.")),
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("notebook"),
SmolStr::new_static("authors"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authors"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#authorListView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebook"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#notebookView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..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("contentFormat"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"The format of the content. This is used to determine how to render the content.",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("markdown"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The format of the content. This is used to determine how to render the content.",
),
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contentRating"),
LexUserType::String(LexString {
description: Some(CowStr::new_static("Author-applied content rating.")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contentWarning"),
LexUserType::String(LexString {
description: Some(CowStr::new_static("Author-applied content warning.")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contentWarnings"),
LexUserType::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#contentWarning"),
..Default::default()
}),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryView"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("authors"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authors"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#authorListView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bookmarkCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#path"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissions"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#permissionsState"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("renderedView"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#renderedView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerBookmark"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerLike"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerReadingProgress"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#readingProgress"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("feedEntryView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Entry with feed-specific context (discovery reason, notebook context).",
)),
required: Some(vec![SmolStr::new_static("entry")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#entryView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebookContext"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#feedNotebookContext"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reason"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#feedReason"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("feedNotebookContext"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Minimal notebook context for feed display.",
)),
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("title"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString {
..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("feedReason"),
LexUserType::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#reasonLike"),
CowStr::new_static("#reasonBookmark"),
CowStr::new_static("#reasonSubscription"),
],
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebookView"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("authors"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("authors"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#authorListView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bookmarkCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#path"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissions"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#permissionsState"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subscriberCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerBookmark"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerLike"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerReadingProgress"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#readingProgress"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerSubscription"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pageView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Hydrated view of a page (entries displayed together).",
)),
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("notebook"),
SmolStr::new_static("record"),
SmolStr::new_static("indexedAt"),
]),
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("entryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebook"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#notebookView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#tags"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#title"),
..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("path"),
LexUserType::String(LexString {
description: Some(CowStr::new_static("The path of the notebook.")),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissionGrant"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A single permission grant. For resource authority: source=resource URI, grantedAt=createdAt. For invitees: source=invite URI, grantedAt=accept createdAt.",
),
),
required: Some(
vec![
SmolStr::new_static("did"), SmolStr::new_static("scope"),
SmolStr::new_static("source"),
SmolStr::new_static("grantedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("grantedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"For authority: record createdAt. For invitees: accept createdAt",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("scope"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"direct = this resource (includes authority), inherited = via notebook invite",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"For authority: resource URI. For invitees: invite URI",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("permissionsState"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"ACL-style permissions for a resource. Separate from authors (who contributed).",
),
),
required: Some(vec![SmolStr::new_static("editors")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("editors"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("DIDs that can edit this resource"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#permissionGrant"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewers"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("DIDs that can view (future use)"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#permissionGrant"),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedVersionView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"A published version of an entry in a collaborator's repo.",
)),
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("publisher"),
SmolStr::new_static("publishedAt"),
]),
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("divergedFrom"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isCanonical"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publisher"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("sh.weaver.actor.defs#profileViewBasic"),
..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
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("readingProgress"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Viewer's reading progress (appview-side state, not a record).",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("currentEntry"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Last entry the viewer was reading.",
)),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("finishedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastReadAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("percentComplete"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(100i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("startedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonBookmark"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("by"),
SmolStr::new_static("indexedAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("by"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("sh.weaver.actor.defs#profileViewBasic"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonLike"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("by"),
SmolStr::new_static("indexedAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("by"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("sh.weaver.actor.defs#profileViewBasic"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonSubscription"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("indexedAt")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("renderedView"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"View of a rendered and cached notebook entry",
)),
required: Some(vec![SmolStr::new_static("html")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("css"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("html"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexUserType::Array(LexArray {
items: LexArrayItem::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexUserType::String(LexString {
description: Some(CowStr::new_static("The title of the notebook entry.")),
max_length: Some(300usize),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod book_entry_ref_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 Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Entry = Unset;
}
pub struct SetEntry<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEntry<St> {}
impl<St: State> State for SetEntry<St> {
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct entry(());
}
}
pub struct BookEntryRefBuilder<S: BosStr, St: book_entry_ref_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<notebook::EntryView<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> BookEntryRef<S> {
pub fn new() -> BookEntryRefBuilder<S, book_entry_ref_state::Empty> {
BookEntryRefBuilder::new()
}
}
impl<S: BosStr> BookEntryRefBuilder<S, book_entry_ref_state::Empty> {
pub fn new() -> Self {
BookEntryRefBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BookEntryRefBuilder<S, St>
where
St: book_entry_ref_state::State,
St::Entry: book_entry_ref_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<S>>,
) -> BookEntryRefBuilder<S, book_entry_ref_state::SetEntry<St>> {
self._fields.0 = Option::Some(value.into());
BookEntryRefBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BookEntryRefBuilder<S, St>
where
St: book_entry_ref_state::State,
St::Entry: book_entry_ref_state::IsSet,
{
pub fn build(self) -> BookEntryRef<S> {
BookEntryRef {
entry: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> BookEntryRef<S> {
BookEntryRef {
entry: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod book_entry_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 Entry;
type Index;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Entry = Unset;
type Index = Unset;
}
pub struct SetEntry<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEntry<St> {}
impl<St: State> State for SetEntry<St> {
type Entry = Set<members::entry>;
type Index = St::Index;
}
pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndex<St> {}
impl<St: State> State for SetIndex<St> {
type Entry = St::Entry;
type Index = Set<members::index>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct entry(());
pub struct index(());
}
}
pub struct BookEntryViewBuilder<S: BosStr, St: book_entry_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<notebook::EntryView<S>>,
Option<i64>,
Option<notebook::BookEntryRef<S>>,
Option<notebook::BookEntryRef<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> BookEntryView<S> {
pub fn new() -> BookEntryViewBuilder<S, book_entry_view_state::Empty> {
BookEntryViewBuilder::new()
}
}
impl<S: BosStr> BookEntryViewBuilder<S, book_entry_view_state::Empty> {
pub fn new() -> Self {
BookEntryViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BookEntryViewBuilder<S, St>
where
St: book_entry_view_state::State,
St::Entry: book_entry_view_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<S>>,
) -> BookEntryViewBuilder<S, book_entry_view_state::SetEntry<St>> {
self._fields.0 = Option::Some(value.into());
BookEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BookEntryViewBuilder<S, St>
where
St: book_entry_view_state::State,
St::Index: book_entry_view_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<i64>,
) -> BookEntryViewBuilder<S, book_entry_view_state::SetIndex<St>> {
self._fields.1 = Option::Some(value.into());
BookEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: book_entry_view_state::State> BookEntryViewBuilder<S, St> {
pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: book_entry_view_state::State> BookEntryViewBuilder<S, St> {
pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> BookEntryViewBuilder<S, St>
where
St: book_entry_view_state::State,
St::Entry: book_entry_view_state::IsSet,
St::Index: book_entry_view_state::IsSet,
{
pub fn build(self) -> BookEntryView<S> {
BookEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> BookEntryView<S> {
BookEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Some(extra_data),
}
}
}
pub mod chapter_entry_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 Index;
type Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Index = Unset;
type Entry = Unset;
}
pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndex<St> {}
impl<St: State> State for SetIndex<St> {
type Index = Set<members::index>;
type Entry = St::Entry;
}
pub struct SetEntry<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEntry<St> {}
impl<St: State> State for SetEntry<St> {
type Index = St::Index;
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct index(());
pub struct entry(());
}
}
pub struct ChapterEntryViewBuilder<S: BosStr, St: chapter_entry_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<notebook::EntryView<S>>,
Option<i64>,
Option<notebook::BookEntryRef<S>>,
Option<notebook::BookEntryRef<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ChapterEntryView<S> {
pub fn new() -> ChapterEntryViewBuilder<S, chapter_entry_view_state::Empty> {
ChapterEntryViewBuilder::new()
}
}
impl<S: BosStr> ChapterEntryViewBuilder<S, chapter_entry_view_state::Empty> {
pub fn new() -> Self {
ChapterEntryViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterEntryViewBuilder<S, St>
where
St: chapter_entry_view_state::State,
St::Entry: chapter_entry_view_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<S>>,
) -> ChapterEntryViewBuilder<S, chapter_entry_view_state::SetEntry<St>> {
self._fields.0 = Option::Some(value.into());
ChapterEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterEntryViewBuilder<S, St>
where
St: chapter_entry_view_state::State,
St::Index: chapter_entry_view_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<i64>,
) -> ChapterEntryViewBuilder<S, chapter_entry_view_state::SetIndex<St>> {
self._fields.1 = Option::Some(value.into());
ChapterEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: chapter_entry_view_state::State> ChapterEntryViewBuilder<S, St> {
pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: chapter_entry_view_state::State> ChapterEntryViewBuilder<S, St> {
pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> ChapterEntryViewBuilder<S, St>
where
St: chapter_entry_view_state::State,
St::Index: chapter_entry_view_state::IsSet,
St::Entry: chapter_entry_view_state::IsSet,
{
pub fn build(self) -> ChapterEntryView<S> {
ChapterEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ChapterEntryView<S> {
ChapterEntryView {
entry: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
next: self._fields.2,
prev: self._fields.3,
extra_data: Some(extra_data),
}
}
}
pub mod chapter_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 Uri;
type Cid;
type Notebook;
type Record;
type Authors;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Cid = Unset;
type Notebook = Unset;
type Record = Unset;
type Authors = Unset;
type IndexedAt = 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;
type Notebook = St::Notebook;
type Record = St::Record;
type Authors = St::Authors;
type IndexedAt = St::IndexedAt;
}
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>;
type Notebook = St::Notebook;
type Record = St::Record;
type Authors = St::Authors;
type IndexedAt = St::IndexedAt;
}
pub struct SetNotebook<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetNotebook<St> {}
impl<St: State> State for SetNotebook<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = Set<members::notebook>;
type Record = St::Record;
type Authors = St::Authors;
type IndexedAt = St::IndexedAt;
}
pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = St::Notebook;
type Record = Set<members::record>;
type Authors = St::Authors;
type IndexedAt = St::IndexedAt;
}
pub struct SetAuthors<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthors<St> {}
impl<St: State> State for SetAuthors<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = St::Notebook;
type Record = St::Record;
type Authors = Set<members::authors>;
type IndexedAt = St::IndexedAt;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = St::Notebook;
type Record = St::Record;
type Authors = St::Authors;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct cid(());
pub struct notebook(());
pub struct record(());
pub struct authors(());
pub struct indexed_at(());
}
}
pub struct ChapterViewBuilder<S: BosStr, St: chapter_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<notebook::AuthorListView<S>>>,
Option<Cid<S>>,
Option<i64>,
Option<Datetime>,
Option<notebook::NotebookView<S>>,
Option<Data<S>>,
Option<notebook::Tags<S>>,
Option<notebook::Title<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ChapterView<S> {
pub fn new() -> ChapterViewBuilder<S, chapter_view_state::Empty> {
ChapterViewBuilder::new()
}
}
impl<S: BosStr> ChapterViewBuilder<S, chapter_view_state::Empty> {
pub fn new() -> Self {
ChapterViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::Authors: chapter_view_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<Vec<notebook::AuthorListView<S>>>,
) -> ChapterViewBuilder<S, chapter_view_state::SetAuthors<St>> {
self._fields.0 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::Cid: chapter_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> ChapterViewBuilder<S, chapter_view_state::SetCid<St>> {
self._fields.1 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: chapter_view_state::State> ChapterViewBuilder<S, St> {
pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::IndexedAt: chapter_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ChapterViewBuilder<S, chapter_view_state::SetIndexedAt<St>> {
self._fields.3 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::Notebook: chapter_view_state::IsUnset,
{
pub fn notebook(
mut self,
value: impl Into<notebook::NotebookView<S>>,
) -> ChapterViewBuilder<S, chapter_view_state::SetNotebook<St>> {
self._fields.4 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::Record: chapter_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<S>>,
) -> ChapterViewBuilder<S, chapter_view_state::SetRecord<St>> {
self._fields.5 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: chapter_view_state::State> ChapterViewBuilder<S, St> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: chapter_view_state::State> ChapterViewBuilder<S, St> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::Uri: chapter_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ChapterViewBuilder<S, chapter_view_state::SetUri<St>> {
self._fields.8 = Option::Some(value.into());
ChapterViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ChapterViewBuilder<S, St>
where
St: chapter_view_state::State,
St::Uri: chapter_view_state::IsSet,
St::Cid: chapter_view_state::IsSet,
St::Notebook: chapter_view_state::IsSet,
St::Record: chapter_view_state::IsSet,
St::Authors: chapter_view_state::IsSet,
St::IndexedAt: chapter_view_state::IsSet,
{
pub fn build(self) -> ChapterView<S> {
ChapterView {
authors: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
entry_count: self._fields.2,
indexed_at: self._fields.3.unwrap(),
notebook: self._fields.4.unwrap(),
record: self._fields.5.unwrap(),
tags: self._fields.6,
title: self._fields.7,
uri: self._fields.8.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ChapterView<S> {
ChapterView {
authors: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
entry_count: self._fields.2,
indexed_at: self._fields.3.unwrap(),
notebook: self._fields.4.unwrap(),
record: self._fields.5.unwrap(),
tags: self._fields.6,
title: self._fields.7,
uri: self._fields.8.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn _default_content_format_markdown<S: FromStaticStr>() -> ::core::option::Option<S> {
Some(S::from_static("weaver"))
}
impl Default for ContentFormat {
fn default() -> Self {
Self {
markdown: Some(SmolStr::from("weaver")),
extra_data: Default::default(),
}
}
}
pub mod entry_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 Cid;
type IndexedAt;
type Uri;
type Record;
type Authors;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type IndexedAt = Unset;
type Uri = Unset;
type Record = Unset;
type Authors = Unset;
}
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 Cid = Set<members::cid>;
type IndexedAt = St::IndexedAt;
type Uri = St::Uri;
type Record = St::Record;
type Authors = St::Authors;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Cid = St::Cid;
type IndexedAt = Set<members::indexed_at>;
type Uri = St::Uri;
type Record = St::Record;
type Authors = St::Authors;
}
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 Cid = St::Cid;
type IndexedAt = St::IndexedAt;
type Uri = Set<members::uri>;
type Record = St::Record;
type Authors = St::Authors;
}
pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Cid = St::Cid;
type IndexedAt = St::IndexedAt;
type Uri = St::Uri;
type Record = Set<members::record>;
type Authors = St::Authors;
}
pub struct SetAuthors<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthors<St> {}
impl<St: State> State for SetAuthors<St> {
type Cid = St::Cid;
type IndexedAt = St::IndexedAt;
type Uri = St::Uri;
type Record = St::Record;
type Authors = Set<members::authors>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct indexed_at(());
pub struct uri(());
pub struct record(());
pub struct authors(());
}
}
pub struct EntryViewBuilder<S: BosStr, St: entry_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<notebook::AuthorListView<S>>>,
Option<i64>,
Option<Cid<S>>,
Option<Datetime>,
Option<i64>,
Option<notebook::Path<S>>,
Option<notebook::PermissionsState<S>>,
Option<Data<S>>,
Option<notebook::RenderedView<S>>,
Option<notebook::Tags<S>>,
Option<notebook::Title<S>>,
Option<AtUri<S>>,
Option<AtUri<S>>,
Option<AtUri<S>>,
Option<notebook::ReadingProgress<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> EntryView<S> {
pub fn new() -> EntryViewBuilder<S, entry_view_state::Empty> {
EntryViewBuilder::new()
}
}
impl<S: BosStr> EntryViewBuilder<S, entry_view_state::Empty> {
pub fn new() -> Self {
EntryViewBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EntryViewBuilder<S, St>
where
St: entry_view_state::State,
St::Authors: entry_view_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<Vec<notebook::AuthorListView<S>>>,
) -> EntryViewBuilder<S, entry_view_state::SetAuthors<St>> {
self._fields.0 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> EntryViewBuilder<S, St>
where
St: entry_view_state::State,
St::Cid: entry_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> EntryViewBuilder<S, entry_view_state::SetCid<St>> {
self._fields.2 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EntryViewBuilder<S, St>
where
St: entry_view_state::State,
St::IndexedAt: entry_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> EntryViewBuilder<S, entry_view_state::SetIndexedAt<St>> {
self._fields.3 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn path(mut self, value: impl Into<Option<notebook::Path<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<notebook::Path<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn permissions(mut self, value: impl Into<Option<notebook::PermissionsState<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_permissions(mut self, value: Option<notebook::PermissionsState<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> EntryViewBuilder<S, St>
where
St: entry_view_state::State,
St::Record: entry_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<S>>,
) -> EntryViewBuilder<S, entry_view_state::SetRecord<St>> {
self._fields.7 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn rendered_view(mut self, value: impl Into<Option<notebook::RenderedView<S>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_rendered_view(mut self, value: Option<notebook::RenderedView<S>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St> EntryViewBuilder<S, St>
where
St: entry_view_state::State,
St::Uri: entry_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> EntryViewBuilder<S, entry_view_state::SetUri<St>> {
self._fields.11 = Option::Some(value.into());
EntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.12 = value;
self
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn viewer_like(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_viewer_like(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.13 = value;
self
}
}
impl<S: BosStr, St: entry_view_state::State> EntryViewBuilder<S, St> {
pub fn viewer_reading_progress(
mut self,
value: impl Into<Option<notebook::ReadingProgress<S>>>,
) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_viewer_reading_progress(
mut self,
value: Option<notebook::ReadingProgress<S>>,
) -> Self {
self._fields.14 = value;
self
}
}
impl<S: BosStr, St> EntryViewBuilder<S, St>
where
St: entry_view_state::State,
St::Cid: entry_view_state::IsSet,
St::IndexedAt: entry_view_state::IsSet,
St::Uri: entry_view_state::IsSet,
St::Record: entry_view_state::IsSet,
St::Authors: entry_view_state::IsSet,
{
pub fn build(self) -> EntryView<S> {
EntryView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
indexed_at: self._fields.3.unwrap(),
like_count: self._fields.4,
path: self._fields.5,
permissions: self._fields.6,
record: self._fields.7.unwrap(),
rendered_view: self._fields.8,
tags: self._fields.9,
title: self._fields.10,
uri: self._fields.11.unwrap(),
viewer_bookmark: self._fields.12,
viewer_like: self._fields.13,
viewer_reading_progress: self._fields.14,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> EntryView<S> {
EntryView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
indexed_at: self._fields.3.unwrap(),
like_count: self._fields.4,
path: self._fields.5,
permissions: self._fields.6,
record: self._fields.7.unwrap(),
rendered_view: self._fields.8,
tags: self._fields.9,
title: self._fields.10,
uri: self._fields.11.unwrap(),
viewer_bookmark: self._fields.12,
viewer_like: self._fields.13,
viewer_reading_progress: self._fields.14,
extra_data: Some(extra_data),
}
}
}
pub mod feed_entry_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 Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Entry = Unset;
}
pub struct SetEntry<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEntry<St> {}
impl<St: State> State for SetEntry<St> {
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct entry(());
}
}
pub struct FeedEntryViewBuilder<S: BosStr, St: feed_entry_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<notebook::EntryView<S>>,
Option<notebook::FeedNotebookContext<S>>,
Option<notebook::FeedReason<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> FeedEntryView<S> {
pub fn new() -> FeedEntryViewBuilder<S, feed_entry_view_state::Empty> {
FeedEntryViewBuilder::new()
}
}
impl<S: BosStr> FeedEntryViewBuilder<S, feed_entry_view_state::Empty> {
pub fn new() -> Self {
FeedEntryViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FeedEntryViewBuilder<S, St>
where
St: feed_entry_view_state::State,
St::Entry: feed_entry_view_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<notebook::EntryView<S>>,
) -> FeedEntryViewBuilder<S, feed_entry_view_state::SetEntry<St>> {
self._fields.0 = Option::Some(value.into());
FeedEntryViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: feed_entry_view_state::State> FeedEntryViewBuilder<S, St> {
pub fn notebook_context(
mut self,
value: impl Into<Option<notebook::FeedNotebookContext<S>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_notebook_context(
mut self,
value: Option<notebook::FeedNotebookContext<S>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: feed_entry_view_state::State> FeedEntryViewBuilder<S, St> {
pub fn reason(mut self, value: impl Into<Option<notebook::FeedReason<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_reason(mut self, value: Option<notebook::FeedReason<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> FeedEntryViewBuilder<S, St>
where
St: feed_entry_view_state::State,
St::Entry: feed_entry_view_state::IsSet,
{
pub fn build(self) -> FeedEntryView<S> {
FeedEntryView {
entry: self._fields.0.unwrap(),
notebook_context: self._fields.1,
reason: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> FeedEntryView<S> {
FeedEntryView {
entry: self._fields.0.unwrap(),
notebook_context: self._fields.1,
reason: self._fields.2,
extra_data: Some(extra_data),
}
}
}
pub mod feed_notebook_context_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 Title;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Title = Unset;
type Uri = Unset;
}
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 Title = Set<members::title>;
type Uri = St::Uri;
}
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 Title = St::Title;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct title(());
pub struct uri(());
}
}
pub struct FeedNotebookContextBuilder<S: BosStr, St: feed_notebook_context_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<S>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> FeedNotebookContext<S> {
pub fn new() -> FeedNotebookContextBuilder<S, feed_notebook_context_state::Empty> {
FeedNotebookContextBuilder::new()
}
}
impl<S: BosStr> FeedNotebookContextBuilder<S, feed_notebook_context_state::Empty> {
pub fn new() -> Self {
FeedNotebookContextBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: feed_notebook_context_state::State> FeedNotebookContextBuilder<S, St> {
pub fn path(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> FeedNotebookContextBuilder<S, St>
where
St: feed_notebook_context_state::State,
St::Title: feed_notebook_context_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> FeedNotebookContextBuilder<S, feed_notebook_context_state::SetTitle<St>> {
self._fields.1 = Option::Some(value.into());
FeedNotebookContextBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FeedNotebookContextBuilder<S, St>
where
St: feed_notebook_context_state::State,
St::Uri: feed_notebook_context_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> FeedNotebookContextBuilder<S, feed_notebook_context_state::SetUri<St>> {
self._fields.2 = Option::Some(value.into());
FeedNotebookContextBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FeedNotebookContextBuilder<S, St>
where
St: feed_notebook_context_state::State,
St::Title: feed_notebook_context_state::IsSet,
St::Uri: feed_notebook_context_state::IsSet,
{
pub fn build(self) -> FeedNotebookContext<S> {
FeedNotebookContext {
path: self._fields.0,
title: 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>>) -> FeedNotebookContext<S> {
FeedNotebookContext {
path: self._fields.0,
title: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod notebook_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 Record;
type IndexedAt;
type Uri;
type Cid;
type Authors;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
type IndexedAt = Unset;
type Uri = Unset;
type Cid = Unset;
type Authors = Unset;
}
pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Record = Set<members::record>;
type IndexedAt = St::IndexedAt;
type Uri = St::Uri;
type Cid = St::Cid;
type Authors = St::Authors;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Record = St::Record;
type IndexedAt = Set<members::indexed_at>;
type Uri = St::Uri;
type Cid = St::Cid;
type Authors = St::Authors;
}
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 Record = St::Record;
type IndexedAt = St::IndexedAt;
type Uri = Set<members::uri>;
type Cid = St::Cid;
type Authors = St::Authors;
}
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 Record = St::Record;
type IndexedAt = St::IndexedAt;
type Uri = St::Uri;
type Cid = Set<members::cid>;
type Authors = St::Authors;
}
pub struct SetAuthors<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthors<St> {}
impl<St: State> State for SetAuthors<St> {
type Record = St::Record;
type IndexedAt = St::IndexedAt;
type Uri = St::Uri;
type Cid = St::Cid;
type Authors = Set<members::authors>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
pub struct indexed_at(());
pub struct uri(());
pub struct cid(());
pub struct authors(());
}
}
pub struct NotebookViewBuilder<S: BosStr, St: notebook_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<notebook::AuthorListView<S>>>,
Option<i64>,
Option<Cid<S>>,
Option<i64>,
Option<Datetime>,
Option<i64>,
Option<notebook::Path<S>>,
Option<notebook::PermissionsState<S>>,
Option<Data<S>>,
Option<i64>,
Option<notebook::Tags<S>>,
Option<notebook::Title<S>>,
Option<AtUri<S>>,
Option<AtUri<S>>,
Option<AtUri<S>>,
Option<notebook::ReadingProgress<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> NotebookView<S> {
pub fn new() -> NotebookViewBuilder<S, notebook_view_state::Empty> {
NotebookViewBuilder::new()
}
}
impl<S: BosStr> NotebookViewBuilder<S, notebook_view_state::Empty> {
pub fn new() -> Self {
NotebookViewBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotebookViewBuilder<S, St>
where
St: notebook_view_state::State,
St::Authors: notebook_view_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<Vec<notebook::AuthorListView<S>>>,
) -> NotebookViewBuilder<S, notebook_view_state::SetAuthors<St>> {
self._fields.0 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> NotebookViewBuilder<S, St>
where
St: notebook_view_state::State,
St::Cid: notebook_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> NotebookViewBuilder<S, notebook_view_state::SetCid<St>> {
self._fields.2 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> NotebookViewBuilder<S, St>
where
St: notebook_view_state::State,
St::IndexedAt: notebook_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> NotebookViewBuilder<S, notebook_view_state::SetIndexedAt<St>> {
self._fields.4 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn path(mut self, value: impl Into<Option<notebook::Path<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_path(mut self, value: Option<notebook::Path<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn permissions(mut self, value: impl Into<Option<notebook::PermissionsState<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_permissions(mut self, value: Option<notebook::PermissionsState<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St> NotebookViewBuilder<S, St>
where
St: notebook_view_state::State,
St::Record: notebook_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<S>>,
) -> NotebookViewBuilder<S, notebook_view_state::SetRecord<St>> {
self._fields.8 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn subscriber_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_subscriber_count(mut self, value: Option<i64>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
self._fields.11 = value;
self
}
}
impl<S: BosStr, St> NotebookViewBuilder<S, St>
where
St: notebook_view_state::State,
St::Uri: notebook_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> NotebookViewBuilder<S, notebook_view_state::SetUri<St>> {
self._fields.12 = Option::Some(value.into());
NotebookViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.13 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn viewer_like(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_viewer_like(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.14 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn viewer_reading_progress(
mut self,
value: impl Into<Option<notebook::ReadingProgress<S>>>,
) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_viewer_reading_progress(
mut self,
value: Option<notebook::ReadingProgress<S>>,
) -> Self {
self._fields.15 = value;
self
}
}
impl<S: BosStr, St: notebook_view_state::State> NotebookViewBuilder<S, St> {
pub fn viewer_subscription(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_viewer_subscription(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.16 = value;
self
}
}
impl<S: BosStr, St> NotebookViewBuilder<S, St>
where
St: notebook_view_state::State,
St::Record: notebook_view_state::IsSet,
St::IndexedAt: notebook_view_state::IsSet,
St::Uri: notebook_view_state::IsSet,
St::Cid: notebook_view_state::IsSet,
St::Authors: notebook_view_state::IsSet,
{
pub fn build(self) -> NotebookView<S> {
NotebookView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
entry_count: self._fields.3,
indexed_at: self._fields.4.unwrap(),
like_count: self._fields.5,
path: self._fields.6,
permissions: self._fields.7,
record: self._fields.8.unwrap(),
subscriber_count: self._fields.9,
tags: self._fields.10,
title: self._fields.11,
uri: self._fields.12.unwrap(),
viewer_bookmark: self._fields.13,
viewer_like: self._fields.14,
viewer_reading_progress: self._fields.15,
viewer_subscription: self._fields.16,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> NotebookView<S> {
NotebookView {
authors: self._fields.0.unwrap(),
bookmark_count: self._fields.1,
cid: self._fields.2.unwrap(),
entry_count: self._fields.3,
indexed_at: self._fields.4.unwrap(),
like_count: self._fields.5,
path: self._fields.6,
permissions: self._fields.7,
record: self._fields.8.unwrap(),
subscriber_count: self._fields.9,
tags: self._fields.10,
title: self._fields.11,
uri: self._fields.12.unwrap(),
viewer_bookmark: self._fields.13,
viewer_like: self._fields.14,
viewer_reading_progress: self._fields.15,
viewer_subscription: self._fields.16,
extra_data: Some(extra_data),
}
}
}
pub mod page_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 Uri;
type Cid;
type Notebook;
type Record;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Cid = Unset;
type Notebook = Unset;
type Record = Unset;
type IndexedAt = 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;
type Notebook = St::Notebook;
type Record = St::Record;
type IndexedAt = St::IndexedAt;
}
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>;
type Notebook = St::Notebook;
type Record = St::Record;
type IndexedAt = St::IndexedAt;
}
pub struct SetNotebook<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetNotebook<St> {}
impl<St: State> State for SetNotebook<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = Set<members::notebook>;
type Record = St::Record;
type IndexedAt = St::IndexedAt;
}
pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = St::Notebook;
type Record = Set<members::record>;
type IndexedAt = St::IndexedAt;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Notebook = St::Notebook;
type Record = St::Record;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct cid(());
pub struct notebook(());
pub struct record(());
pub struct indexed_at(());
}
}
pub struct PageViewBuilder<S: BosStr, St: page_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Cid<S>>,
Option<i64>,
Option<Datetime>,
Option<notebook::NotebookView<S>>,
Option<Data<S>>,
Option<notebook::Tags<S>>,
Option<notebook::Title<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> PageView<S> {
pub fn new() -> PageViewBuilder<S, page_view_state::Empty> {
PageViewBuilder::new()
}
}
impl<S: BosStr> PageViewBuilder<S, page_view_state::Empty> {
pub fn new() -> Self {
PageViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PageViewBuilder<S, St>
where
St: page_view_state::State,
St::Cid: page_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> PageViewBuilder<S, page_view_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: page_view_state::State> PageViewBuilder<S, St> {
pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> PageViewBuilder<S, St>
where
St: page_view_state::State,
St::IndexedAt: page_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> PageViewBuilder<S, page_view_state::SetIndexedAt<St>> {
self._fields.2 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PageViewBuilder<S, St>
where
St: page_view_state::State,
St::Notebook: page_view_state::IsUnset,
{
pub fn notebook(
mut self,
value: impl Into<notebook::NotebookView<S>>,
) -> PageViewBuilder<S, page_view_state::SetNotebook<St>> {
self._fields.3 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PageViewBuilder<S, St>
where
St: page_view_state::State,
St::Record: page_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<S>>,
) -> PageViewBuilder<S, page_view_state::SetRecord<St>> {
self._fields.4 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: page_view_state::State> PageViewBuilder<S, St> {
pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: page_view_state::State> PageViewBuilder<S, St> {
pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> PageViewBuilder<S, St>
where
St: page_view_state::State,
St::Uri: page_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> PageViewBuilder<S, page_view_state::SetUri<St>> {
self._fields.7 = Option::Some(value.into());
PageViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PageViewBuilder<S, St>
where
St: page_view_state::State,
St::Uri: page_view_state::IsSet,
St::Cid: page_view_state::IsSet,
St::Notebook: page_view_state::IsSet,
St::Record: page_view_state::IsSet,
St::IndexedAt: page_view_state::IsSet,
{
pub fn build(self) -> PageView<S> {
PageView {
cid: self._fields.0.unwrap(),
entry_count: self._fields.1,
indexed_at: self._fields.2.unwrap(),
notebook: self._fields.3.unwrap(),
record: self._fields.4.unwrap(),
tags: self._fields.5,
title: self._fields.6,
uri: self._fields.7.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> PageView<S> {
PageView {
cid: self._fields.0.unwrap(),
entry_count: self._fields.1,
indexed_at: self._fields.2.unwrap(),
notebook: self._fields.3.unwrap(),
record: self._fields.4.unwrap(),
tags: self._fields.5,
title: self._fields.6,
uri: self._fields.7.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod permission_grant_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 Did;
type Scope;
type Source;
type GrantedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
type Scope = Unset;
type Source = Unset;
type GrantedAt = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
type Scope = St::Scope;
type Source = St::Source;
type GrantedAt = St::GrantedAt;
}
pub struct SetScope<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetScope<St> {}
impl<St: State> State for SetScope<St> {
type Did = St::Did;
type Scope = Set<members::scope>;
type Source = St::Source;
type GrantedAt = St::GrantedAt;
}
pub struct SetSource<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSource<St> {}
impl<St: State> State for SetSource<St> {
type Did = St::Did;
type Scope = St::Scope;
type Source = Set<members::source>;
type GrantedAt = St::GrantedAt;
}
pub struct SetGrantedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetGrantedAt<St> {}
impl<St: State> State for SetGrantedAt<St> {
type Did = St::Did;
type Scope = St::Scope;
type Source = St::Source;
type GrantedAt = Set<members::granted_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
pub struct scope(());
pub struct source(());
pub struct granted_at(());
}
}
pub struct PermissionGrantBuilder<S: BosStr, St: permission_grant_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Did<S>>,
Option<Datetime>,
Option<PermissionGrantScope<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> PermissionGrant<S> {
pub fn new() -> PermissionGrantBuilder<S, permission_grant_state::Empty> {
PermissionGrantBuilder::new()
}
}
impl<S: BosStr> PermissionGrantBuilder<S, permission_grant_state::Empty> {
pub fn new() -> Self {
PermissionGrantBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PermissionGrantBuilder<S, St>
where
St: permission_grant_state::State,
St::Did: permission_grant_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> PermissionGrantBuilder<S, permission_grant_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PermissionGrantBuilder<S, St>
where
St: permission_grant_state::State,
St::GrantedAt: permission_grant_state::IsUnset,
{
pub fn granted_at(
mut self,
value: impl Into<Datetime>,
) -> PermissionGrantBuilder<S, permission_grant_state::SetGrantedAt<St>> {
self._fields.1 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PermissionGrantBuilder<S, St>
where
St: permission_grant_state::State,
St::Scope: permission_grant_state::IsUnset,
{
pub fn scope(
mut self,
value: impl Into<PermissionGrantScope<S>>,
) -> PermissionGrantBuilder<S, permission_grant_state::SetScope<St>> {
self._fields.2 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PermissionGrantBuilder<S, St>
where
St: permission_grant_state::State,
St::Source: permission_grant_state::IsUnset,
{
pub fn source(
mut self,
value: impl Into<AtUri<S>>,
) -> PermissionGrantBuilder<S, permission_grant_state::SetSource<St>> {
self._fields.3 = Option::Some(value.into());
PermissionGrantBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PermissionGrantBuilder<S, St>
where
St: permission_grant_state::State,
St::Did: permission_grant_state::IsSet,
St::Scope: permission_grant_state::IsSet,
St::Source: permission_grant_state::IsSet,
St::GrantedAt: permission_grant_state::IsSet,
{
pub fn build(self) -> PermissionGrant<S> {
PermissionGrant {
did: self._fields.0.unwrap(),
granted_at: self._fields.1.unwrap(),
scope: self._fields.2.unwrap(),
source: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> PermissionGrant<S> {
PermissionGrant {
did: self._fields.0.unwrap(),
granted_at: self._fields.1.unwrap(),
scope: self._fields.2.unwrap(),
source: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod permissions_state_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 Editors;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Editors = Unset;
}
pub struct SetEditors<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEditors<St> {}
impl<St: State> State for SetEditors<St> {
type Editors = Set<members::editors>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct editors(());
}
}
pub struct PermissionsStateBuilder<S: BosStr, St: permissions_state_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<notebook::PermissionGrant<S>>>,
Option<Vec<notebook::PermissionGrant<S>>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> PermissionsState<S> {
pub fn new() -> PermissionsStateBuilder<S, permissions_state_state::Empty> {
PermissionsStateBuilder::new()
}
}
impl<S: BosStr> PermissionsStateBuilder<S, permissions_state_state::Empty> {
pub fn new() -> Self {
PermissionsStateBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PermissionsStateBuilder<S, St>
where
St: permissions_state_state::State,
St::Editors: permissions_state_state::IsUnset,
{
pub fn editors(
mut self,
value: impl Into<Vec<notebook::PermissionGrant<S>>>,
) -> PermissionsStateBuilder<S, permissions_state_state::SetEditors<St>> {
self._fields.0 = Option::Some(value.into());
PermissionsStateBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: permissions_state_state::State> PermissionsStateBuilder<S, St> {
pub fn viewers(mut self, value: impl Into<Option<Vec<notebook::PermissionGrant<S>>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_viewers(mut self, value: Option<Vec<notebook::PermissionGrant<S>>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> PermissionsStateBuilder<S, St>
where
St: permissions_state_state::State,
St::Editors: permissions_state_state::IsSet,
{
pub fn build(self) -> PermissionsState<S> {
PermissionsState {
editors: self._fields.0.unwrap(),
viewers: self._fields.1,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> PermissionsState<S> {
PermissionsState {
editors: self._fields.0.unwrap(),
viewers: self._fields.1,
extra_data: Some(extra_data),
}
}
}
pub mod published_version_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 PublishedAt;
type Cid;
type Publisher;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type PublishedAt = Unset;
type Cid = Unset;
type Publisher = Unset;
type Uri = Unset;
}
pub struct SetPublishedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPublishedAt<St> {}
impl<St: State> State for SetPublishedAt<St> {
type PublishedAt = Set<members::published_at>;
type Cid = St::Cid;
type Publisher = St::Publisher;
type Uri = St::Uri;
}
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 PublishedAt = St::PublishedAt;
type Cid = Set<members::cid>;
type Publisher = St::Publisher;
type Uri = St::Uri;
}
pub struct SetPublisher<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPublisher<St> {}
impl<St: State> State for SetPublisher<St> {
type PublishedAt = St::PublishedAt;
type Cid = St::Cid;
type Publisher = Set<members::publisher>;
type Uri = St::Uri;
}
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 PublishedAt = St::PublishedAt;
type Cid = St::Cid;
type Publisher = St::Publisher;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct published_at(());
pub struct cid(());
pub struct publisher(());
pub struct uri(());
}
}
pub struct PublishedVersionViewBuilder<S: BosStr, St: published_version_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Cid<S>>,
Option<StrongRef<S>>,
Option<bool>,
Option<Datetime>,
Option<ProfileViewBasic<S>>,
Option<Datetime>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> PublishedVersionView<S> {
pub fn new() -> PublishedVersionViewBuilder<S, published_version_view_state::Empty> {
PublishedVersionViewBuilder::new()
}
}
impl<S: BosStr> PublishedVersionViewBuilder<S, published_version_view_state::Empty> {
pub fn new() -> Self {
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PublishedVersionViewBuilder<S, St>
where
St: published_version_view_state::State,
St::Cid: published_version_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> PublishedVersionViewBuilder<S, published_version_view_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: published_version_view_state::State> PublishedVersionViewBuilder<S, St> {
pub fn diverged_from(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_diverged_from(mut self, value: Option<StrongRef<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: published_version_view_state::State> PublishedVersionViewBuilder<S, St> {
pub fn is_canonical(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_is_canonical(mut self, value: Option<bool>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> PublishedVersionViewBuilder<S, St>
where
St: published_version_view_state::State,
St::PublishedAt: published_version_view_state::IsUnset,
{
pub fn published_at(
mut self,
value: impl Into<Datetime>,
) -> PublishedVersionViewBuilder<S, published_version_view_state::SetPublishedAt<St>> {
self._fields.3 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PublishedVersionViewBuilder<S, St>
where
St: published_version_view_state::State,
St::Publisher: published_version_view_state::IsUnset,
{
pub fn publisher(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> PublishedVersionViewBuilder<S, published_version_view_state::SetPublisher<St>> {
self._fields.4 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: published_version_view_state::State> PublishedVersionViewBuilder<S, St> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St> PublishedVersionViewBuilder<S, St>
where
St: published_version_view_state::State,
St::Uri: published_version_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> PublishedVersionViewBuilder<S, published_version_view_state::SetUri<St>> {
self._fields.6 = Option::Some(value.into());
PublishedVersionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> PublishedVersionViewBuilder<S, St>
where
St: published_version_view_state::State,
St::PublishedAt: published_version_view_state::IsSet,
St::Cid: published_version_view_state::IsSet,
St::Publisher: published_version_view_state::IsSet,
St::Uri: published_version_view_state::IsSet,
{
pub fn build(self) -> PublishedVersionView<S> {
PublishedVersionView {
cid: self._fields.0.unwrap(),
diverged_from: self._fields.1,
is_canonical: self._fields.2,
published_at: self._fields.3.unwrap(),
publisher: self._fields.4.unwrap(),
updated_at: self._fields.5,
uri: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> PublishedVersionView<S> {
PublishedVersionView {
cid: self._fields.0.unwrap(),
diverged_from: self._fields.1,
is_canonical: self._fields.2,
published_at: self._fields.3.unwrap(),
publisher: self._fields.4.unwrap(),
updated_at: self._fields.5,
uri: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reason_bookmark_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 By;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type By = Unset;
type IndexedAt = Unset;
}
pub struct SetBy<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBy<St> {}
impl<St: State> State for SetBy<St> {
type By = Set<members::by>;
type IndexedAt = St::IndexedAt;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type By = St::By;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct by(());
pub struct indexed_at(());
}
}
pub struct ReasonBookmarkBuilder<S: BosStr, St: reason_bookmark_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ProfileViewBasic<S>>, Option<Datetime>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReasonBookmark<S> {
pub fn new() -> ReasonBookmarkBuilder<S, reason_bookmark_state::Empty> {
ReasonBookmarkBuilder::new()
}
}
impl<S: BosStr> ReasonBookmarkBuilder<S, reason_bookmark_state::Empty> {
pub fn new() -> Self {
ReasonBookmarkBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonBookmarkBuilder<S, St>
where
St: reason_bookmark_state::State,
St::By: reason_bookmark_state::IsUnset,
{
pub fn by(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> ReasonBookmarkBuilder<S, reason_bookmark_state::SetBy<St>> {
self._fields.0 = Option::Some(value.into());
ReasonBookmarkBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonBookmarkBuilder<S, St>
where
St: reason_bookmark_state::State,
St::IndexedAt: reason_bookmark_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ReasonBookmarkBuilder<S, reason_bookmark_state::SetIndexedAt<St>> {
self._fields.1 = Option::Some(value.into());
ReasonBookmarkBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonBookmarkBuilder<S, St>
where
St: reason_bookmark_state::State,
St::By: reason_bookmark_state::IsSet,
St::IndexedAt: reason_bookmark_state::IsSet,
{
pub fn build(self) -> ReasonBookmark<S> {
ReasonBookmark {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReasonBookmark<S> {
ReasonBookmark {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reason_like_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 By;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type By = Unset;
type IndexedAt = Unset;
}
pub struct SetBy<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBy<St> {}
impl<St: State> State for SetBy<St> {
type By = Set<members::by>;
type IndexedAt = St::IndexedAt;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type By = St::By;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct by(());
pub struct indexed_at(());
}
}
pub struct ReasonLikeBuilder<S: BosStr, St: reason_like_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ProfileViewBasic<S>>, Option<Datetime>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReasonLike<S> {
pub fn new() -> ReasonLikeBuilder<S, reason_like_state::Empty> {
ReasonLikeBuilder::new()
}
}
impl<S: BosStr> ReasonLikeBuilder<S, reason_like_state::Empty> {
pub fn new() -> Self {
ReasonLikeBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonLikeBuilder<S, St>
where
St: reason_like_state::State,
St::By: reason_like_state::IsUnset,
{
pub fn by(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> ReasonLikeBuilder<S, reason_like_state::SetBy<St>> {
self._fields.0 = Option::Some(value.into());
ReasonLikeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonLikeBuilder<S, St>
where
St: reason_like_state::State,
St::IndexedAt: reason_like_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ReasonLikeBuilder<S, reason_like_state::SetIndexedAt<St>> {
self._fields.1 = Option::Some(value.into());
ReasonLikeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonLikeBuilder<S, St>
where
St: reason_like_state::State,
St::By: reason_like_state::IsSet,
St::IndexedAt: reason_like_state::IsSet,
{
pub fn build(self) -> ReasonLike<S> {
ReasonLike {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReasonLike<S> {
ReasonLike {
by: self._fields.0.unwrap(),
indexed_at: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod reason_subscription_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 IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type IndexedAt = Unset;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct indexed_at(());
}
}
pub struct ReasonSubscriptionBuilder<S: BosStr, St: reason_subscription_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Datetime>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReasonSubscription<S> {
pub fn new() -> ReasonSubscriptionBuilder<S, reason_subscription_state::Empty> {
ReasonSubscriptionBuilder::new()
}
}
impl<S: BosStr> ReasonSubscriptionBuilder<S, reason_subscription_state::Empty> {
pub fn new() -> Self {
ReasonSubscriptionBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonSubscriptionBuilder<S, St>
where
St: reason_subscription_state::State,
St::IndexedAt: reason_subscription_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> ReasonSubscriptionBuilder<S, reason_subscription_state::SetIndexedAt<St>> {
self._fields.0 = Option::Some(value.into());
ReasonSubscriptionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReasonSubscriptionBuilder<S, St>
where
St: reason_subscription_state::State,
St::IndexedAt: reason_subscription_state::IsSet,
{
pub fn build(self) -> ReasonSubscription<S> {
ReasonSubscription {
indexed_at: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReasonSubscription<S> {
ReasonSubscription {
indexed_at: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod rendered_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 Html;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Html = Unset;
}
pub struct SetHtml<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetHtml<St> {}
impl<St: State> State for SetHtml<St> {
type Html = Set<members::html>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct html(());
}
}
pub struct RenderedViewBuilder<S: BosStr, St: rendered_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlobRef<S>>, Option<BlobRef<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> RenderedView<S> {
pub fn new() -> RenderedViewBuilder<S, rendered_view_state::Empty> {
RenderedViewBuilder::new()
}
}
impl<S: BosStr> RenderedViewBuilder<S, rendered_view_state::Empty> {
pub fn new() -> Self {
RenderedViewBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: rendered_view_state::State> RenderedViewBuilder<S, St> {
pub fn css(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_css(mut self, value: Option<BlobRef<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> RenderedViewBuilder<S, St>
where
St: rendered_view_state::State,
St::Html: rendered_view_state::IsUnset,
{
pub fn html(
mut self,
value: impl Into<BlobRef<S>>,
) -> RenderedViewBuilder<S, rendered_view_state::SetHtml<St>> {
self._fields.1 = Option::Some(value.into());
RenderedViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RenderedViewBuilder<S, St>
where
St: rendered_view_state::State,
St::Html: rendered_view_state::IsSet,
{
pub fn build(self) -> RenderedView<S> {
RenderedView {
css: self._fields.0,
html: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> RenderedView<S> {
RenderedView {
css: self._fields.0,
html: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}