1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: net.anisota.feed.draft
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8/// Record containing a draft post that can be edited and later published as app.bsky.feed.post
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 Draft<'a> {
22 /// Client-declared timestamp when this draft was originally 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<DraftEmbed<'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::draft::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 /// Client-declared timestamp when this draft was last updated.
56 #[serde(skip_serializing_if = "std::option::Option::is_none")]
57 #[builder(into)]
58 pub updated_at: Option<jacquard_common::types::string::Datetime>,
59}
60
61#[jacquard_derive::open_union]
62#[derive(
63 serde::Serialize,
64 serde::Deserialize,
65 Debug,
66 Clone,
67 PartialEq,
68 Eq,
69 jacquard_derive::IntoStatic
70)]
71#[serde(tag = "$type")]
72#[serde(bound(deserialize = "'de: 'a"))]
73pub enum DraftEmbed<'a> {
74 #[serde(rename = "app.bsky.embed.images")]
75 Images(Box<crate::app_bsky::embed::images::Images<'a>>),
76 #[serde(rename = "app.bsky.embed.video")]
77 Video(Box<crate::app_bsky::embed::video::Video<'a>>),
78 #[serde(rename = "app.bsky.embed.external")]
79 External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>),
80 #[serde(rename = "app.bsky.embed.record")]
81 Record(Box<crate::app_bsky::embed::record::Record<'a>>),
82 #[serde(rename = "app.bsky.embed.recordWithMedia")]
83 RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>),
84}
85
86/// Typed wrapper for GetRecord response with this collection's record type.
87#[derive(
88 serde::Serialize,
89 serde::Deserialize,
90 Debug,
91 Clone,
92 PartialEq,
93 Eq,
94 jacquard_derive::IntoStatic
95)]
96#[serde(rename_all = "camelCase")]
97pub struct DraftGetRecordOutput<'a> {
98 #[serde(skip_serializing_if = "std::option::Option::is_none")]
99 #[serde(borrow)]
100 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
101 #[serde(borrow)]
102 pub uri: jacquard_common::types::string::AtUri<'a>,
103 #[serde(borrow)]
104 pub value: Draft<'a>,
105}
106
107/// Marker type for deserializing records from this collection.
108pub struct DraftRecord;
109impl jacquard_common::xrpc::XrpcResp for DraftRecord {
110 const NSID: &'static str = "net.anisota.feed.draft";
111 const ENCODING: &'static str = "application/json";
112 type Output<'de> = DraftGetRecordOutput<'de>;
113 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
114}
115
116impl jacquard_common::types::collection::Collection for Draft<'_> {
117 const NSID: &'static str = "net.anisota.feed.draft";
118 type Record = DraftRecord;
119}
120
121impl From<DraftGetRecordOutput<'_>> for Draft<'_> {
122 fn from(output: DraftGetRecordOutput<'_>) -> Self {
123 use jacquard_common::IntoStatic;
124 output.value.into_static()
125 }
126}
127
128#[jacquard_derive::lexicon]
129#[derive(
130 serde::Serialize,
131 serde::Deserialize,
132 Debug,
133 Clone,
134 PartialEq,
135 Eq,
136 jacquard_derive::IntoStatic,
137 bon::Builder
138)]
139#[serde(rename_all = "camelCase")]
140pub struct ReplyRef<'a> {
141 #[serde(borrow)]
142 pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
143 #[serde(borrow)]
144 pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
145}