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)]
19#[serde(rename_all = "camelCase")]
20pub struct Draft<'a> {
21 ///Client-declared timestamp when this draft was originally created.
22 pub created_at: jacquard_common::types::string::Datetime,
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 #[serde(borrow)]
25 pub embed: std::option::Option<DraftEmbed<'a>>,
26 ///Annotations of text (mentions, URLs, hashtags, etc)
27 #[serde(skip_serializing_if = "std::option::Option::is_none")]
28 #[serde(borrow)]
29 pub facets: std::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
30 ///Self-label values for this post. Effectively content warnings.
31 #[serde(skip_serializing_if = "std::option::Option::is_none")]
32 #[serde(borrow)]
33 pub labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>,
34 ///Indicates human language of post primary text content.
35 #[serde(skip_serializing_if = "std::option::Option::is_none")]
36 pub langs: std::option::Option<Vec<jacquard_common::types::string::Language>>,
37 #[serde(skip_serializing_if = "std::option::Option::is_none")]
38 #[serde(borrow)]
39 pub reply: std::option::Option<crate::net_anisota::feed::draft::ReplyRef<'a>>,
40 ///Additional hashtags, in addition to any included in post text and facets.
41 #[serde(skip_serializing_if = "std::option::Option::is_none")]
42 #[serde(borrow)]
43 pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>,
44 ///The primary post content. May be an empty string, if there are embeds.
45 #[serde(borrow)]
46 pub text: jacquard_common::CowStr<'a>,
47 ///Client-declared timestamp when this draft was last updated.
48 #[serde(skip_serializing_if = "std::option::Option::is_none")]
49 pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>,
50}
51
52#[jacquard_derive::open_union]
53#[derive(
54 serde::Serialize,
55 serde::Deserialize,
56 Debug,
57 Clone,
58 PartialEq,
59 Eq,
60 jacquard_derive::IntoStatic
61)]
62#[serde(tag = "$type")]
63#[serde(bound(deserialize = "'de: 'a"))]
64pub enum DraftEmbed<'a> {
65 #[serde(rename = "app.bsky.embed.images")]
66 Images(Box<crate::app_bsky::embed::images::Images<'a>>),
67 #[serde(rename = "app.bsky.embed.video")]
68 Video(Box<crate::app_bsky::embed::video::Video<'a>>),
69 #[serde(rename = "app.bsky.embed.external")]
70 External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>),
71 #[serde(rename = "app.bsky.embed.record")]
72 Record(Box<crate::app_bsky::embed::record::Record<'a>>),
73 #[serde(rename = "app.bsky.embed.recordWithMedia")]
74 RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>),
75}
76
77/// Typed wrapper for GetRecord response with this collection's record type.
78#[derive(
79 serde::Serialize,
80 serde::Deserialize,
81 Debug,
82 Clone,
83 PartialEq,
84 Eq,
85 jacquard_derive::IntoStatic
86)]
87#[serde(rename_all = "camelCase")]
88pub struct DraftGetRecordOutput<'a> {
89 #[serde(skip_serializing_if = "std::option::Option::is_none")]
90 #[serde(borrow)]
91 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
92 #[serde(borrow)]
93 pub uri: jacquard_common::types::string::AtUri<'a>,
94 #[serde(borrow)]
95 pub value: Draft<'a>,
96}
97
98/// Marker type for deserializing records from this collection.
99pub struct DraftRecord;
100impl jacquard_common::xrpc::XrpcResp for DraftRecord {
101 const NSID: &'static str = "net.anisota.feed.draft";
102 const ENCODING: &'static str = "application/json";
103 type Output<'de> = DraftGetRecordOutput<'de>;
104 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
105}
106
107impl jacquard_common::types::collection::Collection for Draft<'_> {
108 const NSID: &'static str = "net.anisota.feed.draft";
109 type Record = DraftRecord;
110}
111
112impl From<DraftGetRecordOutput<'_>> for Draft<'_> {
113 fn from(output: DraftGetRecordOutput<'_>) -> Self {
114 use jacquard_common::IntoStatic;
115 output.value.into_static()
116 }
117}
118
119#[jacquard_derive::lexicon]
120#[derive(
121 serde::Serialize,
122 serde::Deserialize,
123 Debug,
124 Clone,
125 PartialEq,
126 Eq,
127 jacquard_derive::IntoStatic
128)]
129#[serde(rename_all = "camelCase")]
130pub struct ReplyRef<'a> {
131 #[serde(borrow)]
132 pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
133 #[serde(borrow)]
134 pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
135}