atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.embed.video
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 Caption<'a> {
20 #[serde(borrow)]
21 pub file: jacquard_common::types::blob::BlobRef<'a>,
22 pub lang: jacquard_common::types::string::Language,
23}
24
25pub mod caption_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 File;
36 type Lang;
37 }
38 /// Empty state - all required fields are unset
39 pub struct Empty(());
40 impl sealed::Sealed for Empty {}
41 impl State for Empty {
42 type File = Unset;
43 type Lang = Unset;
44 }
45 ///State transition - sets the `file` field to Set
46 pub struct SetFile<S: State = Empty>(PhantomData<fn() -> S>);
47 impl<S: State> sealed::Sealed for SetFile<S> {}
48 impl<S: State> State for SetFile<S> {
49 type File = Set<members::file>;
50 type Lang = S::Lang;
51 }
52 ///State transition - sets the `lang` field to Set
53 pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>);
54 impl<S: State> sealed::Sealed for SetLang<S> {}
55 impl<S: State> State for SetLang<S> {
56 type File = S::File;
57 type Lang = Set<members::lang>;
58 }
59 /// Marker types for field names
60 #[allow(non_camel_case_types)]
61 pub mod members {
62 ///Marker type for the `file` field
63 pub struct file(());
64 ///Marker type for the `lang` field
65 pub struct lang(());
66 }
67}
68
69/// Builder for constructing an instance of this type
70pub struct CaptionBuilder<'a, S: caption_state::State> {
71 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
72 __unsafe_private_named: (
73 ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
74 ::core::option::Option<jacquard_common::types::string::Language>,
75 ),
76 _phantom: ::core::marker::PhantomData<&'a ()>,
77}
78
79impl<'a> Caption<'a> {
80 /// Create a new builder for this type
81 pub fn new() -> CaptionBuilder<'a, caption_state::Empty> {
82 CaptionBuilder::new()
83 }
84}
85
86impl<'a> CaptionBuilder<'a, caption_state::Empty> {
87 /// Create a new builder with all fields unset
88 pub fn new() -> Self {
89 CaptionBuilder {
90 _phantom_state: ::core::marker::PhantomData,
91 __unsafe_private_named: (None, None),
92 _phantom: ::core::marker::PhantomData,
93 }
94 }
95}
96
97impl<'a, S> CaptionBuilder<'a, S>
98where
99 S: caption_state::State,
100 S::File: caption_state::IsUnset,
101{
102 /// Set the `file` field (required)
103 pub fn file(
104 mut self,
105 value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
106 ) -> CaptionBuilder<'a, caption_state::SetFile<S>> {
107 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
108 CaptionBuilder {
109 _phantom_state: ::core::marker::PhantomData,
110 __unsafe_private_named: self.__unsafe_private_named,
111 _phantom: ::core::marker::PhantomData,
112 }
113 }
114}
115
116impl<'a, S> CaptionBuilder<'a, S>
117where
118 S: caption_state::State,
119 S::Lang: caption_state::IsUnset,
120{
121 /// Set the `lang` field (required)
122 pub fn lang(
123 mut self,
124 value: impl Into<jacquard_common::types::string::Language>,
125 ) -> CaptionBuilder<'a, caption_state::SetLang<S>> {
126 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
127 CaptionBuilder {
128 _phantom_state: ::core::marker::PhantomData,
129 __unsafe_private_named: self.__unsafe_private_named,
130 _phantom: ::core::marker::PhantomData,
131 }
132 }
133}
134
135impl<'a, S> CaptionBuilder<'a, S>
136where
137 S: caption_state::State,
138 S::File: caption_state::IsSet,
139 S::Lang: caption_state::IsSet,
140{
141 /// Build the final struct
142 pub fn build(self) -> Caption<'a> {
143 Caption {
144 file: self.__unsafe_private_named.0.unwrap(),
145 lang: self.__unsafe_private_named.1.unwrap(),
146 extra_data: Default::default(),
147 }
148 }
149 /// Build the final struct with custom extra_data
150 pub fn build_with_data(
151 self,
152 extra_data: std::collections::BTreeMap<
153 jacquard_common::smol_str::SmolStr,
154 jacquard_common::types::value::Data<'a>,
155 >,
156 ) -> Caption<'a> {
157 Caption {
158 file: self.__unsafe_private_named.0.unwrap(),
159 lang: self.__unsafe_private_named.1.unwrap(),
160 extra_data: Some(extra_data),
161 }
162 }
163}
164
165fn lexicon_doc_sh_weaver_embed_video() -> ::jacquard_lexicon::lexicon::LexiconDoc<
166 'static,
167> {
168 ::jacquard_lexicon::lexicon::LexiconDoc {
169 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
170 id: ::jacquard_common::CowStr::new_static("sh.weaver.embed.video"),
171 revision: None,
172 description: None,
173 defs: {
174 let mut map = ::alloc::collections::BTreeMap::new();
175 map.insert(
176 ::jacquard_common::smol_str::SmolStr::new_static("caption"),
177 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
178 description: None,
179 required: Some(
180 vec![
181 ::jacquard_common::smol_str::SmolStr::new_static("lang"),
182 ::jacquard_common::smol_str::SmolStr::new_static("file")
183 ],
184 ),
185 nullable: None,
186 properties: {
187 #[allow(unused_mut)]
188 let mut map = ::alloc::collections::BTreeMap::new();
189 map.insert(
190 ::jacquard_common::smol_str::SmolStr::new_static("file"),
191 ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
192 description: None,
193 accept: None,
194 max_size: None,
195 }),
196 );
197 map.insert(
198 ::jacquard_common::smol_str::SmolStr::new_static("lang"),
199 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
200 description: None,
201 format: Some(
202 ::jacquard_lexicon::lexicon::LexStringFormat::Language,
203 ),
204 default: None,
205 min_length: None,
206 max_length: None,
207 min_graphemes: None,
208 max_graphemes: None,
209 r#enum: None,
210 r#const: None,
211 known_values: None,
212 }),
213 );
214 map
215 },
216 }),
217 );
218 map.insert(
219 ::jacquard_common::smol_str::SmolStr::new_static("main"),
220 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
221 description: None,
222 required: Some(
223 vec![::jacquard_common::smol_str::SmolStr::new_static("videos")],
224 ),
225 nullable: None,
226 properties: {
227 #[allow(unused_mut)]
228 let mut map = ::alloc::collections::BTreeMap::new();
229 map.insert(
230 ::jacquard_common::smol_str::SmolStr::new_static("videos"),
231 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
232 description: None,
233 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
234 description: None,
235 r#ref: ::jacquard_common::CowStr::new_static("#video"),
236 }),
237 min_length: None,
238 max_length: None,
239 }),
240 );
241 map
242 },
243 }),
244 );
245 map.insert(
246 ::jacquard_common::smol_str::SmolStr::new_static("video"),
247 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
248 description: None,
249 required: Some(
250 vec![::jacquard_common::smol_str::SmolStr::new_static("video")],
251 ),
252 nullable: None,
253 properties: {
254 #[allow(unused_mut)]
255 let mut map = ::alloc::collections::BTreeMap::new();
256 map.insert(
257 ::jacquard_common::smol_str::SmolStr::new_static("alt"),
258 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
259 description: Some(
260 ::jacquard_common::CowStr::new_static(
261 "Alt text description of the video, for accessibility.",
262 ),
263 ),
264 format: None,
265 default: None,
266 min_length: None,
267 max_length: Some(10000usize),
268 min_graphemes: None,
269 max_graphemes: Some(1000usize),
270 r#enum: None,
271 r#const: None,
272 known_values: None,
273 }),
274 );
275 map.insert(
276 ::jacquard_common::smol_str::SmolStr::new_static("captions"),
277 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
278 description: None,
279 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
280 description: None,
281 r#ref: ::jacquard_common::CowStr::new_static("#caption"),
282 }),
283 min_length: None,
284 max_length: Some(20usize),
285 }),
286 );
287 map.insert(
288 ::jacquard_common::smol_str::SmolStr::new_static(
289 "dimensions",
290 ),
291 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
292 description: None,
293 refs: vec![
294 ::jacquard_common::CowStr::new_static("app.bsky.embed.defs#aspectRatio"),
295 ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#percentSize"),
296 ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#pixelSize")
297 ],
298 closed: None,
299 }),
300 );
301 map.insert(
302 ::jacquard_common::smol_str::SmolStr::new_static("name"),
303 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
304 description: None,
305 format: None,
306 default: None,
307 min_length: None,
308 max_length: Some(128usize),
309 min_graphemes: None,
310 max_graphemes: None,
311 r#enum: None,
312 r#const: None,
313 known_values: None,
314 }),
315 );
316 map.insert(
317 ::jacquard_common::smol_str::SmolStr::new_static("video"),
318 ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
319 description: None,
320 accept: None,
321 max_size: None,
322 }),
323 );
324 map
325 },
326 }),
327 );
328 map.insert(
329 ::jacquard_common::smol_str::SmolStr::new_static("view"),
330 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
331 description: None,
332 required: Some(
333 vec![
334 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
335 ::jacquard_common::smol_str::SmolStr::new_static("playlist")
336 ],
337 ),
338 nullable: None,
339 properties: {
340 #[allow(unused_mut)]
341 let mut map = ::alloc::collections::BTreeMap::new();
342 map.insert(
343 ::jacquard_common::smol_str::SmolStr::new_static("alt"),
344 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
345 description: None,
346 format: None,
347 default: None,
348 min_length: None,
349 max_length: Some(10000usize),
350 min_graphemes: None,
351 max_graphemes: Some(1000usize),
352 r#enum: None,
353 r#const: None,
354 known_values: None,
355 }),
356 );
357 map.insert(
358 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
359 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
360 description: None,
361 format: Some(
362 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
363 ),
364 default: None,
365 min_length: None,
366 max_length: None,
367 min_graphemes: None,
368 max_graphemes: None,
369 r#enum: None,
370 r#const: None,
371 known_values: None,
372 }),
373 );
374 map.insert(
375 ::jacquard_common::smol_str::SmolStr::new_static(
376 "dimensions",
377 ),
378 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
379 description: None,
380 refs: vec![
381 ::jacquard_common::CowStr::new_static("app.bsky.embed.defs#aspectRatio"),
382 ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#percentSize"),
383 ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#pixelSize")
384 ],
385 closed: None,
386 }),
387 );
388 map.insert(
389 ::jacquard_common::smol_str::SmolStr::new_static("name"),
390 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
391 description: None,
392 format: None,
393 default: None,
394 min_length: None,
395 max_length: Some(128usize),
396 min_graphemes: None,
397 max_graphemes: None,
398 r#enum: None,
399 r#const: None,
400 known_values: None,
401 }),
402 );
403 map.insert(
404 ::jacquard_common::smol_str::SmolStr::new_static("playlist"),
405 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
406 description: None,
407 format: Some(
408 ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
409 ),
410 default: None,
411 min_length: None,
412 max_length: None,
413 min_graphemes: None,
414 max_graphemes: None,
415 r#enum: None,
416 r#const: None,
417 known_values: None,
418 }),
419 );
420 map.insert(
421 ::jacquard_common::smol_str::SmolStr::new_static(
422 "thumbnail",
423 ),
424 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
425 description: None,
426 format: Some(
427 ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
428 ),
429 default: None,
430 min_length: None,
431 max_length: None,
432 min_graphemes: None,
433 max_graphemes: None,
434 r#enum: None,
435 r#const: None,
436 known_values: None,
437 }),
438 );
439 map
440 },
441 }),
442 );
443 map
444 },
445 }
446}
447
448impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Caption<'a> {
449 fn nsid() -> &'static str {
450 "sh.weaver.embed.video"
451 }
452 fn def_name() -> &'static str {
453 "caption"
454 }
455 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
456 lexicon_doc_sh_weaver_embed_video()
457 }
458 fn validate(
459 &self,
460 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
461 Ok(())
462 }
463}
464
465#[jacquard_derive::lexicon]
466#[derive(
467 serde::Serialize,
468 serde::Deserialize,
469 Debug,
470 Clone,
471 PartialEq,
472 Eq,
473 jacquard_derive::IntoStatic
474)]
475#[serde(rename_all = "camelCase")]
476pub struct VideoRecord<'a> {
477 #[serde(borrow)]
478 pub videos: Vec<crate::sh_weaver::embed::video::Video<'a>>,
479}
480
481pub mod video_record_state {
482
483 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
484 #[allow(unused)]
485 use ::core::marker::PhantomData;
486 mod sealed {
487 pub trait Sealed {}
488 }
489 /// State trait tracking which required fields have been set
490 pub trait State: sealed::Sealed {
491 type Videos;
492 }
493 /// Empty state - all required fields are unset
494 pub struct Empty(());
495 impl sealed::Sealed for Empty {}
496 impl State for Empty {
497 type Videos = Unset;
498 }
499 ///State transition - sets the `videos` field to Set
500 pub struct SetVideos<S: State = Empty>(PhantomData<fn() -> S>);
501 impl<S: State> sealed::Sealed for SetVideos<S> {}
502 impl<S: State> State for SetVideos<S> {
503 type Videos = Set<members::videos>;
504 }
505 /// Marker types for field names
506 #[allow(non_camel_case_types)]
507 pub mod members {
508 ///Marker type for the `videos` field
509 pub struct videos(());
510 }
511}
512
513/// Builder for constructing an instance of this type
514pub struct VideoRecordBuilder<'a, S: video_record_state::State> {
515 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
516 __unsafe_private_named: (
517 ::core::option::Option<Vec<crate::sh_weaver::embed::video::Video<'a>>>,
518 ),
519 _phantom: ::core::marker::PhantomData<&'a ()>,
520}
521
522impl<'a> VideoRecord<'a> {
523 /// Create a new builder for this type
524 pub fn new() -> VideoRecordBuilder<'a, video_record_state::Empty> {
525 VideoRecordBuilder::new()
526 }
527}
528
529impl<'a> VideoRecordBuilder<'a, video_record_state::Empty> {
530 /// Create a new builder with all fields unset
531 pub fn new() -> Self {
532 VideoRecordBuilder {
533 _phantom_state: ::core::marker::PhantomData,
534 __unsafe_private_named: (None,),
535 _phantom: ::core::marker::PhantomData,
536 }
537 }
538}
539
540impl<'a, S> VideoRecordBuilder<'a, S>
541where
542 S: video_record_state::State,
543 S::Videos: video_record_state::IsUnset,
544{
545 /// Set the `videos` field (required)
546 pub fn videos(
547 mut self,
548 value: impl Into<Vec<crate::sh_weaver::embed::video::Video<'a>>>,
549 ) -> VideoRecordBuilder<'a, video_record_state::SetVideos<S>> {
550 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
551 VideoRecordBuilder {
552 _phantom_state: ::core::marker::PhantomData,
553 __unsafe_private_named: self.__unsafe_private_named,
554 _phantom: ::core::marker::PhantomData,
555 }
556 }
557}
558
559impl<'a, S> VideoRecordBuilder<'a, S>
560where
561 S: video_record_state::State,
562 S::Videos: video_record_state::IsSet,
563{
564 /// Build the final struct
565 pub fn build(self) -> VideoRecord<'a> {
566 VideoRecord {
567 videos: self.__unsafe_private_named.0.unwrap(),
568 extra_data: Default::default(),
569 }
570 }
571 /// Build the final struct with custom extra_data
572 pub fn build_with_data(
573 self,
574 extra_data: std::collections::BTreeMap<
575 jacquard_common::smol_str::SmolStr,
576 jacquard_common::types::value::Data<'a>,
577 >,
578 ) -> VideoRecord<'a> {
579 VideoRecord {
580 videos: self.__unsafe_private_named.0.unwrap(),
581 extra_data: Some(extra_data),
582 }
583 }
584}
585
586impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VideoRecord<'a> {
587 fn nsid() -> &'static str {
588 "sh.weaver.embed.video"
589 }
590 fn def_name() -> &'static str {
591 "main"
592 }
593 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
594 lexicon_doc_sh_weaver_embed_video()
595 }
596 fn validate(
597 &self,
598 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
599 Ok(())
600 }
601}
602
603#[jacquard_derive::lexicon]
604#[derive(
605 serde::Serialize,
606 serde::Deserialize,
607 Debug,
608 Clone,
609 PartialEq,
610 Eq,
611 jacquard_derive::IntoStatic
612)]
613#[serde(rename_all = "camelCase")]
614pub struct Video<'a> {
615 /// Alt text description of the video, for accessibility.
616 #[serde(skip_serializing_if = "std::option::Option::is_none")]
617 #[serde(borrow)]
618 pub alt: std::option::Option<jacquard_common::CowStr<'a>>,
619 #[serde(skip_serializing_if = "std::option::Option::is_none")]
620 #[serde(borrow)]
621 pub captions: std::option::Option<Vec<crate::sh_weaver::embed::video::Caption<'a>>>,
622 #[serde(skip_serializing_if = "std::option::Option::is_none")]
623 #[serde(borrow)]
624 pub dimensions: std::option::Option<VideoDimensions<'a>>,
625 #[serde(skip_serializing_if = "std::option::Option::is_none")]
626 #[serde(borrow)]
627 pub name: std::option::Option<jacquard_common::CowStr<'a>>,
628 /// The mp4 video file. May be up to 100mb, formerly limited to 50mb.
629 #[serde(borrow)]
630 pub video: jacquard_common::types::blob::BlobRef<'a>,
631}
632
633pub mod video_state {
634
635 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
636 #[allow(unused)]
637 use ::core::marker::PhantomData;
638 mod sealed {
639 pub trait Sealed {}
640 }
641 /// State trait tracking which required fields have been set
642 pub trait State: sealed::Sealed {
643 type Video;
644 }
645 /// Empty state - all required fields are unset
646 pub struct Empty(());
647 impl sealed::Sealed for Empty {}
648 impl State for Empty {
649 type Video = Unset;
650 }
651 ///State transition - sets the `video` field to Set
652 pub struct SetVideo<S: State = Empty>(PhantomData<fn() -> S>);
653 impl<S: State> sealed::Sealed for SetVideo<S> {}
654 impl<S: State> State for SetVideo<S> {
655 type Video = Set<members::video>;
656 }
657 /// Marker types for field names
658 #[allow(non_camel_case_types)]
659 pub mod members {
660 ///Marker type for the `video` field
661 pub struct video(());
662 }
663}
664
665/// Builder for constructing an instance of this type
666pub struct VideoBuilder<'a, S: video_state::State> {
667 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
668 __unsafe_private_named: (
669 ::core::option::Option<jacquard_common::CowStr<'a>>,
670 ::core::option::Option<Vec<crate::sh_weaver::embed::video::Caption<'a>>>,
671 ::core::option::Option<VideoDimensions<'a>>,
672 ::core::option::Option<jacquard_common::CowStr<'a>>,
673 ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
674 ),
675 _phantom: ::core::marker::PhantomData<&'a ()>,
676}
677
678impl<'a> Video<'a> {
679 /// Create a new builder for this type
680 pub fn new() -> VideoBuilder<'a, video_state::Empty> {
681 VideoBuilder::new()
682 }
683}
684
685impl<'a> VideoBuilder<'a, video_state::Empty> {
686 /// Create a new builder with all fields unset
687 pub fn new() -> Self {
688 VideoBuilder {
689 _phantom_state: ::core::marker::PhantomData,
690 __unsafe_private_named: (None, None, None, None, None),
691 _phantom: ::core::marker::PhantomData,
692 }
693 }
694}
695
696impl<'a, S: video_state::State> VideoBuilder<'a, S> {
697 /// Set the `alt` field (optional)
698 pub fn alt(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self {
699 self.__unsafe_private_named.0 = value.into();
700 self
701 }
702 /// Set the `alt` field to an Option value (optional)
703 pub fn maybe_alt(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
704 self.__unsafe_private_named.0 = value;
705 self
706 }
707}
708
709impl<'a, S: video_state::State> VideoBuilder<'a, S> {
710 /// Set the `captions` field (optional)
711 pub fn captions(
712 mut self,
713 value: impl Into<Option<Vec<crate::sh_weaver::embed::video::Caption<'a>>>>,
714 ) -> Self {
715 self.__unsafe_private_named.1 = value.into();
716 self
717 }
718 /// Set the `captions` field to an Option value (optional)
719 pub fn maybe_captions(
720 mut self,
721 value: Option<Vec<crate::sh_weaver::embed::video::Caption<'a>>>,
722 ) -> Self {
723 self.__unsafe_private_named.1 = value;
724 self
725 }
726}
727
728impl<'a, S: video_state::State> VideoBuilder<'a, S> {
729 /// Set the `dimensions` field (optional)
730 pub fn dimensions(mut self, value: impl Into<Option<VideoDimensions<'a>>>) -> Self {
731 self.__unsafe_private_named.2 = value.into();
732 self
733 }
734 /// Set the `dimensions` field to an Option value (optional)
735 pub fn maybe_dimensions(mut self, value: Option<VideoDimensions<'a>>) -> Self {
736 self.__unsafe_private_named.2 = value;
737 self
738 }
739}
740
741impl<'a, S: video_state::State> VideoBuilder<'a, S> {
742 /// Set the `name` field (optional)
743 pub fn name(
744 mut self,
745 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
746 ) -> Self {
747 self.__unsafe_private_named.3 = value.into();
748 self
749 }
750 /// Set the `name` field to an Option value (optional)
751 pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
752 self.__unsafe_private_named.3 = value;
753 self
754 }
755}
756
757impl<'a, S> VideoBuilder<'a, S>
758where
759 S: video_state::State,
760 S::Video: video_state::IsUnset,
761{
762 /// Set the `video` field (required)
763 pub fn video(
764 mut self,
765 value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
766 ) -> VideoBuilder<'a, video_state::SetVideo<S>> {
767 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
768 VideoBuilder {
769 _phantom_state: ::core::marker::PhantomData,
770 __unsafe_private_named: self.__unsafe_private_named,
771 _phantom: ::core::marker::PhantomData,
772 }
773 }
774}
775
776impl<'a, S> VideoBuilder<'a, S>
777where
778 S: video_state::State,
779 S::Video: video_state::IsSet,
780{
781 /// Build the final struct
782 pub fn build(self) -> Video<'a> {
783 Video {
784 alt: self.__unsafe_private_named.0,
785 captions: self.__unsafe_private_named.1,
786 dimensions: self.__unsafe_private_named.2,
787 name: self.__unsafe_private_named.3,
788 video: self.__unsafe_private_named.4.unwrap(),
789 extra_data: Default::default(),
790 }
791 }
792 /// Build the final struct with custom extra_data
793 pub fn build_with_data(
794 self,
795 extra_data: std::collections::BTreeMap<
796 jacquard_common::smol_str::SmolStr,
797 jacquard_common::types::value::Data<'a>,
798 >,
799 ) -> Video<'a> {
800 Video {
801 alt: self.__unsafe_private_named.0,
802 captions: self.__unsafe_private_named.1,
803 dimensions: self.__unsafe_private_named.2,
804 name: self.__unsafe_private_named.3,
805 video: self.__unsafe_private_named.4.unwrap(),
806 extra_data: Some(extra_data),
807 }
808 }
809}
810
811#[jacquard_derive::open_union]
812#[derive(
813 serde::Serialize,
814 serde::Deserialize,
815 Debug,
816 Clone,
817 PartialEq,
818 Eq,
819 jacquard_derive::IntoStatic
820)]
821#[serde(tag = "$type")]
822#[serde(bound(deserialize = "'de: 'a"))]
823pub enum VideoDimensions<'a> {
824 #[serde(rename = "app.bsky.embed.defs#aspectRatio")]
825 AspectRatio(Box<crate::app_bsky::embed::AspectRatio<'a>>),
826 #[serde(rename = "sh.weaver.embed.defs#percentSize")]
827 PercentSize(Box<crate::sh_weaver::embed::PercentSize<'a>>),
828 #[serde(rename = "sh.weaver.embed.defs#pixelSize")]
829 PixelSize(Box<crate::sh_weaver::embed::PixelSize<'a>>),
830}
831
832impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Video<'a> {
833 fn nsid() -> &'static str {
834 "sh.weaver.embed.video"
835 }
836 fn def_name() -> &'static str {
837 "video"
838 }
839 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
840 lexicon_doc_sh_weaver_embed_video()
841 }
842 fn validate(
843 &self,
844 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
845 if let Some(ref value) = self.alt {
846 #[allow(unused_comparisons)]
847 if <str>::len(value.as_ref()) > 10000usize {
848 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
849 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
850 "alt",
851 ),
852 max: 10000usize,
853 actual: <str>::len(value.as_ref()),
854 });
855 }
856 }
857 if let Some(ref value) = self.alt {
858 {
859 let count = ::unicode_segmentation::UnicodeSegmentation::graphemes(
860 value.as_ref(),
861 true,
862 )
863 .count();
864 if count > 1000usize {
865 return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
866 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
867 "alt",
868 ),
869 max: 1000usize,
870 actual: count,
871 });
872 }
873 }
874 }
875 if let Some(ref value) = self.captions {
876 #[allow(unused_comparisons)]
877 if value.len() > 20usize {
878 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
879 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
880 "captions",
881 ),
882 max: 20usize,
883 actual: value.len(),
884 });
885 }
886 }
887 if let Some(ref value) = self.name {
888 #[allow(unused_comparisons)]
889 if <str>::len(value.as_ref()) > 128usize {
890 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
891 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
892 "name",
893 ),
894 max: 128usize,
895 actual: <str>::len(value.as_ref()),
896 });
897 }
898 }
899 Ok(())
900 }
901}
902
903#[jacquard_derive::lexicon]
904#[derive(
905 serde::Serialize,
906 serde::Deserialize,
907 Debug,
908 Clone,
909 PartialEq,
910 Eq,
911 jacquard_derive::IntoStatic
912)]
913#[serde(rename_all = "camelCase")]
914pub struct View<'a> {
915 #[serde(skip_serializing_if = "std::option::Option::is_none")]
916 #[serde(borrow)]
917 pub alt: std::option::Option<jacquard_common::CowStr<'a>>,
918 #[serde(borrow)]
919 pub cid: jacquard_common::types::string::Cid<'a>,
920 #[serde(skip_serializing_if = "std::option::Option::is_none")]
921 #[serde(borrow)]
922 pub dimensions: std::option::Option<ViewDimensions<'a>>,
923 #[serde(skip_serializing_if = "std::option::Option::is_none")]
924 #[serde(borrow)]
925 pub name: std::option::Option<jacquard_common::CowStr<'a>>,
926 #[serde(borrow)]
927 pub playlist: jacquard_common::types::string::Uri<'a>,
928 #[serde(skip_serializing_if = "std::option::Option::is_none")]
929 #[serde(borrow)]
930 pub thumbnail: std::option::Option<jacquard_common::types::string::Uri<'a>>,
931}
932
933pub mod view_state {
934
935 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
936 #[allow(unused)]
937 use ::core::marker::PhantomData;
938 mod sealed {
939 pub trait Sealed {}
940 }
941 /// State trait tracking which required fields have been set
942 pub trait State: sealed::Sealed {
943 type Playlist;
944 type Cid;
945 }
946 /// Empty state - all required fields are unset
947 pub struct Empty(());
948 impl sealed::Sealed for Empty {}
949 impl State for Empty {
950 type Playlist = Unset;
951 type Cid = Unset;
952 }
953 ///State transition - sets the `playlist` field to Set
954 pub struct SetPlaylist<S: State = Empty>(PhantomData<fn() -> S>);
955 impl<S: State> sealed::Sealed for SetPlaylist<S> {}
956 impl<S: State> State for SetPlaylist<S> {
957 type Playlist = Set<members::playlist>;
958 type Cid = S::Cid;
959 }
960 ///State transition - sets the `cid` field to Set
961 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
962 impl<S: State> sealed::Sealed for SetCid<S> {}
963 impl<S: State> State for SetCid<S> {
964 type Playlist = S::Playlist;
965 type Cid = Set<members::cid>;
966 }
967 /// Marker types for field names
968 #[allow(non_camel_case_types)]
969 pub mod members {
970 ///Marker type for the `playlist` field
971 pub struct playlist(());
972 ///Marker type for the `cid` field
973 pub struct cid(());
974 }
975}
976
977/// Builder for constructing an instance of this type
978pub struct ViewBuilder<'a, S: view_state::State> {
979 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
980 __unsafe_private_named: (
981 ::core::option::Option<jacquard_common::CowStr<'a>>,
982 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
983 ::core::option::Option<ViewDimensions<'a>>,
984 ::core::option::Option<jacquard_common::CowStr<'a>>,
985 ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
986 ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
987 ),
988 _phantom: ::core::marker::PhantomData<&'a ()>,
989}
990
991impl<'a> View<'a> {
992 /// Create a new builder for this type
993 pub fn new() -> ViewBuilder<'a, view_state::Empty> {
994 ViewBuilder::new()
995 }
996}
997
998impl<'a> ViewBuilder<'a, view_state::Empty> {
999 /// Create a new builder with all fields unset
1000 pub fn new() -> Self {
1001 ViewBuilder {
1002 _phantom_state: ::core::marker::PhantomData,
1003 __unsafe_private_named: (None, None, None, None, None, None),
1004 _phantom: ::core::marker::PhantomData,
1005 }
1006 }
1007}
1008
1009impl<'a, S: view_state::State> ViewBuilder<'a, S> {
1010 /// Set the `alt` field (optional)
1011 pub fn alt(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self {
1012 self.__unsafe_private_named.0 = value.into();
1013 self
1014 }
1015 /// Set the `alt` field to an Option value (optional)
1016 pub fn maybe_alt(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
1017 self.__unsafe_private_named.0 = value;
1018 self
1019 }
1020}
1021
1022impl<'a, S> ViewBuilder<'a, S>
1023where
1024 S: view_state::State,
1025 S::Cid: view_state::IsUnset,
1026{
1027 /// Set the `cid` field (required)
1028 pub fn cid(
1029 mut self,
1030 value: impl Into<jacquard_common::types::string::Cid<'a>>,
1031 ) -> ViewBuilder<'a, view_state::SetCid<S>> {
1032 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1033 ViewBuilder {
1034 _phantom_state: ::core::marker::PhantomData,
1035 __unsafe_private_named: self.__unsafe_private_named,
1036 _phantom: ::core::marker::PhantomData,
1037 }
1038 }
1039}
1040
1041impl<'a, S: view_state::State> ViewBuilder<'a, S> {
1042 /// Set the `dimensions` field (optional)
1043 pub fn dimensions(mut self, value: impl Into<Option<ViewDimensions<'a>>>) -> Self {
1044 self.__unsafe_private_named.2 = value.into();
1045 self
1046 }
1047 /// Set the `dimensions` field to an Option value (optional)
1048 pub fn maybe_dimensions(mut self, value: Option<ViewDimensions<'a>>) -> Self {
1049 self.__unsafe_private_named.2 = value;
1050 self
1051 }
1052}
1053
1054impl<'a, S: view_state::State> ViewBuilder<'a, S> {
1055 /// Set the `name` field (optional)
1056 pub fn name(
1057 mut self,
1058 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
1059 ) -> Self {
1060 self.__unsafe_private_named.3 = value.into();
1061 self
1062 }
1063 /// Set the `name` field to an Option value (optional)
1064 pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
1065 self.__unsafe_private_named.3 = value;
1066 self
1067 }
1068}
1069
1070impl<'a, S> ViewBuilder<'a, S>
1071where
1072 S: view_state::State,
1073 S::Playlist: view_state::IsUnset,
1074{
1075 /// Set the `playlist` field (required)
1076 pub fn playlist(
1077 mut self,
1078 value: impl Into<jacquard_common::types::string::Uri<'a>>,
1079 ) -> ViewBuilder<'a, view_state::SetPlaylist<S>> {
1080 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
1081 ViewBuilder {
1082 _phantom_state: ::core::marker::PhantomData,
1083 __unsafe_private_named: self.__unsafe_private_named,
1084 _phantom: ::core::marker::PhantomData,
1085 }
1086 }
1087}
1088
1089impl<'a, S: view_state::State> ViewBuilder<'a, S> {
1090 /// Set the `thumbnail` field (optional)
1091 pub fn thumbnail(
1092 mut self,
1093 value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>,
1094 ) -> Self {
1095 self.__unsafe_private_named.5 = value.into();
1096 self
1097 }
1098 /// Set the `thumbnail` field to an Option value (optional)
1099 pub fn maybe_thumbnail(
1100 mut self,
1101 value: Option<jacquard_common::types::string::Uri<'a>>,
1102 ) -> Self {
1103 self.__unsafe_private_named.5 = value;
1104 self
1105 }
1106}
1107
1108impl<'a, S> ViewBuilder<'a, S>
1109where
1110 S: view_state::State,
1111 S::Playlist: view_state::IsSet,
1112 S::Cid: view_state::IsSet,
1113{
1114 /// Build the final struct
1115 pub fn build(self) -> View<'a> {
1116 View {
1117 alt: self.__unsafe_private_named.0,
1118 cid: self.__unsafe_private_named.1.unwrap(),
1119 dimensions: self.__unsafe_private_named.2,
1120 name: self.__unsafe_private_named.3,
1121 playlist: self.__unsafe_private_named.4.unwrap(),
1122 thumbnail: self.__unsafe_private_named.5,
1123 extra_data: Default::default(),
1124 }
1125 }
1126 /// Build the final struct with custom extra_data
1127 pub fn build_with_data(
1128 self,
1129 extra_data: std::collections::BTreeMap<
1130 jacquard_common::smol_str::SmolStr,
1131 jacquard_common::types::value::Data<'a>,
1132 >,
1133 ) -> View<'a> {
1134 View {
1135 alt: self.__unsafe_private_named.0,
1136 cid: self.__unsafe_private_named.1.unwrap(),
1137 dimensions: self.__unsafe_private_named.2,
1138 name: self.__unsafe_private_named.3,
1139 playlist: self.__unsafe_private_named.4.unwrap(),
1140 thumbnail: self.__unsafe_private_named.5,
1141 extra_data: Some(extra_data),
1142 }
1143 }
1144}
1145
1146#[jacquard_derive::open_union]
1147#[derive(
1148 serde::Serialize,
1149 serde::Deserialize,
1150 Debug,
1151 Clone,
1152 PartialEq,
1153 Eq,
1154 jacquard_derive::IntoStatic
1155)]
1156#[serde(tag = "$type")]
1157#[serde(bound(deserialize = "'de: 'a"))]
1158pub enum ViewDimensions<'a> {
1159 #[serde(rename = "app.bsky.embed.defs#aspectRatio")]
1160 AspectRatio(Box<crate::app_bsky::embed::AspectRatio<'a>>),
1161 #[serde(rename = "sh.weaver.embed.defs#percentSize")]
1162 PercentSize(Box<crate::sh_weaver::embed::PercentSize<'a>>),
1163 #[serde(rename = "sh.weaver.embed.defs#pixelSize")]
1164 PixelSize(Box<crate::sh_weaver::embed::PixelSize<'a>>),
1165}
1166
1167impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> {
1168 fn nsid() -> &'static str {
1169 "sh.weaver.embed.video"
1170 }
1171 fn def_name() -> &'static str {
1172 "view"
1173 }
1174 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1175 lexicon_doc_sh_weaver_embed_video()
1176 }
1177 fn validate(
1178 &self,
1179 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1180 if let Some(ref value) = self.alt {
1181 #[allow(unused_comparisons)]
1182 if <str>::len(value.as_ref()) > 10000usize {
1183 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1184 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1185 "alt",
1186 ),
1187 max: 10000usize,
1188 actual: <str>::len(value.as_ref()),
1189 });
1190 }
1191 }
1192 if let Some(ref value) = self.alt {
1193 {
1194 let count = ::unicode_segmentation::UnicodeSegmentation::graphemes(
1195 value.as_ref(),
1196 true,
1197 )
1198 .count();
1199 if count > 1000usize {
1200 return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
1201 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1202 "alt",
1203 ),
1204 max: 1000usize,
1205 actual: count,
1206 });
1207 }
1208 }
1209 }
1210 if let Some(ref value) = self.name {
1211 #[allow(unused_comparisons)]
1212 if <str>::len(value.as_ref()) > 128usize {
1213 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1214 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1215 "name",
1216 ),
1217 max: 128usize,
1218 actual: <str>::len(value.as_ref()),
1219 });
1220 }
1221 }
1222 Ok(())
1223 }
1224}