atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: pub.leaflet.blocks.bskyPost
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct BskyPost<'a> {
20 #[serde(borrow)]
21 pub post_ref: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
22}
23
24pub mod bsky_post_state {
25
26 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
27 #[allow(unused)]
28 use ::core::marker::PhantomData;
29 mod sealed {
30 pub trait Sealed {}
31 }
32 /// State trait tracking which required fields have been set
33 pub trait State: sealed::Sealed {
34 type PostRef;
35 }
36 /// Empty state - all required fields are unset
37 pub struct Empty(());
38 impl sealed::Sealed for Empty {}
39 impl State for Empty {
40 type PostRef = Unset;
41 }
42 ///State transition - sets the `post_ref` field to Set
43 pub struct SetPostRef<S: State = Empty>(PhantomData<fn() -> S>);
44 impl<S: State> sealed::Sealed for SetPostRef<S> {}
45 impl<S: State> State for SetPostRef<S> {
46 type PostRef = Set<members::post_ref>;
47 }
48 /// Marker types for field names
49 #[allow(non_camel_case_types)]
50 pub mod members {
51 ///Marker type for the `post_ref` field
52 pub struct post_ref(());
53 }
54}
55
56/// Builder for constructing an instance of this type
57pub struct BskyPostBuilder<'a, S: bsky_post_state::State> {
58 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
59 __unsafe_private_named: (
60 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
61 ),
62 _phantom: ::core::marker::PhantomData<&'a ()>,
63}
64
65impl<'a> BskyPost<'a> {
66 /// Create a new builder for this type
67 pub fn new() -> BskyPostBuilder<'a, bsky_post_state::Empty> {
68 BskyPostBuilder::new()
69 }
70}
71
72impl<'a> BskyPostBuilder<'a, bsky_post_state::Empty> {
73 /// Create a new builder with all fields unset
74 pub fn new() -> Self {
75 BskyPostBuilder {
76 _phantom_state: ::core::marker::PhantomData,
77 __unsafe_private_named: (None,),
78 _phantom: ::core::marker::PhantomData,
79 }
80 }
81}
82
83impl<'a, S> BskyPostBuilder<'a, S>
84where
85 S: bsky_post_state::State,
86 S::PostRef: bsky_post_state::IsUnset,
87{
88 /// Set the `postRef` field (required)
89 pub fn post_ref(
90 mut self,
91 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
92 ) -> BskyPostBuilder<'a, bsky_post_state::SetPostRef<S>> {
93 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
94 BskyPostBuilder {
95 _phantom_state: ::core::marker::PhantomData,
96 __unsafe_private_named: self.__unsafe_private_named,
97 _phantom: ::core::marker::PhantomData,
98 }
99 }
100}
101
102impl<'a, S> BskyPostBuilder<'a, S>
103where
104 S: bsky_post_state::State,
105 S::PostRef: bsky_post_state::IsSet,
106{
107 /// Build the final struct
108 pub fn build(self) -> BskyPost<'a> {
109 BskyPost {
110 post_ref: self.__unsafe_private_named.0.unwrap(),
111 extra_data: Default::default(),
112 }
113 }
114 /// Build the final struct with custom extra_data
115 pub fn build_with_data(
116 self,
117 extra_data: std::collections::BTreeMap<
118 jacquard_common::smol_str::SmolStr,
119 jacquard_common::types::value::Data<'a>,
120 >,
121 ) -> BskyPost<'a> {
122 BskyPost {
123 post_ref: self.__unsafe_private_named.0.unwrap(),
124 extra_data: Some(extra_data),
125 }
126 }
127}
128
129fn lexicon_doc_pub_leaflet_blocks_bskyPost() -> ::jacquard_lexicon::lexicon::LexiconDoc<
130 'static,
131> {
132 ::jacquard_lexicon::lexicon::LexiconDoc {
133 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
134 id: ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.bskyPost"),
135 revision: None,
136 description: None,
137 defs: {
138 let mut map = ::alloc::collections::BTreeMap::new();
139 map.insert(
140 ::jacquard_common::smol_str::SmolStr::new_static("main"),
141 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
142 description: None,
143 required: Some(
144 vec![::jacquard_common::smol_str::SmolStr::new_static("postRef")],
145 ),
146 nullable: None,
147 properties: {
148 #[allow(unused_mut)]
149 let mut map = ::alloc::collections::BTreeMap::new();
150 map.insert(
151 ::jacquard_common::smol_str::SmolStr::new_static("postRef"),
152 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
153 description: None,
154 r#ref: ::jacquard_common::CowStr::new_static(
155 "com.atproto.repo.strongRef",
156 ),
157 }),
158 );
159 map
160 },
161 }),
162 );
163 map
164 },
165 }
166}
167
168impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BskyPost<'a> {
169 fn nsid() -> &'static str {
170 "pub.leaflet.blocks.bskyPost"
171 }
172 fn def_name() -> &'static str {
173 "main"
174 }
175 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
176 lexicon_doc_pub_leaflet_blocks_bskyPost()
177 }
178 fn validate(
179 &self,
180 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
181 Ok(())
182 }
183}