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