jacquard_api/sh_weaver/
edit.rs

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