atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.notebook.getNotebookDetail
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct GetNotebookDetail<'a> {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 #[serde(borrow)]
21 pub entry_cursor: std::option::Option<jacquard_common::CowStr<'a>>,
22 ///(default: 50, min: 1, max: 100)
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 pub entry_limit: std::option::Option<i64>,
25 #[serde(borrow)]
26 pub notebook: jacquard_common::types::string::AtUri<'a>,
27}
28
29pub mod get_notebook_detail_state {
30
31 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
32 #[allow(unused)]
33 use ::core::marker::PhantomData;
34 mod sealed {
35 pub trait Sealed {}
36 }
37 /// State trait tracking which required fields have been set
38 pub trait State: sealed::Sealed {
39 type Notebook;
40 }
41 /// Empty state - all required fields are unset
42 pub struct Empty(());
43 impl sealed::Sealed for Empty {}
44 impl State for Empty {
45 type Notebook = Unset;
46 }
47 ///State transition - sets the `notebook` field to Set
48 pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>);
49 impl<S: State> sealed::Sealed for SetNotebook<S> {}
50 impl<S: State> State for SetNotebook<S> {
51 type Notebook = Set<members::notebook>;
52 }
53 /// Marker types for field names
54 #[allow(non_camel_case_types)]
55 pub mod members {
56 ///Marker type for the `notebook` field
57 pub struct notebook(());
58 }
59}
60
61/// Builder for constructing an instance of this type
62pub struct GetNotebookDetailBuilder<'a, S: get_notebook_detail_state::State> {
63 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
64 __unsafe_private_named: (
65 ::core::option::Option<jacquard_common::CowStr<'a>>,
66 ::core::option::Option<i64>,
67 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
68 ),
69 _phantom: ::core::marker::PhantomData<&'a ()>,
70}
71
72impl<'a> GetNotebookDetail<'a> {
73 /// Create a new builder for this type
74 pub fn new() -> GetNotebookDetailBuilder<'a, get_notebook_detail_state::Empty> {
75 GetNotebookDetailBuilder::new()
76 }
77}
78
79impl<'a> GetNotebookDetailBuilder<'a, get_notebook_detail_state::Empty> {
80 /// Create a new builder with all fields unset
81 pub fn new() -> Self {
82 GetNotebookDetailBuilder {
83 _phantom_state: ::core::marker::PhantomData,
84 __unsafe_private_named: (None, None, None),
85 _phantom: ::core::marker::PhantomData,
86 }
87 }
88}
89
90impl<'a, S: get_notebook_detail_state::State> GetNotebookDetailBuilder<'a, S> {
91 /// Set the `entryCursor` field (optional)
92 pub fn entry_cursor(
93 mut self,
94 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
95 ) -> Self {
96 self.__unsafe_private_named.0 = value.into();
97 self
98 }
99 /// Set the `entryCursor` field to an Option value (optional)
100 pub fn maybe_entry_cursor(
101 mut self,
102 value: Option<jacquard_common::CowStr<'a>>,
103 ) -> Self {
104 self.__unsafe_private_named.0 = value;
105 self
106 }
107}
108
109impl<'a, S: get_notebook_detail_state::State> GetNotebookDetailBuilder<'a, S> {
110 /// Set the `entryLimit` field (optional)
111 pub fn entry_limit(mut self, value: impl Into<Option<i64>>) -> Self {
112 self.__unsafe_private_named.1 = value.into();
113 self
114 }
115 /// Set the `entryLimit` field to an Option value (optional)
116 pub fn maybe_entry_limit(mut self, value: Option<i64>) -> Self {
117 self.__unsafe_private_named.1 = value;
118 self
119 }
120}
121
122impl<'a, S> GetNotebookDetailBuilder<'a, S>
123where
124 S: get_notebook_detail_state::State,
125 S::Notebook: get_notebook_detail_state::IsUnset,
126{
127 /// Set the `notebook` field (required)
128 pub fn notebook(
129 mut self,
130 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
131 ) -> GetNotebookDetailBuilder<'a, get_notebook_detail_state::SetNotebook<S>> {
132 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
133 GetNotebookDetailBuilder {
134 _phantom_state: ::core::marker::PhantomData,
135 __unsafe_private_named: self.__unsafe_private_named,
136 _phantom: ::core::marker::PhantomData,
137 }
138 }
139}
140
141impl<'a, S> GetNotebookDetailBuilder<'a, S>
142where
143 S: get_notebook_detail_state::State,
144 S::Notebook: get_notebook_detail_state::IsSet,
145{
146 /// Build the final struct
147 pub fn build(self) -> GetNotebookDetail<'a> {
148 GetNotebookDetail {
149 entry_cursor: self.__unsafe_private_named.0,
150 entry_limit: self.__unsafe_private_named.1,
151 notebook: self.__unsafe_private_named.2.unwrap(),
152 }
153 }
154}
155
156#[jacquard_derive::lexicon]
157#[derive(
158 serde::Serialize,
159 serde::Deserialize,
160 Debug,
161 Clone,
162 PartialEq,
163 Eq,
164 jacquard_derive::IntoStatic
165)]
166#[serde(rename_all = "camelCase")]
167pub struct GetNotebookDetailOutput<'a> {
168 #[serde(borrow)]
169 pub entries: Vec<crate::sh_weaver::notebook::BookEntryView<'a>>,
170 #[serde(skip_serializing_if = "std::option::Option::is_none")]
171 #[serde(borrow)]
172 pub entry_cursor: std::option::Option<jacquard_common::CowStr<'a>>,
173 #[serde(borrow)]
174 pub notebook: crate::sh_weaver::notebook::NotebookView<'a>,
175}
176
177#[jacquard_derive::open_union]
178#[derive(
179 serde::Serialize,
180 serde::Deserialize,
181 Debug,
182 Clone,
183 PartialEq,
184 Eq,
185 thiserror::Error,
186 miette::Diagnostic,
187 jacquard_derive::IntoStatic
188)]
189#[serde(tag = "error", content = "message")]
190#[serde(bound(deserialize = "'de: 'a"))]
191pub enum GetNotebookDetailError<'a> {
192 #[serde(rename = "NotebookNotFound")]
193 NotebookNotFound(std::option::Option<jacquard_common::CowStr<'a>>),
194}
195
196impl core::fmt::Display for GetNotebookDetailError<'_> {
197 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
198 match self {
199 Self::NotebookNotFound(msg) => {
200 write!(f, "NotebookNotFound")?;
201 if let Some(msg) = msg {
202 write!(f, ": {}", msg)?;
203 }
204 Ok(())
205 }
206 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
207 }
208 }
209}
210
211/// Response type for
212///sh.weaver.notebook.getNotebookDetail
213pub struct GetNotebookDetailResponse;
214impl jacquard_common::xrpc::XrpcResp for GetNotebookDetailResponse {
215 const NSID: &'static str = "sh.weaver.notebook.getNotebookDetail";
216 const ENCODING: &'static str = "application/json";
217 type Output<'de> = GetNotebookDetailOutput<'de>;
218 type Err<'de> = GetNotebookDetailError<'de>;
219}
220
221impl<'a> jacquard_common::xrpc::XrpcRequest for GetNotebookDetail<'a> {
222 const NSID: &'static str = "sh.weaver.notebook.getNotebookDetail";
223 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
224 type Response = GetNotebookDetailResponse;
225}
226
227/// Endpoint type for
228///sh.weaver.notebook.getNotebookDetail
229pub struct GetNotebookDetailRequest;
230impl jacquard_common::xrpc::XrpcEndpoint for GetNotebookDetailRequest {
231 const PATH: &'static str = "/xrpc/sh.weaver.notebook.getNotebookDetail";
232 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
233 type Request<'de> = GetNotebookDetail<'de>;
234 type Response = GetNotebookDetailResponse;
235}