atproto blogging
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 draft;
11pub mod get_branch;
12pub mod get_contributors;
13pub mod get_edit_history;
14pub mod get_edit_tree;
15pub mod list_drafts;
16pub mod root;
17
18#[jacquard_derive::lexicon]
19#[derive(
20 serde::Serialize,
21 serde::Deserialize,
22 Debug,
23 Clone,
24 PartialEq,
25 Eq,
26 jacquard_derive::IntoStatic
27)]
28#[serde(rename_all = "camelCase")]
29pub struct DocRef<'a> {
30 #[serde(borrow)]
31 pub value: DocRefValue<'a>,
32}
33
34pub mod doc_ref_state {
35
36 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
37 #[allow(unused)]
38 use ::core::marker::PhantomData;
39 mod sealed {
40 pub trait Sealed {}
41 }
42 /// State trait tracking which required fields have been set
43 pub trait State: sealed::Sealed {
44 type Value;
45 }
46 /// Empty state - all required fields are unset
47 pub struct Empty(());
48 impl sealed::Sealed for Empty {}
49 impl State for Empty {
50 type Value = Unset;
51 }
52 ///State transition - sets the `value` field to Set
53 pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
54 impl<S: State> sealed::Sealed for SetValue<S> {}
55 impl<S: State> State for SetValue<S> {
56 type Value = Set<members::value>;
57 }
58 /// Marker types for field names
59 #[allow(non_camel_case_types)]
60 pub mod members {
61 ///Marker type for the `value` field
62 pub struct value(());
63 }
64}
65
66/// Builder for constructing an instance of this type
67pub struct DocRefBuilder<'a, S: doc_ref_state::State> {
68 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
69 __unsafe_private_named: (::core::option::Option<DocRefValue<'a>>,),
70 _phantom: ::core::marker::PhantomData<&'a ()>,
71}
72
73impl<'a> DocRef<'a> {
74 /// Create a new builder for this type
75 pub fn new() -> DocRefBuilder<'a, doc_ref_state::Empty> {
76 DocRefBuilder::new()
77 }
78}
79
80impl<'a> DocRefBuilder<'a, doc_ref_state::Empty> {
81 /// Create a new builder with all fields unset
82 pub fn new() -> Self {
83 DocRefBuilder {
84 _phantom_state: ::core::marker::PhantomData,
85 __unsafe_private_named: (None,),
86 _phantom: ::core::marker::PhantomData,
87 }
88 }
89}
90
91impl<'a, S> DocRefBuilder<'a, S>
92where
93 S: doc_ref_state::State,
94 S::Value: doc_ref_state::IsUnset,
95{
96 /// Set the `value` field (required)
97 pub fn value(
98 mut self,
99 value: impl Into<DocRefValue<'a>>,
100 ) -> DocRefBuilder<'a, doc_ref_state::SetValue<S>> {
101 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
102 DocRefBuilder {
103 _phantom_state: ::core::marker::PhantomData,
104 __unsafe_private_named: self.__unsafe_private_named,
105 _phantom: ::core::marker::PhantomData,
106 }
107 }
108}
109
110impl<'a, S> DocRefBuilder<'a, S>
111where
112 S: doc_ref_state::State,
113 S::Value: doc_ref_state::IsSet,
114{
115 /// Build the final struct
116 pub fn build(self) -> DocRef<'a> {
117 DocRef {
118 value: self.__unsafe_private_named.0.unwrap(),
119 extra_data: Default::default(),
120 }
121 }
122 /// Build the final struct with custom extra_data
123 pub fn build_with_data(
124 self,
125 extra_data: std::collections::BTreeMap<
126 jacquard_common::smol_str::SmolStr,
127 jacquard_common::types::value::Data<'a>,
128 >,
129 ) -> DocRef<'a> {
130 DocRef {
131 value: self.__unsafe_private_named.0.unwrap(),
132 extra_data: Some(extra_data),
133 }
134 }
135}
136
137#[jacquard_derive::open_union]
138#[derive(
139 serde::Serialize,
140 serde::Deserialize,
141 Debug,
142 Clone,
143 PartialEq,
144 Eq,
145 jacquard_derive::IntoStatic
146)]
147#[serde(tag = "$type")]
148#[serde(bound(deserialize = "'de: 'a"))]
149pub enum DocRefValue<'a> {
150 #[serde(rename = "sh.weaver.edit.defs#notebookRef")]
151 NotebookRef(Box<crate::sh_weaver::edit::NotebookRef<'a>>),
152 #[serde(rename = "sh.weaver.edit.defs#entryRef")]
153 EntryRef(Box<crate::sh_weaver::edit::EntryRef<'a>>),
154 #[serde(rename = "sh.weaver.edit.defs#draftRef")]
155 DraftRef(Box<crate::sh_weaver::edit::DraftRef<'a>>),
156}
157
158fn lexicon_doc_sh_weaver_edit_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
159 'static,
160> {
161 ::jacquard_lexicon::lexicon::LexiconDoc {
162 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
163 id: ::jacquard_common::CowStr::new_static("sh.weaver.edit.defs"),
164 revision: None,
165 description: None,
166 defs: {
167 let mut map = ::alloc::collections::BTreeMap::new();
168 map.insert(
169 ::jacquard_common::smol_str::SmolStr::new_static("docRef"),
170 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
171 description: None,
172 required: Some(
173 vec![::jacquard_common::smol_str::SmolStr::new_static("value")],
174 ),
175 nullable: None,
176 properties: {
177 #[allow(unused_mut)]
178 let mut map = ::alloc::collections::BTreeMap::new();
179 map.insert(
180 ::jacquard_common::smol_str::SmolStr::new_static("value"),
181 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
182 description: None,
183 refs: vec![
184 ::jacquard_common::CowStr::new_static("#notebookRef"),
185 ::jacquard_common::CowStr::new_static("#entryRef"),
186 ::jacquard_common::CowStr::new_static("#draftRef")
187 ],
188 closed: None,
189 }),
190 );
191 map
192 },
193 }),
194 );
195 map.insert(
196 ::jacquard_common::smol_str::SmolStr::new_static("draftRef"),
197 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
198 description: None,
199 required: Some(
200 vec![
201 ::jacquard_common::smol_str::SmolStr::new_static("draftKey")
202 ],
203 ),
204 nullable: None,
205 properties: {
206 #[allow(unused_mut)]
207 let mut map = ::alloc::collections::BTreeMap::new();
208 map.insert(
209 ::jacquard_common::smol_str::SmolStr::new_static("draftKey"),
210 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
211 description: None,
212 format: None,
213 default: None,
214 min_length: None,
215 max_length: Some(200usize),
216 min_graphemes: None,
217 max_graphemes: None,
218 r#enum: None,
219 r#const: None,
220 known_values: None,
221 }),
222 );
223 map
224 },
225 }),
226 );
227 map.insert(
228 ::jacquard_common::smol_str::SmolStr::new_static("editBranchView"),
229 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
230 description: Some(
231 ::jacquard_common::CowStr::new_static(
232 "A branch/fork in edit history (for when collaborators diverge).",
233 ),
234 ),
235 required: Some(
236 vec![
237 ::jacquard_common::smol_str::SmolStr::new_static("head"),
238 ::jacquard_common::smol_str::SmolStr::new_static("author"),
239 ::jacquard_common::smol_str::SmolStr::new_static("length"),
240 ::jacquard_common::smol_str::SmolStr::new_static("lastUpdated")
241 ],
242 ),
243 nullable: None,
244 properties: {
245 #[allow(unused_mut)]
246 let mut map = ::alloc::collections::BTreeMap::new();
247 map.insert(
248 ::jacquard_common::smol_str::SmolStr::new_static("author"),
249 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
250 description: None,
251 r#ref: ::jacquard_common::CowStr::new_static(
252 "sh.weaver.actor.defs#profileViewBasic",
253 ),
254 }),
255 );
256 map.insert(
257 ::jacquard_common::smol_str::SmolStr::new_static(
258 "divergesFrom",
259 ),
260 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
261 description: None,
262 r#ref: ::jacquard_common::CowStr::new_static(
263 "com.atproto.repo.strongRef",
264 ),
265 }),
266 );
267 map.insert(
268 ::jacquard_common::smol_str::SmolStr::new_static("head"),
269 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
270 description: None,
271 r#ref: ::jacquard_common::CowStr::new_static(
272 "com.atproto.repo.strongRef",
273 ),
274 }),
275 );
276 map.insert(
277 ::jacquard_common::smol_str::SmolStr::new_static("isMerged"),
278 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
279 description: None,
280 default: None,
281 r#const: None,
282 }),
283 );
284 map.insert(
285 ::jacquard_common::smol_str::SmolStr::new_static(
286 "lastUpdated",
287 ),
288 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
289 description: None,
290 format: Some(
291 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
292 ),
293 default: None,
294 min_length: None,
295 max_length: None,
296 min_graphemes: None,
297 max_graphemes: None,
298 r#enum: None,
299 r#const: None,
300 known_values: None,
301 }),
302 );
303 map.insert(
304 ::jacquard_common::smol_str::SmolStr::new_static("length"),
305 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
306 description: None,
307 default: None,
308 minimum: None,
309 maximum: None,
310 r#enum: None,
311 r#const: None,
312 }),
313 );
314 map.insert(
315 ::jacquard_common::smol_str::SmolStr::new_static("root"),
316 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
317 description: None,
318 r#ref: ::jacquard_common::CowStr::new_static(
319 "com.atproto.repo.strongRef",
320 ),
321 }),
322 );
323 map
324 },
325 }),
326 );
327 map.insert(
328 ::jacquard_common::smol_str::SmolStr::new_static("editHistoryEntry"),
329 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
330 description: Some(
331 ::jacquard_common::CowStr::new_static(
332 "Summary of an edit (root or diff) for history queries.",
333 ),
334 ),
335 required: Some(
336 vec![
337 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
338 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
339 ::jacquard_common::smol_str::SmolStr::new_static("author"),
340 ::jacquard_common::smol_str::SmolStr::new_static("createdAt"),
341 ::jacquard_common::smol_str::SmolStr::new_static("type")
342 ],
343 ),
344 nullable: None,
345 properties: {
346 #[allow(unused_mut)]
347 let mut map = ::alloc::collections::BTreeMap::new();
348 map.insert(
349 ::jacquard_common::smol_str::SmolStr::new_static("author"),
350 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
351 description: None,
352 r#ref: ::jacquard_common::CowStr::new_static(
353 "sh.weaver.actor.defs#profileViewBasic",
354 ),
355 }),
356 );
357 map.insert(
358 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
359 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
360 description: None,
361 format: Some(
362 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
363 ),
364 default: None,
365 min_length: None,
366 max_length: None,
367 min_graphemes: None,
368 max_graphemes: None,
369 r#enum: None,
370 r#const: None,
371 known_values: None,
372 }),
373 );
374 map.insert(
375 ::jacquard_common::smol_str::SmolStr::new_static(
376 "createdAt",
377 ),
378 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
379 description: None,
380 format: Some(
381 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
382 ),
383 default: None,
384 min_length: None,
385 max_length: None,
386 min_graphemes: None,
387 max_graphemes: None,
388 r#enum: None,
389 r#const: None,
390 known_values: None,
391 }),
392 );
393 map.insert(
394 ::jacquard_common::smol_str::SmolStr::new_static(
395 "hasInlineDiff",
396 ),
397 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
398 description: None,
399 default: None,
400 r#const: None,
401 }),
402 );
403 map.insert(
404 ::jacquard_common::smol_str::SmolStr::new_static("prevRef"),
405 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
406 description: None,
407 r#ref: ::jacquard_common::CowStr::new_static(
408 "com.atproto.repo.strongRef",
409 ),
410 }),
411 );
412 map.insert(
413 ::jacquard_common::smol_str::SmolStr::new_static("rootRef"),
414 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
415 description: None,
416 r#ref: ::jacquard_common::CowStr::new_static(
417 "com.atproto.repo.strongRef",
418 ),
419 }),
420 );
421 map.insert(
422 ::jacquard_common::smol_str::SmolStr::new_static(
423 "snapshotCid",
424 ),
425 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
426 description: None,
427 format: Some(
428 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
429 ),
430 default: None,
431 min_length: None,
432 max_length: None,
433 min_graphemes: None,
434 max_graphemes: None,
435 r#enum: None,
436 r#const: None,
437 known_values: None,
438 }),
439 );
440 map.insert(
441 ::jacquard_common::smol_str::SmolStr::new_static("type"),
442 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
443 description: None,
444 format: None,
445 default: None,
446 min_length: None,
447 max_length: None,
448 min_graphemes: None,
449 max_graphemes: None,
450 r#enum: None,
451 r#const: None,
452 known_values: None,
453 }),
454 );
455 map.insert(
456 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
457 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
458 description: None,
459 format: Some(
460 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
461 ),
462 default: None,
463 min_length: None,
464 max_length: None,
465 min_graphemes: None,
466 max_graphemes: None,
467 r#enum: None,
468 r#const: None,
469 known_values: None,
470 }),
471 );
472 map
473 },
474 }),
475 );
476 map.insert(
477 ::jacquard_common::smol_str::SmolStr::new_static("editTreeView"),
478 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
479 description: Some(
480 ::jacquard_common::CowStr::new_static(
481 "Full tree structure showing all branches for a resource.",
482 ),
483 ),
484 required: Some(
485 vec![
486 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
487 ::jacquard_common::smol_str::SmolStr::new_static("branches")
488 ],
489 ),
490 nullable: None,
491 properties: {
492 #[allow(unused_mut)]
493 let mut map = ::alloc::collections::BTreeMap::new();
494 map.insert(
495 ::jacquard_common::smol_str::SmolStr::new_static("branches"),
496 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
497 description: None,
498 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
499 description: None,
500 r#ref: ::jacquard_common::CowStr::new_static(
501 "#editBranchView",
502 ),
503 }),
504 min_length: None,
505 max_length: None,
506 }),
507 );
508 map.insert(
509 ::jacquard_common::smol_str::SmolStr::new_static(
510 "conflictPoints",
511 ),
512 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
513 description: Some(
514 ::jacquard_common::CowStr::new_static(
515 "Diffs where branches diverge",
516 ),
517 ),
518 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
519 description: None,
520 r#ref: ::jacquard_common::CowStr::new_static(
521 "com.atproto.repo.strongRef",
522 ),
523 }),
524 min_length: None,
525 max_length: None,
526 }),
527 );
528 map.insert(
529 ::jacquard_common::smol_str::SmolStr::new_static(
530 "hasConflicts",
531 ),
532 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
533 description: None,
534 default: None,
535 r#const: None,
536 }),
537 );
538 map.insert(
539 ::jacquard_common::smol_str::SmolStr::new_static(
540 "mainBranch",
541 ),
542 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
543 description: None,
544 r#ref: ::jacquard_common::CowStr::new_static(
545 "#editBranchView",
546 ),
547 }),
548 );
549 map.insert(
550 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
551 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
552 description: None,
553 r#ref: ::jacquard_common::CowStr::new_static(
554 "com.atproto.repo.strongRef",
555 ),
556 }),
557 );
558 map
559 },
560 }),
561 );
562 map.insert(
563 ::jacquard_common::smol_str::SmolStr::new_static("entryRef"),
564 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
565 description: None,
566 required: Some(
567 vec![::jacquard_common::smol_str::SmolStr::new_static("entry")],
568 ),
569 nullable: None,
570 properties: {
571 #[allow(unused_mut)]
572 let mut map = ::alloc::collections::BTreeMap::new();
573 map.insert(
574 ::jacquard_common::smol_str::SmolStr::new_static("entry"),
575 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
576 description: None,
577 r#ref: ::jacquard_common::CowStr::new_static(
578 "com.atproto.repo.strongRef",
579 ),
580 }),
581 );
582 map
583 },
584 }),
585 );
586 map.insert(
587 ::jacquard_common::smol_str::SmolStr::new_static("notebookRef"),
588 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
589 description: None,
590 required: Some(
591 vec![
592 ::jacquard_common::smol_str::SmolStr::new_static("notebook")
593 ],
594 ),
595 nullable: None,
596 properties: {
597 #[allow(unused_mut)]
598 let mut map = ::alloc::collections::BTreeMap::new();
599 map.insert(
600 ::jacquard_common::smol_str::SmolStr::new_static("notebook"),
601 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
602 description: None,
603 r#ref: ::jacquard_common::CowStr::new_static(
604 "com.atproto.repo.strongRef",
605 ),
606 }),
607 );
608 map
609 },
610 }),
611 );
612 map
613 },
614 }
615}
616
617impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DocRef<'a> {
618 fn nsid() -> &'static str {
619 "sh.weaver.edit.defs"
620 }
621 fn def_name() -> &'static str {
622 "docRef"
623 }
624 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
625 lexicon_doc_sh_weaver_edit_defs()
626 }
627 fn validate(
628 &self,
629 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
630 Ok(())
631 }
632}
633
634#[jacquard_derive::lexicon]
635#[derive(
636 serde::Serialize,
637 serde::Deserialize,
638 Debug,
639 Clone,
640 PartialEq,
641 Eq,
642 jacquard_derive::IntoStatic,
643 Default
644)]
645#[serde(rename_all = "camelCase")]
646pub struct DraftRef<'a> {
647 #[serde(borrow)]
648 pub draft_key: jacquard_common::CowStr<'a>,
649}
650
651impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DraftRef<'a> {
652 fn nsid() -> &'static str {
653 "sh.weaver.edit.defs"
654 }
655 fn def_name() -> &'static str {
656 "draftRef"
657 }
658 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
659 lexicon_doc_sh_weaver_edit_defs()
660 }
661 fn validate(
662 &self,
663 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
664 {
665 let value = &self.draft_key;
666 #[allow(unused_comparisons)]
667 if <str>::len(value.as_ref()) > 200usize {
668 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
669 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
670 "draft_key",
671 ),
672 max: 200usize,
673 actual: <str>::len(value.as_ref()),
674 });
675 }
676 }
677 Ok(())
678 }
679}
680
681/// A branch/fork in edit history (for when collaborators diverge).
682#[jacquard_derive::lexicon]
683#[derive(
684 serde::Serialize,
685 serde::Deserialize,
686 Debug,
687 Clone,
688 PartialEq,
689 Eq,
690 jacquard_derive::IntoStatic
691)]
692#[serde(rename_all = "camelCase")]
693pub struct EditBranchView<'a> {
694 #[serde(borrow)]
695 pub author: crate::sh_weaver::actor::ProfileViewBasic<'a>,
696 /// Common ancestor if this is a fork
697 #[serde(skip_serializing_if = "std::option::Option::is_none")]
698 #[serde(borrow)]
699 pub diverges_from: std::option::Option<
700 crate::com_atproto::repo::strong_ref::StrongRef<'a>,
701 >,
702 #[serde(borrow)]
703 pub head: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
704 #[serde(skip_serializing_if = "std::option::Option::is_none")]
705 pub is_merged: std::option::Option<bool>,
706 pub last_updated: jacquard_common::types::string::Datetime,
707 /// Number of diffs in this branch
708 pub length: i64,
709 #[serde(skip_serializing_if = "std::option::Option::is_none")]
710 #[serde(borrow)]
711 pub root: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
712}
713
714pub mod edit_branch_view_state {
715
716 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
717 #[allow(unused)]
718 use ::core::marker::PhantomData;
719 mod sealed {
720 pub trait Sealed {}
721 }
722 /// State trait tracking which required fields have been set
723 pub trait State: sealed::Sealed {
724 type Head;
725 type Author;
726 type LastUpdated;
727 type Length;
728 }
729 /// Empty state - all required fields are unset
730 pub struct Empty(());
731 impl sealed::Sealed for Empty {}
732 impl State for Empty {
733 type Head = Unset;
734 type Author = Unset;
735 type LastUpdated = Unset;
736 type Length = Unset;
737 }
738 ///State transition - sets the `head` field to Set
739 pub struct SetHead<S: State = Empty>(PhantomData<fn() -> S>);
740 impl<S: State> sealed::Sealed for SetHead<S> {}
741 impl<S: State> State for SetHead<S> {
742 type Head = Set<members::head>;
743 type Author = S::Author;
744 type LastUpdated = S::LastUpdated;
745 type Length = S::Length;
746 }
747 ///State transition - sets the `author` field to Set
748 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
749 impl<S: State> sealed::Sealed for SetAuthor<S> {}
750 impl<S: State> State for SetAuthor<S> {
751 type Head = S::Head;
752 type Author = Set<members::author>;
753 type LastUpdated = S::LastUpdated;
754 type Length = S::Length;
755 }
756 ///State transition - sets the `last_updated` field to Set
757 pub struct SetLastUpdated<S: State = Empty>(PhantomData<fn() -> S>);
758 impl<S: State> sealed::Sealed for SetLastUpdated<S> {}
759 impl<S: State> State for SetLastUpdated<S> {
760 type Head = S::Head;
761 type Author = S::Author;
762 type LastUpdated = Set<members::last_updated>;
763 type Length = S::Length;
764 }
765 ///State transition - sets the `length` field to Set
766 pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>);
767 impl<S: State> sealed::Sealed for SetLength<S> {}
768 impl<S: State> State for SetLength<S> {
769 type Head = S::Head;
770 type Author = S::Author;
771 type LastUpdated = S::LastUpdated;
772 type Length = Set<members::length>;
773 }
774 /// Marker types for field names
775 #[allow(non_camel_case_types)]
776 pub mod members {
777 ///Marker type for the `head` field
778 pub struct head(());
779 ///Marker type for the `author` field
780 pub struct author(());
781 ///Marker type for the `last_updated` field
782 pub struct last_updated(());
783 ///Marker type for the `length` field
784 pub struct length(());
785 }
786}
787
788/// Builder for constructing an instance of this type
789pub struct EditBranchViewBuilder<'a, S: edit_branch_view_state::State> {
790 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
791 __unsafe_private_named: (
792 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
793 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
794 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
795 ::core::option::Option<bool>,
796 ::core::option::Option<jacquard_common::types::string::Datetime>,
797 ::core::option::Option<i64>,
798 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
799 ),
800 _phantom: ::core::marker::PhantomData<&'a ()>,
801}
802
803impl<'a> EditBranchView<'a> {
804 /// Create a new builder for this type
805 pub fn new() -> EditBranchViewBuilder<'a, edit_branch_view_state::Empty> {
806 EditBranchViewBuilder::new()
807 }
808}
809
810impl<'a> EditBranchViewBuilder<'a, edit_branch_view_state::Empty> {
811 /// Create a new builder with all fields unset
812 pub fn new() -> Self {
813 EditBranchViewBuilder {
814 _phantom_state: ::core::marker::PhantomData,
815 __unsafe_private_named: (None, None, None, None, None, None, None),
816 _phantom: ::core::marker::PhantomData,
817 }
818 }
819}
820
821impl<'a, S> EditBranchViewBuilder<'a, S>
822where
823 S: edit_branch_view_state::State,
824 S::Author: edit_branch_view_state::IsUnset,
825{
826 /// Set the `author` field (required)
827 pub fn author(
828 mut self,
829 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
830 ) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetAuthor<S>> {
831 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
832 EditBranchViewBuilder {
833 _phantom_state: ::core::marker::PhantomData,
834 __unsafe_private_named: self.__unsafe_private_named,
835 _phantom: ::core::marker::PhantomData,
836 }
837 }
838}
839
840impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> {
841 /// Set the `divergesFrom` field (optional)
842 pub fn diverges_from(
843 mut self,
844 value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
845 ) -> Self {
846 self.__unsafe_private_named.1 = value.into();
847 self
848 }
849 /// Set the `divergesFrom` field to an Option value (optional)
850 pub fn maybe_diverges_from(
851 mut self,
852 value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
853 ) -> Self {
854 self.__unsafe_private_named.1 = value;
855 self
856 }
857}
858
859impl<'a, S> EditBranchViewBuilder<'a, S>
860where
861 S: edit_branch_view_state::State,
862 S::Head: edit_branch_view_state::IsUnset,
863{
864 /// Set the `head` field (required)
865 pub fn head(
866 mut self,
867 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
868 ) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetHead<S>> {
869 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
870 EditBranchViewBuilder {
871 _phantom_state: ::core::marker::PhantomData,
872 __unsafe_private_named: self.__unsafe_private_named,
873 _phantom: ::core::marker::PhantomData,
874 }
875 }
876}
877
878impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> {
879 /// Set the `isMerged` field (optional)
880 pub fn is_merged(mut self, value: impl Into<Option<bool>>) -> Self {
881 self.__unsafe_private_named.3 = value.into();
882 self
883 }
884 /// Set the `isMerged` field to an Option value (optional)
885 pub fn maybe_is_merged(mut self, value: Option<bool>) -> Self {
886 self.__unsafe_private_named.3 = value;
887 self
888 }
889}
890
891impl<'a, S> EditBranchViewBuilder<'a, S>
892where
893 S: edit_branch_view_state::State,
894 S::LastUpdated: edit_branch_view_state::IsUnset,
895{
896 /// Set the `lastUpdated` field (required)
897 pub fn last_updated(
898 mut self,
899 value: impl Into<jacquard_common::types::string::Datetime>,
900 ) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetLastUpdated<S>> {
901 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
902 EditBranchViewBuilder {
903 _phantom_state: ::core::marker::PhantomData,
904 __unsafe_private_named: self.__unsafe_private_named,
905 _phantom: ::core::marker::PhantomData,
906 }
907 }
908}
909
910impl<'a, S> EditBranchViewBuilder<'a, S>
911where
912 S: edit_branch_view_state::State,
913 S::Length: edit_branch_view_state::IsUnset,
914{
915 /// Set the `length` field (required)
916 pub fn length(
917 mut self,
918 value: impl Into<i64>,
919 ) -> EditBranchViewBuilder<'a, edit_branch_view_state::SetLength<S>> {
920 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
921 EditBranchViewBuilder {
922 _phantom_state: ::core::marker::PhantomData,
923 __unsafe_private_named: self.__unsafe_private_named,
924 _phantom: ::core::marker::PhantomData,
925 }
926 }
927}
928
929impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> {
930 /// Set the `root` field (optional)
931 pub fn root(
932 mut self,
933 value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
934 ) -> Self {
935 self.__unsafe_private_named.6 = value.into();
936 self
937 }
938 /// Set the `root` field to an Option value (optional)
939 pub fn maybe_root(
940 mut self,
941 value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
942 ) -> Self {
943 self.__unsafe_private_named.6 = value;
944 self
945 }
946}
947
948impl<'a, S> EditBranchViewBuilder<'a, S>
949where
950 S: edit_branch_view_state::State,
951 S::Head: edit_branch_view_state::IsSet,
952 S::Author: edit_branch_view_state::IsSet,
953 S::LastUpdated: edit_branch_view_state::IsSet,
954 S::Length: edit_branch_view_state::IsSet,
955{
956 /// Build the final struct
957 pub fn build(self) -> EditBranchView<'a> {
958 EditBranchView {
959 author: self.__unsafe_private_named.0.unwrap(),
960 diverges_from: self.__unsafe_private_named.1,
961 head: self.__unsafe_private_named.2.unwrap(),
962 is_merged: self.__unsafe_private_named.3,
963 last_updated: self.__unsafe_private_named.4.unwrap(),
964 length: self.__unsafe_private_named.5.unwrap(),
965 root: self.__unsafe_private_named.6,
966 extra_data: Default::default(),
967 }
968 }
969 /// Build the final struct with custom extra_data
970 pub fn build_with_data(
971 self,
972 extra_data: std::collections::BTreeMap<
973 jacquard_common::smol_str::SmolStr,
974 jacquard_common::types::value::Data<'a>,
975 >,
976 ) -> EditBranchView<'a> {
977 EditBranchView {
978 author: self.__unsafe_private_named.0.unwrap(),
979 diverges_from: self.__unsafe_private_named.1,
980 head: self.__unsafe_private_named.2.unwrap(),
981 is_merged: self.__unsafe_private_named.3,
982 last_updated: self.__unsafe_private_named.4.unwrap(),
983 length: self.__unsafe_private_named.5.unwrap(),
984 root: self.__unsafe_private_named.6,
985 extra_data: Some(extra_data),
986 }
987 }
988}
989
990impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditBranchView<'a> {
991 fn nsid() -> &'static str {
992 "sh.weaver.edit.defs"
993 }
994 fn def_name() -> &'static str {
995 "editBranchView"
996 }
997 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
998 lexicon_doc_sh_weaver_edit_defs()
999 }
1000 fn validate(
1001 &self,
1002 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1003 Ok(())
1004 }
1005}
1006
1007/// Summary of an edit (root or diff) for history queries.
1008#[jacquard_derive::lexicon]
1009#[derive(
1010 serde::Serialize,
1011 serde::Deserialize,
1012 Debug,
1013 Clone,
1014 PartialEq,
1015 Eq,
1016 jacquard_derive::IntoStatic
1017)]
1018#[serde(rename_all = "camelCase")]
1019pub struct EditHistoryEntry<'a> {
1020 #[serde(borrow)]
1021 pub author: crate::sh_weaver::actor::ProfileViewBasic<'a>,
1022 #[serde(borrow)]
1023 pub cid: jacquard_common::types::string::Cid<'a>,
1024 pub created_at: jacquard_common::types::string::Datetime,
1025 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1026 pub has_inline_diff: std::option::Option<bool>,
1027 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1028 #[serde(borrow)]
1029 pub prev_ref: std::option::Option<
1030 crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1031 >,
1032 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1033 #[serde(borrow)]
1034 pub root_ref: std::option::Option<
1035 crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1036 >,
1037 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1038 #[serde(borrow)]
1039 pub snapshot_cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
1040 #[serde(borrow)]
1041 pub r#type: EditHistoryEntryType<'a>,
1042 #[serde(borrow)]
1043 pub uri: jacquard_common::types::string::AtUri<'a>,
1044}
1045
1046pub mod edit_history_entry_state {
1047
1048 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1049 #[allow(unused)]
1050 use ::core::marker::PhantomData;
1051 mod sealed {
1052 pub trait Sealed {}
1053 }
1054 /// State trait tracking which required fields have been set
1055 pub trait State: sealed::Sealed {
1056 type Cid;
1057 type CreatedAt;
1058 type Author;
1059 type Uri;
1060 type Type;
1061 }
1062 /// Empty state - all required fields are unset
1063 pub struct Empty(());
1064 impl sealed::Sealed for Empty {}
1065 impl State for Empty {
1066 type Cid = Unset;
1067 type CreatedAt = Unset;
1068 type Author = Unset;
1069 type Uri = Unset;
1070 type Type = Unset;
1071 }
1072 ///State transition - sets the `cid` field to Set
1073 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
1074 impl<S: State> sealed::Sealed for SetCid<S> {}
1075 impl<S: State> State for SetCid<S> {
1076 type Cid = Set<members::cid>;
1077 type CreatedAt = S::CreatedAt;
1078 type Author = S::Author;
1079 type Uri = S::Uri;
1080 type Type = S::Type;
1081 }
1082 ///State transition - sets the `created_at` field to Set
1083 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
1084 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
1085 impl<S: State> State for SetCreatedAt<S> {
1086 type Cid = S::Cid;
1087 type CreatedAt = Set<members::created_at>;
1088 type Author = S::Author;
1089 type Uri = S::Uri;
1090 type Type = S::Type;
1091 }
1092 ///State transition - sets the `author` field to Set
1093 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
1094 impl<S: State> sealed::Sealed for SetAuthor<S> {}
1095 impl<S: State> State for SetAuthor<S> {
1096 type Cid = S::Cid;
1097 type CreatedAt = S::CreatedAt;
1098 type Author = Set<members::author>;
1099 type Uri = S::Uri;
1100 type Type = S::Type;
1101 }
1102 ///State transition - sets the `uri` field to Set
1103 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1104 impl<S: State> sealed::Sealed for SetUri<S> {}
1105 impl<S: State> State for SetUri<S> {
1106 type Cid = S::Cid;
1107 type CreatedAt = S::CreatedAt;
1108 type Author = S::Author;
1109 type Uri = Set<members::uri>;
1110 type Type = S::Type;
1111 }
1112 ///State transition - sets the `type` field to Set
1113 pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
1114 impl<S: State> sealed::Sealed for SetType<S> {}
1115 impl<S: State> State for SetType<S> {
1116 type Cid = S::Cid;
1117 type CreatedAt = S::CreatedAt;
1118 type Author = S::Author;
1119 type Uri = S::Uri;
1120 type Type = Set<members::r#type>;
1121 }
1122 /// Marker types for field names
1123 #[allow(non_camel_case_types)]
1124 pub mod members {
1125 ///Marker type for the `cid` field
1126 pub struct cid(());
1127 ///Marker type for the `created_at` field
1128 pub struct created_at(());
1129 ///Marker type for the `author` field
1130 pub struct author(());
1131 ///Marker type for the `uri` field
1132 pub struct uri(());
1133 ///Marker type for the `type` field
1134 pub struct r#type(());
1135 }
1136}
1137
1138/// Builder for constructing an instance of this type
1139pub struct EditHistoryEntryBuilder<'a, S: edit_history_entry_state::State> {
1140 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1141 __unsafe_private_named: (
1142 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
1143 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
1144 ::core::option::Option<jacquard_common::types::string::Datetime>,
1145 ::core::option::Option<bool>,
1146 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1147 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1148 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
1149 ::core::option::Option<EditHistoryEntryType<'a>>,
1150 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
1151 ),
1152 _phantom: ::core::marker::PhantomData<&'a ()>,
1153}
1154
1155impl<'a> EditHistoryEntry<'a> {
1156 /// Create a new builder for this type
1157 pub fn new() -> EditHistoryEntryBuilder<'a, edit_history_entry_state::Empty> {
1158 EditHistoryEntryBuilder::new()
1159 }
1160}
1161
1162impl<'a> EditHistoryEntryBuilder<'a, edit_history_entry_state::Empty> {
1163 /// Create a new builder with all fields unset
1164 pub fn new() -> Self {
1165 EditHistoryEntryBuilder {
1166 _phantom_state: ::core::marker::PhantomData,
1167 __unsafe_private_named: (
1168 None,
1169 None,
1170 None,
1171 None,
1172 None,
1173 None,
1174 None,
1175 None,
1176 None,
1177 ),
1178 _phantom: ::core::marker::PhantomData,
1179 }
1180 }
1181}
1182
1183impl<'a, S> EditHistoryEntryBuilder<'a, S>
1184where
1185 S: edit_history_entry_state::State,
1186 S::Author: edit_history_entry_state::IsUnset,
1187{
1188 /// Set the `author` field (required)
1189 pub fn author(
1190 mut self,
1191 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
1192 ) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetAuthor<S>> {
1193 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1194 EditHistoryEntryBuilder {
1195 _phantom_state: ::core::marker::PhantomData,
1196 __unsafe_private_named: self.__unsafe_private_named,
1197 _phantom: ::core::marker::PhantomData,
1198 }
1199 }
1200}
1201
1202impl<'a, S> EditHistoryEntryBuilder<'a, S>
1203where
1204 S: edit_history_entry_state::State,
1205 S::Cid: edit_history_entry_state::IsUnset,
1206{
1207 /// Set the `cid` field (required)
1208 pub fn cid(
1209 mut self,
1210 value: impl Into<jacquard_common::types::string::Cid<'a>>,
1211 ) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetCid<S>> {
1212 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1213 EditHistoryEntryBuilder {
1214 _phantom_state: ::core::marker::PhantomData,
1215 __unsafe_private_named: self.__unsafe_private_named,
1216 _phantom: ::core::marker::PhantomData,
1217 }
1218 }
1219}
1220
1221impl<'a, S> EditHistoryEntryBuilder<'a, S>
1222where
1223 S: edit_history_entry_state::State,
1224 S::CreatedAt: edit_history_entry_state::IsUnset,
1225{
1226 /// Set the `createdAt` field (required)
1227 pub fn created_at(
1228 mut self,
1229 value: impl Into<jacquard_common::types::string::Datetime>,
1230 ) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetCreatedAt<S>> {
1231 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
1232 EditHistoryEntryBuilder {
1233 _phantom_state: ::core::marker::PhantomData,
1234 __unsafe_private_named: self.__unsafe_private_named,
1235 _phantom: ::core::marker::PhantomData,
1236 }
1237 }
1238}
1239
1240impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
1241 /// Set the `hasInlineDiff` field (optional)
1242 pub fn has_inline_diff(mut self, value: impl Into<Option<bool>>) -> Self {
1243 self.__unsafe_private_named.3 = value.into();
1244 self
1245 }
1246 /// Set the `hasInlineDiff` field to an Option value (optional)
1247 pub fn maybe_has_inline_diff(mut self, value: Option<bool>) -> Self {
1248 self.__unsafe_private_named.3 = value;
1249 self
1250 }
1251}
1252
1253impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
1254 /// Set the `prevRef` field (optional)
1255 pub fn prev_ref(
1256 mut self,
1257 value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
1258 ) -> Self {
1259 self.__unsafe_private_named.4 = value.into();
1260 self
1261 }
1262 /// Set the `prevRef` field to an Option value (optional)
1263 pub fn maybe_prev_ref(
1264 mut self,
1265 value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1266 ) -> Self {
1267 self.__unsafe_private_named.4 = value;
1268 self
1269 }
1270}
1271
1272impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
1273 /// Set the `rootRef` field (optional)
1274 pub fn root_ref(
1275 mut self,
1276 value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
1277 ) -> Self {
1278 self.__unsafe_private_named.5 = value.into();
1279 self
1280 }
1281 /// Set the `rootRef` field to an Option value (optional)
1282 pub fn maybe_root_ref(
1283 mut self,
1284 value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1285 ) -> Self {
1286 self.__unsafe_private_named.5 = value;
1287 self
1288 }
1289}
1290
1291impl<'a, S: edit_history_entry_state::State> EditHistoryEntryBuilder<'a, S> {
1292 /// Set the `snapshotCid` field (optional)
1293 pub fn snapshot_cid(
1294 mut self,
1295 value: impl Into<Option<jacquard_common::types::string::Cid<'a>>>,
1296 ) -> Self {
1297 self.__unsafe_private_named.6 = value.into();
1298 self
1299 }
1300 /// Set the `snapshotCid` field to an Option value (optional)
1301 pub fn maybe_snapshot_cid(
1302 mut self,
1303 value: Option<jacquard_common::types::string::Cid<'a>>,
1304 ) -> Self {
1305 self.__unsafe_private_named.6 = value;
1306 self
1307 }
1308}
1309
1310impl<'a, S> EditHistoryEntryBuilder<'a, S>
1311where
1312 S: edit_history_entry_state::State,
1313 S::Type: edit_history_entry_state::IsUnset,
1314{
1315 /// Set the `type` field (required)
1316 pub fn r#type(
1317 mut self,
1318 value: impl Into<EditHistoryEntryType<'a>>,
1319 ) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetType<S>> {
1320 self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
1321 EditHistoryEntryBuilder {
1322 _phantom_state: ::core::marker::PhantomData,
1323 __unsafe_private_named: self.__unsafe_private_named,
1324 _phantom: ::core::marker::PhantomData,
1325 }
1326 }
1327}
1328
1329impl<'a, S> EditHistoryEntryBuilder<'a, S>
1330where
1331 S: edit_history_entry_state::State,
1332 S::Uri: edit_history_entry_state::IsUnset,
1333{
1334 /// Set the `uri` field (required)
1335 pub fn uri(
1336 mut self,
1337 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
1338 ) -> EditHistoryEntryBuilder<'a, edit_history_entry_state::SetUri<S>> {
1339 self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
1340 EditHistoryEntryBuilder {
1341 _phantom_state: ::core::marker::PhantomData,
1342 __unsafe_private_named: self.__unsafe_private_named,
1343 _phantom: ::core::marker::PhantomData,
1344 }
1345 }
1346}
1347
1348impl<'a, S> EditHistoryEntryBuilder<'a, S>
1349where
1350 S: edit_history_entry_state::State,
1351 S::Cid: edit_history_entry_state::IsSet,
1352 S::CreatedAt: edit_history_entry_state::IsSet,
1353 S::Author: edit_history_entry_state::IsSet,
1354 S::Uri: edit_history_entry_state::IsSet,
1355 S::Type: edit_history_entry_state::IsSet,
1356{
1357 /// Build the final struct
1358 pub fn build(self) -> EditHistoryEntry<'a> {
1359 EditHistoryEntry {
1360 author: self.__unsafe_private_named.0.unwrap(),
1361 cid: self.__unsafe_private_named.1.unwrap(),
1362 created_at: self.__unsafe_private_named.2.unwrap(),
1363 has_inline_diff: self.__unsafe_private_named.3,
1364 prev_ref: self.__unsafe_private_named.4,
1365 root_ref: self.__unsafe_private_named.5,
1366 snapshot_cid: self.__unsafe_private_named.6,
1367 r#type: self.__unsafe_private_named.7.unwrap(),
1368 uri: self.__unsafe_private_named.8.unwrap(),
1369 extra_data: Default::default(),
1370 }
1371 }
1372 /// Build the final struct with custom extra_data
1373 pub fn build_with_data(
1374 self,
1375 extra_data: std::collections::BTreeMap<
1376 jacquard_common::smol_str::SmolStr,
1377 jacquard_common::types::value::Data<'a>,
1378 >,
1379 ) -> EditHistoryEntry<'a> {
1380 EditHistoryEntry {
1381 author: self.__unsafe_private_named.0.unwrap(),
1382 cid: self.__unsafe_private_named.1.unwrap(),
1383 created_at: self.__unsafe_private_named.2.unwrap(),
1384 has_inline_diff: self.__unsafe_private_named.3,
1385 prev_ref: self.__unsafe_private_named.4,
1386 root_ref: self.__unsafe_private_named.5,
1387 snapshot_cid: self.__unsafe_private_named.6,
1388 r#type: self.__unsafe_private_named.7.unwrap(),
1389 uri: self.__unsafe_private_named.8.unwrap(),
1390 extra_data: Some(extra_data),
1391 }
1392 }
1393}
1394
1395#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1396pub enum EditHistoryEntryType<'a> {
1397 Root,
1398 Diff,
1399 Other(jacquard_common::CowStr<'a>),
1400}
1401
1402impl<'a> EditHistoryEntryType<'a> {
1403 pub fn as_str(&self) -> &str {
1404 match self {
1405 Self::Root => "root",
1406 Self::Diff => "diff",
1407 Self::Other(s) => s.as_ref(),
1408 }
1409 }
1410}
1411
1412impl<'a> From<&'a str> for EditHistoryEntryType<'a> {
1413 fn from(s: &'a str) -> Self {
1414 match s {
1415 "root" => Self::Root,
1416 "diff" => Self::Diff,
1417 _ => Self::Other(jacquard_common::CowStr::from(s)),
1418 }
1419 }
1420}
1421
1422impl<'a> From<String> for EditHistoryEntryType<'a> {
1423 fn from(s: String) -> Self {
1424 match s.as_str() {
1425 "root" => Self::Root,
1426 "diff" => Self::Diff,
1427 _ => Self::Other(jacquard_common::CowStr::from(s)),
1428 }
1429 }
1430}
1431
1432impl<'a> core::fmt::Display for EditHistoryEntryType<'a> {
1433 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1434 write!(f, "{}", self.as_str())
1435 }
1436}
1437
1438impl<'a> AsRef<str> for EditHistoryEntryType<'a> {
1439 fn as_ref(&self) -> &str {
1440 self.as_str()
1441 }
1442}
1443
1444impl<'a> serde::Serialize for EditHistoryEntryType<'a> {
1445 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1446 where
1447 S: serde::Serializer,
1448 {
1449 serializer.serialize_str(self.as_str())
1450 }
1451}
1452
1453impl<'de, 'a> serde::Deserialize<'de> for EditHistoryEntryType<'a>
1454where
1455 'de: 'a,
1456{
1457 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1458 where
1459 D: serde::Deserializer<'de>,
1460 {
1461 let s = <&'de str>::deserialize(deserializer)?;
1462 Ok(Self::from(s))
1463 }
1464}
1465
1466impl<'a> Default for EditHistoryEntryType<'a> {
1467 fn default() -> Self {
1468 Self::Other(Default::default())
1469 }
1470}
1471
1472impl jacquard_common::IntoStatic for EditHistoryEntryType<'_> {
1473 type Output = EditHistoryEntryType<'static>;
1474 fn into_static(self) -> Self::Output {
1475 match self {
1476 EditHistoryEntryType::Root => EditHistoryEntryType::Root,
1477 EditHistoryEntryType::Diff => EditHistoryEntryType::Diff,
1478 EditHistoryEntryType::Other(v) => {
1479 EditHistoryEntryType::Other(v.into_static())
1480 }
1481 }
1482 }
1483}
1484
1485impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditHistoryEntry<'a> {
1486 fn nsid() -> &'static str {
1487 "sh.weaver.edit.defs"
1488 }
1489 fn def_name() -> &'static str {
1490 "editHistoryEntry"
1491 }
1492 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1493 lexicon_doc_sh_weaver_edit_defs()
1494 }
1495 fn validate(
1496 &self,
1497 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1498 Ok(())
1499 }
1500}
1501
1502/// Full tree structure showing all branches for a resource.
1503#[jacquard_derive::lexicon]
1504#[derive(
1505 serde::Serialize,
1506 serde::Deserialize,
1507 Debug,
1508 Clone,
1509 PartialEq,
1510 Eq,
1511 jacquard_derive::IntoStatic
1512)]
1513#[serde(rename_all = "camelCase")]
1514pub struct EditTreeView<'a> {
1515 #[serde(borrow)]
1516 pub branches: Vec<crate::sh_weaver::edit::EditBranchView<'a>>,
1517 /// Diffs where branches diverge
1518 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1519 #[serde(borrow)]
1520 pub conflict_points: std::option::Option<
1521 Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1522 >,
1523 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1524 pub has_conflicts: std::option::Option<bool>,
1525 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1526 #[serde(borrow)]
1527 pub main_branch: std::option::Option<crate::sh_weaver::edit::EditBranchView<'a>>,
1528 #[serde(borrow)]
1529 pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1530}
1531
1532pub mod edit_tree_view_state {
1533
1534 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1535 #[allow(unused)]
1536 use ::core::marker::PhantomData;
1537 mod sealed {
1538 pub trait Sealed {}
1539 }
1540 /// State trait tracking which required fields have been set
1541 pub trait State: sealed::Sealed {
1542 type Resource;
1543 type Branches;
1544 }
1545 /// Empty state - all required fields are unset
1546 pub struct Empty(());
1547 impl sealed::Sealed for Empty {}
1548 impl State for Empty {
1549 type Resource = Unset;
1550 type Branches = Unset;
1551 }
1552 ///State transition - sets the `resource` field to Set
1553 pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>);
1554 impl<S: State> sealed::Sealed for SetResource<S> {}
1555 impl<S: State> State for SetResource<S> {
1556 type Resource = Set<members::resource>;
1557 type Branches = S::Branches;
1558 }
1559 ///State transition - sets the `branches` field to Set
1560 pub struct SetBranches<S: State = Empty>(PhantomData<fn() -> S>);
1561 impl<S: State> sealed::Sealed for SetBranches<S> {}
1562 impl<S: State> State for SetBranches<S> {
1563 type Resource = S::Resource;
1564 type Branches = Set<members::branches>;
1565 }
1566 /// Marker types for field names
1567 #[allow(non_camel_case_types)]
1568 pub mod members {
1569 ///Marker type for the `resource` field
1570 pub struct resource(());
1571 ///Marker type for the `branches` field
1572 pub struct branches(());
1573 }
1574}
1575
1576/// Builder for constructing an instance of this type
1577pub struct EditTreeViewBuilder<'a, S: edit_tree_view_state::State> {
1578 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1579 __unsafe_private_named: (
1580 ::core::option::Option<Vec<crate::sh_weaver::edit::EditBranchView<'a>>>,
1581 ::core::option::Option<Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
1582 ::core::option::Option<bool>,
1583 ::core::option::Option<crate::sh_weaver::edit::EditBranchView<'a>>,
1584 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1585 ),
1586 _phantom: ::core::marker::PhantomData<&'a ()>,
1587}
1588
1589impl<'a> EditTreeView<'a> {
1590 /// Create a new builder for this type
1591 pub fn new() -> EditTreeViewBuilder<'a, edit_tree_view_state::Empty> {
1592 EditTreeViewBuilder::new()
1593 }
1594}
1595
1596impl<'a> EditTreeViewBuilder<'a, edit_tree_view_state::Empty> {
1597 /// Create a new builder with all fields unset
1598 pub fn new() -> Self {
1599 EditTreeViewBuilder {
1600 _phantom_state: ::core::marker::PhantomData,
1601 __unsafe_private_named: (None, None, None, None, None),
1602 _phantom: ::core::marker::PhantomData,
1603 }
1604 }
1605}
1606
1607impl<'a, S> EditTreeViewBuilder<'a, S>
1608where
1609 S: edit_tree_view_state::State,
1610 S::Branches: edit_tree_view_state::IsUnset,
1611{
1612 /// Set the `branches` field (required)
1613 pub fn branches(
1614 mut self,
1615 value: impl Into<Vec<crate::sh_weaver::edit::EditBranchView<'a>>>,
1616 ) -> EditTreeViewBuilder<'a, edit_tree_view_state::SetBranches<S>> {
1617 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1618 EditTreeViewBuilder {
1619 _phantom_state: ::core::marker::PhantomData,
1620 __unsafe_private_named: self.__unsafe_private_named,
1621 _phantom: ::core::marker::PhantomData,
1622 }
1623 }
1624}
1625
1626impl<'a, S: edit_tree_view_state::State> EditTreeViewBuilder<'a, S> {
1627 /// Set the `conflictPoints` field (optional)
1628 pub fn conflict_points(
1629 mut self,
1630 value: impl Into<
1631 Option<Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
1632 >,
1633 ) -> Self {
1634 self.__unsafe_private_named.1 = value.into();
1635 self
1636 }
1637 /// Set the `conflictPoints` field to an Option value (optional)
1638 pub fn maybe_conflict_points(
1639 mut self,
1640 value: Option<Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
1641 ) -> Self {
1642 self.__unsafe_private_named.1 = value;
1643 self
1644 }
1645}
1646
1647impl<'a, S: edit_tree_view_state::State> EditTreeViewBuilder<'a, S> {
1648 /// Set the `hasConflicts` field (optional)
1649 pub fn has_conflicts(mut self, value: impl Into<Option<bool>>) -> Self {
1650 self.__unsafe_private_named.2 = value.into();
1651 self
1652 }
1653 /// Set the `hasConflicts` field to an Option value (optional)
1654 pub fn maybe_has_conflicts(mut self, value: Option<bool>) -> Self {
1655 self.__unsafe_private_named.2 = value;
1656 self
1657 }
1658}
1659
1660impl<'a, S: edit_tree_view_state::State> EditTreeViewBuilder<'a, S> {
1661 /// Set the `mainBranch` field (optional)
1662 pub fn main_branch(
1663 mut self,
1664 value: impl Into<Option<crate::sh_weaver::edit::EditBranchView<'a>>>,
1665 ) -> Self {
1666 self.__unsafe_private_named.3 = value.into();
1667 self
1668 }
1669 /// Set the `mainBranch` field to an Option value (optional)
1670 pub fn maybe_main_branch(
1671 mut self,
1672 value: Option<crate::sh_weaver::edit::EditBranchView<'a>>,
1673 ) -> Self {
1674 self.__unsafe_private_named.3 = value;
1675 self
1676 }
1677}
1678
1679impl<'a, S> EditTreeViewBuilder<'a, S>
1680where
1681 S: edit_tree_view_state::State,
1682 S::Resource: edit_tree_view_state::IsUnset,
1683{
1684 /// Set the `resource` field (required)
1685 pub fn resource(
1686 mut self,
1687 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1688 ) -> EditTreeViewBuilder<'a, edit_tree_view_state::SetResource<S>> {
1689 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
1690 EditTreeViewBuilder {
1691 _phantom_state: ::core::marker::PhantomData,
1692 __unsafe_private_named: self.__unsafe_private_named,
1693 _phantom: ::core::marker::PhantomData,
1694 }
1695 }
1696}
1697
1698impl<'a, S> EditTreeViewBuilder<'a, S>
1699where
1700 S: edit_tree_view_state::State,
1701 S::Resource: edit_tree_view_state::IsSet,
1702 S::Branches: edit_tree_view_state::IsSet,
1703{
1704 /// Build the final struct
1705 pub fn build(self) -> EditTreeView<'a> {
1706 EditTreeView {
1707 branches: self.__unsafe_private_named.0.unwrap(),
1708 conflict_points: self.__unsafe_private_named.1,
1709 has_conflicts: self.__unsafe_private_named.2,
1710 main_branch: self.__unsafe_private_named.3,
1711 resource: self.__unsafe_private_named.4.unwrap(),
1712 extra_data: Default::default(),
1713 }
1714 }
1715 /// Build the final struct with custom extra_data
1716 pub fn build_with_data(
1717 self,
1718 extra_data: std::collections::BTreeMap<
1719 jacquard_common::smol_str::SmolStr,
1720 jacquard_common::types::value::Data<'a>,
1721 >,
1722 ) -> EditTreeView<'a> {
1723 EditTreeView {
1724 branches: self.__unsafe_private_named.0.unwrap(),
1725 conflict_points: self.__unsafe_private_named.1,
1726 has_conflicts: self.__unsafe_private_named.2,
1727 main_branch: self.__unsafe_private_named.3,
1728 resource: self.__unsafe_private_named.4.unwrap(),
1729 extra_data: Some(extra_data),
1730 }
1731 }
1732}
1733
1734impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EditTreeView<'a> {
1735 fn nsid() -> &'static str {
1736 "sh.weaver.edit.defs"
1737 }
1738 fn def_name() -> &'static str {
1739 "editTreeView"
1740 }
1741 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1742 lexicon_doc_sh_weaver_edit_defs()
1743 }
1744 fn validate(
1745 &self,
1746 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1747 Ok(())
1748 }
1749}
1750
1751#[jacquard_derive::lexicon]
1752#[derive(
1753 serde::Serialize,
1754 serde::Deserialize,
1755 Debug,
1756 Clone,
1757 PartialEq,
1758 Eq,
1759 jacquard_derive::IntoStatic
1760)]
1761#[serde(rename_all = "camelCase")]
1762pub struct EntryRef<'a> {
1763 #[serde(borrow)]
1764 pub entry: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1765}
1766
1767pub mod entry_ref_state {
1768
1769 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1770 #[allow(unused)]
1771 use ::core::marker::PhantomData;
1772 mod sealed {
1773 pub trait Sealed {}
1774 }
1775 /// State trait tracking which required fields have been set
1776 pub trait State: sealed::Sealed {
1777 type Entry;
1778 }
1779 /// Empty state - all required fields are unset
1780 pub struct Empty(());
1781 impl sealed::Sealed for Empty {}
1782 impl State for Empty {
1783 type Entry = Unset;
1784 }
1785 ///State transition - sets the `entry` field to Set
1786 pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>);
1787 impl<S: State> sealed::Sealed for SetEntry<S> {}
1788 impl<S: State> State for SetEntry<S> {
1789 type Entry = Set<members::entry>;
1790 }
1791 /// Marker types for field names
1792 #[allow(non_camel_case_types)]
1793 pub mod members {
1794 ///Marker type for the `entry` field
1795 pub struct entry(());
1796 }
1797}
1798
1799/// Builder for constructing an instance of this type
1800pub struct EntryRefBuilder<'a, S: entry_ref_state::State> {
1801 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1802 __unsafe_private_named: (
1803 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1804 ),
1805 _phantom: ::core::marker::PhantomData<&'a ()>,
1806}
1807
1808impl<'a> EntryRef<'a> {
1809 /// Create a new builder for this type
1810 pub fn new() -> EntryRefBuilder<'a, entry_ref_state::Empty> {
1811 EntryRefBuilder::new()
1812 }
1813}
1814
1815impl<'a> EntryRefBuilder<'a, entry_ref_state::Empty> {
1816 /// Create a new builder with all fields unset
1817 pub fn new() -> Self {
1818 EntryRefBuilder {
1819 _phantom_state: ::core::marker::PhantomData,
1820 __unsafe_private_named: (None,),
1821 _phantom: ::core::marker::PhantomData,
1822 }
1823 }
1824}
1825
1826impl<'a, S> EntryRefBuilder<'a, S>
1827where
1828 S: entry_ref_state::State,
1829 S::Entry: entry_ref_state::IsUnset,
1830{
1831 /// Set the `entry` field (required)
1832 pub fn entry(
1833 mut self,
1834 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1835 ) -> EntryRefBuilder<'a, entry_ref_state::SetEntry<S>> {
1836 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1837 EntryRefBuilder {
1838 _phantom_state: ::core::marker::PhantomData,
1839 __unsafe_private_named: self.__unsafe_private_named,
1840 _phantom: ::core::marker::PhantomData,
1841 }
1842 }
1843}
1844
1845impl<'a, S> EntryRefBuilder<'a, S>
1846where
1847 S: entry_ref_state::State,
1848 S::Entry: entry_ref_state::IsSet,
1849{
1850 /// Build the final struct
1851 pub fn build(self) -> EntryRef<'a> {
1852 EntryRef {
1853 entry: self.__unsafe_private_named.0.unwrap(),
1854 extra_data: Default::default(),
1855 }
1856 }
1857 /// Build the final struct with custom extra_data
1858 pub fn build_with_data(
1859 self,
1860 extra_data: std::collections::BTreeMap<
1861 jacquard_common::smol_str::SmolStr,
1862 jacquard_common::types::value::Data<'a>,
1863 >,
1864 ) -> EntryRef<'a> {
1865 EntryRef {
1866 entry: self.__unsafe_private_named.0.unwrap(),
1867 extra_data: Some(extra_data),
1868 }
1869 }
1870}
1871
1872impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EntryRef<'a> {
1873 fn nsid() -> &'static str {
1874 "sh.weaver.edit.defs"
1875 }
1876 fn def_name() -> &'static str {
1877 "entryRef"
1878 }
1879 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1880 lexicon_doc_sh_weaver_edit_defs()
1881 }
1882 fn validate(
1883 &self,
1884 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1885 Ok(())
1886 }
1887}
1888
1889#[jacquard_derive::lexicon]
1890#[derive(
1891 serde::Serialize,
1892 serde::Deserialize,
1893 Debug,
1894 Clone,
1895 PartialEq,
1896 Eq,
1897 jacquard_derive::IntoStatic
1898)]
1899#[serde(rename_all = "camelCase")]
1900pub struct NotebookRef<'a> {
1901 #[serde(borrow)]
1902 pub notebook: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1903}
1904
1905pub mod notebook_ref_state {
1906
1907 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1908 #[allow(unused)]
1909 use ::core::marker::PhantomData;
1910 mod sealed {
1911 pub trait Sealed {}
1912 }
1913 /// State trait tracking which required fields have been set
1914 pub trait State: sealed::Sealed {
1915 type Notebook;
1916 }
1917 /// Empty state - all required fields are unset
1918 pub struct Empty(());
1919 impl sealed::Sealed for Empty {}
1920 impl State for Empty {
1921 type Notebook = Unset;
1922 }
1923 ///State transition - sets the `notebook` field to Set
1924 pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>);
1925 impl<S: State> sealed::Sealed for SetNotebook<S> {}
1926 impl<S: State> State for SetNotebook<S> {
1927 type Notebook = Set<members::notebook>;
1928 }
1929 /// Marker types for field names
1930 #[allow(non_camel_case_types)]
1931 pub mod members {
1932 ///Marker type for the `notebook` field
1933 pub struct notebook(());
1934 }
1935}
1936
1937/// Builder for constructing an instance of this type
1938pub struct NotebookRefBuilder<'a, S: notebook_ref_state::State> {
1939 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1940 __unsafe_private_named: (
1941 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1942 ),
1943 _phantom: ::core::marker::PhantomData<&'a ()>,
1944}
1945
1946impl<'a> NotebookRef<'a> {
1947 /// Create a new builder for this type
1948 pub fn new() -> NotebookRefBuilder<'a, notebook_ref_state::Empty> {
1949 NotebookRefBuilder::new()
1950 }
1951}
1952
1953impl<'a> NotebookRefBuilder<'a, notebook_ref_state::Empty> {
1954 /// Create a new builder with all fields unset
1955 pub fn new() -> Self {
1956 NotebookRefBuilder {
1957 _phantom_state: ::core::marker::PhantomData,
1958 __unsafe_private_named: (None,),
1959 _phantom: ::core::marker::PhantomData,
1960 }
1961 }
1962}
1963
1964impl<'a, S> NotebookRefBuilder<'a, S>
1965where
1966 S: notebook_ref_state::State,
1967 S::Notebook: notebook_ref_state::IsUnset,
1968{
1969 /// Set the `notebook` field (required)
1970 pub fn notebook(
1971 mut self,
1972 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1973 ) -> NotebookRefBuilder<'a, notebook_ref_state::SetNotebook<S>> {
1974 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1975 NotebookRefBuilder {
1976 _phantom_state: ::core::marker::PhantomData,
1977 __unsafe_private_named: self.__unsafe_private_named,
1978 _phantom: ::core::marker::PhantomData,
1979 }
1980 }
1981}
1982
1983impl<'a, S> NotebookRefBuilder<'a, S>
1984where
1985 S: notebook_ref_state::State,
1986 S::Notebook: notebook_ref_state::IsSet,
1987{
1988 /// Build the final struct
1989 pub fn build(self) -> NotebookRef<'a> {
1990 NotebookRef {
1991 notebook: self.__unsafe_private_named.0.unwrap(),
1992 extra_data: Default::default(),
1993 }
1994 }
1995 /// Build the final struct with custom extra_data
1996 pub fn build_with_data(
1997 self,
1998 extra_data: std::collections::BTreeMap<
1999 jacquard_common::smol_str::SmolStr,
2000 jacquard_common::types::value::Data<'a>,
2001 >,
2002 ) -> NotebookRef<'a> {
2003 NotebookRef {
2004 notebook: self.__unsafe_private_named.0.unwrap(),
2005 extra_data: Some(extra_data),
2006 }
2007 }
2008}
2009
2010impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NotebookRef<'a> {
2011 fn nsid() -> &'static str {
2012 "sh.weaver.edit.defs"
2013 }
2014 fn def_name() -> &'static str {
2015 "notebookRef"
2016 }
2017 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
2018 lexicon_doc_sh_weaver_edit_defs()
2019 }
2020 fn validate(
2021 &self,
2022 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
2023 Ok(())
2024 }
2025}