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)]
19#[serde(rename_all = "camelCase")]
20pub struct FollowerRule<'a> {}
21///Allow replies from actors you follow.
22#[jacquard_derive::lexicon]
23#[derive(
24    serde::Serialize,
25    serde::Deserialize,
26    Debug,
27    Clone,
28    PartialEq,
29    Eq,
30    jacquard_derive::IntoStatic
31)]
32#[serde(rename_all = "camelCase")]
33pub struct FollowingRule<'a> {}
34///Allow replies from actors on a list.
35#[jacquard_derive::lexicon]
36#[derive(
37    serde::Serialize,
38    serde::Deserialize,
39    Debug,
40    Clone,
41    PartialEq,
42    Eq,
43    jacquard_derive::IntoStatic
44)]
45#[serde(rename_all = "camelCase")]
46pub struct ListRule<'a> {
47    #[serde(borrow)]
48    pub list: jacquard_common::types::string::AtUri<'a>,
49}
50
51///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.
52#[jacquard_derive::lexicon]
53#[derive(
54    serde::Serialize,
55    serde::Deserialize,
56    Debug,
57    Clone,
58    PartialEq,
59    Eq,
60    jacquard_derive::IntoStatic
61)]
62#[serde(rename_all = "camelCase")]
63pub struct Threadgate<'a> {
64    ///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.
65    #[serde(skip_serializing_if = "std::option::Option::is_none")]
66    #[serde(borrow)]
67    pub allow: std::option::Option<Vec<ThreadgateAllowItem<'a>>>,
68    pub created_at: jacquard_common::types::string::Datetime,
69    ///List of hidden reply URIs.
70    #[serde(skip_serializing_if = "std::option::Option::is_none")]
71    #[serde(borrow)]
72    pub hidden_replies: std::option::Option<
73        Vec<jacquard_common::types::string::AtUri<'a>>,
74    >,
75    ///Reference (AT-URI) to the post record.
76    #[serde(borrow)]
77    pub post: jacquard_common::types::string::AtUri<'a>,
78}
79
80#[jacquard_derive::open_union]
81#[derive(
82    serde::Serialize,
83    serde::Deserialize,
84    Debug,
85    Clone,
86    PartialEq,
87    Eq,
88    jacquard_derive::IntoStatic
89)]
90#[serde(tag = "$type")]
91#[serde(bound(deserialize = "'de: 'a"))]
92pub enum ThreadgateAllowItem<'a> {
93    #[serde(rename = "app.bsky.feed.threadgate#mentionRule")]
94    MentionRule(Box<crate::app_bsky::feed::threadgate::MentionRule<'a>>),
95    #[serde(rename = "app.bsky.feed.threadgate#followerRule")]
96    FollowerRule(Box<crate::app_bsky::feed::threadgate::FollowerRule<'a>>),
97    #[serde(rename = "app.bsky.feed.threadgate#followingRule")]
98    FollowingRule(Box<crate::app_bsky::feed::threadgate::FollowingRule<'a>>),
99    #[serde(rename = "app.bsky.feed.threadgate#listRule")]
100    ListRule(Box<crate::app_bsky::feed::threadgate::ListRule<'a>>),
101}
102
103/// Typed wrapper for GetRecord response with this collection's record type.
104#[derive(
105    serde::Serialize,
106    serde::Deserialize,
107    Debug,
108    Clone,
109    PartialEq,
110    Eq,
111    jacquard_derive::IntoStatic
112)]
113#[serde(rename_all = "camelCase")]
114pub struct ThreadgateGetRecordOutput<'a> {
115    #[serde(skip_serializing_if = "std::option::Option::is_none")]
116    #[serde(borrow)]
117    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
118    #[serde(borrow)]
119    pub uri: jacquard_common::types::string::AtUri<'a>,
120    #[serde(borrow)]
121    pub value: Threadgate<'a>,
122}
123
124/// Marker type for deserializing records from this collection.
125pub struct ThreadgateRecord;
126impl jacquard_common::xrpc::XrpcResp for ThreadgateRecord {
127    const NSID: &'static str = "app.bsky.feed.threadgate";
128    const ENCODING: &'static str = "application/json";
129    type Output<'de> = ThreadgateGetRecordOutput<'de>;
130    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
131}
132
133impl jacquard_common::types::collection::Collection for Threadgate<'_> {
134    const NSID: &'static str = "app.bsky.feed.threadgate";
135    type Record = ThreadgateRecord;
136}
137
138impl From<ThreadgateGetRecordOutput<'_>> for Threadgate<'_> {
139    fn from(output: ThreadgateGetRecordOutput<'_>) -> Self {
140        use jacquard_common::IntoStatic;
141        output.value.into_static()
142    }
143}
144
145///Allow replies from actors mentioned in your post.
146#[jacquard_derive::lexicon]
147#[derive(
148    serde::Serialize,
149    serde::Deserialize,
150    Debug,
151    Clone,
152    PartialEq,
153    Eq,
154    jacquard_derive::IntoStatic
155)]
156#[serde(rename_all = "camelCase")]
157pub struct MentionRule<'a> {}