// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.notebook.getReadingHistory // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct GetReadingHistory<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cursor: std::option::Option>, ///(default: 50, min: 1, max: 100) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub limit: std::option::Option, ///(default: "all") #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub status: std::option::Option>, } pub mod get_reading_history_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[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 {} /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty {} /// Marker types for field names #[allow(non_camel_case_types)] pub mod members {} } /// Builder for constructing an instance of this type pub struct GetReadingHistoryBuilder<'a, S: get_reading_history_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> GetReadingHistory<'a> { /// Create a new builder for this type pub fn new() -> GetReadingHistoryBuilder<'a, get_reading_history_state::Empty> { GetReadingHistoryBuilder::new() } } impl<'a> GetReadingHistoryBuilder<'a, get_reading_history_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { GetReadingHistoryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: get_reading_history_state::State> GetReadingHistoryBuilder<'a, S> { /// Set the `cursor` field (optional) pub fn cursor( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `cursor` field to an Option value (optional) pub fn maybe_cursor(mut self, value: Option>) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: get_reading_history_state::State> GetReadingHistoryBuilder<'a, S> { /// Set the `limit` field (optional) pub fn limit(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `limit` field to an Option value (optional) pub fn maybe_limit(mut self, value: Option) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: get_reading_history_state::State> GetReadingHistoryBuilder<'a, S> { /// Set the `status` field (optional) pub fn status( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `status` field to an Option value (optional) pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> GetReadingHistoryBuilder<'a, S> where S: get_reading_history_state::State, { /// Build the final struct pub fn build(self) -> GetReadingHistory<'a> { GetReadingHistory { cursor: self.__unsafe_private_named.0, limit: self.__unsafe_private_named.1, status: self.__unsafe_private_named.2, } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct GetReadingHistoryOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cursor: std::option::Option>, #[serde(borrow)] pub history: Vec< crate::sh_weaver::notebook::get_reading_history::ReadingHistoryItem<'a>, >, } /// Response type for ///sh.weaver.notebook.getReadingHistory pub struct GetReadingHistoryResponse; impl jacquard_common::xrpc::XrpcResp for GetReadingHistoryResponse { const NSID: &'static str = "sh.weaver.notebook.getReadingHistory"; const ENCODING: &'static str = "application/json"; type Output<'de> = GetReadingHistoryOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for GetReadingHistory<'a> { const NSID: &'static str = "sh.weaver.notebook.getReadingHistory"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = GetReadingHistoryResponse; } /// Endpoint type for ///sh.weaver.notebook.getReadingHistory pub struct GetReadingHistoryRequest; impl jacquard_common::xrpc::XrpcEndpoint for GetReadingHistoryRequest { const PATH: &'static str = "/xrpc/sh.weaver.notebook.getReadingHistory"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = GetReadingHistory<'de>; type Response = GetReadingHistoryResponse; } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ReadingHistoryItem<'a> { /// The entry the user was last reading. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub current_entry: std::option::Option>, #[serde(borrow)] pub notebook: crate::sh_weaver::notebook::NotebookView<'a>, #[serde(borrow)] pub progress: crate::sh_weaver::notebook::ReadingProgress<'a>, } pub mod reading_history_item_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[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 Notebook; type Progress; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Notebook = Unset; type Progress = Unset; } ///State transition - sets the `notebook` field to Set pub struct SetNotebook(PhantomData S>); impl sealed::Sealed for SetNotebook {} impl State for SetNotebook { type Notebook = Set; type Progress = S::Progress; } ///State transition - sets the `progress` field to Set pub struct SetProgress(PhantomData S>); impl sealed::Sealed for SetProgress {} impl State for SetProgress { type Notebook = S::Notebook; type Progress = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `notebook` field pub struct notebook(()); ///Marker type for the `progress` field pub struct progress(()); } } /// Builder for constructing an instance of this type pub struct ReadingHistoryItemBuilder<'a, S: reading_history_item_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ReadingHistoryItem<'a> { /// Create a new builder for this type pub fn new() -> ReadingHistoryItemBuilder<'a, reading_history_item_state::Empty> { ReadingHistoryItemBuilder::new() } } impl<'a> ReadingHistoryItemBuilder<'a, reading_history_item_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ReadingHistoryItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: reading_history_item_state::State> ReadingHistoryItemBuilder<'a, S> { /// Set the `currentEntry` field (optional) pub fn current_entry( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `currentEntry` field to an Option value (optional) pub fn maybe_current_entry( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> ReadingHistoryItemBuilder<'a, S> where S: reading_history_item_state::State, S::Notebook: reading_history_item_state::IsUnset, { /// Set the `notebook` field (required) pub fn notebook( mut self, value: impl Into>, ) -> ReadingHistoryItemBuilder<'a, reading_history_item_state::SetNotebook> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); ReadingHistoryItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ReadingHistoryItemBuilder<'a, S> where S: reading_history_item_state::State, S::Progress: reading_history_item_state::IsUnset, { /// Set the `progress` field (required) pub fn progress( mut self, value: impl Into>, ) -> ReadingHistoryItemBuilder<'a, reading_history_item_state::SetProgress> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); ReadingHistoryItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ReadingHistoryItemBuilder<'a, S> where S: reading_history_item_state::State, S::Notebook: reading_history_item_state::IsSet, S::Progress: reading_history_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ReadingHistoryItem<'a> { ReadingHistoryItem { current_entry: self.__unsafe_private_named.0, notebook: self.__unsafe_private_named.1.unwrap(), progress: self.__unsafe_private_named.2.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> ReadingHistoryItem<'a> { ReadingHistoryItem { current_entry: self.__unsafe_private_named.0, notebook: self.__unsafe_private_named.1.unwrap(), progress: self.__unsafe_private_named.2.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_sh_weaver_notebook_getReadingHistory() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static( "sh.weaver.notebook.getReadingHistory", ), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { description: None, parameters: Some( ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { description: None, required: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::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::smol_str::SmolStr::new_static("limit"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("status"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Filter by reading status.", ), ), 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 }, }), ), output: None, errors: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("readingHistoryItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("notebook"), ::jacquard_common::smol_str::SmolStr::new_static("progress") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "currentEntry", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.notebook.defs#entryView", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notebook"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.notebook.defs#notebookView", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("progress"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.notebook.defs#readingProgress", ), }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReadingHistoryItem<'a> { fn nsid() -> &'static str { "sh.weaver.notebook.getReadingHistory" } fn def_name() -> &'static str { "readingHistoryItem" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_notebook_getReadingHistory() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }