A better Rust ATProto crate
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: net.anisota.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///A post that can be created on the Anisota network 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 Post<'a> { 21 ///Client-declared timestamp when this post was created. 22 pub created_at: jacquard_common::types::string::Datetime, 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[serde(borrow)] 25 pub embed: std::option::Option<PostEmbed<'a>>, 26 ///Annotations of text (mentions, URLs, hashtags, etc) 27 #[serde(skip_serializing_if = "std::option::Option::is_none")] 28 #[serde(borrow)] 29 pub facets: std::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, 30 ///Self-label values for this post. Effectively content warnings. 31 #[serde(skip_serializing_if = "std::option::Option::is_none")] 32 #[serde(borrow)] 33 pub labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>, 34 ///Indicates human language of post primary text content. 35 #[serde(skip_serializing_if = "std::option::Option::is_none")] 36 pub langs: std::option::Option<Vec<jacquard_common::types::string::Language>>, 37 #[serde(skip_serializing_if = "std::option::Option::is_none")] 38 #[serde(borrow)] 39 pub reply: std::option::Option<crate::net_anisota::feed::post::ReplyRef<'a>>, 40 ///Additional hashtags, in addition to any included in post text and facets. 41 #[serde(skip_serializing_if = "std::option::Option::is_none")] 42 #[serde(borrow)] 43 pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, 44 ///The primary post content. May be an empty string, if there are embeds. 45 #[serde(borrow)] 46 pub text: jacquard_common::CowStr<'a>, 47} 48 49#[jacquard_derive::open_union] 50#[derive( 51 serde::Serialize, 52 serde::Deserialize, 53 Debug, 54 Clone, 55 PartialEq, 56 Eq, 57 jacquard_derive::IntoStatic 58)] 59#[serde(tag = "$type")] 60#[serde(bound(deserialize = "'de: 'a"))] 61pub enum PostEmbed<'a> { 62 #[serde(rename = "app.bsky.embed.images")] 63 Images(Box<crate::app_bsky::embed::images::Images<'a>>), 64 #[serde(rename = "app.bsky.embed.video")] 65 Video(Box<crate::app_bsky::embed::video::Video<'a>>), 66 #[serde(rename = "app.bsky.embed.external")] 67 External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>), 68 #[serde(rename = "app.bsky.embed.record")] 69 Record(Box<crate::app_bsky::embed::record::Record<'a>>), 70 #[serde(rename = "app.bsky.embed.recordWithMedia")] 71 RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>), 72} 73 74/// Typed wrapper for GetRecord response with this collection's record type. 75#[derive( 76 serde::Serialize, 77 serde::Deserialize, 78 Debug, 79 Clone, 80 PartialEq, 81 Eq, 82 jacquard_derive::IntoStatic 83)] 84#[serde(rename_all = "camelCase")] 85pub struct PostGetRecordOutput<'a> { 86 #[serde(skip_serializing_if = "std::option::Option::is_none")] 87 #[serde(borrow)] 88 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 89 #[serde(borrow)] 90 pub uri: jacquard_common::types::string::AtUri<'a>, 91 #[serde(borrow)] 92 pub value: Post<'a>, 93} 94 95/// Marker type for deserializing records from this collection. 96pub struct PostRecord; 97impl jacquard_common::xrpc::XrpcResp for PostRecord { 98 const NSID: &'static str = "net.anisota.feed.post"; 99 const ENCODING: &'static str = "application/json"; 100 type Output<'de> = PostGetRecordOutput<'de>; 101 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 102} 103 104impl jacquard_common::types::collection::Collection for Post<'_> { 105 const NSID: &'static str = "net.anisota.feed.post"; 106 type Record = PostRecord; 107} 108 109impl From<PostGetRecordOutput<'_>> for Post<'_> { 110 fn from(output: PostGetRecordOutput<'_>) -> Self { 111 use jacquard_common::IntoStatic; 112 output.value.into_static() 113 } 114} 115 116#[jacquard_derive::lexicon] 117#[derive( 118 serde::Serialize, 119 serde::Deserialize, 120 Debug, 121 Clone, 122 PartialEq, 123 Eq, 124 jacquard_derive::IntoStatic 125)] 126#[serde(rename_all = "camelCase")] 127pub struct ReplyRef<'a> { 128 #[serde(borrow)] 129 pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 130 #[serde(borrow)] 131 pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 132}