// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: buzz.bookhive.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. //! Generated bindings for the `buzz.bookhive` Lexicon namespace/module. 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; #[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::string::Datetime; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; use crate::buzz_bookhive; use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; use serde::{Deserialize, Serialize}; /// User has abandoned the book #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] pub struct Abandoned; impl core::fmt::Display for Abandoned { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "abandoned") } } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct Activity { pub created_at: Datetime, /// The hive id of the book pub hive_id: S, /// The title of the book pub title: S, pub r#type: ActivityType, /// The DID of the user who added the book pub user_did: S, /// The handle of the user who added the book pub user_handle: S, #[serde( flatten, default, deserialize_with = "deserialize_activity_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ActivityType { Review, Rated, Started, Finished, Other(S), } impl ActivityType { 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(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "review" => Self::Review, "rated" => Self::Rated, "started" => Self::Started, "finished" => Self::Finished, _ => Self::Other(s), } } } impl core::fmt::Display for ActivityType { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl AsRef for ActivityType { fn as_ref(&self) -> &str { self.as_str() } } impl Serialize for ActivityType { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ActivityType { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) } } impl Default for ActivityType { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for ActivityType where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, { type Output = ActivityType; 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()), } } } /// External identifiers for a book #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct BookIdentifiers { /// Goodreads book ID #[serde(skip_serializing_if = "Option::is_none")] pub goodreads_id: Option, /// BookHive's internal ID #[serde(skip_serializing_if = "Option::is_none")] pub hive_id: Option, /// 10-digit ISBN #[serde(skip_serializing_if = "Option::is_none")] pub isbn10: Option, /// 13-digit ISBN #[serde(skip_serializing_if = "Option::is_none")] pub isbn13: Option, #[serde( flatten, default, deserialize_with = "deserialize_book_identifiers_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } /// Reading progress tracking data #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct BookProgress { /// Current chapter the user is on #[serde(skip_serializing_if = "Option::is_none")] pub current_chapter: Option, /// Current page the user is on #[serde(skip_serializing_if = "Option::is_none")] pub current_page: Option, /// How far through the book the reader is (0-100) #[serde(skip_serializing_if = "Option::is_none")] pub percent: Option, /// Total number of chapters in the book #[serde(skip_serializing_if = "Option::is_none")] pub total_chapters: Option, /// Total number of pages in the book #[serde(skip_serializing_if = "Option::is_none")] pub total_pages: Option, /// When the progress was last updated pub updated_at: Datetime, #[serde( flatten, default, deserialize_with = "deserialize_book_progress_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct Comment { pub book: StrongRef, /// The content of the comment. pub comment: S, /// Client-declared timestamp when this comment was originally created. pub created_at: Datetime, /// The DID of the user who made the comment pub did: S, /// The handle of the user who made the comment pub handle: S, pub parent: StrongRef, #[serde( flatten, default, deserialize_with = "deserialize_comment_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } /// User has finished reading the book #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] pub struct Finished; impl core::fmt::Display for Finished { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "finished") } } /// User owns the book #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] pub struct Owned; impl core::fmt::Display for Owned { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "owned") } } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct Profile { #[serde(skip_serializing_if = "Option::is_none")] pub avatar: Option, pub books_read: i64, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, pub display_name: S, pub handle: S, /// Whether the authed user is following this profile #[serde(skip_serializing_if = "Option::is_none")] pub is_following: Option, pub reviews: i64, #[serde( flatten, default, deserialize_with = "deserialize_profile_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } /// User is currently reading the book #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] pub struct Reading; impl core::fmt::Display for Reading { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "reading") } } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct Review { /// The date the review was created pub created_at: Datetime, /// The DID of the user who made the review pub did: S, /// The handle of the user who made the review pub handle: S, /// The review content pub review: S, /// The number of stars given to the book #[serde(skip_serializing_if = "Option::is_none")] pub stars: Option, #[serde( flatten, default, deserialize_with = "deserialize_review_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr") )] pub struct UserBook { /// The authors of the book (tab separated) pub authors: S, /// Progress tracking information for the book #[serde(skip_serializing_if = "Option::is_none")] pub book_progress: Option>, /// Cover image of the book #[serde(skip_serializing_if = "Option::is_none")] pub cover: Option, pub created_at: Datetime, /// Book description/summary #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, /// The date the user finished reading the book #[serde(skip_serializing_if = "Option::is_none")] pub finished_at: Option, /// The book's hive id, used to correlate user's books with the hive pub hive_id: S, /// Average rating (0-1000) #[serde(skip_serializing_if = "Option::is_none")] pub rating: Option, /// The book's review #[serde(skip_serializing_if = "Option::is_none")] pub review: Option, /// Number of stars given to the book (1-10) which will be mapped to 1-5 stars #[serde(skip_serializing_if = "Option::is_none")] pub stars: Option, /// The date the user started reading the book #[serde(skip_serializing_if = "Option::is_none")] pub started_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub status: Option>, /// Cover image of the book pub thumbnail: S, /// The title of the book pub title: S, /// The DID of the user who added the book pub user_did: S, /// The handle of the user who added the book #[serde(skip_serializing_if = "Option::is_none")] pub user_handle: Option, #[serde( flatten, default, deserialize_with = "deserialize_user_book_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option>>, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum UserBookStatus { Finished, Reading, WantToRead, Abandoned, Owned, Other(S), } impl UserBookStatus { 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(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "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(s), } } } impl core::fmt::Display for UserBookStatus { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl AsRef for UserBookStatus { fn as_ref(&self) -> &str { self.as_str() } } impl Serialize for UserBookStatus { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for UserBookStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) } } impl Default for UserBookStatus { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for UserBookStatus where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, { type Output = UserBookStatus; 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()), } } } /// User wants to read the book #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] pub struct WantToRead; impl core::fmt::Display for WantToRead { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "wantToRead") } } impl LexiconSchema for Activity { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "activity" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for BookIdentifiers { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "bookIdentifiers" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for BookProgress { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "bookProgress" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { if let Some(ref value) = self.current_chapter { if *value < 1i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("current_chapter"), min: 1i64, actual: *value, }); } } if let Some(ref value) = self.current_page { if *value < 1i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("current_page"), min: 1i64, actual: *value, }); } } if let Some(ref value) = self.percent { if *value > 100i64 { return Err(ConstraintError::Maximum { path: ValidationPath::from_field("percent"), max: 100i64, actual: *value, }); } } if let Some(ref value) = self.percent { if *value < 0i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("percent"), min: 0i64, actual: *value, }); } } if let Some(ref value) = self.total_chapters { if *value < 1i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("total_chapters"), min: 1i64, actual: *value, }); } } if let Some(ref value) = self.total_pages { if *value < 1i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("total_pages"), min: 1i64, actual: *value, }); } } Ok(()) } } impl LexiconSchema for Comment { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "comment" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { { let value = &self.comment; #[allow(unused_comparisons)] if ::len(value.as_ref()) > 100000usize { return Err(ConstraintError::MaxLength { path: ValidationPath::from_field("comment"), max: 100000usize, actual: ::len(value.as_ref()), }); } } { let value = &self.comment; { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 10000usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("comment"), max: 10000usize, actual: count, }); } } } Ok(()) } } impl LexiconSchema for Profile { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "profile" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { { let value = &self.books_read; if *value < 0i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("books_read"), min: 0i64, actual: *value, }); } } { let value = &self.reviews; if *value < 0i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("reviews"), min: 0i64, actual: *value, }); } } Ok(()) } } impl LexiconSchema for Review { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "review" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for UserBook { fn nsid() -> &'static str { "buzz.bookhive.defs" } fn def_name() -> &'static str { "userBook" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_buzz_bookhive_defs() } fn validate(&self) -> Result<(), ConstraintError> { { let value = &self.authors; #[allow(unused_comparisons)] if ::len(value.as_ref()) > 2048usize { return Err(ConstraintError::MaxLength { path: ValidationPath::from_field("authors"), max: 2048usize, actual: ::len(value.as_ref()), }); } } { let value = &self.authors; #[allow(unused_comparisons)] if ::len(value.as_ref()) < 1usize { return Err(ConstraintError::MinLength { path: ValidationPath::from_field("authors"), min: 1usize, actual: ::len(value.as_ref()), }); } } if let Some(ref value) = self.description { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 5000usize { return Err(ConstraintError::MaxLength { path: ValidationPath::from_field("description"), max: 5000usize, actual: ::len(value.as_ref()), }); } } if let Some(ref value) = self.rating { if *value > 1000i64 { return Err(ConstraintError::Maximum { path: ValidationPath::from_field("rating"), max: 1000i64, actual: *value, }); } } if let Some(ref value) = self.rating { if *value < 0i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("rating"), min: 0i64, actual: *value, }); } } if let Some(ref value) = self.review { { let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count(); if count > 15000usize { return Err(ConstraintError::MaxGraphemes { path: ValidationPath::from_field("review"), max: 15000usize, actual: count, }); } } } if let Some(ref value) = self.stars { if *value > 10i64 { return Err(ConstraintError::Maximum { path: ValidationPath::from_field("stars"), max: 10i64, actual: *value, }); } } if let Some(ref value) = self.stars { if *value < 1i64 { return Err(ConstraintError::Minimum { path: ValidationPath::from_field("stars"), min: 1i64, actual: *value, }); } } { let value = &self.title; #[allow(unused_comparisons)] if ::len(value.as_ref()) > 512usize { return Err(ConstraintError::MaxLength { path: ValidationPath::from_field("title"), max: 512usize, actual: ::len(value.as_ref()), }); } } { let value = &self.title; #[allow(unused_comparisons)] if ::len(value.as_ref()) < 1usize { return Err(ConstraintError::MinLength { path: ValidationPath::from_field("title"), min: 1usize, actual: ::len(value.as_ref()), }); } } Ok(()) } } fn deserialize_activity_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } pub mod activity_state { pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; type HiveId; type Title; type Type; type UserDid; type UserHandle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; type HiveId = Unset; type Title = Unset; type Type = Unset; type UserDid = Unset; type UserHandle = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData St>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type CreatedAt = Set; type HiveId = St::HiveId; type Title = St::Title; type Type = St::Type; type UserDid = St::UserDid; type UserHandle = St::UserHandle; } ///State transition - sets the `hive_id` field to Set pub struct SetHiveId(PhantomData St>); impl sealed::Sealed for SetHiveId {} impl State for SetHiveId { type CreatedAt = St::CreatedAt; type HiveId = Set; type Title = St::Title; type Type = St::Type; type UserDid = St::UserDid; type UserHandle = St::UserHandle; } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData St>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Title = Set; type Type = St::Type; type UserDid = St::UserDid; type UserHandle = St::UserHandle; } ///State transition - sets the `type` field to Set pub struct SetType(PhantomData St>); impl sealed::Sealed for SetType {} impl State for SetType { type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Title = St::Title; type Type = Set; type UserDid = St::UserDid; type UserHandle = St::UserHandle; } ///State transition - sets the `user_did` field to Set pub struct SetUserDid(PhantomData St>); impl sealed::Sealed for SetUserDid {} impl State for SetUserDid { type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Title = St::Title; type Type = St::Type; type UserDid = Set; type UserHandle = St::UserHandle; } ///State transition - sets the `user_handle` field to Set pub struct SetUserHandle(PhantomData St>); impl sealed::Sealed for SetUserHandle {} impl State for SetUserHandle { type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Title = St::Title; type Type = St::Type; type UserDid = St::UserDid; type UserHandle = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `hive_id` field pub struct hive_id(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `type` field pub struct r#type(()); ///Marker type for the `user_did` field pub struct user_did(()); ///Marker type for the `user_handle` field pub struct user_handle(()); } } /// Builder for constructing an instance of this type. pub struct ActivityBuilder { _state: PhantomData St>, _fields: ( Option, Option, Option, Option>, Option, Option, ), _type: PhantomData S>, } impl Activity { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> ActivityBuilder { ActivityBuilder::new() } } impl Activity { /// Create a new builder for this type pub fn builder() -> ActivityBuilder { ActivityBuilder::builder() } } impl ActivityBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { ActivityBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } } } impl ActivityBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { ActivityBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::CreatedAt: activity_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> ActivityBuilder, S> { self._fields.0 = Option::Some(value.into()); ActivityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::HiveId: activity_state::IsUnset, { /// Set the `hiveId` field (required) pub fn hive_id( mut self, value: impl Into, ) -> ActivityBuilder, S> { self._fields.1 = Option::Some(value.into()); ActivityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::Title: activity_state::IsUnset, { /// Set the `title` field (required) pub fn title( mut self, value: impl Into, ) -> ActivityBuilder, S> { self._fields.2 = Option::Some(value.into()); ActivityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::Type: activity_state::IsUnset, { /// Set the `type` field (required) pub fn r#type( mut self, value: impl Into>, ) -> ActivityBuilder, S> { self._fields.3 = Option::Some(value.into()); ActivityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::UserDid: activity_state::IsUnset, { /// Set the `userDid` field (required) pub fn user_did( mut self, value: impl Into, ) -> ActivityBuilder, S> { self._fields.4 = Option::Some(value.into()); ActivityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::UserHandle: activity_state::IsUnset, { /// Set the `userHandle` field (required) pub fn user_handle( mut self, value: impl Into, ) -> ActivityBuilder, S> { self._fields.5 = Option::Some(value.into()); ActivityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ActivityBuilder where St: activity_state::State, St::CreatedAt: activity_state::IsSet, St::HiveId: activity_state::IsSet, St::Title: activity_state::IsSet, St::Type: activity_state::IsSet, St::UserDid: activity_state::IsSet, St::UserHandle: activity_state::IsSet, { /// Build the final struct. pub fn build(self) -> Activity { Activity { created_at: self._fields.0.unwrap(), hive_id: self._fields.1.unwrap(), title: self._fields.2.unwrap(), r#type: self._fields.3.unwrap(), user_did: self._fields.4.unwrap(), user_handle: self._fields.5.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Activity { Activity { created_at: self._fields.0.unwrap(), hive_id: self._fields.1.unwrap(), title: self._fields.2.unwrap(), r#type: self._fields.3.unwrap(), user_did: self._fields.4.unwrap(), user_handle: self._fields.5.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_buzz_bookhive_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("buzz.bookhive.defs"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("abandoned"), LexUserType::Token(LexToken { ..Default::default() }), ); map.insert( SmolStr::new_static("activity"), LexUserType::Object(LexObject { required: Some(vec![ SmolStr::new_static("type"), SmolStr::new_static("createdAt"), SmolStr::new_static("hiveId"), SmolStr::new_static("title"), SmolStr::new_static("userDid"), SmolStr::new_static("userHandle"), ]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("hiveId"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("The hive id of the book")), ..Default::default() }), ); map.insert( SmolStr::new_static("title"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("The title of the book")), ..Default::default() }), ); map.insert( SmolStr::new_static("type"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("userDid"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "The DID of the user who added the book", )), ..Default::default() }), ); map.insert( SmolStr::new_static("userHandle"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "The handle of the user who added the book", )), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("bookIdentifiers"), LexUserType::Object(LexObject { description: Some(CowStr::new_static("External identifiers for a book")), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("goodreadsId"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("Goodreads book ID")), ..Default::default() }), ); map.insert( SmolStr::new_static("hiveId"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("BookHive's internal ID")), ..Default::default() }), ); map.insert( SmolStr::new_static("isbn10"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("10-digit ISBN")), ..Default::default() }), ); map.insert( SmolStr::new_static("isbn13"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("13-digit ISBN")), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("bookProgress"), LexUserType::Object(LexObject { description: Some(CowStr::new_static("Reading progress tracking data")), required: Some(vec![SmolStr::new_static("updatedAt")]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("currentChapter"), LexObjectProperty::Integer(LexInteger { minimum: Some(1i64), ..Default::default() }), ); map.insert( SmolStr::new_static("currentPage"), LexObjectProperty::Integer(LexInteger { minimum: Some(1i64), ..Default::default() }), ); map.insert( SmolStr::new_static("percent"), LexObjectProperty::Integer(LexInteger { minimum: Some(0i64), maximum: Some(100i64), ..Default::default() }), ); map.insert( SmolStr::new_static("totalChapters"), LexObjectProperty::Integer(LexInteger { minimum: Some(1i64), ..Default::default() }), ); map.insert( SmolStr::new_static("totalPages"), LexObjectProperty::Integer(LexInteger { minimum: Some(1i64), ..Default::default() }), ); map.insert( SmolStr::new_static("updatedAt"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "When the progress was last updated", )), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("comment"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("comment"), SmolStr::new_static("createdAt"), SmolStr::new_static("book"), SmolStr::new_static("parent"), SmolStr::new_static("did"), SmolStr::new_static("handle") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("book"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static("com.atproto.repo.strongRef"), ..Default::default() }), ); map.insert( SmolStr::new_static("comment"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("The content of the comment."), ), max_length: Some(100000usize), max_graphemes: Some(10000usize), ..Default::default() }), ); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Client-declared timestamp when this comment was originally created.", ), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("did"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The DID of the user who made the comment", ), ), ..Default::default() }), ); map.insert( SmolStr::new_static("handle"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The handle of the user who made the comment", ), ), ..Default::default() }), ); map.insert( SmolStr::new_static("parent"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static("com.atproto.repo.strongRef"), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("finished"), LexUserType::Token(LexToken { ..Default::default() }), ); map.insert( SmolStr::new_static("owned"), LexUserType::Token(LexToken { ..Default::default() }), ); map.insert( SmolStr::new_static("profile"), LexUserType::Object(LexObject { required: Some(vec![ SmolStr::new_static("displayName"), SmolStr::new_static("handle"), SmolStr::new_static("booksRead"), SmolStr::new_static("reviews"), ]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("avatar"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("booksRead"), LexObjectProperty::Integer(LexInteger { minimum: Some(0i64), ..Default::default() }), ); map.insert( SmolStr::new_static("description"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("displayName"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("handle"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("isFollowing"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map.insert( SmolStr::new_static("reviews"), LexObjectProperty::Integer(LexInteger { minimum: Some(0i64), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("reading"), LexUserType::Token(LexToken { ..Default::default() }), ); map.insert( SmolStr::new_static("review"), LexUserType::Object(LexObject { required: Some(vec![ SmolStr::new_static("review"), SmolStr::new_static("createdAt"), SmolStr::new_static("did"), SmolStr::new_static("handle"), ]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "The date the review was created", )), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("did"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "The DID of the user who made the review", )), ..Default::default() }), ); map.insert( SmolStr::new_static("handle"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "The handle of the user who made the review", )), ..Default::default() }), ); map.insert( SmolStr::new_static("review"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("The review content")), ..Default::default() }), ); map.insert( SmolStr::new_static("stars"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("userBook"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("userDid"), SmolStr::new_static("title"), SmolStr::new_static("authors"), SmolStr::new_static("hiveId"), SmolStr::new_static("createdAt"), SmolStr::new_static("thumbnail") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("authors"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The authors of the book (tab separated)", ), ), min_length: Some(1usize), max_length: Some(2048usize), ..Default::default() }), ); map.insert( SmolStr::new_static("bookProgress"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static( "buzz.bookhive.defs#bookProgress", ), ..Default::default() }), ); map.insert( SmolStr::new_static("cover"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("Cover image of the book"), ), ..Default::default() }), ); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("description"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("Book description/summary"), ), max_length: Some(5000usize), ..Default::default() }), ); map.insert( SmolStr::new_static("finishedAt"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The date the user finished reading the book", ), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("hiveId"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The book's hive id, used to correlate user's books with the hive", ), ), ..Default::default() }), ); map.insert( SmolStr::new_static("rating"), LexObjectProperty::Integer(LexInteger { minimum: Some(0i64), maximum: Some(1000i64), ..Default::default() }), ); map.insert( SmolStr::new_static("review"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static("The book's review")), max_graphemes: Some(15000usize), ..Default::default() }), ); map.insert( SmolStr::new_static("stars"), LexObjectProperty::Integer(LexInteger { minimum: Some(1i64), maximum: Some(10i64), ..Default::default() }), ); map.insert( SmolStr::new_static("startedAt"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The date the user started reading the book", ), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("status"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("thumbnail"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("Cover image of the book"), ), ..Default::default() }), ); map.insert( SmolStr::new_static("title"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("The title of the book"), ), min_length: Some(1usize), max_length: Some(512usize), ..Default::default() }), ); map.insert( SmolStr::new_static("userDid"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("The DID of the user who added the book"), ), ..Default::default() }), ); map.insert( SmolStr::new_static("userHandle"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The handle of the user who added the book", ), ), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("wantToRead"), LexUserType::Token(LexToken { ..Default::default() }), ); map }, ..Default::default() } } fn deserialize_book_identifiers_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } fn deserialize_book_progress_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } pub mod book_progress_state { pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type UpdatedAt = Unset; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt(PhantomData St>); impl sealed::Sealed for SetUpdatedAt {} impl State for SetUpdatedAt { type UpdatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `updated_at` field pub struct updated_at(()); } } /// Builder for constructing an instance of this type. pub struct BookProgressBuilder { _state: PhantomData St>, _fields: ( Option, Option, Option, Option, Option, Option, ), _type: PhantomData S>, } impl BookProgress { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> BookProgressBuilder { BookProgressBuilder::new() } } impl BookProgress { /// Create a new builder for this type pub fn builder() -> BookProgressBuilder { BookProgressBuilder::builder() } } impl BookProgressBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { BookProgressBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } } } impl BookProgressBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { BookProgressBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } } } impl BookProgressBuilder { /// Set the `currentChapter` field (optional) pub fn current_chapter(mut self, value: impl Into>) -> Self { self._fields.0 = value.into(); self } /// Set the `currentChapter` field to an Option value (optional) pub fn maybe_current_chapter(mut self, value: Option) -> Self { self._fields.0 = value; self } } impl BookProgressBuilder { /// Set the `currentPage` field (optional) pub fn current_page(mut self, value: impl Into>) -> Self { self._fields.1 = value.into(); self } /// Set the `currentPage` field to an Option value (optional) pub fn maybe_current_page(mut self, value: Option) -> Self { self._fields.1 = value; self } } impl BookProgressBuilder { /// Set the `percent` field (optional) pub fn percent(mut self, value: impl Into>) -> Self { self._fields.2 = value.into(); self } /// Set the `percent` field to an Option value (optional) pub fn maybe_percent(mut self, value: Option) -> Self { self._fields.2 = value; self } } impl BookProgressBuilder { /// Set the `totalChapters` field (optional) pub fn total_chapters(mut self, value: impl Into>) -> Self { self._fields.3 = value.into(); self } /// Set the `totalChapters` field to an Option value (optional) pub fn maybe_total_chapters(mut self, value: Option) -> Self { self._fields.3 = value; self } } impl BookProgressBuilder { /// Set the `totalPages` field (optional) pub fn total_pages(mut self, value: impl Into>) -> Self { self._fields.4 = value.into(); self } /// Set the `totalPages` field to an Option value (optional) pub fn maybe_total_pages(mut self, value: Option) -> Self { self._fields.4 = value; self } } impl BookProgressBuilder where St: book_progress_state::State, St::UpdatedAt: book_progress_state::IsUnset, { /// Set the `updatedAt` field (required) pub fn updated_at( mut self, value: impl Into, ) -> BookProgressBuilder, S> { self._fields.5 = Option::Some(value.into()); BookProgressBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl BookProgressBuilder where St: book_progress_state::State, St::UpdatedAt: book_progress_state::IsSet, { /// Build the final struct. pub fn build(self) -> BookProgress { BookProgress { current_chapter: self._fields.0, current_page: self._fields.1, percent: self._fields.2, total_chapters: self._fields.3, total_pages: self._fields.4, updated_at: self._fields.5.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> BookProgress { BookProgress { current_chapter: self._fields.0, current_page: self._fields.1, percent: self._fields.2, total_chapters: self._fields.3, total_pages: self._fields.4, updated_at: self._fields.5.unwrap(), extra_data: Some(extra_data), } } } fn deserialize_comment_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } pub mod comment_state { pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Book; type Comment; type CreatedAt; type Did; type Handle; type Parent; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Book = Unset; type Comment = Unset; type CreatedAt = Unset; type Did = Unset; type Handle = Unset; type Parent = Unset; } ///State transition - sets the `book` field to Set pub struct SetBook(PhantomData St>); impl sealed::Sealed for SetBook {} impl State for SetBook { type Book = Set; type Comment = St::Comment; type CreatedAt = St::CreatedAt; type Did = St::Did; type Handle = St::Handle; type Parent = St::Parent; } ///State transition - sets the `comment` field to Set pub struct SetComment(PhantomData St>); impl sealed::Sealed for SetComment {} impl State for SetComment { type Book = St::Book; type Comment = Set; type CreatedAt = St::CreatedAt; type Did = St::Did; type Handle = St::Handle; type Parent = St::Parent; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData St>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Book = St::Book; type Comment = St::Comment; type CreatedAt = Set; type Did = St::Did; type Handle = St::Handle; type Parent = St::Parent; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData St>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Book = St::Book; type Comment = St::Comment; type CreatedAt = St::CreatedAt; type Did = Set; type Handle = St::Handle; type Parent = St::Parent; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData St>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type Book = St::Book; type Comment = St::Comment; type CreatedAt = St::CreatedAt; type Did = St::Did; type Handle = Set; type Parent = St::Parent; } ///State transition - sets the `parent` field to Set pub struct SetParent(PhantomData St>); impl sealed::Sealed for SetParent {} impl State for SetParent { type Book = St::Book; type Comment = St::Comment; type CreatedAt = St::CreatedAt; type Did = St::Did; type Handle = St::Handle; type Parent = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `book` field pub struct book(()); ///Marker type for the `comment` field pub struct comment(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `parent` field pub struct parent(()); } } /// Builder for constructing an instance of this type. pub struct CommentBuilder { _state: PhantomData St>, _fields: ( Option>, Option, Option, Option, Option, Option>, ), _type: PhantomData S>, } impl Comment { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> CommentBuilder { CommentBuilder::new() } } impl Comment { /// Create a new builder for this type pub fn builder() -> CommentBuilder { CommentBuilder::builder() } } impl CommentBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { CommentBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } } } impl CommentBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { CommentBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::Book: comment_state::IsUnset, { /// Set the `book` field (required) pub fn book( mut self, value: impl Into>, ) -> CommentBuilder, S> { self._fields.0 = Option::Some(value.into()); CommentBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::Comment: comment_state::IsUnset, { /// Set the `comment` field (required) pub fn comment( mut self, value: impl Into, ) -> CommentBuilder, S> { self._fields.1 = Option::Some(value.into()); CommentBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::CreatedAt: comment_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> CommentBuilder, S> { self._fields.2 = Option::Some(value.into()); CommentBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::Did: comment_state::IsUnset, { /// Set the `did` field (required) pub fn did(mut self, value: impl Into) -> CommentBuilder, S> { self._fields.3 = Option::Some(value.into()); CommentBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::Handle: comment_state::IsUnset, { /// Set the `handle` field (required) pub fn handle( mut self, value: impl Into, ) -> CommentBuilder, S> { self._fields.4 = Option::Some(value.into()); CommentBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::Parent: comment_state::IsUnset, { /// Set the `parent` field (required) pub fn parent( mut self, value: impl Into>, ) -> CommentBuilder, S> { self._fields.5 = Option::Some(value.into()); CommentBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommentBuilder where St: comment_state::State, St::Book: comment_state::IsSet, St::Comment: comment_state::IsSet, St::CreatedAt: comment_state::IsSet, St::Did: comment_state::IsSet, St::Handle: comment_state::IsSet, St::Parent: comment_state::IsSet, { /// Build the final struct. pub fn build(self) -> Comment { Comment { book: self._fields.0.unwrap(), comment: self._fields.1.unwrap(), created_at: self._fields.2.unwrap(), did: self._fields.3.unwrap(), handle: self._fields.4.unwrap(), parent: self._fields.5.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Comment { Comment { book: self._fields.0.unwrap(), comment: self._fields.1.unwrap(), created_at: self._fields.2.unwrap(), did: self._fields.3.unwrap(), handle: self._fields.4.unwrap(), parent: self._fields.5.unwrap(), extra_data: Some(extra_data), } } } fn deserialize_profile_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } pub mod profile_state { pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type BooksRead; type DisplayName; type Handle; type Reviews; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type BooksRead = Unset; type DisplayName = Unset; type Handle = Unset; type Reviews = Unset; } ///State transition - sets the `books_read` field to Set pub struct SetBooksRead(PhantomData St>); impl sealed::Sealed for SetBooksRead {} impl State for SetBooksRead { type BooksRead = Set; type DisplayName = St::DisplayName; type Handle = St::Handle; type Reviews = St::Reviews; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName(PhantomData St>); impl sealed::Sealed for SetDisplayName {} impl State for SetDisplayName { type BooksRead = St::BooksRead; type DisplayName = Set; type Handle = St::Handle; type Reviews = St::Reviews; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData St>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type BooksRead = St::BooksRead; type DisplayName = St::DisplayName; type Handle = Set; type Reviews = St::Reviews; } ///State transition - sets the `reviews` field to Set pub struct SetReviews(PhantomData St>); impl sealed::Sealed for SetReviews {} impl State for SetReviews { type BooksRead = St::BooksRead; type DisplayName = St::DisplayName; type Handle = St::Handle; type Reviews = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `books_read` field pub struct books_read(()); ///Marker type for the `display_name` field pub struct display_name(()); ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `reviews` field pub struct reviews(()); } } /// Builder for constructing an instance of this type. pub struct ProfileBuilder { _state: PhantomData St>, _fields: ( Option, Option, Option, Option, Option, Option, Option, ), _type: PhantomData S>, } impl Profile { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> ProfileBuilder { ProfileBuilder::new() } } impl Profile { /// Create a new builder for this type pub fn builder() -> ProfileBuilder { ProfileBuilder::builder() } } impl ProfileBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { ProfileBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None), _type: PhantomData, } } } impl ProfileBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { ProfileBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None), _type: PhantomData, } } } impl ProfileBuilder { /// Set the `avatar` field (optional) pub fn avatar(mut self, value: impl Into>) -> Self { self._fields.0 = value.into(); self } /// Set the `avatar` field to an Option value (optional) pub fn maybe_avatar(mut self, value: Option) -> Self { self._fields.0 = value; self } } impl ProfileBuilder where St: profile_state::State, St::BooksRead: profile_state::IsUnset, { /// Set the `booksRead` field (required) pub fn books_read( mut self, value: impl Into, ) -> ProfileBuilder, S> { self._fields.1 = Option::Some(value.into()); ProfileBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ProfileBuilder { /// Set the `description` field (optional) pub fn description(mut self, value: impl Into>) -> Self { self._fields.2 = value.into(); self } /// Set the `description` field to an Option value (optional) pub fn maybe_description(mut self, value: Option) -> Self { self._fields.2 = value; self } } impl ProfileBuilder where St: profile_state::State, St::DisplayName: profile_state::IsUnset, { /// Set the `displayName` field (required) pub fn display_name( mut self, value: impl Into, ) -> ProfileBuilder, S> { self._fields.3 = Option::Some(value.into()); ProfileBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ProfileBuilder where St: profile_state::State, St::Handle: profile_state::IsUnset, { /// Set the `handle` field (required) pub fn handle( mut self, value: impl Into, ) -> ProfileBuilder, S> { self._fields.4 = Option::Some(value.into()); ProfileBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ProfileBuilder { /// Set the `isFollowing` field (optional) pub fn is_following(mut self, value: impl Into>) -> Self { self._fields.5 = value.into(); self } /// Set the `isFollowing` field to an Option value (optional) pub fn maybe_is_following(mut self, value: Option) -> Self { self._fields.5 = value; self } } impl ProfileBuilder where St: profile_state::State, St::Reviews: profile_state::IsUnset, { /// Set the `reviews` field (required) pub fn reviews( mut self, value: impl Into, ) -> ProfileBuilder, S> { self._fields.6 = Option::Some(value.into()); ProfileBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ProfileBuilder where St: profile_state::State, St::BooksRead: profile_state::IsSet, St::DisplayName: profile_state::IsSet, St::Handle: profile_state::IsSet, St::Reviews: profile_state::IsSet, { /// Build the final struct. pub fn build(self) -> Profile { Profile { avatar: self._fields.0, books_read: self._fields.1.unwrap(), description: self._fields.2, display_name: self._fields.3.unwrap(), handle: self._fields.4.unwrap(), is_following: self._fields.5, reviews: self._fields.6.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Profile { Profile { avatar: self._fields.0, books_read: self._fields.1.unwrap(), description: self._fields.2, display_name: self._fields.3.unwrap(), handle: self._fields.4.unwrap(), is_following: self._fields.5, reviews: self._fields.6.unwrap(), extra_data: Some(extra_data), } } } fn deserialize_review_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } pub mod review_state { pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; type Did; type Handle; type Review; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; type Did = Unset; type Handle = Unset; type Review = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData St>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type CreatedAt = Set; type Did = St::Did; type Handle = St::Handle; type Review = St::Review; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData St>); impl sealed::Sealed for SetDid {} impl State for SetDid { type CreatedAt = St::CreatedAt; type Did = Set; type Handle = St::Handle; type Review = St::Review; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData St>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type CreatedAt = St::CreatedAt; type Did = St::Did; type Handle = Set; type Review = St::Review; } ///State transition - sets the `review` field to Set pub struct SetReview(PhantomData St>); impl sealed::Sealed for SetReview {} impl State for SetReview { type CreatedAt = St::CreatedAt; type Did = St::Did; type Handle = St::Handle; type Review = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `review` field pub struct review(()); } } /// Builder for constructing an instance of this type. pub struct ReviewBuilder { _state: PhantomData St>, _fields: ( Option, Option, Option, Option, Option, ), _type: PhantomData S>, } impl Review { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> ReviewBuilder { ReviewBuilder::new() } } impl Review { /// Create a new builder for this type pub fn builder() -> ReviewBuilder { ReviewBuilder::builder() } } impl ReviewBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { ReviewBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _type: PhantomData, } } } impl ReviewBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { ReviewBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _type: PhantomData, } } } impl ReviewBuilder where St: review_state::State, St::CreatedAt: review_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> ReviewBuilder, S> { self._fields.0 = Option::Some(value.into()); ReviewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ReviewBuilder where St: review_state::State, St::Did: review_state::IsUnset, { /// Set the `did` field (required) pub fn did(mut self, value: impl Into) -> ReviewBuilder, S> { self._fields.1 = Option::Some(value.into()); ReviewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ReviewBuilder where St: review_state::State, St::Handle: review_state::IsUnset, { /// Set the `handle` field (required) pub fn handle(mut self, value: impl Into) -> ReviewBuilder, S> { self._fields.2 = Option::Some(value.into()); ReviewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ReviewBuilder where St: review_state::State, St::Review: review_state::IsUnset, { /// Set the `review` field (required) pub fn review(mut self, value: impl Into) -> ReviewBuilder, S> { self._fields.3 = Option::Some(value.into()); ReviewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl ReviewBuilder { /// Set the `stars` field (optional) pub fn stars(mut self, value: impl Into>) -> Self { self._fields.4 = value.into(); self } /// Set the `stars` field to an Option value (optional) pub fn maybe_stars(mut self, value: Option) -> Self { self._fields.4 = value; self } } impl ReviewBuilder where St: review_state::State, St::CreatedAt: review_state::IsSet, St::Did: review_state::IsSet, St::Handle: review_state::IsSet, St::Review: review_state::IsSet, { /// Build the final struct. pub fn build(self) -> Review { Review { created_at: self._fields.0.unwrap(), did: self._fields.1.unwrap(), handle: self._fields.2.unwrap(), review: self._fields.3.unwrap(), stars: self._fields.4, extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Review { Review { created_at: self._fields.0.unwrap(), did: self._fields.1.unwrap(), handle: self._fields.2.unwrap(), review: self._fields.3.unwrap(), stars: self._fields.4, extra_data: Some(extra_data), } } } fn deserialize_user_book_extra_data<'de, S, D>( deserializer: D, ) -> Result>>, D::Error> where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>, { let data = >> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty())) } pub mod user_book_state { pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Authors; type CreatedAt; type HiveId; type Thumbnail; type Title; type UserDid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Authors = Unset; type CreatedAt = Unset; type HiveId = Unset; type Thumbnail = Unset; type Title = Unset; type UserDid = Unset; } ///State transition - sets the `authors` field to Set pub struct SetAuthors(PhantomData St>); impl sealed::Sealed for SetAuthors {} impl State for SetAuthors { type Authors = Set; type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Thumbnail = St::Thumbnail; type Title = St::Title; type UserDid = St::UserDid; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData St>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Authors = St::Authors; type CreatedAt = Set; type HiveId = St::HiveId; type Thumbnail = St::Thumbnail; type Title = St::Title; type UserDid = St::UserDid; } ///State transition - sets the `hive_id` field to Set pub struct SetHiveId(PhantomData St>); impl sealed::Sealed for SetHiveId {} impl State for SetHiveId { type Authors = St::Authors; type CreatedAt = St::CreatedAt; type HiveId = Set; type Thumbnail = St::Thumbnail; type Title = St::Title; type UserDid = St::UserDid; } ///State transition - sets the `thumbnail` field to Set pub struct SetThumbnail(PhantomData St>); impl sealed::Sealed for SetThumbnail {} impl State for SetThumbnail { type Authors = St::Authors; type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Thumbnail = Set; type Title = St::Title; type UserDid = St::UserDid; } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData St>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { type Authors = St::Authors; type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Thumbnail = St::Thumbnail; type Title = Set; type UserDid = St::UserDid; } ///State transition - sets the `user_did` field to Set pub struct SetUserDid(PhantomData St>); impl sealed::Sealed for SetUserDid {} impl State for SetUserDid { type Authors = St::Authors; type CreatedAt = St::CreatedAt; type HiveId = St::HiveId; type Thumbnail = St::Thumbnail; type Title = St::Title; type UserDid = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `authors` field pub struct authors(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `hive_id` field pub struct hive_id(()); ///Marker type for the `thumbnail` field pub struct thumbnail(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `user_did` field pub struct user_did(()); } } /// Builder for constructing an instance of this type. pub struct UserBookBuilder { _state: PhantomData St>, _fields: ( Option, Option>, Option, Option, Option, Option, Option, Option, Option, Option, Option, Option>, Option, Option, Option, Option, ), _type: PhantomData S>, } impl UserBook { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> UserBookBuilder { UserBookBuilder::new() } } impl UserBook { /// Create a new builder for this type pub fn builder() -> UserBookBuilder { UserBookBuilder::builder() } } impl UserBookBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { UserBookBuilder { _state: PhantomData, _fields: ( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ), _type: PhantomData, } } } impl UserBookBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { UserBookBuilder { _state: PhantomData, _fields: ( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ), _type: PhantomData, } } } impl UserBookBuilder where St: user_book_state::State, St::Authors: user_book_state::IsUnset, { /// Set the `authors` field (required) pub fn authors( mut self, value: impl Into, ) -> UserBookBuilder, S> { self._fields.0 = Option::Some(value.into()); UserBookBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl UserBookBuilder { /// Set the `bookProgress` field (optional) pub fn book_progress( mut self, value: impl Into>>, ) -> Self { self._fields.1 = value.into(); self } /// Set the `bookProgress` field to an Option value (optional) pub fn maybe_book_progress(mut self, value: Option>) -> Self { self._fields.1 = value; self } } impl UserBookBuilder { /// Set the `cover` field (optional) pub fn cover(mut self, value: impl Into>) -> Self { self._fields.2 = value.into(); self } /// Set the `cover` field to an Option value (optional) pub fn maybe_cover(mut self, value: Option) -> Self { self._fields.2 = value; self } } impl UserBookBuilder where St: user_book_state::State, St::CreatedAt: user_book_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> UserBookBuilder, S> { self._fields.3 = Option::Some(value.into()); UserBookBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl UserBookBuilder { /// Set the `description` field (optional) pub fn description(mut self, value: impl Into>) -> Self { self._fields.4 = value.into(); self } /// Set the `description` field to an Option value (optional) pub fn maybe_description(mut self, value: Option) -> Self { self._fields.4 = value; self } } impl UserBookBuilder { /// Set the `finishedAt` field (optional) pub fn finished_at(mut self, value: impl Into>) -> Self { self._fields.5 = value.into(); self } /// Set the `finishedAt` field to an Option value (optional) pub fn maybe_finished_at(mut self, value: Option) -> Self { self._fields.5 = value; self } } impl UserBookBuilder where St: user_book_state::State, St::HiveId: user_book_state::IsUnset, { /// Set the `hiveId` field (required) pub fn hive_id( mut self, value: impl Into, ) -> UserBookBuilder, S> { self._fields.6 = Option::Some(value.into()); UserBookBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl UserBookBuilder { /// Set the `rating` field (optional) pub fn rating(mut self, value: impl Into>) -> Self { self._fields.7 = value.into(); self } /// Set the `rating` field to an Option value (optional) pub fn maybe_rating(mut self, value: Option) -> Self { self._fields.7 = value; self } } impl UserBookBuilder { /// Set the `review` field (optional) pub fn review(mut self, value: impl Into>) -> Self { self._fields.8 = value.into(); self } /// Set the `review` field to an Option value (optional) pub fn maybe_review(mut self, value: Option) -> Self { self._fields.8 = value; self } } impl UserBookBuilder { /// Set the `stars` field (optional) pub fn stars(mut self, value: impl Into>) -> Self { self._fields.9 = value.into(); self } /// Set the `stars` field to an Option value (optional) pub fn maybe_stars(mut self, value: Option) -> Self { self._fields.9 = value; self } } impl UserBookBuilder { /// Set the `startedAt` field (optional) pub fn started_at(mut self, value: impl Into>) -> Self { self._fields.10 = value.into(); self } /// Set the `startedAt` field to an Option value (optional) pub fn maybe_started_at(mut self, value: Option) -> Self { self._fields.10 = value; self } } impl UserBookBuilder { /// Set the `status` field (optional) pub fn status(mut self, value: impl Into>>) -> Self { self._fields.11 = value.into(); self } /// Set the `status` field to an Option value (optional) pub fn maybe_status(mut self, value: Option>) -> Self { self._fields.11 = value; self } } impl UserBookBuilder where St: user_book_state::State, St::Thumbnail: user_book_state::IsUnset, { /// Set the `thumbnail` field (required) pub fn thumbnail( mut self, value: impl Into, ) -> UserBookBuilder, S> { self._fields.12 = Option::Some(value.into()); UserBookBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl UserBookBuilder where St: user_book_state::State, St::Title: user_book_state::IsUnset, { /// Set the `title` field (required) pub fn title( mut self, value: impl Into, ) -> UserBookBuilder, S> { self._fields.13 = Option::Some(value.into()); UserBookBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl UserBookBuilder where St: user_book_state::State, St::UserDid: user_book_state::IsUnset, { /// Set the `userDid` field (required) pub fn user_did( mut self, value: impl Into, ) -> UserBookBuilder, S> { self._fields.14 = Option::Some(value.into()); UserBookBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl UserBookBuilder { /// Set the `userHandle` field (optional) pub fn user_handle(mut self, value: impl Into>) -> Self { self._fields.15 = value.into(); self } /// Set the `userHandle` field to an Option value (optional) pub fn maybe_user_handle(mut self, value: Option) -> Self { self._fields.15 = value; self } } impl UserBookBuilder where St: user_book_state::State, St::Authors: user_book_state::IsSet, St::CreatedAt: user_book_state::IsSet, St::HiveId: user_book_state::IsSet, St::Thumbnail: user_book_state::IsSet, St::Title: user_book_state::IsSet, St::UserDid: user_book_state::IsSet, { /// Build the final struct. pub fn build(self) -> UserBook { UserBook { authors: self._fields.0.unwrap(), book_progress: self._fields.1, cover: self._fields.2, created_at: self._fields.3.unwrap(), description: self._fields.4, finished_at: self._fields.5, hive_id: self._fields.6.unwrap(), rating: self._fields.7, review: self._fields.8, stars: self._fields.9, started_at: self._fields.10, status: self._fields.11, thumbnail: self._fields.12.unwrap(), title: self._fields.13.unwrap(), user_did: self._fields.14.unwrap(), user_handle: self._fields.15, extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> UserBook { UserBook { authors: self._fields.0.unwrap(), book_progress: self._fields.1, cover: self._fields.2, created_at: self._fields.3.unwrap(), description: self._fields.4, finished_at: self._fields.5, hive_id: self._fields.6.unwrap(), rating: self._fields.7, review: self._fields.8, stars: self._fields.9, started_at: self._fields.10, status: self._fields.11, thumbnail: self._fields.12.unwrap(), title: self._fields.13.unwrap(), user_did: self._fields.14.unwrap(), user_handle: self._fields.15, extra_data: Some(extra_data), } } }