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