jacquard_api/app_bsky/feed/
post.rs

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<PostEmbed<'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<crate::com_atproto::label::SelfLabels<'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 PostEmbed<'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/// Typed wrapper for GetRecord response with this collection's record type.
101#[derive(
102    serde::Serialize,
103    serde::Deserialize,
104    Debug,
105    Clone,
106    PartialEq,
107    Eq,
108    jacquard_derive::IntoStatic
109)]
110#[serde(rename_all = "camelCase")]
111pub struct PostGetRecordOutput<'a> {
112    #[serde(skip_serializing_if = "std::option::Option::is_none")]
113    #[serde(borrow)]
114    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
115    #[serde(borrow)]
116    pub uri: jacquard_common::types::string::AtUri<'a>,
117    #[serde(borrow)]
118    pub value: Post<'a>,
119}
120
121/// Marker type for deserializing records from this collection.
122pub struct PostRecord;
123impl jacquard_common::xrpc::XrpcResp for PostRecord {
124    const NSID: &'static str = "app.bsky.feed.post";
125    const ENCODING: &'static str = "application/json";
126    type Output<'de> = PostGetRecordOutput<'de>;
127    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
128}
129
130impl jacquard_common::types::collection::Collection for Post<'_> {
131    const NSID: &'static str = "app.bsky.feed.post";
132    type Record = PostRecord;
133}
134
135impl From<PostGetRecordOutput<'_>> for Post<'_> {
136    fn from(output: PostGetRecordOutput<'_>) -> Self {
137        use jacquard_common::IntoStatic;
138        output.value.into_static()
139    }
140}
141
142#[jacquard_derive::lexicon]
143#[derive(
144    serde::Serialize,
145    serde::Deserialize,
146    Debug,
147    Clone,
148    PartialEq,
149    Eq,
150    jacquard_derive::IntoStatic
151)]
152#[serde(rename_all = "camelCase")]
153pub struct ReplyRef<'a> {
154    #[serde(borrow)]
155    pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
156    #[serde(borrow)]
157    pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
158}
159
160///Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.
161#[jacquard_derive::lexicon]
162#[derive(
163    serde::Serialize,
164    serde::Deserialize,
165    Debug,
166    Clone,
167    PartialEq,
168    Eq,
169    jacquard_derive::IntoStatic
170)]
171#[serde(rename_all = "camelCase")]
172pub struct TextSlice<'a> {
173    pub end: i64,
174    pub start: i64,
175}