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 bon::Builder
19)]
20#[serde(rename_all = "camelCase")]
21pub struct Entity<'a> {
22 #[serde(borrow)]
23 pub index: crate::app_bsky::feed::post::TextSlice<'a>,
24 /// Expected values are 'mention' and 'link'.
25 #[serde(borrow)]
26 #[builder(into)]
27 pub r#type: jacquard_common::CowStr<'a>,
28 #[serde(borrow)]
29 #[builder(into)]
30 pub value: jacquard_common::CowStr<'a>,
31}
32
33/// Record containing a Bluesky post.
34#[jacquard_derive::lexicon]
35#[derive(
36 serde::Serialize,
37 serde::Deserialize,
38 Debug,
39 Clone,
40 PartialEq,
41 Eq,
42 jacquard_derive::IntoStatic,
43 bon::Builder
44)]
45#[serde(rename_all = "camelCase")]
46pub struct Post<'a> {
47 /// Client-declared timestamp when this post was originally created.
48 pub created_at: jacquard_common::types::string::Datetime,
49 #[serde(skip_serializing_if = "std::option::Option::is_none")]
50 #[builder(into)]
51 #[serde(borrow)]
52 pub embed: Option<PostEmbed<'a>>,
53 /// DEPRECATED: replaced by app.bsky.richtext.facet.
54 #[serde(skip_serializing_if = "std::option::Option::is_none")]
55 #[builder(into)]
56 #[serde(borrow)]
57 pub entities: Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
58 /// Annotations of text (mentions, URLs, hashtags, etc)
59 #[serde(skip_serializing_if = "std::option::Option::is_none")]
60 #[builder(into)]
61 #[serde(borrow)]
62 pub facets: Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
63 /// Self-label values for this post. Effectively content warnings.
64 #[serde(skip_serializing_if = "std::option::Option::is_none")]
65 #[builder(into)]
66 #[serde(borrow)]
67 pub labels: Option<crate::com_atproto::label::SelfLabels<'a>>,
68 /// Indicates human language of post primary text content.
69 #[serde(skip_serializing_if = "std::option::Option::is_none")]
70 #[builder(into)]
71 pub langs: Option<Vec<jacquard_common::types::string::Language>>,
72 #[serde(skip_serializing_if = "std::option::Option::is_none")]
73 #[builder(into)]
74 #[serde(borrow)]
75 pub reply: Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
76 /// Additional hashtags, in addition to any included in post text and facets.
77 #[serde(skip_serializing_if = "std::option::Option::is_none")]
78 #[builder(into)]
79 #[serde(borrow)]
80 pub tags: Option<Vec<jacquard_common::CowStr<'a>>>,
81 /// The primary post content. May be an empty string, if there are embeds.
82 #[serde(borrow)]
83 #[builder(into)]
84 pub text: jacquard_common::CowStr<'a>,
85}
86
87#[jacquard_derive::open_union]
88#[derive(
89 serde::Serialize,
90 serde::Deserialize,
91 Debug,
92 Clone,
93 PartialEq,
94 Eq,
95 jacquard_derive::IntoStatic
96)]
97#[serde(tag = "$type")]
98#[serde(bound(deserialize = "'de: 'a"))]
99pub enum PostEmbed<'a> {
100 #[serde(rename = "app.bsky.embed.images")]
101 Images(Box<crate::app_bsky::embed::images::Images<'a>>),
102 #[serde(rename = "app.bsky.embed.video")]
103 Video(Box<crate::app_bsky::embed::video::Video<'a>>),
104 #[serde(rename = "app.bsky.embed.external")]
105 External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>),
106 #[serde(rename = "app.bsky.embed.record")]
107 Record(Box<crate::app_bsky::embed::record::Record<'a>>),
108 #[serde(rename = "app.bsky.embed.recordWithMedia")]
109 RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>),
110}
111
112/// Typed wrapper for GetRecord response with this collection's record type.
113#[derive(
114 serde::Serialize,
115 serde::Deserialize,
116 Debug,
117 Clone,
118 PartialEq,
119 Eq,
120 jacquard_derive::IntoStatic
121)]
122#[serde(rename_all = "camelCase")]
123pub struct PostGetRecordOutput<'a> {
124 #[serde(skip_serializing_if = "std::option::Option::is_none")]
125 #[serde(borrow)]
126 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
127 #[serde(borrow)]
128 pub uri: jacquard_common::types::string::AtUri<'a>,
129 #[serde(borrow)]
130 pub value: Post<'a>,
131}
132
133/// Marker type for deserializing records from this collection.
134pub struct PostRecord;
135impl jacquard_common::xrpc::XrpcResp for PostRecord {
136 const NSID: &'static str = "app.bsky.feed.post";
137 const ENCODING: &'static str = "application/json";
138 type Output<'de> = PostGetRecordOutput<'de>;
139 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
140}
141
142impl jacquard_common::types::collection::Collection for Post<'_> {
143 const NSID: &'static str = "app.bsky.feed.post";
144 type Record = PostRecord;
145}
146
147impl From<PostGetRecordOutput<'_>> for Post<'_> {
148 fn from(output: PostGetRecordOutput<'_>) -> Self {
149 use jacquard_common::IntoStatic;
150 output.value.into_static()
151 }
152}
153
154#[jacquard_derive::lexicon]
155#[derive(
156 serde::Serialize,
157 serde::Deserialize,
158 Debug,
159 Clone,
160 PartialEq,
161 Eq,
162 jacquard_derive::IntoStatic,
163 bon::Builder
164)]
165#[serde(rename_all = "camelCase")]
166pub struct ReplyRef<'a> {
167 #[serde(borrow)]
168 pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
169 #[serde(borrow)]
170 pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
171}
172
173/// Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.
174#[jacquard_derive::lexicon]
175#[derive(
176 serde::Serialize,
177 serde::Deserialize,
178 Debug,
179 Clone,
180 PartialEq,
181 Eq,
182 jacquard_derive::IntoStatic,
183 bon::Builder
184)]
185#[serde(rename_all = "camelCase")]
186pub struct TextSlice<'a> {
187 pub end: i64,
188 pub start: i64,
189}