pub mod book;
pub mod buzz;
pub mod get_book;
pub mod get_book_identifiers;
pub mod get_profile;
pub mod hive_book;
pub mod list_genres;
pub mod search_books;
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
Hash,
jacquard_derive::IntoStatic
)]
pub struct Abandoned;
impl std::fmt::Display for Abandoned {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "abandoned")
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Activity<'a> {
pub created_at: jacquard_common::types::string::Datetime,
#[serde(borrow)]
pub hive_id: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub title: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub r#type: ActivityType<'a>,
#[serde(borrow)]
pub user_did: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub user_handle: jacquard_common::CowStr<'a>,
}
pub mod activity_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Title;
type Type;
type UserDid;
type CreatedAt;
type HiveId;
type UserHandle;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Title = Unset;
type Type = Unset;
type UserDid = Unset;
type CreatedAt = Unset;
type HiveId = Unset;
type UserHandle = Unset;
}
pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTitle<S> {}
impl<S: State> State for SetTitle<S> {
type Title = Set<members::title>;
type Type = S::Type;
type UserDid = S::UserDid;
type CreatedAt = S::CreatedAt;
type HiveId = S::HiveId;
type UserHandle = S::UserHandle;
}
pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetType<S> {}
impl<S: State> State for SetType<S> {
type Title = S::Title;
type Type = Set<members::r#type>;
type UserDid = S::UserDid;
type CreatedAt = S::CreatedAt;
type HiveId = S::HiveId;
type UserHandle = S::UserHandle;
}
pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUserDid<S> {}
impl<S: State> State for SetUserDid<S> {
type Title = S::Title;
type Type = S::Type;
type UserDid = Set<members::user_did>;
type CreatedAt = S::CreatedAt;
type HiveId = S::HiveId;
type UserHandle = S::UserHandle;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Title = S::Title;
type Type = S::Type;
type UserDid = S::UserDid;
type CreatedAt = Set<members::created_at>;
type HiveId = S::HiveId;
type UserHandle = S::UserHandle;
}
pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHiveId<S> {}
impl<S: State> State for SetHiveId<S> {
type Title = S::Title;
type Type = S::Type;
type UserDid = S::UserDid;
type CreatedAt = S::CreatedAt;
type HiveId = Set<members::hive_id>;
type UserHandle = S::UserHandle;
}
pub struct SetUserHandle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUserHandle<S> {}
impl<S: State> State for SetUserHandle<S> {
type Title = S::Title;
type Type = S::Type;
type UserDid = S::UserDid;
type CreatedAt = S::CreatedAt;
type HiveId = S::HiveId;
type UserHandle = Set<members::user_handle>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct title(());
pub struct r#type(());
pub struct user_did(());
pub struct created_at(());
pub struct hive_id(());
pub struct user_handle(());
}
}
pub struct ActivityBuilder<'a, S: activity_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<ActivityType<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Activity<'a> {
pub fn new() -> ActivityBuilder<'a, activity_state::Empty> {
ActivityBuilder::new()
}
}
impl<'a> ActivityBuilder<'a, activity_state::Empty> {
pub fn new() -> Self {
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::CreatedAt: activity_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> ActivityBuilder<'a, activity_state::SetCreatedAt<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::HiveId: activity_state::IsUnset,
{
pub fn hive_id(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ActivityBuilder<'a, activity_state::SetHiveId<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::Title: activity_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ActivityBuilder<'a, activity_state::SetTitle<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::Type: activity_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<ActivityType<'a>>,
) -> ActivityBuilder<'a, activity_state::SetType<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::UserDid: activity_state::IsUnset,
{
pub fn user_did(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ActivityBuilder<'a, activity_state::SetUserDid<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::UserHandle: activity_state::IsUnset,
{
pub fn user_handle(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ActivityBuilder<'a, activity_state::SetUserHandle<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
ActivityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ActivityBuilder<'a, S>
where
S: activity_state::State,
S::Title: activity_state::IsSet,
S::Type: activity_state::IsSet,
S::UserDid: activity_state::IsSet,
S::CreatedAt: activity_state::IsSet,
S::HiveId: activity_state::IsSet,
S::UserHandle: activity_state::IsSet,
{
pub fn build(self) -> Activity<'a> {
Activity {
created_at: self.__unsafe_private_named.0.unwrap(),
hive_id: self.__unsafe_private_named.1.unwrap(),
title: self.__unsafe_private_named.2.unwrap(),
r#type: self.__unsafe_private_named.3.unwrap(),
user_did: self.__unsafe_private_named.4.unwrap(),
user_handle: self.__unsafe_private_named.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Activity<'a> {
Activity {
created_at: self.__unsafe_private_named.0.unwrap(),
hive_id: self.__unsafe_private_named.1.unwrap(),
title: self.__unsafe_private_named.2.unwrap(),
r#type: self.__unsafe_private_named.3.unwrap(),
user_did: self.__unsafe_private_named.4.unwrap(),
user_handle: self.__unsafe_private_named.5.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ActivityType<'a> {
Review,
Rated,
Started,
Finished,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> ActivityType<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Review => "review",
Self::Rated => "rated",
Self::Started => "started",
Self::Finished => "finished",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ActivityType<'a> {
fn from(s: &'a str) -> Self {
match s {
"review" => Self::Review,
"rated" => Self::Rated,
"started" => Self::Started,
"finished" => Self::Finished,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for ActivityType<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"review" => Self::Review,
"rated" => Self::Rated,
"started" => Self::Started,
"finished" => Self::Finished,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ActivityType<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ActivityType<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ActivityType<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for ActivityType<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for ActivityType<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ActivityType<'_> {
type Output = ActivityType<'static>;
fn into_static(self) -> Self::Output {
match self {
ActivityType::Review => ActivityType::Review,
ActivityType::Rated => ActivityType::Rated,
ActivityType::Started => ActivityType::Started,
ActivityType::Finished => ActivityType::Finished,
ActivityType::Other(v) => ActivityType::Other(v.into_static()),
}
}
}
fn lexicon_doc_buzz_bookhive_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("buzz.bookhive.defs"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("abandoned"),
::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("activity"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("type"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt"),
::jacquard_common::deps::smol_str::SmolStr::new_static("hiveId"),
::jacquard_common::deps::smol_str::SmolStr::new_static("title"),
::jacquard_common::deps::smol_str::SmolStr::new_static("userDid"),
::jacquard_common::deps::smol_str::SmolStr::new_static("userHandle")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"hiveId",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The hive id of the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"title",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The title of the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"type",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"userDid",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The DID of the user who added the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"userHandle",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The handle of the user who added the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"bookIdentifiers",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"External identifiers for a book",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"goodreadsId",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Goodreads book ID"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"hiveId",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"BookHive's internal ID",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"isbn10",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("10-digit ISBN"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"isbn13",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("13-digit ISBN"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("bookProgress"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Reading progress tracking data",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("updatedAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"currentChapter",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(1i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"currentPage",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(1i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"percent",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: Some(100i64),
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"totalChapters",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(1i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"totalPages",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(1i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"updatedAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"When the progress was last updated",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("comment"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("comment"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt"),
::jacquard_common::deps::smol_str::SmolStr::new_static("book"),
::jacquard_common::deps::smol_str::SmolStr::new_static("parent"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("handle")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"book",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"comment",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The content of the comment.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(100000usize),
min_graphemes: None,
max_graphemes: Some(10000usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Client-declared timestamp when this comment was originally created.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"did",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The DID of the user who made the comment",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"handle",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The handle of the user who made the comment",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"parent",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("finished"),
::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("owned"),
::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("profile"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("displayName"),
::jacquard_common::deps::smol_str::SmolStr::new_static("handle"),
::jacquard_common::deps::smol_str::SmolStr::new_static("booksRead"),
::jacquard_common::deps::smol_str::SmolStr::new_static("reviews")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"avatar",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"booksRead",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"displayName",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"handle",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"isFollowing",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"reviews",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("reading"),
::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("review"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("review"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("handle")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The date the review was created",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"did",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The DID of the user who made the review",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"handle",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The handle of the user who made the review",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"review",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("The review content"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"stars",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("userBook"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("userDid"),
::jacquard_common::deps::smol_str::SmolStr::new_static("title"),
::jacquard_common::deps::smol_str::SmolStr::new_static("authors"),
::jacquard_common::deps::smol_str::SmolStr::new_static("hiveId"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt"),
::jacquard_common::deps::smol_str::SmolStr::new_static("thumbnail")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"authors",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The authors of the book (tab separated)",
),
),
format: None,
default: None,
min_length: Some(1usize),
max_length: Some(2048usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"bookProgress",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"buzz.bookhive.defs#bookProgress",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"cover",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Cover image of the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Book description/summary",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(5000usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"finishedAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The date the user finished reading the book",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"hiveId",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The book's hive id, used to correlate user's books with the hive",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"rating",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: Some(1000i64),
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"review",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("The book's review"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(15000usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"stars",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(1i64),
maximum: Some(10i64),
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"startedAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The date the user started reading the book",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"status",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"thumbnail",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Cover image of the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"title",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The title of the book",
),
),
format: None,
default: None,
min_length: Some(1usize),
max_length: Some(512usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"userDid",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The DID of the user who added the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"userHandle",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The handle of the user who added the book",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("wantToRead"),
::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
description: None,
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Activity<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"activity"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct BookIdentifiers<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub goodreads_id: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub hive_id: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub isbn10: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub isbn13: std::option::Option<jacquard_common::CowStr<'a>>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BookIdentifiers<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"bookIdentifiers"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct BookProgress<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub current_chapter: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub current_page: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub percent: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub total_chapters: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub total_pages: std::option::Option<i64>,
pub updated_at: jacquard_common::types::string::Datetime,
}
pub mod book_progress_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type UpdatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type UpdatedAt = Unset;
}
pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
impl<S: State> State for SetUpdatedAt<S> {
type UpdatedAt = Set<members::updated_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct updated_at(());
}
}
pub struct BookProgressBuilder<'a, S: book_progress_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<i64>,
::core::option::Option<i64>,
::core::option::Option<i64>,
::core::option::Option<i64>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> BookProgress<'a> {
pub fn new() -> BookProgressBuilder<'a, book_progress_state::Empty> {
BookProgressBuilder::new()
}
}
impl<'a> BookProgressBuilder<'a, book_progress_state::Empty> {
pub fn new() -> Self {
BookProgressBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: book_progress_state::State> BookProgressBuilder<'a, S> {
pub fn current_chapter(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_current_chapter(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: book_progress_state::State> BookProgressBuilder<'a, S> {
pub fn current_page(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_current_page(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: book_progress_state::State> BookProgressBuilder<'a, S> {
pub fn percent(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_percent(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: book_progress_state::State> BookProgressBuilder<'a, S> {
pub fn total_chapters(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_total_chapters(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: book_progress_state::State> BookProgressBuilder<'a, S> {
pub fn total_pages(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_total_pages(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> BookProgressBuilder<'a, S>
where
S: book_progress_state::State,
S::UpdatedAt: book_progress_state::IsUnset,
{
pub fn updated_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> BookProgressBuilder<'a, book_progress_state::SetUpdatedAt<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
BookProgressBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> BookProgressBuilder<'a, S>
where
S: book_progress_state::State,
S::UpdatedAt: book_progress_state::IsSet,
{
pub fn build(self) -> BookProgress<'a> {
BookProgress {
current_chapter: self.__unsafe_private_named.0,
current_page: self.__unsafe_private_named.1,
percent: self.__unsafe_private_named.2,
total_chapters: self.__unsafe_private_named.3,
total_pages: self.__unsafe_private_named.4,
updated_at: self.__unsafe_private_named.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> BookProgress<'a> {
BookProgress {
current_chapter: self.__unsafe_private_named.0,
current_page: self.__unsafe_private_named.1,
percent: self.__unsafe_private_named.2,
total_chapters: self.__unsafe_private_named.3,
total_pages: self.__unsafe_private_named.4,
updated_at: self.__unsafe_private_named.5.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BookProgress<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"bookProgress"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.current_chapter {
if *value < 1i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"current_chapter",
),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.current_page {
if *value < 1i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"current_page",
),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.percent {
if *value > 100i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Maximum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"percent",
),
max: 100i64,
actual: *value,
});
}
}
if let Some(ref value) = self.percent {
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"percent",
),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.total_chapters {
if *value < 1i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"total_chapters",
),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.total_pages {
if *value < 1i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"total_pages",
),
min: 1i64,
actual: *value,
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Comment<'a> {
#[serde(borrow)]
pub book: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
#[serde(borrow)]
pub comment: jacquard_common::CowStr<'a>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(borrow)]
pub did: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub handle: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
}
pub mod comment_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Book;
type CreatedAt;
type Handle;
type Comment;
type Parent;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Book = Unset;
type CreatedAt = Unset;
type Handle = Unset;
type Comment = Unset;
type Parent = Unset;
type Did = Unset;
}
pub struct SetBook<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBook<S> {}
impl<S: State> State for SetBook<S> {
type Book = Set<members::book>;
type CreatedAt = S::CreatedAt;
type Handle = S::Handle;
type Comment = S::Comment;
type Parent = S::Parent;
type Did = S::Did;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Book = S::Book;
type CreatedAt = Set<members::created_at>;
type Handle = S::Handle;
type Comment = S::Comment;
type Parent = S::Parent;
type Did = S::Did;
}
pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHandle<S> {}
impl<S: State> State for SetHandle<S> {
type Book = S::Book;
type CreatedAt = S::CreatedAt;
type Handle = Set<members::handle>;
type Comment = S::Comment;
type Parent = S::Parent;
type Did = S::Did;
}
pub struct SetComment<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetComment<S> {}
impl<S: State> State for SetComment<S> {
type Book = S::Book;
type CreatedAt = S::CreatedAt;
type Handle = S::Handle;
type Comment = Set<members::comment>;
type Parent = S::Parent;
type Did = S::Did;
}
pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetParent<S> {}
impl<S: State> State for SetParent<S> {
type Book = S::Book;
type CreatedAt = S::CreatedAt;
type Handle = S::Handle;
type Comment = S::Comment;
type Parent = Set<members::parent>;
type Did = S::Did;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Book = S::Book;
type CreatedAt = S::CreatedAt;
type Handle = S::Handle;
type Comment = S::Comment;
type Parent = S::Parent;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct book(());
pub struct created_at(());
pub struct handle(());
pub struct comment(());
pub struct parent(());
pub struct did(());
}
}
pub struct CommentBuilder<'a, S: comment_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Comment<'a> {
pub fn new() -> CommentBuilder<'a, comment_state::Empty> {
CommentBuilder::new()
}
}
impl<'a> CommentBuilder<'a, comment_state::Empty> {
pub fn new() -> Self {
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::Book: comment_state::IsUnset,
{
pub fn book(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> CommentBuilder<'a, comment_state::SetBook<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::Comment: comment_state::IsUnset,
{
pub fn comment(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> CommentBuilder<'a, comment_state::SetComment<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::CreatedAt: comment_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> CommentBuilder<'a, comment_state::SetCreatedAt<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::Did: comment_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> CommentBuilder<'a, comment_state::SetDid<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::Handle: comment_state::IsUnset,
{
pub fn handle(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> CommentBuilder<'a, comment_state::SetHandle<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::Parent: comment_state::IsUnset,
{
pub fn parent(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> CommentBuilder<'a, comment_state::SetParent<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
CommentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommentBuilder<'a, S>
where
S: comment_state::State,
S::Book: comment_state::IsSet,
S::CreatedAt: comment_state::IsSet,
S::Handle: comment_state::IsSet,
S::Comment: comment_state::IsSet,
S::Parent: comment_state::IsSet,
S::Did: comment_state::IsSet,
{
pub fn build(self) -> Comment<'a> {
Comment {
book: self.__unsafe_private_named.0.unwrap(),
comment: self.__unsafe_private_named.1.unwrap(),
created_at: self.__unsafe_private_named.2.unwrap(),
did: self.__unsafe_private_named.3.unwrap(),
handle: self.__unsafe_private_named.4.unwrap(),
parent: self.__unsafe_private_named.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Comment<'a> {
Comment {
book: self.__unsafe_private_named.0.unwrap(),
comment: self.__unsafe_private_named.1.unwrap(),
created_at: self.__unsafe_private_named.2.unwrap(),
did: self.__unsafe_private_named.3.unwrap(),
handle: self.__unsafe_private_named.4.unwrap(),
parent: self.__unsafe_private_named.5.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Comment<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"comment"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.comment;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"comment",
),
max: 100000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.comment;
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 10000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"comment",
),
max: 10000usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
Hash,
jacquard_derive::IntoStatic
)]
pub struct Finished;
impl std::fmt::Display for Finished {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "finished")
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
Hash,
jacquard_derive::IntoStatic
)]
pub struct Owned;
impl std::fmt::Display for Owned {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "owned")
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Profile<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub avatar: std::option::Option<jacquard_common::CowStr<'a>>,
pub books_read: i64,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub display_name: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub handle: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub is_following: std::option::Option<bool>,
pub reviews: i64,
}
pub mod profile_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type DisplayName;
type Reviews;
type Handle;
type BooksRead;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type DisplayName = Unset;
type Reviews = Unset;
type Handle = Unset;
type BooksRead = Unset;
}
pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDisplayName<S> {}
impl<S: State> State for SetDisplayName<S> {
type DisplayName = Set<members::display_name>;
type Reviews = S::Reviews;
type Handle = S::Handle;
type BooksRead = S::BooksRead;
}
pub struct SetReviews<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetReviews<S> {}
impl<S: State> State for SetReviews<S> {
type DisplayName = S::DisplayName;
type Reviews = Set<members::reviews>;
type Handle = S::Handle;
type BooksRead = S::BooksRead;
}
pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHandle<S> {}
impl<S: State> State for SetHandle<S> {
type DisplayName = S::DisplayName;
type Reviews = S::Reviews;
type Handle = Set<members::handle>;
type BooksRead = S::BooksRead;
}
pub struct SetBooksRead<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBooksRead<S> {}
impl<S: State> State for SetBooksRead<S> {
type DisplayName = S::DisplayName;
type Reviews = S::Reviews;
type Handle = S::Handle;
type BooksRead = Set<members::books_read>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct display_name(());
pub struct reviews(());
pub struct handle(());
pub struct books_read(());
}
}
pub struct ProfileBuilder<'a, S: profile_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<bool>,
::core::option::Option<i64>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Profile<'a> {
pub fn new() -> ProfileBuilder<'a, profile_state::Empty> {
ProfileBuilder::new()
}
}
impl<'a> ProfileBuilder<'a, profile_state::Empty> {
pub fn new() -> Self {
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn avatar(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_avatar(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::BooksRead: profile_state::IsUnset,
{
pub fn books_read(
mut self,
value: impl Into<i64>,
) -> ProfileBuilder<'a, profile_state::SetBooksRead<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::DisplayName: profile_state::IsUnset,
{
pub fn display_name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ProfileBuilder<'a, profile_state::SetDisplayName<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::Handle: profile_state::IsUnset,
{
pub fn handle(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ProfileBuilder<'a, profile_state::SetHandle<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn is_following(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_is_following(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::Reviews: profile_state::IsUnset,
{
pub fn reviews(
mut self,
value: impl Into<i64>,
) -> ProfileBuilder<'a, profile_state::SetReviews<S>> {
self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::DisplayName: profile_state::IsSet,
S::Reviews: profile_state::IsSet,
S::Handle: profile_state::IsSet,
S::BooksRead: profile_state::IsSet,
{
pub fn build(self) -> Profile<'a> {
Profile {
avatar: self.__unsafe_private_named.0,
books_read: self.__unsafe_private_named.1.unwrap(),
description: self.__unsafe_private_named.2,
display_name: self.__unsafe_private_named.3.unwrap(),
handle: self.__unsafe_private_named.4.unwrap(),
is_following: self.__unsafe_private_named.5,
reviews: self.__unsafe_private_named.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Profile<'a> {
Profile {
avatar: self.__unsafe_private_named.0,
books_read: self.__unsafe_private_named.1.unwrap(),
description: self.__unsafe_private_named.2,
display_name: self.__unsafe_private_named.3.unwrap(),
handle: self.__unsafe_private_named.4.unwrap(),
is_following: self.__unsafe_private_named.5,
reviews: self.__unsafe_private_named.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"profile"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.books_read;
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"books_read",
),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.reviews;
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"reviews",
),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
Hash,
jacquard_derive::IntoStatic
)]
pub struct Reading;
impl std::fmt::Display for Reading {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "reading")
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Review<'a> {
pub created_at: jacquard_common::types::string::Datetime,
#[serde(borrow)]
pub did: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub handle: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub review: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub stars: std::option::Option<i64>,
}
pub mod review_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Handle;
type CreatedAt;
type Did;
type Review;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Handle = Unset;
type CreatedAt = Unset;
type Did = Unset;
type Review = Unset;
}
pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHandle<S> {}
impl<S: State> State for SetHandle<S> {
type Handle = Set<members::handle>;
type CreatedAt = S::CreatedAt;
type Did = S::Did;
type Review = S::Review;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Handle = S::Handle;
type CreatedAt = Set<members::created_at>;
type Did = S::Did;
type Review = S::Review;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Handle = S::Handle;
type CreatedAt = S::CreatedAt;
type Did = Set<members::did>;
type Review = S::Review;
}
pub struct SetReview<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetReview<S> {}
impl<S: State> State for SetReview<S> {
type Handle = S::Handle;
type CreatedAt = S::CreatedAt;
type Did = S::Did;
type Review = Set<members::review>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct handle(());
pub struct created_at(());
pub struct did(());
pub struct review(());
}
}
pub struct ReviewBuilder<'a, S: review_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Review<'a> {
pub fn new() -> ReviewBuilder<'a, review_state::Empty> {
ReviewBuilder::new()
}
}
impl<'a> ReviewBuilder<'a, review_state::Empty> {
pub fn new() -> Self {
ReviewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReviewBuilder<'a, S>
where
S: review_state::State,
S::CreatedAt: review_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> ReviewBuilder<'a, review_state::SetCreatedAt<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ReviewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReviewBuilder<'a, S>
where
S: review_state::State,
S::Did: review_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ReviewBuilder<'a, review_state::SetDid<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ReviewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReviewBuilder<'a, S>
where
S: review_state::State,
S::Handle: review_state::IsUnset,
{
pub fn handle(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ReviewBuilder<'a, review_state::SetHandle<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
ReviewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReviewBuilder<'a, S>
where
S: review_state::State,
S::Review: review_state::IsUnset,
{
pub fn review(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ReviewBuilder<'a, review_state::SetReview<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
ReviewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: review_state::State> ReviewBuilder<'a, S> {
pub fn stars(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_stars(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> ReviewBuilder<'a, S>
where
S: review_state::State,
S::Handle: review_state::IsSet,
S::CreatedAt: review_state::IsSet,
S::Did: review_state::IsSet,
S::Review: review_state::IsSet,
{
pub fn build(self) -> Review<'a> {
Review {
created_at: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
handle: self.__unsafe_private_named.2.unwrap(),
review: self.__unsafe_private_named.3.unwrap(),
stars: self.__unsafe_private_named.4,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Review<'a> {
Review {
created_at: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
handle: self.__unsafe_private_named.2.unwrap(),
review: self.__unsafe_private_named.3.unwrap(),
stars: self.__unsafe_private_named.4,
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Review<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"review"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct UserBook<'a> {
#[serde(borrow)]
pub authors: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub book_progress: std::option::Option<crate::buzz_bookhive::BookProgress<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cover: std::option::Option<jacquard_common::CowStr<'a>>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub finished_at: std::option::Option<jacquard_common::types::string::Datetime>,
#[serde(borrow)]
pub hive_id: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub rating: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub review: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub stars: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub started_at: std::option::Option<jacquard_common::types::string::Datetime>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub status: std::option::Option<UserBookStatus<'a>>,
#[serde(borrow)]
pub thumbnail: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub title: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub user_did: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub user_handle: std::option::Option<jacquard_common::CowStr<'a>>,
}
pub mod user_book_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Title;
type UserDid;
type Thumbnail;
type Authors;
type HiveId;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Title = Unset;
type UserDid = Unset;
type Thumbnail = Unset;
type Authors = Unset;
type HiveId = Unset;
type CreatedAt = Unset;
}
pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTitle<S> {}
impl<S: State> State for SetTitle<S> {
type Title = Set<members::title>;
type UserDid = S::UserDid;
type Thumbnail = S::Thumbnail;
type Authors = S::Authors;
type HiveId = S::HiveId;
type CreatedAt = S::CreatedAt;
}
pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUserDid<S> {}
impl<S: State> State for SetUserDid<S> {
type Title = S::Title;
type UserDid = Set<members::user_did>;
type Thumbnail = S::Thumbnail;
type Authors = S::Authors;
type HiveId = S::HiveId;
type CreatedAt = S::CreatedAt;
}
pub struct SetThumbnail<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetThumbnail<S> {}
impl<S: State> State for SetThumbnail<S> {
type Title = S::Title;
type UserDid = S::UserDid;
type Thumbnail = Set<members::thumbnail>;
type Authors = S::Authors;
type HiveId = S::HiveId;
type CreatedAt = S::CreatedAt;
}
pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthors<S> {}
impl<S: State> State for SetAuthors<S> {
type Title = S::Title;
type UserDid = S::UserDid;
type Thumbnail = S::Thumbnail;
type Authors = Set<members::authors>;
type HiveId = S::HiveId;
type CreatedAt = S::CreatedAt;
}
pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHiveId<S> {}
impl<S: State> State for SetHiveId<S> {
type Title = S::Title;
type UserDid = S::UserDid;
type Thumbnail = S::Thumbnail;
type Authors = S::Authors;
type HiveId = Set<members::hive_id>;
type CreatedAt = S::CreatedAt;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Title = S::Title;
type UserDid = S::UserDid;
type Thumbnail = S::Thumbnail;
type Authors = S::Authors;
type HiveId = S::HiveId;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct title(());
pub struct user_did(());
pub struct thumbnail(());
pub struct authors(());
pub struct hive_id(());
pub struct created_at(());
}
}
pub struct UserBookBuilder<'a, S: user_book_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<crate::buzz_bookhive::BookProgress<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<UserBookStatus<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> UserBook<'a> {
pub fn new() -> UserBookBuilder<'a, user_book_state::Empty> {
UserBookBuilder::new()
}
}
impl<'a> UserBookBuilder<'a, user_book_state::Empty> {
pub fn new() -> Self {
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::Authors: user_book_state::IsUnset,
{
pub fn authors(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> UserBookBuilder<'a, user_book_state::SetAuthors<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn book_progress(
mut self,
value: impl Into<Option<crate::buzz_bookhive::BookProgress<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_book_progress(
mut self,
value: Option<crate::buzz_bookhive::BookProgress<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn cover(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_cover(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::CreatedAt: user_book_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> UserBookBuilder<'a, user_book_state::SetCreatedAt<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn finished_at(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_finished_at(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::HiveId: user_book_state::IsUnset,
{
pub fn hive_id(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> UserBookBuilder<'a, user_book_state::SetHiveId<S>> {
self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn rating(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.7 = value.into();
self
}
pub fn maybe_rating(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.7 = value;
self
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn review(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.8 = value.into();
self
}
pub fn maybe_review(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.8 = value;
self
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn stars(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.9 = value.into();
self
}
pub fn maybe_stars(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.9 = value;
self
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn started_at(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.10 = value.into();
self
}
pub fn maybe_started_at(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.10 = value;
self
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn status(mut self, value: impl Into<Option<UserBookStatus<'a>>>) -> Self {
self.__unsafe_private_named.11 = value.into();
self
}
pub fn maybe_status(mut self, value: Option<UserBookStatus<'a>>) -> Self {
self.__unsafe_private_named.11 = value;
self
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::Thumbnail: user_book_state::IsUnset,
{
pub fn thumbnail(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> UserBookBuilder<'a, user_book_state::SetThumbnail<S>> {
self.__unsafe_private_named.12 = ::core::option::Option::Some(value.into());
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::Title: user_book_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> UserBookBuilder<'a, user_book_state::SetTitle<S>> {
self.__unsafe_private_named.13 = ::core::option::Option::Some(value.into());
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::UserDid: user_book_state::IsUnset,
{
pub fn user_did(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> UserBookBuilder<'a, user_book_state::SetUserDid<S>> {
self.__unsafe_private_named.14 = ::core::option::Option::Some(value.into());
UserBookBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> {
pub fn user_handle(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.15 = value.into();
self
}
pub fn maybe_user_handle(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.15 = value;
self
}
}
impl<'a, S> UserBookBuilder<'a, S>
where
S: user_book_state::State,
S::Title: user_book_state::IsSet,
S::UserDid: user_book_state::IsSet,
S::Thumbnail: user_book_state::IsSet,
S::Authors: user_book_state::IsSet,
S::HiveId: user_book_state::IsSet,
S::CreatedAt: user_book_state::IsSet,
{
pub fn build(self) -> UserBook<'a> {
UserBook {
authors: self.__unsafe_private_named.0.unwrap(),
book_progress: self.__unsafe_private_named.1,
cover: self.__unsafe_private_named.2,
created_at: self.__unsafe_private_named.3.unwrap(),
description: self.__unsafe_private_named.4,
finished_at: self.__unsafe_private_named.5,
hive_id: self.__unsafe_private_named.6.unwrap(),
rating: self.__unsafe_private_named.7,
review: self.__unsafe_private_named.8,
stars: self.__unsafe_private_named.9,
started_at: self.__unsafe_private_named.10,
status: self.__unsafe_private_named.11,
thumbnail: self.__unsafe_private_named.12.unwrap(),
title: self.__unsafe_private_named.13.unwrap(),
user_did: self.__unsafe_private_named.14.unwrap(),
user_handle: self.__unsafe_private_named.15,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> UserBook<'a> {
UserBook {
authors: self.__unsafe_private_named.0.unwrap(),
book_progress: self.__unsafe_private_named.1,
cover: self.__unsafe_private_named.2,
created_at: self.__unsafe_private_named.3.unwrap(),
description: self.__unsafe_private_named.4,
finished_at: self.__unsafe_private_named.5,
hive_id: self.__unsafe_private_named.6.unwrap(),
rating: self.__unsafe_private_named.7,
review: self.__unsafe_private_named.8,
stars: self.__unsafe_private_named.9,
started_at: self.__unsafe_private_named.10,
status: self.__unsafe_private_named.11,
thumbnail: self.__unsafe_private_named.12.unwrap(),
title: self.__unsafe_private_named.13.unwrap(),
user_did: self.__unsafe_private_named.14.unwrap(),
user_handle: self.__unsafe_private_named.15,
extra_data: Some(extra_data),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum UserBookStatus<'a> {
Finished,
Reading,
WantToRead,
Abandoned,
Owned,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> UserBookStatus<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Finished => "buzz.bookhive.defs#finished",
Self::Reading => "buzz.bookhive.defs#reading",
Self::WantToRead => "buzz.bookhive.defs#wantToRead",
Self::Abandoned => "buzz.bookhive.defs#abandoned",
Self::Owned => "buzz.bookhive.defs#owned",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for UserBookStatus<'a> {
fn from(s: &'a str) -> Self {
match s {
"buzz.bookhive.defs#finished" => Self::Finished,
"buzz.bookhive.defs#reading" => Self::Reading,
"buzz.bookhive.defs#wantToRead" => Self::WantToRead,
"buzz.bookhive.defs#abandoned" => Self::Abandoned,
"buzz.bookhive.defs#owned" => Self::Owned,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for UserBookStatus<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"buzz.bookhive.defs#finished" => Self::Finished,
"buzz.bookhive.defs#reading" => Self::Reading,
"buzz.bookhive.defs#wantToRead" => Self::WantToRead,
"buzz.bookhive.defs#abandoned" => Self::Abandoned,
"buzz.bookhive.defs#owned" => Self::Owned,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for UserBookStatus<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for UserBookStatus<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for UserBookStatus<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for UserBookStatus<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for UserBookStatus<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for UserBookStatus<'_> {
type Output = UserBookStatus<'static>;
fn into_static(self) -> Self::Output {
match self {
UserBookStatus::Finished => UserBookStatus::Finished,
UserBookStatus::Reading => UserBookStatus::Reading,
UserBookStatus::WantToRead => UserBookStatus::WantToRead,
UserBookStatus::Abandoned => UserBookStatus::Abandoned,
UserBookStatus::Owned => UserBookStatus::Owned,
UserBookStatus::Other(v) => UserBookStatus::Other(v.into_static()),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for UserBook<'a> {
fn nsid() -> &'static str {
"buzz.bookhive.defs"
}
fn def_name() -> &'static str {
"userBook"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_buzz_bookhive_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.authors;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2048usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"authors",
),
max: 2048usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.authors;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 1usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MinLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"authors",
),
min: 1usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 5000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"description",
),
max: 5000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.rating {
if *value > 1000i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Maximum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"rating",
),
max: 1000i64,
actual: *value,
});
}
}
if let Some(ref value) = self.rating {
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"rating",
),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.review {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 15000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"review",
),
max: 15000usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.stars {
if *value > 10i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Maximum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"stars",
),
max: 10i64,
actual: *value,
});
}
}
if let Some(ref value) = self.stars {
if *value < 1i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"stars",
),
min: 1i64,
actual: *value,
});
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 512usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"title",
),
max: 512usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 1usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MinLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"title",
),
min: 1usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
Hash,
jacquard_derive::IntoStatic
)]
pub struct WantToRead;
impl std::fmt::Display for WantToRead {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "wantToRead")
}
}