jacquard_api/app_bsky/feed/
post.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.feed.post
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8/// Deprecated: use facets instead.
9#[jacquard_derive::lexicon]
10#[derive(
11    serde::Serialize,
12    serde::Deserialize,
13    Debug,
14    Clone,
15    PartialEq,
16    Eq,
17    jacquard_derive::IntoStatic
18)]
19#[serde(rename_all = "camelCase")]
20pub struct Entity<'a> {
21    #[serde(borrow)]
22    pub index: crate::app_bsky::feed::post::TextSlice<'a>,
23    /// Expected values are 'mention' and 'link'.
24    #[serde(borrow)]
25    pub r#type: jacquard_common::CowStr<'a>,
26    #[serde(borrow)]
27    pub value: jacquard_common::CowStr<'a>,
28}
29
30pub mod entity_state {
31
32    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
33    #[allow(unused)]
34    use ::core::marker::PhantomData;
35    mod sealed {
36        pub trait Sealed {}
37    }
38    /// State trait tracking which required fields have been set
39    pub trait State: sealed::Sealed {
40        type Index;
41        type Type;
42        type Value;
43    }
44    /// Empty state - all required fields are unset
45    pub struct Empty(());
46    impl sealed::Sealed for Empty {}
47    impl State for Empty {
48        type Index = Unset;
49        type Type = Unset;
50        type Value = Unset;
51    }
52    ///State transition - sets the `index` field to Set
53    pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
54    impl<S: State> sealed::Sealed for SetIndex<S> {}
55    impl<S: State> State for SetIndex<S> {
56        type Index = Set<members::index>;
57        type Type = S::Type;
58        type Value = S::Value;
59    }
60    ///State transition - sets the `type` field to Set
61    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
62    impl<S: State> sealed::Sealed for SetType<S> {}
63    impl<S: State> State for SetType<S> {
64        type Index = S::Index;
65        type Type = Set<members::r#type>;
66        type Value = S::Value;
67    }
68    ///State transition - sets the `value` field to Set
69    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
70    impl<S: State> sealed::Sealed for SetValue<S> {}
71    impl<S: State> State for SetValue<S> {
72        type Index = S::Index;
73        type Type = S::Type;
74        type Value = Set<members::value>;
75    }
76    /// Marker types for field names
77    #[allow(non_camel_case_types)]
78    pub mod members {
79        ///Marker type for the `index` field
80        pub struct index(());
81        ///Marker type for the `type` field
82        pub struct r#type(());
83        ///Marker type for the `value` field
84        pub struct value(());
85    }
86}
87
88/// Builder for constructing an instance of this type
89pub struct EntityBuilder<'a, S: entity_state::State> {
90    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
91    __unsafe_private_named: (
92        ::core::option::Option<crate::app_bsky::feed::post::TextSlice<'a>>,
93        ::core::option::Option<jacquard_common::CowStr<'a>>,
94        ::core::option::Option<jacquard_common::CowStr<'a>>,
95    ),
96    _phantom: ::core::marker::PhantomData<&'a ()>,
97}
98
99impl<'a> Entity<'a> {
100    /// Create a new builder for this type
101    pub fn new() -> EntityBuilder<'a, entity_state::Empty> {
102        EntityBuilder::new()
103    }
104}
105
106impl<'a> EntityBuilder<'a, entity_state::Empty> {
107    /// Create a new builder with all fields unset
108    pub fn new() -> Self {
109        EntityBuilder {
110            _phantom_state: ::core::marker::PhantomData,
111            __unsafe_private_named: (None, None, None),
112            _phantom: ::core::marker::PhantomData,
113        }
114    }
115}
116
117impl<'a, S> EntityBuilder<'a, S>
118where
119    S: entity_state::State,
120    S::Index: entity_state::IsUnset,
121{
122    /// Set the `index` field (required)
123    pub fn index(
124        mut self,
125        value: impl Into<crate::app_bsky::feed::post::TextSlice<'a>>,
126    ) -> EntityBuilder<'a, entity_state::SetIndex<S>> {
127        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
128        EntityBuilder {
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> EntityBuilder<'a, S>
137where
138    S: entity_state::State,
139    S::Type: entity_state::IsUnset,
140{
141    /// Set the `type` field (required)
142    pub fn r#type(
143        mut self,
144        value: impl Into<jacquard_common::CowStr<'a>>,
145    ) -> EntityBuilder<'a, entity_state::SetType<S>> {
146        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
147        EntityBuilder {
148            _phantom_state: ::core::marker::PhantomData,
149            __unsafe_private_named: self.__unsafe_private_named,
150            _phantom: ::core::marker::PhantomData,
151        }
152    }
153}
154
155impl<'a, S> EntityBuilder<'a, S>
156where
157    S: entity_state::State,
158    S::Value: entity_state::IsUnset,
159{
160    /// Set the `value` field (required)
161    pub fn value(
162        mut self,
163        value: impl Into<jacquard_common::CowStr<'a>>,
164    ) -> EntityBuilder<'a, entity_state::SetValue<S>> {
165        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
166        EntityBuilder {
167            _phantom_state: ::core::marker::PhantomData,
168            __unsafe_private_named: self.__unsafe_private_named,
169            _phantom: ::core::marker::PhantomData,
170        }
171    }
172}
173
174impl<'a, S> EntityBuilder<'a, S>
175where
176    S: entity_state::State,
177    S::Index: entity_state::IsSet,
178    S::Type: entity_state::IsSet,
179    S::Value: entity_state::IsSet,
180{
181    /// Build the final struct
182    pub fn build(self) -> Entity<'a> {
183        Entity {
184            index: self.__unsafe_private_named.0.unwrap(),
185            r#type: self.__unsafe_private_named.1.unwrap(),
186            value: self.__unsafe_private_named.2.unwrap(),
187            extra_data: Default::default(),
188        }
189    }
190    /// Build the final struct with custom extra_data
191    pub fn build_with_data(
192        self,
193        extra_data: std::collections::BTreeMap<
194            jacquard_common::smol_str::SmolStr,
195            jacquard_common::types::value::Data<'a>,
196        >,
197    ) -> Entity<'a> {
198        Entity {
199            index: self.__unsafe_private_named.0.unwrap(),
200            r#type: self.__unsafe_private_named.1.unwrap(),
201            value: self.__unsafe_private_named.2.unwrap(),
202            extra_data: Some(extra_data),
203        }
204    }
205}
206
207fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
208    ::jacquard_lexicon::lexicon::LexiconDoc {
209        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
210        id: ::jacquard_common::CowStr::new_static("app.bsky.feed.post"),
211        revision: None,
212        description: None,
213        defs: {
214            let mut map = ::std::collections::BTreeMap::new();
215            map.insert(
216                ::jacquard_common::smol_str::SmolStr::new_static("entity"),
217                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
218                    description: Some(
219                        ::jacquard_common::CowStr::new_static(
220                            "Deprecated: use facets instead.",
221                        ),
222                    ),
223                    required: Some(
224                        vec![
225                            ::jacquard_common::smol_str::SmolStr::new_static("index"),
226                            ::jacquard_common::smol_str::SmolStr::new_static("type"),
227                            ::jacquard_common::smol_str::SmolStr::new_static("value")
228                        ],
229                    ),
230                    nullable: None,
231                    properties: {
232                        #[allow(unused_mut)]
233                        let mut map = ::std::collections::BTreeMap::new();
234                        map.insert(
235                            ::jacquard_common::smol_str::SmolStr::new_static("index"),
236                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
237                                description: None,
238                                r#ref: ::jacquard_common::CowStr::new_static("#textSlice"),
239                            }),
240                        );
241                        map.insert(
242                            ::jacquard_common::smol_str::SmolStr::new_static("type"),
243                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
244                                description: Some(
245                                    ::jacquard_common::CowStr::new_static(
246                                        "Expected values are 'mention' and 'link'.",
247                                    ),
248                                ),
249                                format: None,
250                                default: None,
251                                min_length: None,
252                                max_length: None,
253                                min_graphemes: None,
254                                max_graphemes: None,
255                                r#enum: None,
256                                r#const: None,
257                                known_values: None,
258                            }),
259                        );
260                        map.insert(
261                            ::jacquard_common::smol_str::SmolStr::new_static("value"),
262                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
263                                description: None,
264                                format: None,
265                                default: None,
266                                min_length: None,
267                                max_length: None,
268                                min_graphemes: None,
269                                max_graphemes: None,
270                                r#enum: None,
271                                r#const: None,
272                                known_values: None,
273                            }),
274                        );
275                        map
276                    },
277                }),
278            );
279            map.insert(
280                ::jacquard_common::smol_str::SmolStr::new_static("main"),
281                ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
282                    description: Some(
283                        ::jacquard_common::CowStr::new_static(
284                            "Record containing a Bluesky post.",
285                        ),
286                    ),
287                    key: Some(::jacquard_common::CowStr::new_static("tid")),
288                    record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
289                        description: None,
290                        required: Some(
291                            vec![
292                                ::jacquard_common::smol_str::SmolStr::new_static("text"),
293                                ::jacquard_common::smol_str::SmolStr::new_static("createdAt")
294                            ],
295                        ),
296                        nullable: None,
297                        properties: {
298                            #[allow(unused_mut)]
299                            let mut map = ::std::collections::BTreeMap::new();
300                            map.insert(
301                                ::jacquard_common::smol_str::SmolStr::new_static(
302                                    "createdAt",
303                                ),
304                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
305                                    description: Some(
306                                        ::jacquard_common::CowStr::new_static(
307                                            "Client-declared timestamp when this post was originally created.",
308                                        ),
309                                    ),
310                                    format: Some(
311                                        ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
312                                    ),
313                                    default: None,
314                                    min_length: None,
315                                    max_length: None,
316                                    min_graphemes: None,
317                                    max_graphemes: None,
318                                    r#enum: None,
319                                    r#const: None,
320                                    known_values: None,
321                                }),
322                            );
323                            map.insert(
324                                ::jacquard_common::smol_str::SmolStr::new_static("embed"),
325                                ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
326                                    description: None,
327                                    refs: vec![
328                                        ::jacquard_common::CowStr::new_static("app.bsky.embed.images"),
329                                        ::jacquard_common::CowStr::new_static("app.bsky.embed.video"),
330                                        ::jacquard_common::CowStr::new_static("app.bsky.embed.external"),
331                                        ::jacquard_common::CowStr::new_static("app.bsky.embed.record"),
332                                        ::jacquard_common::CowStr::new_static("app.bsky.embed.recordWithMedia")
333                                    ],
334                                    closed: None,
335                                }),
336                            );
337                            map.insert(
338                                ::jacquard_common::smol_str::SmolStr::new_static(
339                                    "entities",
340                                ),
341                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
342                                    description: Some(
343                                        ::jacquard_common::CowStr::new_static(
344                                            "DEPRECATED: replaced by app.bsky.richtext.facet.",
345                                        ),
346                                    ),
347                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
348                                        description: None,
349                                        r#ref: ::jacquard_common::CowStr::new_static("#entity"),
350                                    }),
351                                    min_length: None,
352                                    max_length: None,
353                                }),
354                            );
355                            map.insert(
356                                ::jacquard_common::smol_str::SmolStr::new_static("facets"),
357                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
358                                    description: Some(
359                                        ::jacquard_common::CowStr::new_static(
360                                            "Annotations of text (mentions, URLs, hashtags, etc)",
361                                        ),
362                                    ),
363                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
364                                        description: None,
365                                        r#ref: ::jacquard_common::CowStr::new_static(
366                                            "app.bsky.richtext.facet",
367                                        ),
368                                    }),
369                                    min_length: None,
370                                    max_length: None,
371                                }),
372                            );
373                            map.insert(
374                                ::jacquard_common::smol_str::SmolStr::new_static("labels"),
375                                ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
376                                    description: Some(
377                                        ::jacquard_common::CowStr::new_static(
378                                            "Self-label values for this post. Effectively content warnings.",
379                                        ),
380                                    ),
381                                    refs: vec![
382                                        ::jacquard_common::CowStr::new_static("com.atproto.label.defs#selfLabels")
383                                    ],
384                                    closed: None,
385                                }),
386                            );
387                            map.insert(
388                                ::jacquard_common::smol_str::SmolStr::new_static("langs"),
389                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
390                                    description: Some(
391                                        ::jacquard_common::CowStr::new_static(
392                                            "Indicates human language of post primary text content.",
393                                        ),
394                                    ),
395                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
396                                        description: None,
397                                        format: Some(
398                                            ::jacquard_lexicon::lexicon::LexStringFormat::Language,
399                                        ),
400                                        default: None,
401                                        min_length: None,
402                                        max_length: None,
403                                        min_graphemes: None,
404                                        max_graphemes: None,
405                                        r#enum: None,
406                                        r#const: None,
407                                        known_values: None,
408                                    }),
409                                    min_length: None,
410                                    max_length: Some(3usize),
411                                }),
412                            );
413                            map.insert(
414                                ::jacquard_common::smol_str::SmolStr::new_static("reply"),
415                                ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
416                                    description: None,
417                                    r#ref: ::jacquard_common::CowStr::new_static("#replyRef"),
418                                }),
419                            );
420                            map.insert(
421                                ::jacquard_common::smol_str::SmolStr::new_static("tags"),
422                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
423                                    description: Some(
424                                        ::jacquard_common::CowStr::new_static(
425                                            "Additional hashtags, in addition to any included in post text and facets.",
426                                        ),
427                                    ),
428                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
429                                        description: None,
430                                        format: None,
431                                        default: None,
432                                        min_length: None,
433                                        max_length: Some(640usize),
434                                        min_graphemes: None,
435                                        max_graphemes: Some(64usize),
436                                        r#enum: None,
437                                        r#const: None,
438                                        known_values: None,
439                                    }),
440                                    min_length: None,
441                                    max_length: Some(8usize),
442                                }),
443                            );
444                            map.insert(
445                                ::jacquard_common::smol_str::SmolStr::new_static("text"),
446                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
447                                    description: Some(
448                                        ::jacquard_common::CowStr::new_static(
449                                            "The primary post content. May be an empty string, if there are embeds.",
450                                        ),
451                                    ),
452                                    format: None,
453                                    default: None,
454                                    min_length: None,
455                                    max_length: Some(3000usize),
456                                    min_graphemes: None,
457                                    max_graphemes: Some(300usize),
458                                    r#enum: None,
459                                    r#const: None,
460                                    known_values: None,
461                                }),
462                            );
463                            map
464                        },
465                    }),
466                }),
467            );
468            map.insert(
469                ::jacquard_common::smol_str::SmolStr::new_static("replyRef"),
470                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
471                    description: None,
472                    required: Some(
473                        vec![
474                            ::jacquard_common::smol_str::SmolStr::new_static("root"),
475                            ::jacquard_common::smol_str::SmolStr::new_static("parent")
476                        ],
477                    ),
478                    nullable: None,
479                    properties: {
480                        #[allow(unused_mut)]
481                        let mut map = ::std::collections::BTreeMap::new();
482                        map.insert(
483                            ::jacquard_common::smol_str::SmolStr::new_static("parent"),
484                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
485                                description: None,
486                                r#ref: ::jacquard_common::CowStr::new_static(
487                                    "com.atproto.repo.strongRef",
488                                ),
489                            }),
490                        );
491                        map.insert(
492                            ::jacquard_common::smol_str::SmolStr::new_static("root"),
493                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
494                                description: None,
495                                r#ref: ::jacquard_common::CowStr::new_static(
496                                    "com.atproto.repo.strongRef",
497                                ),
498                            }),
499                        );
500                        map
501                    },
502                }),
503            );
504            map.insert(
505                ::jacquard_common::smol_str::SmolStr::new_static("textSlice"),
506                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
507                    description: Some(
508                        ::jacquard_common::CowStr::new_static(
509                            "Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.",
510                        ),
511                    ),
512                    required: Some(
513                        vec![
514                            ::jacquard_common::smol_str::SmolStr::new_static("start"),
515                            ::jacquard_common::smol_str::SmolStr::new_static("end")
516                        ],
517                    ),
518                    nullable: None,
519                    properties: {
520                        #[allow(unused_mut)]
521                        let mut map = ::std::collections::BTreeMap::new();
522                        map.insert(
523                            ::jacquard_common::smol_str::SmolStr::new_static("end"),
524                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
525                                description: None,
526                                default: None,
527                                minimum: Some(0i64),
528                                maximum: None,
529                                r#enum: None,
530                                r#const: None,
531                            }),
532                        );
533                        map.insert(
534                            ::jacquard_common::smol_str::SmolStr::new_static("start"),
535                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
536                                description: None,
537                                default: None,
538                                minimum: Some(0i64),
539                                maximum: None,
540                                r#enum: None,
541                                r#const: None,
542                            }),
543                        );
544                        map
545                    },
546                }),
547            );
548            map
549        },
550    }
551}
552
553impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entity<'a> {
554    fn nsid() -> &'static str {
555        "app.bsky.feed.post"
556    }
557    fn def_name() -> &'static str {
558        "entity"
559    }
560    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
561        lexicon_doc_app_bsky_feed_post()
562    }
563    fn validate(
564        &self,
565    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
566        Ok(())
567    }
568}
569
570/// Record containing a Bluesky post.
571#[jacquard_derive::lexicon]
572#[derive(
573    serde::Serialize,
574    serde::Deserialize,
575    Debug,
576    Clone,
577    PartialEq,
578    Eq,
579    jacquard_derive::IntoStatic
580)]
581#[serde(rename_all = "camelCase")]
582pub struct Post<'a> {
583    /// Client-declared timestamp when this post was originally created.
584    pub created_at: jacquard_common::types::string::Datetime,
585    #[serde(skip_serializing_if = "std::option::Option::is_none")]
586    #[serde(borrow)]
587    pub embed: Option<PostEmbed<'a>>,
588    /// DEPRECATED: replaced by app.bsky.richtext.facet.
589    #[serde(skip_serializing_if = "std::option::Option::is_none")]
590    #[serde(borrow)]
591    pub entities: Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
592    /// Annotations of text (mentions, URLs, hashtags, etc)
593    #[serde(skip_serializing_if = "std::option::Option::is_none")]
594    #[serde(borrow)]
595    pub facets: Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
596    /// Self-label values for this post. Effectively content warnings.
597    #[serde(skip_serializing_if = "std::option::Option::is_none")]
598    #[serde(borrow)]
599    pub labels: Option<crate::com_atproto::label::SelfLabels<'a>>,
600    /// Indicates human language of post primary text content.
601    #[serde(skip_serializing_if = "std::option::Option::is_none")]
602    pub langs: Option<Vec<jacquard_common::types::string::Language>>,
603    #[serde(skip_serializing_if = "std::option::Option::is_none")]
604    #[serde(borrow)]
605    pub reply: Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
606    /// Additional hashtags, in addition to any included in post text and facets.
607    #[serde(skip_serializing_if = "std::option::Option::is_none")]
608    #[serde(borrow)]
609    pub tags: Option<Vec<jacquard_common::CowStr<'a>>>,
610    /// The primary post content. May be an empty string, if there are embeds.
611    #[serde(borrow)]
612    pub text: jacquard_common::CowStr<'a>,
613}
614
615pub mod post_state {
616
617    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
618    #[allow(unused)]
619    use ::core::marker::PhantomData;
620    mod sealed {
621        pub trait Sealed {}
622    }
623    /// State trait tracking which required fields have been set
624    pub trait State: sealed::Sealed {
625        type Text;
626        type CreatedAt;
627    }
628    /// Empty state - all required fields are unset
629    pub struct Empty(());
630    impl sealed::Sealed for Empty {}
631    impl State for Empty {
632        type Text = Unset;
633        type CreatedAt = Unset;
634    }
635    ///State transition - sets the `text` field to Set
636    pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
637    impl<S: State> sealed::Sealed for SetText<S> {}
638    impl<S: State> State for SetText<S> {
639        type Text = Set<members::text>;
640        type CreatedAt = S::CreatedAt;
641    }
642    ///State transition - sets the `created_at` field to Set
643    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
644    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
645    impl<S: State> State for SetCreatedAt<S> {
646        type Text = S::Text;
647        type CreatedAt = Set<members::created_at>;
648    }
649    /// Marker types for field names
650    #[allow(non_camel_case_types)]
651    pub mod members {
652        ///Marker type for the `text` field
653        pub struct text(());
654        ///Marker type for the `created_at` field
655        pub struct created_at(());
656    }
657}
658
659/// Builder for constructing an instance of this type
660pub struct PostBuilder<'a, S: post_state::State> {
661    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
662    __unsafe_private_named: (
663        ::core::option::Option<jacquard_common::types::string::Datetime>,
664        ::core::option::Option<PostEmbed<'a>>,
665        ::core::option::Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
666        ::core::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
667        ::core::option::Option<crate::com_atproto::label::SelfLabels<'a>>,
668        ::core::option::Option<Vec<jacquard_common::types::string::Language>>,
669        ::core::option::Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
670        ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>,
671        ::core::option::Option<jacquard_common::CowStr<'a>>,
672    ),
673    _phantom: ::core::marker::PhantomData<&'a ()>,
674}
675
676impl<'a> Post<'a> {
677    /// Create a new builder for this type
678    pub fn new() -> PostBuilder<'a, post_state::Empty> {
679        PostBuilder::new()
680    }
681}
682
683impl<'a> PostBuilder<'a, post_state::Empty> {
684    /// Create a new builder with all fields unset
685    pub fn new() -> Self {
686        PostBuilder {
687            _phantom_state: ::core::marker::PhantomData,
688            __unsafe_private_named: (
689                None,
690                None,
691                None,
692                None,
693                None,
694                None,
695                None,
696                None,
697                None,
698            ),
699            _phantom: ::core::marker::PhantomData,
700        }
701    }
702}
703
704impl<'a, S> PostBuilder<'a, S>
705where
706    S: post_state::State,
707    S::CreatedAt: post_state::IsUnset,
708{
709    /// Set the `createdAt` field (required)
710    pub fn created_at(
711        mut self,
712        value: impl Into<jacquard_common::types::string::Datetime>,
713    ) -> PostBuilder<'a, post_state::SetCreatedAt<S>> {
714        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
715        PostBuilder {
716            _phantom_state: ::core::marker::PhantomData,
717            __unsafe_private_named: self.__unsafe_private_named,
718            _phantom: ::core::marker::PhantomData,
719        }
720    }
721}
722
723impl<'a, S: post_state::State> PostBuilder<'a, S> {
724    /// Set the `embed` field (optional)
725    pub fn embed(mut self, value: impl Into<Option<PostEmbed<'a>>>) -> Self {
726        self.__unsafe_private_named.1 = value.into();
727        self
728    }
729    /// Set the `embed` field to an Option value (optional)
730    pub fn maybe_embed(mut self, value: Option<PostEmbed<'a>>) -> Self {
731        self.__unsafe_private_named.1 = value;
732        self
733    }
734}
735
736impl<'a, S: post_state::State> PostBuilder<'a, S> {
737    /// Set the `entities` field (optional)
738    pub fn entities(
739        mut self,
740        value: impl Into<Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>>,
741    ) -> Self {
742        self.__unsafe_private_named.2 = value.into();
743        self
744    }
745    /// Set the `entities` field to an Option value (optional)
746    pub fn maybe_entities(
747        mut self,
748        value: Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
749    ) -> Self {
750        self.__unsafe_private_named.2 = value;
751        self
752    }
753}
754
755impl<'a, S: post_state::State> PostBuilder<'a, S> {
756    /// Set the `facets` field (optional)
757    pub fn facets(
758        mut self,
759        value: impl Into<Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>>,
760    ) -> Self {
761        self.__unsafe_private_named.3 = value.into();
762        self
763    }
764    /// Set the `facets` field to an Option value (optional)
765    pub fn maybe_facets(
766        mut self,
767        value: Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
768    ) -> Self {
769        self.__unsafe_private_named.3 = value;
770        self
771    }
772}
773
774impl<'a, S: post_state::State> PostBuilder<'a, S> {
775    /// Set the `labels` field (optional)
776    pub fn labels(
777        mut self,
778        value: impl Into<Option<crate::com_atproto::label::SelfLabels<'a>>>,
779    ) -> Self {
780        self.__unsafe_private_named.4 = value.into();
781        self
782    }
783    /// Set the `labels` field to an Option value (optional)
784    pub fn maybe_labels(
785        mut self,
786        value: Option<crate::com_atproto::label::SelfLabels<'a>>,
787    ) -> Self {
788        self.__unsafe_private_named.4 = value;
789        self
790    }
791}
792
793impl<'a, S: post_state::State> PostBuilder<'a, S> {
794    /// Set the `langs` field (optional)
795    pub fn langs(
796        mut self,
797        value: impl Into<Option<Vec<jacquard_common::types::string::Language>>>,
798    ) -> Self {
799        self.__unsafe_private_named.5 = value.into();
800        self
801    }
802    /// Set the `langs` field to an Option value (optional)
803    pub fn maybe_langs(
804        mut self,
805        value: Option<Vec<jacquard_common::types::string::Language>>,
806    ) -> Self {
807        self.__unsafe_private_named.5 = value;
808        self
809    }
810}
811
812impl<'a, S: post_state::State> PostBuilder<'a, S> {
813    /// Set the `reply` field (optional)
814    pub fn reply(
815        mut self,
816        value: impl Into<Option<crate::app_bsky::feed::post::ReplyRef<'a>>>,
817    ) -> Self {
818        self.__unsafe_private_named.6 = value.into();
819        self
820    }
821    /// Set the `reply` field to an Option value (optional)
822    pub fn maybe_reply(
823        mut self,
824        value: Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
825    ) -> Self {
826        self.__unsafe_private_named.6 = value;
827        self
828    }
829}
830
831impl<'a, S: post_state::State> PostBuilder<'a, S> {
832    /// Set the `tags` field (optional)
833    pub fn tags(
834        mut self,
835        value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>,
836    ) -> Self {
837        self.__unsafe_private_named.7 = value.into();
838        self
839    }
840    /// Set the `tags` field to an Option value (optional)
841    pub fn maybe_tags(
842        mut self,
843        value: Option<Vec<jacquard_common::CowStr<'a>>>,
844    ) -> Self {
845        self.__unsafe_private_named.7 = value;
846        self
847    }
848}
849
850impl<'a, S> PostBuilder<'a, S>
851where
852    S: post_state::State,
853    S::Text: post_state::IsUnset,
854{
855    /// Set the `text` field (required)
856    pub fn text(
857        mut self,
858        value: impl Into<jacquard_common::CowStr<'a>>,
859    ) -> PostBuilder<'a, post_state::SetText<S>> {
860        self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
861        PostBuilder {
862            _phantom_state: ::core::marker::PhantomData,
863            __unsafe_private_named: self.__unsafe_private_named,
864            _phantom: ::core::marker::PhantomData,
865        }
866    }
867}
868
869impl<'a, S> PostBuilder<'a, S>
870where
871    S: post_state::State,
872    S::Text: post_state::IsSet,
873    S::CreatedAt: post_state::IsSet,
874{
875    /// Build the final struct
876    pub fn build(self) -> Post<'a> {
877        Post {
878            created_at: self.__unsafe_private_named.0.unwrap(),
879            embed: self.__unsafe_private_named.1,
880            entities: self.__unsafe_private_named.2,
881            facets: self.__unsafe_private_named.3,
882            labels: self.__unsafe_private_named.4,
883            langs: self.__unsafe_private_named.5,
884            reply: self.__unsafe_private_named.6,
885            tags: self.__unsafe_private_named.7,
886            text: self.__unsafe_private_named.8.unwrap(),
887            extra_data: Default::default(),
888        }
889    }
890    /// Build the final struct with custom extra_data
891    pub fn build_with_data(
892        self,
893        extra_data: std::collections::BTreeMap<
894            jacquard_common::smol_str::SmolStr,
895            jacquard_common::types::value::Data<'a>,
896        >,
897    ) -> Post<'a> {
898        Post {
899            created_at: self.__unsafe_private_named.0.unwrap(),
900            embed: self.__unsafe_private_named.1,
901            entities: self.__unsafe_private_named.2,
902            facets: self.__unsafe_private_named.3,
903            labels: self.__unsafe_private_named.4,
904            langs: self.__unsafe_private_named.5,
905            reply: self.__unsafe_private_named.6,
906            tags: self.__unsafe_private_named.7,
907            text: self.__unsafe_private_named.8.unwrap(),
908            extra_data: Some(extra_data),
909        }
910    }
911}
912
913impl<'a> Post<'a> {
914    pub fn uri(
915        uri: impl Into<jacquard_common::CowStr<'a>>,
916    ) -> Result<
917        jacquard_common::types::uri::RecordUri<'a, PostRecord>,
918        jacquard_common::types::uri::UriError,
919    > {
920        jacquard_common::types::uri::RecordUri::try_from_uri(
921            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
922        )
923    }
924}
925
926#[jacquard_derive::open_union]
927#[derive(
928    serde::Serialize,
929    serde::Deserialize,
930    Debug,
931    Clone,
932    PartialEq,
933    Eq,
934    jacquard_derive::IntoStatic
935)]
936#[serde(tag = "$type")]
937#[serde(bound(deserialize = "'de: 'a"))]
938pub enum PostEmbed<'a> {
939    #[serde(rename = "app.bsky.embed.images")]
940    Images(Box<crate::app_bsky::embed::images::Images<'a>>),
941    #[serde(rename = "app.bsky.embed.video")]
942    Video(Box<crate::app_bsky::embed::video::Video<'a>>),
943    #[serde(rename = "app.bsky.embed.external")]
944    External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>),
945    #[serde(rename = "app.bsky.embed.record")]
946    Record(Box<crate::app_bsky::embed::record::Record<'a>>),
947    #[serde(rename = "app.bsky.embed.recordWithMedia")]
948    RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>),
949}
950
951/// Typed wrapper for GetRecord response with this collection's record type.
952#[derive(
953    serde::Serialize,
954    serde::Deserialize,
955    Debug,
956    Clone,
957    PartialEq,
958    Eq,
959    jacquard_derive::IntoStatic
960)]
961#[serde(rename_all = "camelCase")]
962pub struct PostGetRecordOutput<'a> {
963    #[serde(skip_serializing_if = "std::option::Option::is_none")]
964    #[serde(borrow)]
965    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
966    #[serde(borrow)]
967    pub uri: jacquard_common::types::string::AtUri<'a>,
968    #[serde(borrow)]
969    pub value: Post<'a>,
970}
971
972impl From<PostGetRecordOutput<'_>> for Post<'_> {
973    fn from(output: PostGetRecordOutput<'_>) -> Self {
974        use jacquard_common::IntoStatic;
975        output.value.into_static()
976    }
977}
978
979impl jacquard_common::types::collection::Collection for Post<'_> {
980    const NSID: &'static str = "app.bsky.feed.post";
981    type Record = PostRecord;
982}
983
984/// Marker type for deserializing records from this collection.
985#[derive(Debug, serde::Serialize, serde::Deserialize)]
986pub struct PostRecord;
987impl jacquard_common::xrpc::XrpcResp for PostRecord {
988    const NSID: &'static str = "app.bsky.feed.post";
989    const ENCODING: &'static str = "application/json";
990    type Output<'de> = PostGetRecordOutput<'de>;
991    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
992}
993
994impl jacquard_common::types::collection::Collection for PostRecord {
995    const NSID: &'static str = "app.bsky.feed.post";
996    type Record = PostRecord;
997}
998
999impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Post<'a> {
1000    fn nsid() -> &'static str {
1001        "app.bsky.feed.post"
1002    }
1003    fn def_name() -> &'static str {
1004        "main"
1005    }
1006    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1007        lexicon_doc_app_bsky_feed_post()
1008    }
1009    fn validate(
1010        &self,
1011    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1012        if let Some(ref value) = self.langs {
1013            #[allow(unused_comparisons)]
1014            if value.len() > 3usize {
1015                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1016                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1017                        "langs",
1018                    ),
1019                    max: 3usize,
1020                    actual: value.len(),
1021                });
1022            }
1023        }
1024        if let Some(ref value) = self.tags {
1025            #[allow(unused_comparisons)]
1026            if value.len() > 8usize {
1027                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1028                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1029                        "tags",
1030                    ),
1031                    max: 8usize,
1032                    actual: value.len(),
1033                });
1034            }
1035        }
1036        {
1037            let value = &self.text;
1038            #[allow(unused_comparisons)]
1039            if <str>::len(value.as_ref()) > 3000usize {
1040                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1041                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1042                        "text",
1043                    ),
1044                    max: 3000usize,
1045                    actual: <str>::len(value.as_ref()),
1046                });
1047            }
1048        }
1049        {
1050            let value = &self.text;
1051            {
1052                let count = ::unicode_segmentation::UnicodeSegmentation::graphemes(
1053                        value.as_ref(),
1054                        true,
1055                    )
1056                    .count();
1057                if count > 300usize {
1058                    return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
1059                        path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1060                            "text",
1061                        ),
1062                        max: 300usize,
1063                        actual: count,
1064                    });
1065                }
1066            }
1067        }
1068        Ok(())
1069    }
1070}
1071
1072#[jacquard_derive::lexicon]
1073#[derive(
1074    serde::Serialize,
1075    serde::Deserialize,
1076    Debug,
1077    Clone,
1078    PartialEq,
1079    Eq,
1080    jacquard_derive::IntoStatic
1081)]
1082#[serde(rename_all = "camelCase")]
1083pub struct ReplyRef<'a> {
1084    #[serde(borrow)]
1085    pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1086    #[serde(borrow)]
1087    pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
1088}
1089
1090pub mod reply_ref_state {
1091
1092    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1093    #[allow(unused)]
1094    use ::core::marker::PhantomData;
1095    mod sealed {
1096        pub trait Sealed {}
1097    }
1098    /// State trait tracking which required fields have been set
1099    pub trait State: sealed::Sealed {
1100        type Root;
1101        type Parent;
1102    }
1103    /// Empty state - all required fields are unset
1104    pub struct Empty(());
1105    impl sealed::Sealed for Empty {}
1106    impl State for Empty {
1107        type Root = Unset;
1108        type Parent = Unset;
1109    }
1110    ///State transition - sets the `root` field to Set
1111    pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>);
1112    impl<S: State> sealed::Sealed for SetRoot<S> {}
1113    impl<S: State> State for SetRoot<S> {
1114        type Root = Set<members::root>;
1115        type Parent = S::Parent;
1116    }
1117    ///State transition - sets the `parent` field to Set
1118    pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>);
1119    impl<S: State> sealed::Sealed for SetParent<S> {}
1120    impl<S: State> State for SetParent<S> {
1121        type Root = S::Root;
1122        type Parent = Set<members::parent>;
1123    }
1124    /// Marker types for field names
1125    #[allow(non_camel_case_types)]
1126    pub mod members {
1127        ///Marker type for the `root` field
1128        pub struct root(());
1129        ///Marker type for the `parent` field
1130        pub struct parent(());
1131    }
1132}
1133
1134/// Builder for constructing an instance of this type
1135pub struct ReplyRefBuilder<'a, S: reply_ref_state::State> {
1136    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1137    __unsafe_private_named: (
1138        ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1139        ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1140    ),
1141    _phantom: ::core::marker::PhantomData<&'a ()>,
1142}
1143
1144impl<'a> ReplyRef<'a> {
1145    /// Create a new builder for this type
1146    pub fn new() -> ReplyRefBuilder<'a, reply_ref_state::Empty> {
1147        ReplyRefBuilder::new()
1148    }
1149}
1150
1151impl<'a> ReplyRefBuilder<'a, reply_ref_state::Empty> {
1152    /// Create a new builder with all fields unset
1153    pub fn new() -> Self {
1154        ReplyRefBuilder {
1155            _phantom_state: ::core::marker::PhantomData,
1156            __unsafe_private_named: (None, None),
1157            _phantom: ::core::marker::PhantomData,
1158        }
1159    }
1160}
1161
1162impl<'a, S> ReplyRefBuilder<'a, S>
1163where
1164    S: reply_ref_state::State,
1165    S::Parent: reply_ref_state::IsUnset,
1166{
1167    /// Set the `parent` field (required)
1168    pub fn parent(
1169        mut self,
1170        value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1171    ) -> ReplyRefBuilder<'a, reply_ref_state::SetParent<S>> {
1172        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1173        ReplyRefBuilder {
1174            _phantom_state: ::core::marker::PhantomData,
1175            __unsafe_private_named: self.__unsafe_private_named,
1176            _phantom: ::core::marker::PhantomData,
1177        }
1178    }
1179}
1180
1181impl<'a, S> ReplyRefBuilder<'a, S>
1182where
1183    S: reply_ref_state::State,
1184    S::Root: reply_ref_state::IsUnset,
1185{
1186    /// Set the `root` field (required)
1187    pub fn root(
1188        mut self,
1189        value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
1190    ) -> ReplyRefBuilder<'a, reply_ref_state::SetRoot<S>> {
1191        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1192        ReplyRefBuilder {
1193            _phantom_state: ::core::marker::PhantomData,
1194            __unsafe_private_named: self.__unsafe_private_named,
1195            _phantom: ::core::marker::PhantomData,
1196        }
1197    }
1198}
1199
1200impl<'a, S> ReplyRefBuilder<'a, S>
1201where
1202    S: reply_ref_state::State,
1203    S::Root: reply_ref_state::IsSet,
1204    S::Parent: reply_ref_state::IsSet,
1205{
1206    /// Build the final struct
1207    pub fn build(self) -> ReplyRef<'a> {
1208        ReplyRef {
1209            parent: self.__unsafe_private_named.0.unwrap(),
1210            root: self.__unsafe_private_named.1.unwrap(),
1211            extra_data: Default::default(),
1212        }
1213    }
1214    /// Build the final struct with custom extra_data
1215    pub fn build_with_data(
1216        self,
1217        extra_data: std::collections::BTreeMap<
1218            jacquard_common::smol_str::SmolStr,
1219            jacquard_common::types::value::Data<'a>,
1220        >,
1221    ) -> ReplyRef<'a> {
1222        ReplyRef {
1223            parent: self.__unsafe_private_named.0.unwrap(),
1224            root: self.__unsafe_private_named.1.unwrap(),
1225            extra_data: Some(extra_data),
1226        }
1227    }
1228}
1229
1230impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> {
1231    fn nsid() -> &'static str {
1232        "app.bsky.feed.post"
1233    }
1234    fn def_name() -> &'static str {
1235        "replyRef"
1236    }
1237    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1238        lexicon_doc_app_bsky_feed_post()
1239    }
1240    fn validate(
1241        &self,
1242    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1243        Ok(())
1244    }
1245}
1246
1247/// Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.
1248#[jacquard_derive::lexicon]
1249#[derive(
1250    serde::Serialize,
1251    serde::Deserialize,
1252    Debug,
1253    Clone,
1254    PartialEq,
1255    Eq,
1256    jacquard_derive::IntoStatic
1257)]
1258#[serde(rename_all = "camelCase")]
1259pub struct TextSlice<'a> {
1260    pub end: i64,
1261    pub start: i64,
1262}
1263
1264pub mod text_slice_state {
1265
1266    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1267    #[allow(unused)]
1268    use ::core::marker::PhantomData;
1269    mod sealed {
1270        pub trait Sealed {}
1271    }
1272    /// State trait tracking which required fields have been set
1273    pub trait State: sealed::Sealed {
1274        type Start;
1275        type End;
1276    }
1277    /// Empty state - all required fields are unset
1278    pub struct Empty(());
1279    impl sealed::Sealed for Empty {}
1280    impl State for Empty {
1281        type Start = Unset;
1282        type End = Unset;
1283    }
1284    ///State transition - sets the `start` field to Set
1285    pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>);
1286    impl<S: State> sealed::Sealed for SetStart<S> {}
1287    impl<S: State> State for SetStart<S> {
1288        type Start = Set<members::start>;
1289        type End = S::End;
1290    }
1291    ///State transition - sets the `end` field to Set
1292    pub struct SetEnd<S: State = Empty>(PhantomData<fn() -> S>);
1293    impl<S: State> sealed::Sealed for SetEnd<S> {}
1294    impl<S: State> State for SetEnd<S> {
1295        type Start = S::Start;
1296        type End = Set<members::end>;
1297    }
1298    /// Marker types for field names
1299    #[allow(non_camel_case_types)]
1300    pub mod members {
1301        ///Marker type for the `start` field
1302        pub struct start(());
1303        ///Marker type for the `end` field
1304        pub struct end(());
1305    }
1306}
1307
1308/// Builder for constructing an instance of this type
1309pub struct TextSliceBuilder<'a, S: text_slice_state::State> {
1310    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1311    __unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>),
1312    _phantom: ::core::marker::PhantomData<&'a ()>,
1313}
1314
1315impl<'a> TextSlice<'a> {
1316    /// Create a new builder for this type
1317    pub fn new() -> TextSliceBuilder<'a, text_slice_state::Empty> {
1318        TextSliceBuilder::new()
1319    }
1320}
1321
1322impl<'a> TextSliceBuilder<'a, text_slice_state::Empty> {
1323    /// Create a new builder with all fields unset
1324    pub fn new() -> Self {
1325        TextSliceBuilder {
1326            _phantom_state: ::core::marker::PhantomData,
1327            __unsafe_private_named: (None, None),
1328            _phantom: ::core::marker::PhantomData,
1329        }
1330    }
1331}
1332
1333impl<'a, S> TextSliceBuilder<'a, S>
1334where
1335    S: text_slice_state::State,
1336    S::End: text_slice_state::IsUnset,
1337{
1338    /// Set the `end` field (required)
1339    pub fn end(
1340        mut self,
1341        value: impl Into<i64>,
1342    ) -> TextSliceBuilder<'a, text_slice_state::SetEnd<S>> {
1343        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1344        TextSliceBuilder {
1345            _phantom_state: ::core::marker::PhantomData,
1346            __unsafe_private_named: self.__unsafe_private_named,
1347            _phantom: ::core::marker::PhantomData,
1348        }
1349    }
1350}
1351
1352impl<'a, S> TextSliceBuilder<'a, S>
1353where
1354    S: text_slice_state::State,
1355    S::Start: text_slice_state::IsUnset,
1356{
1357    /// Set the `start` field (required)
1358    pub fn start(
1359        mut self,
1360        value: impl Into<i64>,
1361    ) -> TextSliceBuilder<'a, text_slice_state::SetStart<S>> {
1362        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1363        TextSliceBuilder {
1364            _phantom_state: ::core::marker::PhantomData,
1365            __unsafe_private_named: self.__unsafe_private_named,
1366            _phantom: ::core::marker::PhantomData,
1367        }
1368    }
1369}
1370
1371impl<'a, S> TextSliceBuilder<'a, S>
1372where
1373    S: text_slice_state::State,
1374    S::Start: text_slice_state::IsSet,
1375    S::End: text_slice_state::IsSet,
1376{
1377    /// Build the final struct
1378    pub fn build(self) -> TextSlice<'a> {
1379        TextSlice {
1380            end: self.__unsafe_private_named.0.unwrap(),
1381            start: self.__unsafe_private_named.1.unwrap(),
1382            extra_data: Default::default(),
1383        }
1384    }
1385    /// Build the final struct with custom extra_data
1386    pub fn build_with_data(
1387        self,
1388        extra_data: std::collections::BTreeMap<
1389            jacquard_common::smol_str::SmolStr,
1390            jacquard_common::types::value::Data<'a>,
1391        >,
1392    ) -> TextSlice<'a> {
1393        TextSlice {
1394            end: self.__unsafe_private_named.0.unwrap(),
1395            start: self.__unsafe_private_named.1.unwrap(),
1396            extra_data: Some(extra_data),
1397        }
1398    }
1399}
1400
1401impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TextSlice<'a> {
1402    fn nsid() -> &'static str {
1403        "app.bsky.feed.post"
1404    }
1405    fn def_name() -> &'static str {
1406        "textSlice"
1407    }
1408    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1409        lexicon_doc_app_bsky_feed_post()
1410    }
1411    fn validate(
1412        &self,
1413    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1414        {
1415            let value = &self.end;
1416            if *value < 0i64 {
1417                return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
1418                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1419                        "end",
1420                    ),
1421                    min: 0i64,
1422                    actual: *value,
1423                });
1424            }
1425        }
1426        {
1427            let value = &self.start;
1428            if *value < 0i64 {
1429                return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
1430                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1431                        "start",
1432                    ),
1433                    min: 0i64,
1434                    actual: *value,
1435                });
1436            }
1437        }
1438        Ok(())
1439    }
1440}