atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.notebook.getEntryNotebooks
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 GetEntryNotebooks<'a> {
19 #[serde(borrow)]
20 pub entry: jacquard_common::types::string::AtUri<'a>,
21}
22
23pub mod get_entry_notebooks_state {
24
25 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
26 #[allow(unused)]
27 use ::core::marker::PhantomData;
28 mod sealed {
29 pub trait Sealed {}
30 }
31 /// State trait tracking which required fields have been set
32 pub trait State: sealed::Sealed {
33 type Entry;
34 }
35 /// Empty state - all required fields are unset
36 pub struct Empty(());
37 impl sealed::Sealed for Empty {}
38 impl State for Empty {
39 type Entry = Unset;
40 }
41 ///State transition - sets the `entry` field to Set
42 pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
43 impl<S: State> sealed::Sealed for SetEntry<S> {}
44 impl<S: State> State for SetEntry<S> {
45 type Entry = Set<members::entry>;
46 }
47 /// Marker types for field names
48 #[allow(non_camel_case_types)]
49 pub mod members {
50 ///Marker type for the `entry` field
51 pub struct entry(());
52 }
53}
54
55/// Builder for constructing an instance of this type
56pub struct GetEntryNotebooksBuilder<'a, S: get_entry_notebooks_state::State> {
57 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
58 __unsafe_private_named: (
59 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
60 ),
61 _phantom: ::core::marker::PhantomData<&'a ()>,
62}
63
64impl<'a> GetEntryNotebooks<'a> {
65 /// Create a new builder for this type
66 pub fn new() -> GetEntryNotebooksBuilder<'a, get_entry_notebooks_state::Empty> {
67 GetEntryNotebooksBuilder::new()
68 }
69}
70
71impl<'a> GetEntryNotebooksBuilder<'a, get_entry_notebooks_state::Empty> {
72 /// Create a new builder with all fields unset
73 pub fn new() -> Self {
74 GetEntryNotebooksBuilder {
75 _phantom_state: ::core::marker::PhantomData,
76 __unsafe_private_named: (None,),
77 _phantom: ::core::marker::PhantomData,
78 }
79 }
80}
81
82impl<'a, S> GetEntryNotebooksBuilder<'a, S>
83where
84 S: get_entry_notebooks_state::State,
85 S::Entry: get_entry_notebooks_state::IsUnset,
86{
87 /// Set the `entry` field (required)
88 pub fn entry(
89 mut self,
90 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
91 ) -> GetEntryNotebooksBuilder<'a, get_entry_notebooks_state::SetEntry<S>> {
92 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
93 GetEntryNotebooksBuilder {
94 _phantom_state: ::core::marker::PhantomData,
95 __unsafe_private_named: self.__unsafe_private_named,
96 _phantom: ::core::marker::PhantomData,
97 }
98 }
99}
100
101impl<'a, S> GetEntryNotebooksBuilder<'a, S>
102where
103 S: get_entry_notebooks_state::State,
104 S::Entry: get_entry_notebooks_state::IsSet,
105{
106 /// Build the final struct
107 pub fn build(self) -> GetEntryNotebooks<'a> {
108 GetEntryNotebooks {
109 entry: self.__unsafe_private_named.0.unwrap(),
110 }
111 }
112}
113
114#[jacquard_derive::lexicon]
115#[derive(
116 serde::Serialize,
117 serde::Deserialize,
118 Debug,
119 Clone,
120 PartialEq,
121 Eq,
122 jacquard_derive::IntoStatic
123)]
124#[serde(rename_all = "camelCase")]
125pub struct GetEntryNotebooksOutput<'a> {
126 #[serde(borrow)]
127 pub notebooks: Vec<crate::sh_weaver::notebook::get_entry_notebooks::NotebookRef<'a>>,
128}
129
130/// Response type for
131///sh.weaver.notebook.getEntryNotebooks
132pub struct GetEntryNotebooksResponse;
133impl jacquard_common::xrpc::XrpcResp for GetEntryNotebooksResponse {
134 const NSID: &'static str = "sh.weaver.notebook.getEntryNotebooks";
135 const ENCODING: &'static str = "application/json";
136 type Output<'de> = GetEntryNotebooksOutput<'de>;
137 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
138}
139
140impl<'a> jacquard_common::xrpc::XrpcRequest for GetEntryNotebooks<'a> {
141 const NSID: &'static str = "sh.weaver.notebook.getEntryNotebooks";
142 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
143 type Response = GetEntryNotebooksResponse;
144}
145
146/// Endpoint type for
147///sh.weaver.notebook.getEntryNotebooks
148pub struct GetEntryNotebooksRequest;
149impl jacquard_common::xrpc::XrpcEndpoint for GetEntryNotebooksRequest {
150 const PATH: &'static str = "/xrpc/sh.weaver.notebook.getEntryNotebooks";
151 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
152 type Request<'de> = GetEntryNotebooks<'de>;
153 type Response = GetEntryNotebooksResponse;
154}
155
156/// Reference to a notebook containing this entry.
157#[jacquard_derive::lexicon]
158#[derive(
159 serde::Serialize,
160 serde::Deserialize,
161 Debug,
162 Clone,
163 PartialEq,
164 Eq,
165 jacquard_derive::IntoStatic
166)]
167#[serde(rename_all = "camelCase")]
168pub struct NotebookRef<'a> {
169 #[serde(borrow)]
170 pub cid: jacquard_common::types::string::Cid<'a>,
171 #[serde(skip_serializing_if = "std::option::Option::is_none")]
172 #[serde(borrow)]
173 pub owner: std::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
174 #[serde(skip_serializing_if = "std::option::Option::is_none")]
175 #[serde(borrow)]
176 pub title: std::option::Option<jacquard_common::CowStr<'a>>,
177 #[serde(borrow)]
178 pub uri: jacquard_common::types::string::AtUri<'a>,
179}
180
181pub mod notebook_ref_state {
182
183 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
184 #[allow(unused)]
185 use ::core::marker::PhantomData;
186 mod sealed {
187 pub trait Sealed {}
188 }
189 /// State trait tracking which required fields have been set
190 pub trait State: sealed::Sealed {
191 type Uri;
192 type Cid;
193 }
194 /// Empty state - all required fields are unset
195 pub struct Empty(());
196 impl sealed::Sealed for Empty {}
197 impl State for Empty {
198 type Uri = Unset;
199 type Cid = Unset;
200 }
201 ///State transition - sets the `uri` field to Set
202 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
203 impl<S: State> sealed::Sealed for SetUri<S> {}
204 impl<S: State> State for SetUri<S> {
205 type Uri = Set<members::uri>;
206 type Cid = S::Cid;
207 }
208 ///State transition - sets the `cid` field to Set
209 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
210 impl<S: State> sealed::Sealed for SetCid<S> {}
211 impl<S: State> State for SetCid<S> {
212 type Uri = S::Uri;
213 type Cid = Set<members::cid>;
214 }
215 /// Marker types for field names
216 #[allow(non_camel_case_types)]
217 pub mod members {
218 ///Marker type for the `uri` field
219 pub struct uri(());
220 ///Marker type for the `cid` field
221 pub struct cid(());
222 }
223}
224
225/// Builder for constructing an instance of this type
226pub struct NotebookRefBuilder<'a, S: notebook_ref_state::State> {
227 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
228 __unsafe_private_named: (
229 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
230 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
231 ::core::option::Option<jacquard_common::CowStr<'a>>,
232 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
233 ),
234 _phantom: ::core::marker::PhantomData<&'a ()>,
235}
236
237impl<'a> NotebookRef<'a> {
238 /// Create a new builder for this type
239 pub fn new() -> NotebookRefBuilder<'a, notebook_ref_state::Empty> {
240 NotebookRefBuilder::new()
241 }
242}
243
244impl<'a> NotebookRefBuilder<'a, notebook_ref_state::Empty> {
245 /// Create a new builder with all fields unset
246 pub fn new() -> Self {
247 NotebookRefBuilder {
248 _phantom_state: ::core::marker::PhantomData,
249 __unsafe_private_named: (None, None, None, None),
250 _phantom: ::core::marker::PhantomData,
251 }
252 }
253}
254
255impl<'a, S> NotebookRefBuilder<'a, S>
256where
257 S: notebook_ref_state::State,
258 S::Cid: notebook_ref_state::IsUnset,
259{
260 /// Set the `cid` field (required)
261 pub fn cid(
262 mut self,
263 value: impl Into<jacquard_common::types::string::Cid<'a>>,
264 ) -> NotebookRefBuilder<'a, notebook_ref_state::SetCid<S>> {
265 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
266 NotebookRefBuilder {
267 _phantom_state: ::core::marker::PhantomData,
268 __unsafe_private_named: self.__unsafe_private_named,
269 _phantom: ::core::marker::PhantomData,
270 }
271 }
272}
273
274impl<'a, S: notebook_ref_state::State> NotebookRefBuilder<'a, S> {
275 /// Set the `owner` field (optional)
276 pub fn owner(
277 mut self,
278 value: impl Into<Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>>,
279 ) -> Self {
280 self.__unsafe_private_named.1 = value.into();
281 self
282 }
283 /// Set the `owner` field to an Option value (optional)
284 pub fn maybe_owner(
285 mut self,
286 value: Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
287 ) -> Self {
288 self.__unsafe_private_named.1 = value;
289 self
290 }
291}
292
293impl<'a, S: notebook_ref_state::State> NotebookRefBuilder<'a, S> {
294 /// Set the `title` field (optional)
295 pub fn title(
296 mut self,
297 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
298 ) -> Self {
299 self.__unsafe_private_named.2 = value.into();
300 self
301 }
302 /// Set the `title` field to an Option value (optional)
303 pub fn maybe_title(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
304 self.__unsafe_private_named.2 = value;
305 self
306 }
307}
308
309impl<'a, S> NotebookRefBuilder<'a, S>
310where
311 S: notebook_ref_state::State,
312 S::Uri: notebook_ref_state::IsUnset,
313{
314 /// Set the `uri` field (required)
315 pub fn uri(
316 mut self,
317 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
318 ) -> NotebookRefBuilder<'a, notebook_ref_state::SetUri<S>> {
319 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
320 NotebookRefBuilder {
321 _phantom_state: ::core::marker::PhantomData,
322 __unsafe_private_named: self.__unsafe_private_named,
323 _phantom: ::core::marker::PhantomData,
324 }
325 }
326}
327
328impl<'a, S> NotebookRefBuilder<'a, S>
329where
330 S: notebook_ref_state::State,
331 S::Uri: notebook_ref_state::IsSet,
332 S::Cid: notebook_ref_state::IsSet,
333{
334 /// Build the final struct
335 pub fn build(self) -> NotebookRef<'a> {
336 NotebookRef {
337 cid: self.__unsafe_private_named.0.unwrap(),
338 owner: self.__unsafe_private_named.1,
339 title: self.__unsafe_private_named.2,
340 uri: self.__unsafe_private_named.3.unwrap(),
341 extra_data: Default::default(),
342 }
343 }
344 /// Build the final struct with custom extra_data
345 pub fn build_with_data(
346 self,
347 extra_data: std::collections::BTreeMap<
348 jacquard_common::smol_str::SmolStr,
349 jacquard_common::types::value::Data<'a>,
350 >,
351 ) -> NotebookRef<'a> {
352 NotebookRef {
353 cid: self.__unsafe_private_named.0.unwrap(),
354 owner: self.__unsafe_private_named.1,
355 title: self.__unsafe_private_named.2,
356 uri: self.__unsafe_private_named.3.unwrap(),
357 extra_data: Some(extra_data),
358 }
359 }
360}
361
362fn lexicon_doc_sh_weaver_notebook_getEntryNotebooks() -> ::jacquard_lexicon::lexicon::LexiconDoc<
363 'static,
364> {
365 ::jacquard_lexicon::lexicon::LexiconDoc {
366 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
367 id: ::jacquard_common::CowStr::new_static(
368 "sh.weaver.notebook.getEntryNotebooks",
369 ),
370 revision: None,
371 description: None,
372 defs: {
373 let mut map = ::alloc::collections::BTreeMap::new();
374 map.insert(
375 ::jacquard_common::smol_str::SmolStr::new_static("main"),
376 ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
377 description: None,
378 parameters: Some(
379 ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
380 description: None,
381 required: Some(
382 vec![
383 ::jacquard_common::smol_str::SmolStr::new_static("entry")
384 ],
385 ),
386 properties: {
387 #[allow(unused_mut)]
388 let mut map = ::alloc::collections::BTreeMap::new();
389 map.insert(
390 ::jacquard_common::smol_str::SmolStr::new_static("entry"),
391 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
392 description: Some(
393 ::jacquard_common::CowStr::new_static("AT URI of the entry"),
394 ),
395 format: Some(
396 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
397 ),
398 default: None,
399 min_length: None,
400 max_length: None,
401 min_graphemes: None,
402 max_graphemes: None,
403 r#enum: None,
404 r#const: None,
405 known_values: None,
406 }),
407 );
408 map
409 },
410 }),
411 ),
412 output: None,
413 errors: None,
414 }),
415 );
416 map.insert(
417 ::jacquard_common::smol_str::SmolStr::new_static("notebookRef"),
418 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
419 description: Some(
420 ::jacquard_common::CowStr::new_static(
421 "Reference to a notebook containing this entry.",
422 ),
423 ),
424 required: Some(
425 vec![
426 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
427 ::jacquard_common::smol_str::SmolStr::new_static("cid")
428 ],
429 ),
430 nullable: None,
431 properties: {
432 #[allow(unused_mut)]
433 let mut map = ::alloc::collections::BTreeMap::new();
434 map.insert(
435 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
436 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
437 description: None,
438 format: Some(
439 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
440 ),
441 default: None,
442 min_length: None,
443 max_length: None,
444 min_graphemes: None,
445 max_graphemes: None,
446 r#enum: None,
447 r#const: None,
448 known_values: None,
449 }),
450 );
451 map.insert(
452 ::jacquard_common::smol_str::SmolStr::new_static("owner"),
453 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
454 description: None,
455 r#ref: ::jacquard_common::CowStr::new_static(
456 "sh.weaver.actor.defs#profileViewBasic",
457 ),
458 }),
459 );
460 map.insert(
461 ::jacquard_common::smol_str::SmolStr::new_static("title"),
462 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
463 description: None,
464 format: None,
465 default: None,
466 min_length: None,
467 max_length: None,
468 min_graphemes: None,
469 max_graphemes: None,
470 r#enum: None,
471 r#const: None,
472 known_values: None,
473 }),
474 );
475 map.insert(
476 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
477 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
478 description: None,
479 format: Some(
480 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
481 ),
482 default: None,
483 min_length: None,
484 max_length: None,
485 min_graphemes: None,
486 max_graphemes: None,
487 r#enum: None,
488 r#const: None,
489 known_values: None,
490 }),
491 );
492 map
493 },
494 }),
495 );
496 map
497 },
498 }
499}
500
501impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotebookRef<'a> {
502 fn nsid() -> &'static str {
503 "sh.weaver.notebook.getEntryNotebooks"
504 }
505 fn def_name() -> &'static str {
506 "notebookRef"
507 }
508 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
509 lexicon_doc_sh_weaver_notebook_getEntryNotebooks()
510 }
511 fn validate(
512 &self,
513 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
514 Ok(())
515 }
516}