atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: pub.leaflet.comment
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct LinearDocumentQuote<'a> {
20 #[serde(borrow)]
21 pub document: jacquard_common::types::string::AtUri<'a>,
22 #[serde(borrow)]
23 pub quote: crate::pub_leaflet::pages::linear_document::Quote<'a>,
24}
25
26pub mod linear_document_quote_state {
27
28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
29 #[allow(unused)]
30 use ::core::marker::PhantomData;
31 mod sealed {
32 pub trait Sealed {}
33 }
34 /// State trait tracking which required fields have been set
35 pub trait State: sealed::Sealed {
36 type Quote;
37 type Document;
38 }
39 /// Empty state - all required fields are unset
40 pub struct Empty(());
41 impl sealed::Sealed for Empty {}
42 impl State for Empty {
43 type Quote = Unset;
44 type Document = Unset;
45 }
46 ///State transition - sets the `quote` field to Set
47 pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>);
48 impl<S: State> sealed::Sealed for SetQuote<S> {}
49 impl<S: State> State for SetQuote<S> {
50 type Quote = Set<members::quote>;
51 type Document = S::Document;
52 }
53 ///State transition - sets the `document` field to Set
54 pub struct SetDocument<S: State = Empty>(PhantomData<fn() -> S>);
55 impl<S: State> sealed::Sealed for SetDocument<S> {}
56 impl<S: State> State for SetDocument<S> {
57 type Quote = S::Quote;
58 type Document = Set<members::document>;
59 }
60 /// Marker types for field names
61 #[allow(non_camel_case_types)]
62 pub mod members {
63 ///Marker type for the `quote` field
64 pub struct quote(());
65 ///Marker type for the `document` field
66 pub struct document(());
67 }
68}
69
70/// Builder for constructing an instance of this type
71pub struct LinearDocumentQuoteBuilder<'a, S: linear_document_quote_state::State> {
72 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
73 __unsafe_private_named: (
74 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
75 ::core::option::Option<crate::pub_leaflet::pages::linear_document::Quote<'a>>,
76 ),
77 _phantom: ::core::marker::PhantomData<&'a ()>,
78}
79
80impl<'a> LinearDocumentQuote<'a> {
81 /// Create a new builder for this type
82 pub fn new() -> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::Empty> {
83 LinearDocumentQuoteBuilder::new()
84 }
85}
86
87impl<'a> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::Empty> {
88 /// Create a new builder with all fields unset
89 pub fn new() -> Self {
90 LinearDocumentQuoteBuilder {
91 _phantom_state: ::core::marker::PhantomData,
92 __unsafe_private_named: (None, None),
93 _phantom: ::core::marker::PhantomData,
94 }
95 }
96}
97
98impl<'a, S> LinearDocumentQuoteBuilder<'a, S>
99where
100 S: linear_document_quote_state::State,
101 S::Document: linear_document_quote_state::IsUnset,
102{
103 /// Set the `document` field (required)
104 pub fn document(
105 mut self,
106 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
107 ) -> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::SetDocument<S>> {
108 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
109 LinearDocumentQuoteBuilder {
110 _phantom_state: ::core::marker::PhantomData,
111 __unsafe_private_named: self.__unsafe_private_named,
112 _phantom: ::core::marker::PhantomData,
113 }
114 }
115}
116
117impl<'a, S> LinearDocumentQuoteBuilder<'a, S>
118where
119 S: linear_document_quote_state::State,
120 S::Quote: linear_document_quote_state::IsUnset,
121{
122 /// Set the `quote` field (required)
123 pub fn quote(
124 mut self,
125 value: impl Into<crate::pub_leaflet::pages::linear_document::Quote<'a>>,
126 ) -> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::SetQuote<S>> {
127 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
128 LinearDocumentQuoteBuilder {
129 _phantom_state: ::core::marker::PhantomData,
130 __unsafe_private_named: self.__unsafe_private_named,
131 _phantom: ::core::marker::PhantomData,
132 }
133 }
134}
135
136impl<'a, S> LinearDocumentQuoteBuilder<'a, S>
137where
138 S: linear_document_quote_state::State,
139 S::Quote: linear_document_quote_state::IsSet,
140 S::Document: linear_document_quote_state::IsSet,
141{
142 /// Build the final struct
143 pub fn build(self) -> LinearDocumentQuote<'a> {
144 LinearDocumentQuote {
145 document: self.__unsafe_private_named.0.unwrap(),
146 quote: self.__unsafe_private_named.1.unwrap(),
147 extra_data: Default::default(),
148 }
149 }
150 /// Build the final struct with custom extra_data
151 pub fn build_with_data(
152 self,
153 extra_data: std::collections::BTreeMap<
154 jacquard_common::smol_str::SmolStr,
155 jacquard_common::types::value::Data<'a>,
156 >,
157 ) -> LinearDocumentQuote<'a> {
158 LinearDocumentQuote {
159 document: self.__unsafe_private_named.0.unwrap(),
160 quote: self.__unsafe_private_named.1.unwrap(),
161 extra_data: Some(extra_data),
162 }
163 }
164}
165
166fn lexicon_doc_pub_leaflet_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc<
167 'static,
168> {
169 ::jacquard_lexicon::lexicon::LexiconDoc {
170 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
171 id: ::jacquard_common::CowStr::new_static("pub.leaflet.comment"),
172 revision: None,
173 description: None,
174 defs: {
175 let mut map = ::alloc::collections::BTreeMap::new();
176 map.insert(
177 ::jacquard_common::smol_str::SmolStr::new_static("linearDocumentQuote"),
178 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
179 description: None,
180 required: Some(
181 vec![
182 ::jacquard_common::smol_str::SmolStr::new_static("document"),
183 ::jacquard_common::smol_str::SmolStr::new_static("quote")
184 ],
185 ),
186 nullable: None,
187 properties: {
188 #[allow(unused_mut)]
189 let mut map = ::alloc::collections::BTreeMap::new();
190 map.insert(
191 ::jacquard_common::smol_str::SmolStr::new_static("document"),
192 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
193 description: None,
194 format: Some(
195 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
196 ),
197 default: None,
198 min_length: None,
199 max_length: None,
200 min_graphemes: None,
201 max_graphemes: None,
202 r#enum: None,
203 r#const: None,
204 known_values: None,
205 }),
206 );
207 map.insert(
208 ::jacquard_common::smol_str::SmolStr::new_static("quote"),
209 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
210 description: None,
211 r#ref: ::jacquard_common::CowStr::new_static(
212 "pub.leaflet.pages.linearDocument#quote",
213 ),
214 }),
215 );
216 map
217 },
218 }),
219 );
220 map.insert(
221 ::jacquard_common::smol_str::SmolStr::new_static("main"),
222 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
223 description: Some(
224 ::jacquard_common::CowStr::new_static(
225 "Record containing a comment",
226 ),
227 ),
228 key: Some(::jacquard_common::CowStr::new_static("tid")),
229 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
230 description: None,
231 required: Some(
232 vec![
233 ::jacquard_common::smol_str::SmolStr::new_static("subject"),
234 ::jacquard_common::smol_str::SmolStr::new_static("plaintext"),
235 ::jacquard_common::smol_str::SmolStr::new_static("createdAt")
236 ],
237 ),
238 nullable: None,
239 properties: {
240 #[allow(unused_mut)]
241 let mut map = ::alloc::collections::BTreeMap::new();
242 map.insert(
243 ::jacquard_common::smol_str::SmolStr::new_static(
244 "attachment",
245 ),
246 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
247 description: None,
248 refs: vec![
249 ::jacquard_common::CowStr::new_static("#linearDocumentQuote")
250 ],
251 closed: None,
252 }),
253 );
254 map.insert(
255 ::jacquard_common::smol_str::SmolStr::new_static(
256 "createdAt",
257 ),
258 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
259 description: None,
260 format: Some(
261 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
262 ),
263 default: None,
264 min_length: None,
265 max_length: None,
266 min_graphemes: None,
267 max_graphemes: None,
268 r#enum: None,
269 r#const: None,
270 known_values: None,
271 }),
272 );
273 map.insert(
274 ::jacquard_common::smol_str::SmolStr::new_static("facets"),
275 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
276 description: None,
277 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
278 description: None,
279 r#ref: ::jacquard_common::CowStr::new_static(
280 "pub.leaflet.richtext.facet",
281 ),
282 }),
283 min_length: None,
284 max_length: None,
285 }),
286 );
287 map.insert(
288 ::jacquard_common::smol_str::SmolStr::new_static("onPage"),
289 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
290 description: None,
291 format: None,
292 default: None,
293 min_length: None,
294 max_length: None,
295 min_graphemes: None,
296 max_graphemes: None,
297 r#enum: None,
298 r#const: None,
299 known_values: None,
300 }),
301 );
302 map.insert(
303 ::jacquard_common::smol_str::SmolStr::new_static(
304 "plaintext",
305 ),
306 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
307 description: None,
308 format: None,
309 default: None,
310 min_length: None,
311 max_length: None,
312 min_graphemes: None,
313 max_graphemes: None,
314 r#enum: None,
315 r#const: None,
316 known_values: None,
317 }),
318 );
319 map.insert(
320 ::jacquard_common::smol_str::SmolStr::new_static("reply"),
321 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
322 description: None,
323 r#ref: ::jacquard_common::CowStr::new_static("#replyRef"),
324 }),
325 );
326 map.insert(
327 ::jacquard_common::smol_str::SmolStr::new_static("subject"),
328 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
329 description: None,
330 format: Some(
331 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
332 ),
333 default: None,
334 min_length: None,
335 max_length: None,
336 min_graphemes: None,
337 max_graphemes: None,
338 r#enum: None,
339 r#const: None,
340 known_values: None,
341 }),
342 );
343 map
344 },
345 }),
346 }),
347 );
348 map.insert(
349 ::jacquard_common::smol_str::SmolStr::new_static("replyRef"),
350 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
351 description: None,
352 required: Some(
353 vec![::jacquard_common::smol_str::SmolStr::new_static("parent")],
354 ),
355 nullable: None,
356 properties: {
357 #[allow(unused_mut)]
358 let mut map = ::alloc::collections::BTreeMap::new();
359 map.insert(
360 ::jacquard_common::smol_str::SmolStr::new_static("parent"),
361 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
362 description: None,
363 format: Some(
364 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
365 ),
366 default: None,
367 min_length: None,
368 max_length: None,
369 min_graphemes: None,
370 max_graphemes: None,
371 r#enum: None,
372 r#const: None,
373 known_values: None,
374 }),
375 );
376 map
377 },
378 }),
379 );
380 map
381 },
382 }
383}
384
385impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LinearDocumentQuote<'a> {
386 fn nsid() -> &'static str {
387 "pub.leaflet.comment"
388 }
389 fn def_name() -> &'static str {
390 "linearDocumentQuote"
391 }
392 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
393 lexicon_doc_pub_leaflet_comment()
394 }
395 fn validate(
396 &self,
397 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
398 Ok(())
399 }
400}
401
402/// Record containing a comment
403#[jacquard_derive::lexicon]
404#[derive(
405 serde::Serialize,
406 serde::Deserialize,
407 Debug,
408 Clone,
409 PartialEq,
410 Eq,
411 jacquard_derive::IntoStatic
412)]
413#[serde(rename_all = "camelCase")]
414pub struct Comment<'a> {
415 #[serde(skip_serializing_if = "std::option::Option::is_none")]
416 #[serde(borrow)]
417 pub attachment: std::option::Option<
418 crate::pub_leaflet::comment::LinearDocumentQuote<'a>,
419 >,
420 pub created_at: jacquard_common::types::string::Datetime,
421 #[serde(skip_serializing_if = "std::option::Option::is_none")]
422 #[serde(borrow)]
423 pub facets: std::option::Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
424 #[serde(skip_serializing_if = "std::option::Option::is_none")]
425 #[serde(borrow)]
426 pub on_page: std::option::Option<jacquard_common::CowStr<'a>>,
427 #[serde(borrow)]
428 pub plaintext: jacquard_common::CowStr<'a>,
429 #[serde(skip_serializing_if = "std::option::Option::is_none")]
430 #[serde(borrow)]
431 pub reply: std::option::Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
432 #[serde(borrow)]
433 pub subject: jacquard_common::types::string::AtUri<'a>,
434}
435
436pub mod comment_state {
437
438 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
439 #[allow(unused)]
440 use ::core::marker::PhantomData;
441 mod sealed {
442 pub trait Sealed {}
443 }
444 /// State trait tracking which required fields have been set
445 pub trait State: sealed::Sealed {
446 type CreatedAt;
447 type Subject;
448 type Plaintext;
449 }
450 /// Empty state - all required fields are unset
451 pub struct Empty(());
452 impl sealed::Sealed for Empty {}
453 impl State for Empty {
454 type CreatedAt = Unset;
455 type Subject = Unset;
456 type Plaintext = Unset;
457 }
458 ///State transition - sets the `created_at` field to Set
459 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
460 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
461 impl<S: State> State for SetCreatedAt<S> {
462 type CreatedAt = Set<members::created_at>;
463 type Subject = S::Subject;
464 type Plaintext = S::Plaintext;
465 }
466 ///State transition - sets the `subject` field to Set
467 pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
468 impl<S: State> sealed::Sealed for SetSubject<S> {}
469 impl<S: State> State for SetSubject<S> {
470 type CreatedAt = S::CreatedAt;
471 type Subject = Set<members::subject>;
472 type Plaintext = S::Plaintext;
473 }
474 ///State transition - sets the `plaintext` field to Set
475 pub struct SetPlaintext<S: State = Empty>(PhantomData<fn() -> S>);
476 impl<S: State> sealed::Sealed for SetPlaintext<S> {}
477 impl<S: State> State for SetPlaintext<S> {
478 type CreatedAt = S::CreatedAt;
479 type Subject = S::Subject;
480 type Plaintext = Set<members::plaintext>;
481 }
482 /// Marker types for field names
483 #[allow(non_camel_case_types)]
484 pub mod members {
485 ///Marker type for the `created_at` field
486 pub struct created_at(());
487 ///Marker type for the `subject` field
488 pub struct subject(());
489 ///Marker type for the `plaintext` field
490 pub struct plaintext(());
491 }
492}
493
494/// Builder for constructing an instance of this type
495pub struct CommentBuilder<'a, S: comment_state::State> {
496 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
497 __unsafe_private_named: (
498 ::core::option::Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>,
499 ::core::option::Option<jacquard_common::types::string::Datetime>,
500 ::core::option::Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
501 ::core::option::Option<jacquard_common::CowStr<'a>>,
502 ::core::option::Option<jacquard_common::CowStr<'a>>,
503 ::core::option::Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
504 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
505 ),
506 _phantom: ::core::marker::PhantomData<&'a ()>,
507}
508
509impl<'a> Comment<'a> {
510 /// Create a new builder for this type
511 pub fn new() -> CommentBuilder<'a, comment_state::Empty> {
512 CommentBuilder::new()
513 }
514}
515
516impl<'a> CommentBuilder<'a, comment_state::Empty> {
517 /// Create a new builder with all fields unset
518 pub fn new() -> Self {
519 CommentBuilder {
520 _phantom_state: ::core::marker::PhantomData,
521 __unsafe_private_named: (None, None, None, None, None, None, None),
522 _phantom: ::core::marker::PhantomData,
523 }
524 }
525}
526
527impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
528 /// Set the `attachment` field (optional)
529 pub fn attachment(
530 mut self,
531 value: impl Into<Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>>,
532 ) -> Self {
533 self.__unsafe_private_named.0 = value.into();
534 self
535 }
536 /// Set the `attachment` field to an Option value (optional)
537 pub fn maybe_attachment(
538 mut self,
539 value: Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>,
540 ) -> Self {
541 self.__unsafe_private_named.0 = value;
542 self
543 }
544}
545
546impl<'a, S> CommentBuilder<'a, S>
547where
548 S: comment_state::State,
549 S::CreatedAt: comment_state::IsUnset,
550{
551 /// Set the `createdAt` field (required)
552 pub fn created_at(
553 mut self,
554 value: impl Into<jacquard_common::types::string::Datetime>,
555 ) -> CommentBuilder<'a, comment_state::SetCreatedAt<S>> {
556 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
557 CommentBuilder {
558 _phantom_state: ::core::marker::PhantomData,
559 __unsafe_private_named: self.__unsafe_private_named,
560 _phantom: ::core::marker::PhantomData,
561 }
562 }
563}
564
565impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
566 /// Set the `facets` field (optional)
567 pub fn facets(
568 mut self,
569 value: impl Into<Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>>,
570 ) -> Self {
571 self.__unsafe_private_named.2 = value.into();
572 self
573 }
574 /// Set the `facets` field to an Option value (optional)
575 pub fn maybe_facets(
576 mut self,
577 value: Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
578 ) -> Self {
579 self.__unsafe_private_named.2 = value;
580 self
581 }
582}
583
584impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
585 /// Set the `onPage` field (optional)
586 pub fn on_page(
587 mut self,
588 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
589 ) -> Self {
590 self.__unsafe_private_named.3 = value.into();
591 self
592 }
593 /// Set the `onPage` field to an Option value (optional)
594 pub fn maybe_on_page(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
595 self.__unsafe_private_named.3 = value;
596 self
597 }
598}
599
600impl<'a, S> CommentBuilder<'a, S>
601where
602 S: comment_state::State,
603 S::Plaintext: comment_state::IsUnset,
604{
605 /// Set the `plaintext` field (required)
606 pub fn plaintext(
607 mut self,
608 value: impl Into<jacquard_common::CowStr<'a>>,
609 ) -> CommentBuilder<'a, comment_state::SetPlaintext<S>> {
610 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
611 CommentBuilder {
612 _phantom_state: ::core::marker::PhantomData,
613 __unsafe_private_named: self.__unsafe_private_named,
614 _phantom: ::core::marker::PhantomData,
615 }
616 }
617}
618
619impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
620 /// Set the `reply` field (optional)
621 pub fn reply(
622 mut self,
623 value: impl Into<Option<crate::pub_leaflet::comment::ReplyRef<'a>>>,
624 ) -> Self {
625 self.__unsafe_private_named.5 = value.into();
626 self
627 }
628 /// Set the `reply` field to an Option value (optional)
629 pub fn maybe_reply(
630 mut self,
631 value: Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
632 ) -> Self {
633 self.__unsafe_private_named.5 = value;
634 self
635 }
636}
637
638impl<'a, S> CommentBuilder<'a, S>
639where
640 S: comment_state::State,
641 S::Subject: comment_state::IsUnset,
642{
643 /// Set the `subject` field (required)
644 pub fn subject(
645 mut self,
646 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
647 ) -> CommentBuilder<'a, comment_state::SetSubject<S>> {
648 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
649 CommentBuilder {
650 _phantom_state: ::core::marker::PhantomData,
651 __unsafe_private_named: self.__unsafe_private_named,
652 _phantom: ::core::marker::PhantomData,
653 }
654 }
655}
656
657impl<'a, S> CommentBuilder<'a, S>
658where
659 S: comment_state::State,
660 S::CreatedAt: comment_state::IsSet,
661 S::Subject: comment_state::IsSet,
662 S::Plaintext: comment_state::IsSet,
663{
664 /// Build the final struct
665 pub fn build(self) -> Comment<'a> {
666 Comment {
667 attachment: self.__unsafe_private_named.0,
668 created_at: self.__unsafe_private_named.1.unwrap(),
669 facets: self.__unsafe_private_named.2,
670 on_page: self.__unsafe_private_named.3,
671 plaintext: self.__unsafe_private_named.4.unwrap(),
672 reply: self.__unsafe_private_named.5,
673 subject: self.__unsafe_private_named.6.unwrap(),
674 extra_data: Default::default(),
675 }
676 }
677 /// Build the final struct with custom extra_data
678 pub fn build_with_data(
679 self,
680 extra_data: std::collections::BTreeMap<
681 jacquard_common::smol_str::SmolStr,
682 jacquard_common::types::value::Data<'a>,
683 >,
684 ) -> Comment<'a> {
685 Comment {
686 attachment: self.__unsafe_private_named.0,
687 created_at: self.__unsafe_private_named.1.unwrap(),
688 facets: self.__unsafe_private_named.2,
689 on_page: self.__unsafe_private_named.3,
690 plaintext: self.__unsafe_private_named.4.unwrap(),
691 reply: self.__unsafe_private_named.5,
692 subject: self.__unsafe_private_named.6.unwrap(),
693 extra_data: Some(extra_data),
694 }
695 }
696}
697
698impl<'a> Comment<'a> {
699 pub fn uri(
700 uri: impl Into<jacquard_common::CowStr<'a>>,
701 ) -> Result<
702 jacquard_common::types::uri::RecordUri<'a, CommentRecord>,
703 jacquard_common::types::uri::UriError,
704 > {
705 jacquard_common::types::uri::RecordUri::try_from_uri(
706 jacquard_common::types::string::AtUri::new_cow(uri.into())?,
707 )
708 }
709}
710
711/// Typed wrapper for GetRecord response with this collection's record type.
712#[derive(
713 serde::Serialize,
714 serde::Deserialize,
715 Debug,
716 Clone,
717 PartialEq,
718 Eq,
719 jacquard_derive::IntoStatic
720)]
721#[serde(rename_all = "camelCase")]
722pub struct CommentGetRecordOutput<'a> {
723 #[serde(skip_serializing_if = "std::option::Option::is_none")]
724 #[serde(borrow)]
725 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
726 #[serde(borrow)]
727 pub uri: jacquard_common::types::string::AtUri<'a>,
728 #[serde(borrow)]
729 pub value: Comment<'a>,
730}
731
732impl From<CommentGetRecordOutput<'_>> for Comment<'_> {
733 fn from(output: CommentGetRecordOutput<'_>) -> Self {
734 use jacquard_common::IntoStatic;
735 output.value.into_static()
736 }
737}
738
739impl jacquard_common::types::collection::Collection for Comment<'_> {
740 const NSID: &'static str = "pub.leaflet.comment";
741 type Record = CommentRecord;
742}
743
744/// Marker type for deserializing records from this collection.
745#[derive(Debug, serde::Serialize, serde::Deserialize)]
746pub struct CommentRecord;
747impl jacquard_common::xrpc::XrpcResp for CommentRecord {
748 const NSID: &'static str = "pub.leaflet.comment";
749 const ENCODING: &'static str = "application/json";
750 type Output<'de> = CommentGetRecordOutput<'de>;
751 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
752}
753
754impl jacquard_common::types::collection::Collection for CommentRecord {
755 const NSID: &'static str = "pub.leaflet.comment";
756 type Record = CommentRecord;
757}
758
759impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Comment<'a> {
760 fn nsid() -> &'static str {
761 "pub.leaflet.comment"
762 }
763 fn def_name() -> &'static str {
764 "main"
765 }
766 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
767 lexicon_doc_pub_leaflet_comment()
768 }
769 fn validate(
770 &self,
771 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
772 Ok(())
773 }
774}
775
776#[jacquard_derive::lexicon]
777#[derive(
778 serde::Serialize,
779 serde::Deserialize,
780 Debug,
781 Clone,
782 PartialEq,
783 Eq,
784 jacquard_derive::IntoStatic
785)]
786#[serde(rename_all = "camelCase")]
787pub struct ReplyRef<'a> {
788 #[serde(borrow)]
789 pub parent: jacquard_common::types::string::AtUri<'a>,
790}
791
792pub mod reply_ref_state {
793
794 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
795 #[allow(unused)]
796 use ::core::marker::PhantomData;
797 mod sealed {
798 pub trait Sealed {}
799 }
800 /// State trait tracking which required fields have been set
801 pub trait State: sealed::Sealed {
802 type Parent;
803 }
804 /// Empty state - all required fields are unset
805 pub struct Empty(());
806 impl sealed::Sealed for Empty {}
807 impl State for Empty {
808 type Parent = Unset;
809 }
810 ///State transition - sets the `parent` field to Set
811 pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>);
812 impl<S: State> sealed::Sealed for SetParent<S> {}
813 impl<S: State> State for SetParent<S> {
814 type Parent = Set<members::parent>;
815 }
816 /// Marker types for field names
817 #[allow(non_camel_case_types)]
818 pub mod members {
819 ///Marker type for the `parent` field
820 pub struct parent(());
821 }
822}
823
824/// Builder for constructing an instance of this type
825pub struct ReplyRefBuilder<'a, S: reply_ref_state::State> {
826 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
827 __unsafe_private_named: (
828 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
829 ),
830 _phantom: ::core::marker::PhantomData<&'a ()>,
831}
832
833impl<'a> ReplyRef<'a> {
834 /// Create a new builder for this type
835 pub fn new() -> ReplyRefBuilder<'a, reply_ref_state::Empty> {
836 ReplyRefBuilder::new()
837 }
838}
839
840impl<'a> ReplyRefBuilder<'a, reply_ref_state::Empty> {
841 /// Create a new builder with all fields unset
842 pub fn new() -> Self {
843 ReplyRefBuilder {
844 _phantom_state: ::core::marker::PhantomData,
845 __unsafe_private_named: (None,),
846 _phantom: ::core::marker::PhantomData,
847 }
848 }
849}
850
851impl<'a, S> ReplyRefBuilder<'a, S>
852where
853 S: reply_ref_state::State,
854 S::Parent: reply_ref_state::IsUnset,
855{
856 /// Set the `parent` field (required)
857 pub fn parent(
858 mut self,
859 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
860 ) -> ReplyRefBuilder<'a, reply_ref_state::SetParent<S>> {
861 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
862 ReplyRefBuilder {
863 _phantom_state: ::core::marker::PhantomData,
864 __unsafe_private_named: self.__unsafe_private_named,
865 _phantom: ::core::marker::PhantomData,
866 }
867 }
868}
869
870impl<'a, S> ReplyRefBuilder<'a, S>
871where
872 S: reply_ref_state::State,
873 S::Parent: reply_ref_state::IsSet,
874{
875 /// Build the final struct
876 pub fn build(self) -> ReplyRef<'a> {
877 ReplyRef {
878 parent: self.__unsafe_private_named.0.unwrap(),
879 extra_data: Default::default(),
880 }
881 }
882 /// Build the final struct with custom extra_data
883 pub fn build_with_data(
884 self,
885 extra_data: std::collections::BTreeMap<
886 jacquard_common::smol_str::SmolStr,
887 jacquard_common::types::value::Data<'a>,
888 >,
889 ) -> ReplyRef<'a> {
890 ReplyRef {
891 parent: self.__unsafe_private_named.0.unwrap(),
892 extra_data: Some(extra_data),
893 }
894 }
895}
896
897impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> {
898 fn nsid() -> &'static str {
899 "pub.leaflet.comment"
900 }
901 fn def_name() -> &'static str {
902 "replyRef"
903 }
904 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
905 lexicon_doc_pub_leaflet_comment()
906 }
907 fn validate(
908 &self,
909 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
910 Ok(())
911 }
912}