atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: blog.pckt.content
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 Content<'a> {
20 /// Array of content blocks
21 #[serde(borrow)]
22 pub items: Vec<jacquard_common::types::value::Data<'a>>,
23}
24
25pub mod content_state {
26
27 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
28 #[allow(unused)]
29 use ::core::marker::PhantomData;
30 mod sealed {
31 pub trait Sealed {}
32 }
33 /// State trait tracking which required fields have been set
34 pub trait State: sealed::Sealed {
35 type Items;
36 }
37 /// Empty state - all required fields are unset
38 pub struct Empty(());
39 impl sealed::Sealed for Empty {}
40 impl State for Empty {
41 type Items = Unset;
42 }
43 ///State transition - sets the `items` field to Set
44 pub struct SetItems<S: State = Empty>(PhantomData<fn() -> S>);
45 impl<S: State> sealed::Sealed for SetItems<S> {}
46 impl<S: State> State for SetItems<S> {
47 type Items = Set<members::items>;
48 }
49 /// Marker types for field names
50 #[allow(non_camel_case_types)]
51 pub mod members {
52 ///Marker type for the `items` field
53 pub struct items(());
54 }
55}
56
57/// Builder for constructing an instance of this type
58pub struct ContentBuilder<'a, S: content_state::State> {
59 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
60 __unsafe_private_named: (
61 ::core::option::Option<Vec<jacquard_common::types::value::Data<'a>>>,
62 ),
63 _phantom: ::core::marker::PhantomData<&'a ()>,
64}
65
66impl<'a> Content<'a> {
67 /// Create a new builder for this type
68 pub fn new() -> ContentBuilder<'a, content_state::Empty> {
69 ContentBuilder::new()
70 }
71}
72
73impl<'a> ContentBuilder<'a, content_state::Empty> {
74 /// Create a new builder with all fields unset
75 pub fn new() -> Self {
76 ContentBuilder {
77 _phantom_state: ::core::marker::PhantomData,
78 __unsafe_private_named: (None,),
79 _phantom: ::core::marker::PhantomData,
80 }
81 }
82}
83
84impl<'a, S> ContentBuilder<'a, S>
85where
86 S: content_state::State,
87 S::Items: content_state::IsUnset,
88{
89 /// Set the `items` field (required)
90 pub fn items(
91 mut self,
92 value: impl Into<Vec<jacquard_common::types::value::Data<'a>>>,
93 ) -> ContentBuilder<'a, content_state::SetItems<S>> {
94 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
95 ContentBuilder {
96 _phantom_state: ::core::marker::PhantomData,
97 __unsafe_private_named: self.__unsafe_private_named,
98 _phantom: ::core::marker::PhantomData,
99 }
100 }
101}
102
103impl<'a, S> ContentBuilder<'a, S>
104where
105 S: content_state::State,
106 S::Items: content_state::IsSet,
107{
108 /// Build the final struct
109 pub fn build(self) -> Content<'a> {
110 Content {
111 items: self.__unsafe_private_named.0.unwrap(),
112 extra_data: Default::default(),
113 }
114 }
115 /// Build the final struct with custom extra_data
116 pub fn build_with_data(
117 self,
118 extra_data: std::collections::BTreeMap<
119 jacquard_common::smol_str::SmolStr,
120 jacquard_common::types::value::Data<'a>,
121 >,
122 ) -> Content<'a> {
123 Content {
124 items: self.__unsafe_private_named.0.unwrap(),
125 extra_data: Some(extra_data),
126 }
127 }
128}
129
130fn lexicon_doc_blog_pckt_content() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
131 ::jacquard_lexicon::lexicon::LexiconDoc {
132 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
133 id: ::jacquard_common::CowStr::new_static("blog.pckt.content"),
134 revision: None,
135 description: None,
136 defs: {
137 let mut map = ::alloc::collections::BTreeMap::new();
138 map.insert(
139 ::jacquard_common::smol_str::SmolStr::new_static("main"),
140 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
141 description: None,
142 required: Some(
143 vec![::jacquard_common::smol_str::SmolStr::new_static("items")],
144 ),
145 nullable: None,
146 properties: {
147 #[allow(unused_mut)]
148 let mut map = ::alloc::collections::BTreeMap::new();
149 map.insert(
150 ::jacquard_common::smol_str::SmolStr::new_static("items"),
151 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
152 description: Some(
153 ::jacquard_common::CowStr::new_static(
154 "Array of content blocks",
155 ),
156 ),
157 items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion {
158 description: None,
159 refs: vec![],
160 closed: Some(false),
161 }),
162 min_length: None,
163 max_length: None,
164 }),
165 );
166 map
167 },
168 }),
169 );
170 map
171 },
172 }
173}
174
175impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Content<'a> {
176 fn nsid() -> &'static str {
177 "blog.pckt.content"
178 }
179 fn def_name() -> &'static str {
180 "main"
181 }
182 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
183 lexicon_doc_blog_pckt_content()
184 }
185 fn validate(
186 &self,
187 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
188 Ok(())
189 }
190}