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