jacquard_api/app_bsky/feed/
threadgate.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.feed.threadgate
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8/// Allow replies from actors who follow you.
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    Default
19)]
20#[serde(rename_all = "camelCase")]
21pub struct FollowerRule<'a> {}
22fn lexicon_doc_app_bsky_feed_threadgate() -> ::jacquard_lexicon::lexicon::LexiconDoc<
23    'static,
24> {
25    ::jacquard_lexicon::lexicon::LexiconDoc {
26        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
27        id: ::jacquard_common::CowStr::new_static("app.bsky.feed.threadgate"),
28        revision: None,
29        description: None,
30        defs: {
31            let mut map = ::std::collections::BTreeMap::new();
32            map.insert(
33                ::jacquard_common::smol_str::SmolStr::new_static("followerRule"),
34                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
35                    description: Some(
36                        ::jacquard_common::CowStr::new_static(
37                            "Allow replies from actors who follow you.",
38                        ),
39                    ),
40                    required: None,
41                    nullable: None,
42                    properties: {
43                        #[allow(unused_mut)]
44                        let mut map = ::std::collections::BTreeMap::new();
45                        map
46                    },
47                }),
48            );
49            map.insert(
50                ::jacquard_common::smol_str::SmolStr::new_static("followingRule"),
51                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
52                    description: Some(
53                        ::jacquard_common::CowStr::new_static(
54                            "Allow replies from actors you follow.",
55                        ),
56                    ),
57                    required: None,
58                    nullable: None,
59                    properties: {
60                        #[allow(unused_mut)]
61                        let mut map = ::std::collections::BTreeMap::new();
62                        map
63                    },
64                }),
65            );
66            map.insert(
67                ::jacquard_common::smol_str::SmolStr::new_static("listRule"),
68                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
69                    description: Some(
70                        ::jacquard_common::CowStr::new_static(
71                            "Allow replies from actors on a list.",
72                        ),
73                    ),
74                    required: Some(
75                        vec![::jacquard_common::smol_str::SmolStr::new_static("list")],
76                    ),
77                    nullable: None,
78                    properties: {
79                        #[allow(unused_mut)]
80                        let mut map = ::std::collections::BTreeMap::new();
81                        map.insert(
82                            ::jacquard_common::smol_str::SmolStr::new_static("list"),
83                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
84                                description: None,
85                                format: Some(
86                                    ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
87                                ),
88                                default: None,
89                                min_length: None,
90                                max_length: None,
91                                min_graphemes: None,
92                                max_graphemes: None,
93                                r#enum: None,
94                                r#const: None,
95                                known_values: None,
96                            }),
97                        );
98                        map
99                    },
100                }),
101            );
102            map.insert(
103                ::jacquard_common::smol_str::SmolStr::new_static("main"),
104                ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
105                    description: Some(
106                        ::jacquard_common::CowStr::new_static(
107                            "Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository.",
108                        ),
109                    ),
110                    key: Some(::jacquard_common::CowStr::new_static("tid")),
111                    record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
112                        description: None,
113                        required: Some(
114                            vec![
115                                ::jacquard_common::smol_str::SmolStr::new_static("post"),
116                                ::jacquard_common::smol_str::SmolStr::new_static("createdAt")
117                            ],
118                        ),
119                        nullable: None,
120                        properties: {
121                            #[allow(unused_mut)]
122                            let mut map = ::std::collections::BTreeMap::new();
123                            map.insert(
124                                ::jacquard_common::smol_str::SmolStr::new_static("allow"),
125                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
126                                    description: Some(
127                                        ::jacquard_common::CowStr::new_static(
128                                            "List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply.",
129                                        ),
130                                    ),
131                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion {
132                                        description: None,
133                                        refs: vec![
134                                            ::jacquard_common::CowStr::new_static("#mentionRule"),
135                                            ::jacquard_common::CowStr::new_static("#followerRule"),
136                                            ::jacquard_common::CowStr::new_static("#followingRule"),
137                                            ::jacquard_common::CowStr::new_static("#listRule")
138                                        ],
139                                        closed: None,
140                                    }),
141                                    min_length: None,
142                                    max_length: Some(5usize),
143                                }),
144                            );
145                            map.insert(
146                                ::jacquard_common::smol_str::SmolStr::new_static(
147                                    "createdAt",
148                                ),
149                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
150                                    description: None,
151                                    format: Some(
152                                        ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
153                                    ),
154                                    default: None,
155                                    min_length: None,
156                                    max_length: None,
157                                    min_graphemes: None,
158                                    max_graphemes: None,
159                                    r#enum: None,
160                                    r#const: None,
161                                    known_values: None,
162                                }),
163                            );
164                            map.insert(
165                                ::jacquard_common::smol_str::SmolStr::new_static(
166                                    "hiddenReplies",
167                                ),
168                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
169                                    description: Some(
170                                        ::jacquard_common::CowStr::new_static(
171                                            "List of hidden reply URIs.",
172                                        ),
173                                    ),
174                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
175                                        description: None,
176                                        format: Some(
177                                            ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
178                                        ),
179                                        default: None,
180                                        min_length: None,
181                                        max_length: None,
182                                        min_graphemes: None,
183                                        max_graphemes: None,
184                                        r#enum: None,
185                                        r#const: None,
186                                        known_values: None,
187                                    }),
188                                    min_length: None,
189                                    max_length: Some(300usize),
190                                }),
191                            );
192                            map.insert(
193                                ::jacquard_common::smol_str::SmolStr::new_static("post"),
194                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
195                                    description: Some(
196                                        ::jacquard_common::CowStr::new_static(
197                                            "Reference (AT-URI) to the post record.",
198                                        ),
199                                    ),
200                                    format: Some(
201                                        ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
202                                    ),
203                                    default: None,
204                                    min_length: None,
205                                    max_length: None,
206                                    min_graphemes: None,
207                                    max_graphemes: None,
208                                    r#enum: None,
209                                    r#const: None,
210                                    known_values: None,
211                                }),
212                            );
213                            map
214                        },
215                    }),
216                }),
217            );
218            map.insert(
219                ::jacquard_common::smol_str::SmolStr::new_static("mentionRule"),
220                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
221                    description: Some(
222                        ::jacquard_common::CowStr::new_static(
223                            "Allow replies from actors mentioned in your post.",
224                        ),
225                    ),
226                    required: None,
227                    nullable: None,
228                    properties: {
229                        #[allow(unused_mut)]
230                        let mut map = ::std::collections::BTreeMap::new();
231                        map
232                    },
233                }),
234            );
235            map
236        },
237    }
238}
239
240impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FollowerRule<'a> {
241    fn nsid() -> &'static str {
242        "app.bsky.feed.threadgate"
243    }
244    fn def_name() -> &'static str {
245        "followerRule"
246    }
247    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
248        lexicon_doc_app_bsky_feed_threadgate()
249    }
250    fn validate(
251        &self,
252    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
253        Ok(())
254    }
255}
256
257/// Allow replies from actors you follow.
258#[jacquard_derive::lexicon]
259#[derive(
260    serde::Serialize,
261    serde::Deserialize,
262    Debug,
263    Clone,
264    PartialEq,
265    Eq,
266    jacquard_derive::IntoStatic,
267    Default
268)]
269#[serde(rename_all = "camelCase")]
270pub struct FollowingRule<'a> {}
271impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FollowingRule<'a> {
272    fn nsid() -> &'static str {
273        "app.bsky.feed.threadgate"
274    }
275    fn def_name() -> &'static str {
276        "followingRule"
277    }
278    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
279        lexicon_doc_app_bsky_feed_threadgate()
280    }
281    fn validate(
282        &self,
283    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
284        Ok(())
285    }
286}
287
288/// Allow replies from actors on a list.
289#[jacquard_derive::lexicon]
290#[derive(
291    serde::Serialize,
292    serde::Deserialize,
293    Debug,
294    Clone,
295    PartialEq,
296    Eq,
297    jacquard_derive::IntoStatic
298)]
299#[serde(rename_all = "camelCase")]
300pub struct ListRule<'a> {
301    #[serde(borrow)]
302    pub list: jacquard_common::types::string::AtUri<'a>,
303}
304
305pub mod list_rule_state {
306
307    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
308    #[allow(unused)]
309    use ::core::marker::PhantomData;
310    mod sealed {
311        pub trait Sealed {}
312    }
313    /// State trait tracking which required fields have been set
314    pub trait State: sealed::Sealed {
315        type List;
316    }
317    /// Empty state - all required fields are unset
318    pub struct Empty(());
319    impl sealed::Sealed for Empty {}
320    impl State for Empty {
321        type List = Unset;
322    }
323    ///State transition - sets the `list` field to Set
324    pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
325    impl<S: State> sealed::Sealed for SetList<S> {}
326    impl<S: State> State for SetList<S> {
327        type List = Set<members::list>;
328    }
329    /// Marker types for field names
330    #[allow(non_camel_case_types)]
331    pub mod members {
332        ///Marker type for the `list` field
333        pub struct list(());
334    }
335}
336
337/// Builder for constructing an instance of this type
338pub struct ListRuleBuilder<'a, S: list_rule_state::State> {
339    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
340    __unsafe_private_named: (
341        ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
342    ),
343    _phantom: ::core::marker::PhantomData<&'a ()>,
344}
345
346impl<'a> ListRule<'a> {
347    /// Create a new builder for this type
348    pub fn new() -> ListRuleBuilder<'a, list_rule_state::Empty> {
349        ListRuleBuilder::new()
350    }
351}
352
353impl<'a> ListRuleBuilder<'a, list_rule_state::Empty> {
354    /// Create a new builder with all fields unset
355    pub fn new() -> Self {
356        ListRuleBuilder {
357            _phantom_state: ::core::marker::PhantomData,
358            __unsafe_private_named: (None,),
359            _phantom: ::core::marker::PhantomData,
360        }
361    }
362}
363
364impl<'a, S> ListRuleBuilder<'a, S>
365where
366    S: list_rule_state::State,
367    S::List: list_rule_state::IsUnset,
368{
369    /// Set the `list` field (required)
370    pub fn list(
371        mut self,
372        value: impl Into<jacquard_common::types::string::AtUri<'a>>,
373    ) -> ListRuleBuilder<'a, list_rule_state::SetList<S>> {
374        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
375        ListRuleBuilder {
376            _phantom_state: ::core::marker::PhantomData,
377            __unsafe_private_named: self.__unsafe_private_named,
378            _phantom: ::core::marker::PhantomData,
379        }
380    }
381}
382
383impl<'a, S> ListRuleBuilder<'a, S>
384where
385    S: list_rule_state::State,
386    S::List: list_rule_state::IsSet,
387{
388    /// Build the final struct
389    pub fn build(self) -> ListRule<'a> {
390        ListRule {
391            list: self.__unsafe_private_named.0.unwrap(),
392            extra_data: Default::default(),
393        }
394    }
395    /// Build the final struct with custom extra_data
396    pub fn build_with_data(
397        self,
398        extra_data: std::collections::BTreeMap<
399            jacquard_common::smol_str::SmolStr,
400            jacquard_common::types::value::Data<'a>,
401        >,
402    ) -> ListRule<'a> {
403        ListRule {
404            list: self.__unsafe_private_named.0.unwrap(),
405            extra_data: Some(extra_data),
406        }
407    }
408}
409
410impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListRule<'a> {
411    fn nsid() -> &'static str {
412        "app.bsky.feed.threadgate"
413    }
414    fn def_name() -> &'static str {
415        "listRule"
416    }
417    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
418        lexicon_doc_app_bsky_feed_threadgate()
419    }
420    fn validate(
421        &self,
422    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
423        Ok(())
424    }
425}
426
427/// Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository.
428#[jacquard_derive::lexicon]
429#[derive(
430    serde::Serialize,
431    serde::Deserialize,
432    Debug,
433    Clone,
434    PartialEq,
435    Eq,
436    jacquard_derive::IntoStatic
437)]
438#[serde(rename_all = "camelCase")]
439pub struct Threadgate<'a> {
440    /// List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply.
441    #[serde(skip_serializing_if = "std::option::Option::is_none")]
442    #[serde(borrow)]
443    pub allow: Option<Vec<ThreadgateAllowItem<'a>>>,
444    pub created_at: jacquard_common::types::string::Datetime,
445    /// List of hidden reply URIs.
446    #[serde(skip_serializing_if = "std::option::Option::is_none")]
447    #[serde(borrow)]
448    pub hidden_replies: Option<Vec<jacquard_common::types::string::AtUri<'a>>>,
449    /// Reference (AT-URI) to the post record.
450    #[serde(borrow)]
451    pub post: jacquard_common::types::string::AtUri<'a>,
452}
453
454pub mod threadgate_state {
455
456    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
457    #[allow(unused)]
458    use ::core::marker::PhantomData;
459    mod sealed {
460        pub trait Sealed {}
461    }
462    /// State trait tracking which required fields have been set
463    pub trait State: sealed::Sealed {
464        type Post;
465        type CreatedAt;
466    }
467    /// Empty state - all required fields are unset
468    pub struct Empty(());
469    impl sealed::Sealed for Empty {}
470    impl State for Empty {
471        type Post = Unset;
472        type CreatedAt = Unset;
473    }
474    ///State transition - sets the `post` field to Set
475    pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>);
476    impl<S: State> sealed::Sealed for SetPost<S> {}
477    impl<S: State> State for SetPost<S> {
478        type Post = Set<members::post>;
479        type CreatedAt = S::CreatedAt;
480    }
481    ///State transition - sets the `created_at` field to Set
482    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
483    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
484    impl<S: State> State for SetCreatedAt<S> {
485        type Post = S::Post;
486        type CreatedAt = Set<members::created_at>;
487    }
488    /// Marker types for field names
489    #[allow(non_camel_case_types)]
490    pub mod members {
491        ///Marker type for the `post` field
492        pub struct post(());
493        ///Marker type for the `created_at` field
494        pub struct created_at(());
495    }
496}
497
498/// Builder for constructing an instance of this type
499pub struct ThreadgateBuilder<'a, S: threadgate_state::State> {
500    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
501    __unsafe_private_named: (
502        ::core::option::Option<Vec<ThreadgateAllowItem<'a>>>,
503        ::core::option::Option<jacquard_common::types::string::Datetime>,
504        ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>,
505        ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
506    ),
507    _phantom: ::core::marker::PhantomData<&'a ()>,
508}
509
510impl<'a> Threadgate<'a> {
511    /// Create a new builder for this type
512    pub fn new() -> ThreadgateBuilder<'a, threadgate_state::Empty> {
513        ThreadgateBuilder::new()
514    }
515}
516
517impl<'a> ThreadgateBuilder<'a, threadgate_state::Empty> {
518    /// Create a new builder with all fields unset
519    pub fn new() -> Self {
520        ThreadgateBuilder {
521            _phantom_state: ::core::marker::PhantomData,
522            __unsafe_private_named: (None, None, None, None),
523            _phantom: ::core::marker::PhantomData,
524        }
525    }
526}
527
528impl<'a, S: threadgate_state::State> ThreadgateBuilder<'a, S> {
529    /// Set the `allow` field (optional)
530    pub fn allow(
531        mut self,
532        value: impl Into<Option<Vec<ThreadgateAllowItem<'a>>>>,
533    ) -> Self {
534        self.__unsafe_private_named.0 = value.into();
535        self
536    }
537    /// Set the `allow` field to an Option value (optional)
538    pub fn maybe_allow(mut self, value: Option<Vec<ThreadgateAllowItem<'a>>>) -> Self {
539        self.__unsafe_private_named.0 = value;
540        self
541    }
542}
543
544impl<'a, S> ThreadgateBuilder<'a, S>
545where
546    S: threadgate_state::State,
547    S::CreatedAt: threadgate_state::IsUnset,
548{
549    /// Set the `createdAt` field (required)
550    pub fn created_at(
551        mut self,
552        value: impl Into<jacquard_common::types::string::Datetime>,
553    ) -> ThreadgateBuilder<'a, threadgate_state::SetCreatedAt<S>> {
554        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
555        ThreadgateBuilder {
556            _phantom_state: ::core::marker::PhantomData,
557            __unsafe_private_named: self.__unsafe_private_named,
558            _phantom: ::core::marker::PhantomData,
559        }
560    }
561}
562
563impl<'a, S: threadgate_state::State> ThreadgateBuilder<'a, S> {
564    /// Set the `hiddenReplies` field (optional)
565    pub fn hidden_replies(
566        mut self,
567        value: impl Into<Option<Vec<jacquard_common::types::string::AtUri<'a>>>>,
568    ) -> Self {
569        self.__unsafe_private_named.2 = value.into();
570        self
571    }
572    /// Set the `hiddenReplies` field to an Option value (optional)
573    pub fn maybe_hidden_replies(
574        mut self,
575        value: Option<Vec<jacquard_common::types::string::AtUri<'a>>>,
576    ) -> Self {
577        self.__unsafe_private_named.2 = value;
578        self
579    }
580}
581
582impl<'a, S> ThreadgateBuilder<'a, S>
583where
584    S: threadgate_state::State,
585    S::Post: threadgate_state::IsUnset,
586{
587    /// Set the `post` field (required)
588    pub fn post(
589        mut self,
590        value: impl Into<jacquard_common::types::string::AtUri<'a>>,
591    ) -> ThreadgateBuilder<'a, threadgate_state::SetPost<S>> {
592        self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
593        ThreadgateBuilder {
594            _phantom_state: ::core::marker::PhantomData,
595            __unsafe_private_named: self.__unsafe_private_named,
596            _phantom: ::core::marker::PhantomData,
597        }
598    }
599}
600
601impl<'a, S> ThreadgateBuilder<'a, S>
602where
603    S: threadgate_state::State,
604    S::Post: threadgate_state::IsSet,
605    S::CreatedAt: threadgate_state::IsSet,
606{
607    /// Build the final struct
608    pub fn build(self) -> Threadgate<'a> {
609        Threadgate {
610            allow: self.__unsafe_private_named.0,
611            created_at: self.__unsafe_private_named.1.unwrap(),
612            hidden_replies: self.__unsafe_private_named.2,
613            post: self.__unsafe_private_named.3.unwrap(),
614            extra_data: Default::default(),
615        }
616    }
617    /// Build the final struct with custom extra_data
618    pub fn build_with_data(
619        self,
620        extra_data: std::collections::BTreeMap<
621            jacquard_common::smol_str::SmolStr,
622            jacquard_common::types::value::Data<'a>,
623        >,
624    ) -> Threadgate<'a> {
625        Threadgate {
626            allow: self.__unsafe_private_named.0,
627            created_at: self.__unsafe_private_named.1.unwrap(),
628            hidden_replies: self.__unsafe_private_named.2,
629            post: self.__unsafe_private_named.3.unwrap(),
630            extra_data: Some(extra_data),
631        }
632    }
633}
634
635impl<'a> Threadgate<'a> {
636    pub fn uri(
637        uri: impl Into<jacquard_common::CowStr<'a>>,
638    ) -> Result<
639        jacquard_common::types::uri::RecordUri<'a, ThreadgateRecord>,
640        jacquard_common::types::uri::UriError,
641    > {
642        jacquard_common::types::uri::RecordUri::try_from_uri(
643            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
644        )
645    }
646}
647
648#[jacquard_derive::open_union]
649#[derive(
650    serde::Serialize,
651    serde::Deserialize,
652    Debug,
653    Clone,
654    PartialEq,
655    Eq,
656    jacquard_derive::IntoStatic
657)]
658#[serde(tag = "$type")]
659#[serde(bound(deserialize = "'de: 'a"))]
660pub enum ThreadgateAllowItem<'a> {
661    #[serde(rename = "app.bsky.feed.threadgate#mentionRule")]
662    MentionRule(Box<crate::app_bsky::feed::threadgate::MentionRule<'a>>),
663    #[serde(rename = "app.bsky.feed.threadgate#followerRule")]
664    FollowerRule(Box<crate::app_bsky::feed::threadgate::FollowerRule<'a>>),
665    #[serde(rename = "app.bsky.feed.threadgate#followingRule")]
666    FollowingRule(Box<crate::app_bsky::feed::threadgate::FollowingRule<'a>>),
667    #[serde(rename = "app.bsky.feed.threadgate#listRule")]
668    ListRule(Box<crate::app_bsky::feed::threadgate::ListRule<'a>>),
669}
670
671/// Typed wrapper for GetRecord response with this collection's record type.
672#[derive(
673    serde::Serialize,
674    serde::Deserialize,
675    Debug,
676    Clone,
677    PartialEq,
678    Eq,
679    jacquard_derive::IntoStatic
680)]
681#[serde(rename_all = "camelCase")]
682pub struct ThreadgateGetRecordOutput<'a> {
683    #[serde(skip_serializing_if = "std::option::Option::is_none")]
684    #[serde(borrow)]
685    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
686    #[serde(borrow)]
687    pub uri: jacquard_common::types::string::AtUri<'a>,
688    #[serde(borrow)]
689    pub value: Threadgate<'a>,
690}
691
692impl From<ThreadgateGetRecordOutput<'_>> for Threadgate<'_> {
693    fn from(output: ThreadgateGetRecordOutput<'_>) -> Self {
694        use jacquard_common::IntoStatic;
695        output.value.into_static()
696    }
697}
698
699impl jacquard_common::types::collection::Collection for Threadgate<'_> {
700    const NSID: &'static str = "app.bsky.feed.threadgate";
701    type Record = ThreadgateRecord;
702}
703
704/// Marker type for deserializing records from this collection.
705#[derive(Debug, serde::Serialize, serde::Deserialize)]
706pub struct ThreadgateRecord;
707impl jacquard_common::xrpc::XrpcResp for ThreadgateRecord {
708    const NSID: &'static str = "app.bsky.feed.threadgate";
709    const ENCODING: &'static str = "application/json";
710    type Output<'de> = ThreadgateGetRecordOutput<'de>;
711    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
712}
713
714impl jacquard_common::types::collection::Collection for ThreadgateRecord {
715    const NSID: &'static str = "app.bsky.feed.threadgate";
716    type Record = ThreadgateRecord;
717}
718
719impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Threadgate<'a> {
720    fn nsid() -> &'static str {
721        "app.bsky.feed.threadgate"
722    }
723    fn def_name() -> &'static str {
724        "main"
725    }
726    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
727        lexicon_doc_app_bsky_feed_threadgate()
728    }
729    fn validate(
730        &self,
731    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
732        if let Some(ref value) = self.allow {
733            #[allow(unused_comparisons)]
734            if value.len() > 5usize {
735                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
736                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
737                        "allow",
738                    ),
739                    max: 5usize,
740                    actual: value.len(),
741                });
742            }
743        }
744        if let Some(ref value) = self.hidden_replies {
745            #[allow(unused_comparisons)]
746            if value.len() > 300usize {
747                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
748                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
749                        "hidden_replies",
750                    ),
751                    max: 300usize,
752                    actual: value.len(),
753                });
754            }
755        }
756        Ok(())
757    }
758}
759
760/// Allow replies from actors mentioned in your post.
761#[jacquard_derive::lexicon]
762#[derive(
763    serde::Serialize,
764    serde::Deserialize,
765    Debug,
766    Clone,
767    PartialEq,
768    Eq,
769    jacquard_derive::IntoStatic,
770    Default
771)]
772#[serde(rename_all = "camelCase")]
773pub struct MentionRule<'a> {}
774impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MentionRule<'a> {
775    fn nsid() -> &'static str {
776        "app.bsky.feed.threadgate"
777    }
778    fn def_name() -> &'static str {
779        "mentionRule"
780    }
781    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
782        lexicon_doc_app_bsky_feed_threadgate()
783    }
784    fn validate(
785        &self,
786    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
787        Ok(())
788    }
789}