1pub mod badge;
9pub mod branding;
10pub mod broadcast;
11pub mod chat;
12pub mod graph;
13pub mod ingest;
14pub mod key;
15pub mod live;
16pub mod livestream;
17pub mod metadata;
18pub mod moderation;
19pub mod multistream;
20pub mod playback;
21pub mod richtext;
22pub mod segment;
23pub mod server;
24
25
26#[allow(unused_imports)]
27use alloc::collections::BTreeMap;
28
29#[allow(unused_imports)]
30use core::marker::PhantomData;
31use jacquard_common::CowStr;
32
33#[allow(unused_imports)]
34use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
35use jacquard_common::types::string::{AtUri, Cid, Datetime};
36use jacquard_derive::{IntoStatic, lexicon};
37use jacquard_lexicon::lexicon::LexiconDoc;
38use jacquard_lexicon::schema::LexiconSchema;
39
40#[allow(unused_imports)]
41use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
42use serde::{Serialize, Deserialize};
43use crate::app_bsky::actor::ProfileViewBasic;
44use crate::app_bsky::graph::block::Block;
45use crate::place_stream;
46
47#[lexicon]
48#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
49#[serde(rename_all = "camelCase")]
50pub struct BlockView<'a> {
51 #[serde(borrow)]
52 pub blocker: ProfileViewBasic<'a>,
53 #[serde(borrow)]
54 pub cid: Cid<'a>,
55 pub indexed_at: Datetime,
56 #[serde(borrow)]
57 pub record: Block<'a>,
58 #[serde(borrow)]
59 pub uri: AtUri<'a>,
60}
61
62
63#[lexicon]
64#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
65#[serde(rename_all = "camelCase")]
66pub struct Rendition<'a> {
67 #[serde(borrow)]
68 pub name: CowStr<'a>,
69}
70
71
72#[lexicon]
73#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
74#[serde(rename_all = "camelCase")]
75pub struct Renditions<'a> {
76 #[serde(borrow)]
77 pub renditions: Vec<place_stream::Rendition<'a>>,
78}
79
80impl<'a> LexiconSchema for BlockView<'a> {
81 fn nsid() -> &'static str {
82 "place.stream.defs"
83 }
84 fn def_name() -> &'static str {
85 "blockView"
86 }
87 fn lexicon_doc() -> LexiconDoc<'static> {
88 lexicon_doc_place_stream_defs()
89 }
90 fn validate(&self) -> Result<(), ConstraintError> {
91 Ok(())
92 }
93}
94
95impl<'a> LexiconSchema for Rendition<'a> {
96 fn nsid() -> &'static str {
97 "place.stream.defs"
98 }
99 fn def_name() -> &'static str {
100 "rendition"
101 }
102 fn lexicon_doc() -> LexiconDoc<'static> {
103 lexicon_doc_place_stream_defs()
104 }
105 fn validate(&self) -> Result<(), ConstraintError> {
106 Ok(())
107 }
108}
109
110impl<'a> LexiconSchema for Renditions<'a> {
111 fn nsid() -> &'static str {
112 "place.stream.defs"
113 }
114 fn def_name() -> &'static str {
115 "renditions"
116 }
117 fn lexicon_doc() -> LexiconDoc<'static> {
118 lexicon_doc_place_stream_defs()
119 }
120 fn validate(&self) -> Result<(), ConstraintError> {
121 Ok(())
122 }
123}
124
125pub mod block_view_state {
126
127 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
128 #[allow(unused)]
129 use ::core::marker::PhantomData;
130 mod sealed {
131 pub trait Sealed {}
132 }
133 pub trait State: sealed::Sealed {
135 type Record;
136 type Uri;
137 type IndexedAt;
138 type Cid;
139 type Blocker;
140 }
141 pub struct Empty(());
143 impl sealed::Sealed for Empty {}
144 impl State for Empty {
145 type Record = Unset;
146 type Uri = Unset;
147 type IndexedAt = Unset;
148 type Cid = Unset;
149 type Blocker = Unset;
150 }
151 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
153 impl<S: State> sealed::Sealed for SetRecord<S> {}
154 impl<S: State> State for SetRecord<S> {
155 type Record = Set<members::record>;
156 type Uri = S::Uri;
157 type IndexedAt = S::IndexedAt;
158 type Cid = S::Cid;
159 type Blocker = S::Blocker;
160 }
161 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
163 impl<S: State> sealed::Sealed for SetUri<S> {}
164 impl<S: State> State for SetUri<S> {
165 type Record = S::Record;
166 type Uri = Set<members::uri>;
167 type IndexedAt = S::IndexedAt;
168 type Cid = S::Cid;
169 type Blocker = S::Blocker;
170 }
171 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
173 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
174 impl<S: State> State for SetIndexedAt<S> {
175 type Record = S::Record;
176 type Uri = S::Uri;
177 type IndexedAt = Set<members::indexed_at>;
178 type Cid = S::Cid;
179 type Blocker = S::Blocker;
180 }
181 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
183 impl<S: State> sealed::Sealed for SetCid<S> {}
184 impl<S: State> State for SetCid<S> {
185 type Record = S::Record;
186 type Uri = S::Uri;
187 type IndexedAt = S::IndexedAt;
188 type Cid = Set<members::cid>;
189 type Blocker = S::Blocker;
190 }
191 pub struct SetBlocker<S: State = Empty>(PhantomData<fn() -> S>);
193 impl<S: State> sealed::Sealed for SetBlocker<S> {}
194 impl<S: State> State for SetBlocker<S> {
195 type Record = S::Record;
196 type Uri = S::Uri;
197 type IndexedAt = S::IndexedAt;
198 type Cid = S::Cid;
199 type Blocker = Set<members::blocker>;
200 }
201 #[allow(non_camel_case_types)]
203 pub mod members {
204 pub struct record(());
206 pub struct uri(());
208 pub struct indexed_at(());
210 pub struct cid(());
212 pub struct blocker(());
214 }
215}
216
217pub struct BlockViewBuilder<'a, S: block_view_state::State> {
219 _state: PhantomData<fn() -> S>,
220 _fields: (
221 Option<ProfileViewBasic<'a>>,
222 Option<Cid<'a>>,
223 Option<Datetime>,
224 Option<Block<'a>>,
225 Option<AtUri<'a>>,
226 ),
227 _lifetime: PhantomData<&'a ()>,
228}
229
230impl<'a> BlockView<'a> {
231 pub fn new() -> BlockViewBuilder<'a, block_view_state::Empty> {
233 BlockViewBuilder::new()
234 }
235}
236
237impl<'a> BlockViewBuilder<'a, block_view_state::Empty> {
238 pub fn new() -> Self {
240 BlockViewBuilder {
241 _state: PhantomData,
242 _fields: (None, None, None, None, None),
243 _lifetime: PhantomData,
244 }
245 }
246}
247
248impl<'a, S> BlockViewBuilder<'a, S>
249where
250 S: block_view_state::State,
251 S::Blocker: block_view_state::IsUnset,
252{
253 pub fn blocker(
255 mut self,
256 value: impl Into<ProfileViewBasic<'a>>,
257 ) -> BlockViewBuilder<'a, block_view_state::SetBlocker<S>> {
258 self._fields.0 = Option::Some(value.into());
259 BlockViewBuilder {
260 _state: PhantomData,
261 _fields: self._fields,
262 _lifetime: PhantomData,
263 }
264 }
265}
266
267impl<'a, S> BlockViewBuilder<'a, S>
268where
269 S: block_view_state::State,
270 S::Cid: block_view_state::IsUnset,
271{
272 pub fn cid(
274 mut self,
275 value: impl Into<Cid<'a>>,
276 ) -> BlockViewBuilder<'a, block_view_state::SetCid<S>> {
277 self._fields.1 = Option::Some(value.into());
278 BlockViewBuilder {
279 _state: PhantomData,
280 _fields: self._fields,
281 _lifetime: PhantomData,
282 }
283 }
284}
285
286impl<'a, S> BlockViewBuilder<'a, S>
287where
288 S: block_view_state::State,
289 S::IndexedAt: block_view_state::IsUnset,
290{
291 pub fn indexed_at(
293 mut self,
294 value: impl Into<Datetime>,
295 ) -> BlockViewBuilder<'a, block_view_state::SetIndexedAt<S>> {
296 self._fields.2 = Option::Some(value.into());
297 BlockViewBuilder {
298 _state: PhantomData,
299 _fields: self._fields,
300 _lifetime: PhantomData,
301 }
302 }
303}
304
305impl<'a, S> BlockViewBuilder<'a, S>
306where
307 S: block_view_state::State,
308 S::Record: block_view_state::IsUnset,
309{
310 pub fn record(
312 mut self,
313 value: impl Into<Block<'a>>,
314 ) -> BlockViewBuilder<'a, block_view_state::SetRecord<S>> {
315 self._fields.3 = Option::Some(value.into());
316 BlockViewBuilder {
317 _state: PhantomData,
318 _fields: self._fields,
319 _lifetime: PhantomData,
320 }
321 }
322}
323
324impl<'a, S> BlockViewBuilder<'a, S>
325where
326 S: block_view_state::State,
327 S::Uri: block_view_state::IsUnset,
328{
329 pub fn uri(
331 mut self,
332 value: impl Into<AtUri<'a>>,
333 ) -> BlockViewBuilder<'a, block_view_state::SetUri<S>> {
334 self._fields.4 = Option::Some(value.into());
335 BlockViewBuilder {
336 _state: PhantomData,
337 _fields: self._fields,
338 _lifetime: PhantomData,
339 }
340 }
341}
342
343impl<'a, S> BlockViewBuilder<'a, S>
344where
345 S: block_view_state::State,
346 S::Record: block_view_state::IsSet,
347 S::Uri: block_view_state::IsSet,
348 S::IndexedAt: block_view_state::IsSet,
349 S::Cid: block_view_state::IsSet,
350 S::Blocker: block_view_state::IsSet,
351{
352 pub fn build(self) -> BlockView<'a> {
354 BlockView {
355 blocker: self._fields.0.unwrap(),
356 cid: self._fields.1.unwrap(),
357 indexed_at: self._fields.2.unwrap(),
358 record: self._fields.3.unwrap(),
359 uri: self._fields.4.unwrap(),
360 extra_data: Default::default(),
361 }
362 }
363 pub fn build_with_data(
365 self,
366 extra_data: BTreeMap<
367 jacquard_common::deps::smol_str::SmolStr,
368 jacquard_common::types::value::Data<'a>,
369 >,
370 ) -> BlockView<'a> {
371 BlockView {
372 blocker: self._fields.0.unwrap(),
373 cid: self._fields.1.unwrap(),
374 indexed_at: self._fields.2.unwrap(),
375 record: self._fields.3.unwrap(),
376 uri: self._fields.4.unwrap(),
377 extra_data: Some(extra_data),
378 }
379 }
380}
381
382fn lexicon_doc_place_stream_defs() -> LexiconDoc<'static> {
383 #[allow(unused_imports)]
384 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
385 use jacquard_lexicon::lexicon::*;
386 use alloc::collections::BTreeMap;
387 LexiconDoc {
388 lexicon: Lexicon::Lexicon1,
389 id: CowStr::new_static("place.stream.defs"),
390 defs: {
391 let mut map = BTreeMap::new();
392 map.insert(
393 SmolStr::new_static("blockView"),
394 LexUserType::Object(LexObject {
395 required: Some(
396 vec![
397 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
398 SmolStr::new_static("blocker"),
399 SmolStr::new_static("record"),
400 SmolStr::new_static("indexedAt")
401 ],
402 ),
403 properties: {
404 #[allow(unused_mut)]
405 let mut map = BTreeMap::new();
406 map.insert(
407 SmolStr::new_static("blocker"),
408 LexObjectProperty::Ref(LexRef {
409 r#ref: CowStr::new_static(
410 "app.bsky.actor.defs#profileViewBasic",
411 ),
412 ..Default::default()
413 }),
414 );
415 map.insert(
416 SmolStr::new_static("cid"),
417 LexObjectProperty::String(LexString {
418 format: Some(LexStringFormat::Cid),
419 ..Default::default()
420 }),
421 );
422 map.insert(
423 SmolStr::new_static("indexedAt"),
424 LexObjectProperty::String(LexString {
425 format: Some(LexStringFormat::Datetime),
426 ..Default::default()
427 }),
428 );
429 map.insert(
430 SmolStr::new_static("record"),
431 LexObjectProperty::Ref(LexRef {
432 r#ref: CowStr::new_static("app.bsky.graph.block"),
433 ..Default::default()
434 }),
435 );
436 map.insert(
437 SmolStr::new_static("uri"),
438 LexObjectProperty::String(LexString {
439 format: Some(LexStringFormat::AtUri),
440 ..Default::default()
441 }),
442 );
443 map
444 },
445 ..Default::default()
446 }),
447 );
448 map.insert(
449 SmolStr::new_static("rendition"),
450 LexUserType::Object(LexObject {
451 required: Some(vec![SmolStr::new_static("name")]),
452 properties: {
453 #[allow(unused_mut)]
454 let mut map = BTreeMap::new();
455 map.insert(
456 SmolStr::new_static("name"),
457 LexObjectProperty::String(LexString { ..Default::default() }),
458 );
459 map
460 },
461 ..Default::default()
462 }),
463 );
464 map.insert(
465 SmolStr::new_static("renditions"),
466 LexUserType::Object(LexObject {
467 required: Some(vec![SmolStr::new_static("renditions")]),
468 properties: {
469 #[allow(unused_mut)]
470 let mut map = BTreeMap::new();
471 map.insert(
472 SmolStr::new_static("renditions"),
473 LexObjectProperty::Array(LexArray {
474 items: LexArrayItem::Ref(LexRef {
475 r#ref: CowStr::new_static("#rendition"),
476 ..Default::default()
477 }),
478 ..Default::default()
479 }),
480 );
481 map
482 },
483 ..Default::default()
484 }),
485 );
486 map
487 },
488 ..Default::default()
489 }
490}
491
492pub mod renditions_state {
493
494 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
495 #[allow(unused)]
496 use ::core::marker::PhantomData;
497 mod sealed {
498 pub trait Sealed {}
499 }
500 pub trait State: sealed::Sealed {
502 type Renditions;
503 }
504 pub struct Empty(());
506 impl sealed::Sealed for Empty {}
507 impl State for Empty {
508 type Renditions = Unset;
509 }
510 pub struct SetRenditions<S: State = Empty>(PhantomData<fn() -> S>);
512 impl<S: State> sealed::Sealed for SetRenditions<S> {}
513 impl<S: State> State for SetRenditions<S> {
514 type Renditions = Set<members::renditions>;
515 }
516 #[allow(non_camel_case_types)]
518 pub mod members {
519 pub struct renditions(());
521 }
522}
523
524pub struct RenditionsBuilder<'a, S: renditions_state::State> {
526 _state: PhantomData<fn() -> S>,
527 _fields: (Option<Vec<place_stream::Rendition<'a>>>,),
528 _lifetime: PhantomData<&'a ()>,
529}
530
531impl<'a> Renditions<'a> {
532 pub fn new() -> RenditionsBuilder<'a, renditions_state::Empty> {
534 RenditionsBuilder::new()
535 }
536}
537
538impl<'a> RenditionsBuilder<'a, renditions_state::Empty> {
539 pub fn new() -> Self {
541 RenditionsBuilder {
542 _state: PhantomData,
543 _fields: (None,),
544 _lifetime: PhantomData,
545 }
546 }
547}
548
549impl<'a, S> RenditionsBuilder<'a, S>
550where
551 S: renditions_state::State,
552 S::Renditions: renditions_state::IsUnset,
553{
554 pub fn renditions(
556 mut self,
557 value: impl Into<Vec<place_stream::Rendition<'a>>>,
558 ) -> RenditionsBuilder<'a, renditions_state::SetRenditions<S>> {
559 self._fields.0 = Option::Some(value.into());
560 RenditionsBuilder {
561 _state: PhantomData,
562 _fields: self._fields,
563 _lifetime: PhantomData,
564 }
565 }
566}
567
568impl<'a, S> RenditionsBuilder<'a, S>
569where
570 S: renditions_state::State,
571 S::Renditions: renditions_state::IsSet,
572{
573 pub fn build(self) -> Renditions<'a> {
575 Renditions {
576 renditions: self._fields.0.unwrap(),
577 extra_data: Default::default(),
578 }
579 }
580 pub fn build_with_data(
582 self,
583 extra_data: BTreeMap<
584 jacquard_common::deps::smol_str::SmolStr,
585 jacquard_common::types::value::Data<'a>,
586 >,
587 ) -> Renditions<'a> {
588 Renditions {
589 renditions: self._fields.0.unwrap(),
590 extra_data: Some(extra_data),
591 }
592 }
593}