// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.notebook.getPage // // 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 GetPage<'a> { #[serde(borrow)] pub page: jacquard_common::types::string::AtUri<'a>, } pub mod get_page_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 Page; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Page = Unset; } ///State transition - sets the `page` field to Set pub struct SetPage(PhantomData S>); impl sealed::Sealed for SetPage {} impl State for SetPage { type Page = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `page` field pub struct page(()); } } /// Builder for constructing an instance of this type pub struct GetPageBuilder<'a, S: get_page_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> GetPage<'a> { /// Create a new builder for this type pub fn new() -> GetPageBuilder<'a, get_page_state::Empty> { GetPageBuilder::new() } } impl<'a> GetPageBuilder<'a, get_page_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { GetPageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GetPageBuilder<'a, S> where S: get_page_state::State, S::Page: get_page_state::IsUnset, { /// Set the `page` field (required) pub fn page( mut self, value: impl Into>, ) -> GetPageBuilder<'a, get_page_state::SetPage> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); GetPageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GetPageBuilder<'a, S> where S: get_page_state::State, S::Page: get_page_state::IsSet, { /// Build the final struct pub fn build(self) -> GetPage<'a> { GetPage { page: self.__unsafe_private_named.0.unwrap(), } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct GetPageOutput<'a> { #[serde(borrow)] pub entries: Vec>, #[serde(borrow)] pub page: crate::sh_weaver::notebook::PageView<'a>, } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, jacquard_derive::IntoStatic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum GetPageError<'a> { #[serde(rename = "PageNotFound")] PageNotFound(std::option::Option>), } impl core::fmt::Display for GetPageError<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::PageNotFound(msg) => { write!(f, "PageNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } /// Response type for ///sh.weaver.notebook.getPage pub struct GetPageResponse; impl jacquard_common::xrpc::XrpcResp for GetPageResponse { const NSID: &'static str = "sh.weaver.notebook.getPage"; const ENCODING: &'static str = "application/json"; type Output<'de> = GetPageOutput<'de>; type Err<'de> = GetPageError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for GetPage<'a> { const NSID: &'static str = "sh.weaver.notebook.getPage"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = GetPageResponse; } /// Endpoint type for ///sh.weaver.notebook.getPage pub struct GetPageRequest; impl jacquard_common::xrpc::XrpcEndpoint for GetPageRequest { const PATH: &'static str = "/xrpc/sh.weaver.notebook.getPage"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = GetPage<'de>; type Response = GetPageResponse; }