A better Rust ATProto crate
at lifetimes 4.9 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.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///Deprecated: use facets instead. 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 Entity<'a> { 21 #[serde(borrow)] 22 pub index: crate::app_bsky::feed::post::TextSlice<'a>, 23 ///Expected values are 'mention' and 'link'. 24 #[serde(borrow)] 25 pub r#type: jacquard_common::CowStr<'a>, 26 #[serde(borrow)] 27 pub value: jacquard_common::CowStr<'a>, 28} 29 30///Record containing a Bluesky post. 31#[jacquard_derive::lexicon] 32#[derive( 33 serde::Serialize, 34 serde::Deserialize, 35 Debug, 36 Clone, 37 PartialEq, 38 Eq, 39 jacquard_derive::IntoStatic 40)] 41#[serde(rename_all = "camelCase")] 42pub struct Post<'a> { 43 ///Client-declared timestamp when this post was originally created. 44 pub created_at: jacquard_common::types::string::Datetime, 45 #[serde(skip_serializing_if = "std::option::Option::is_none")] 46 #[serde(borrow)] 47 pub embed: std::option::Option<PostRecordEmbed<'a>>, 48 ///DEPRECATED: replaced by app.bsky.richtext.facet. 49 #[serde(skip_serializing_if = "std::option::Option::is_none")] 50 #[serde(borrow)] 51 pub entities: std::option::Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>, 52 ///Annotations of text (mentions, URLs, hashtags, etc) 53 #[serde(skip_serializing_if = "std::option::Option::is_none")] 54 #[serde(borrow)] 55 pub facets: std::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, 56 ///Self-label values for this post. Effectively content warnings. 57 #[serde(skip_serializing_if = "std::option::Option::is_none")] 58 #[serde(borrow)] 59 pub labels: std::option::Option<PostRecordLabels<'a>>, 60 ///Indicates human language of post primary text content. 61 #[serde(skip_serializing_if = "std::option::Option::is_none")] 62 pub langs: std::option::Option<Vec<jacquard_common::types::string::Language>>, 63 #[serde(skip_serializing_if = "std::option::Option::is_none")] 64 #[serde(borrow)] 65 pub reply: std::option::Option<crate::app_bsky::feed::post::ReplyRef<'a>>, 66 ///Additional hashtags, in addition to any included in post text and facets. 67 #[serde(skip_serializing_if = "std::option::Option::is_none")] 68 #[serde(borrow)] 69 pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, 70 ///The primary post content. May be an empty string, if there are embeds. 71 #[serde(borrow)] 72 pub text: jacquard_common::CowStr<'a>, 73} 74 75#[jacquard_derive::open_union] 76#[derive( 77 serde::Serialize, 78 serde::Deserialize, 79 Debug, 80 Clone, 81 PartialEq, 82 Eq, 83 jacquard_derive::IntoStatic 84)] 85#[serde(tag = "$type")] 86#[serde(bound(deserialize = "'de: 'a"))] 87pub enum PostRecordEmbed<'a> { 88 #[serde(rename = "app.bsky.embed.images")] 89 Images(Box<crate::app_bsky::embed::images::Images<'a>>), 90 #[serde(rename = "app.bsky.embed.video")] 91 Video(Box<crate::app_bsky::embed::video::Video<'a>>), 92 #[serde(rename = "app.bsky.embed.external")] 93 External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>), 94 #[serde(rename = "app.bsky.embed.record")] 95 Record(Box<crate::app_bsky::embed::record::Record<'a>>), 96 #[serde(rename = "app.bsky.embed.recordWithMedia")] 97 RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>), 98} 99 100#[jacquard_derive::open_union] 101#[derive( 102 serde::Serialize, 103 serde::Deserialize, 104 Debug, 105 Clone, 106 PartialEq, 107 Eq, 108 jacquard_derive::IntoStatic 109)] 110#[serde(tag = "$type")] 111#[serde(bound(deserialize = "'de: 'a"))] 112pub enum PostRecordLabels<'a> { 113 #[serde(rename = "com.atproto.label.defs#selfLabels")] 114 DefsSelfLabels(Box<crate::com_atproto::label::SelfLabels<'a>>), 115} 116 117impl jacquard_common::types::collection::Collection for Post<'_> { 118 const NSID: &'static str = "app.bsky.feed.post"; 119} 120 121#[jacquard_derive::lexicon] 122#[derive( 123 serde::Serialize, 124 serde::Deserialize, 125 Debug, 126 Clone, 127 PartialEq, 128 Eq, 129 jacquard_derive::IntoStatic 130)] 131#[serde(rename_all = "camelCase")] 132pub struct ReplyRef<'a> { 133 #[serde(borrow)] 134 pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 135 #[serde(borrow)] 136 pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 137} 138 139///Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. 140#[jacquard_derive::lexicon] 141#[derive( 142 serde::Serialize, 143 serde::Deserialize, 144 Debug, 145 Clone, 146 PartialEq, 147 Eq, 148 jacquard_derive::IntoStatic 149)] 150#[serde(rename_all = "camelCase")] 151pub struct TextSlice<'a> { 152 pub end: i64, 153 pub start: i64, 154}