1pub mod create_draft;
9pub mod delete_draft;
10pub mod get_drafts;
11pub mod update_draft;
12
13
14#[allow(unused_imports)]
15use alloc::collections::BTreeMap;
16
17#[allow(unused_imports)]
18use core::marker::PhantomData;
19use jacquard_common::CowStr;
20
21#[allow(unused_imports)]
22use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
23use jacquard_common::types::string::{Tid, Datetime, Language, UriValue};
24use jacquard_derive::{IntoStatic, lexicon, open_union};
25use jacquard_lexicon::lexicon::LexiconDoc;
26use jacquard_lexicon::schema::LexiconSchema;
27
28#[allow(unused_imports)]
29use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
30use serde::{Serialize, Deserialize};
31use crate::app_bsky::feed::postgate::DisableRule;
32use crate::app_bsky::feed::threadgate::FollowerRule;
33use crate::app_bsky::feed::threadgate::FollowingRule;
34use crate::app_bsky::feed::threadgate::ListRule;
35use crate::app_bsky::feed::threadgate::MentionRule;
36use crate::com_atproto::label::SelfLabels;
37use crate::com_atproto::repo::strong_ref::StrongRef;
38use crate::app_bsky::draft;
39#[lexicon]
42#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
43#[serde(rename_all = "camelCase")]
44pub struct Draft<'a> {
45 #[serde(skip_serializing_if = "Option::is_none")]
47 #[serde(borrow)]
48 pub device_id: Option<CowStr<'a>>,
49 #[serde(skip_serializing_if = "Option::is_none")]
51 #[serde(borrow)]
52 pub device_name: Option<CowStr<'a>>,
53 #[serde(skip_serializing_if = "Option::is_none")]
55 pub langs: Option<Vec<Language>>,
56 #[serde(skip_serializing_if = "Option::is_none")]
58 #[serde(borrow)]
59 pub postgate_embedding_rules: Option<Vec<DisableRule<'a>>>,
60 #[serde(borrow)]
62 pub posts: Vec<draft::DraftPost<'a>>,
63 #[serde(skip_serializing_if = "Option::is_none")]
65 #[serde(borrow)]
66 pub threadgate_allow: Option<Vec<DraftThreadgateAllowItem<'a>>>,
67}
68
69
70#[open_union]
71#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
72#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
73pub enum DraftThreadgateAllowItem<'a> {
74 #[serde(rename = "app.bsky.feed.threadgate#mentionRule")]
75 ThreadgateMentionRule(Box<MentionRule<'a>>),
76 #[serde(rename = "app.bsky.feed.threadgate#followerRule")]
77 ThreadgateFollowerRule(Box<FollowerRule<'a>>),
78 #[serde(rename = "app.bsky.feed.threadgate#followingRule")]
79 ThreadgateFollowingRule(Box<FollowingRule<'a>>),
80 #[serde(rename = "app.bsky.feed.threadgate#listRule")]
81 ThreadgateListRule(Box<ListRule<'a>>),
82}
83
84
85#[lexicon]
86#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
87#[serde(rename_all = "camelCase")]
88pub struct DraftEmbedCaption<'a> {
89 #[serde(borrow)]
90 pub content: CowStr<'a>,
91 pub lang: Language,
92}
93
94
95#[lexicon]
96#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
97#[serde(rename_all = "camelCase")]
98pub struct DraftEmbedExternal<'a> {
99 #[serde(borrow)]
100 pub uri: UriValue<'a>,
101}
102
103
104#[lexicon]
105#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
106#[serde(rename_all = "camelCase")]
107pub struct DraftEmbedImage<'a> {
108 #[serde(skip_serializing_if = "Option::is_none")]
109 #[serde(borrow)]
110 pub alt: Option<CowStr<'a>>,
111 #[serde(borrow)]
112 pub local_ref: draft::DraftEmbedLocalRef<'a>,
113}
114
115
116#[lexicon]
117#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
118#[serde(rename_all = "camelCase")]
119pub struct DraftEmbedLocalRef<'a> {
120 #[serde(borrow)]
122 pub path: CowStr<'a>,
123}
124
125
126#[lexicon]
127#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
128#[serde(rename_all = "camelCase")]
129pub struct DraftEmbedRecord<'a> {
130 #[serde(borrow)]
131 pub record: StrongRef<'a>,
132}
133
134
135#[lexicon]
136#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
137#[serde(rename_all = "camelCase")]
138pub struct DraftEmbedVideo<'a> {
139 #[serde(skip_serializing_if = "Option::is_none")]
140 #[serde(borrow)]
141 pub alt: Option<CowStr<'a>>,
142 #[serde(skip_serializing_if = "Option::is_none")]
143 #[serde(borrow)]
144 pub captions: Option<Vec<draft::DraftEmbedCaption<'a>>>,
145 #[serde(borrow)]
146 pub local_ref: draft::DraftEmbedLocalRef<'a>,
147}
148
149#[lexicon]
152#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
153#[serde(rename_all = "camelCase")]
154pub struct DraftPost<'a> {
155 #[serde(skip_serializing_if = "Option::is_none")]
156 #[serde(borrow)]
157 pub embed_externals: Option<Vec<draft::DraftEmbedExternal<'a>>>,
158 #[serde(skip_serializing_if = "Option::is_none")]
159 #[serde(borrow)]
160 pub embed_images: Option<Vec<draft::DraftEmbedImage<'a>>>,
161 #[serde(skip_serializing_if = "Option::is_none")]
162 #[serde(borrow)]
163 pub embed_records: Option<Vec<draft::DraftEmbedRecord<'a>>>,
164 #[serde(skip_serializing_if = "Option::is_none")]
165 #[serde(borrow)]
166 pub embed_videos: Option<Vec<draft::DraftEmbedVideo<'a>>>,
167 #[serde(skip_serializing_if = "Option::is_none")]
169 #[serde(borrow)]
170 pub labels: Option<SelfLabels<'a>>,
171 #[serde(borrow)]
173 pub text: CowStr<'a>,
174}
175
176#[lexicon]
179#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
180#[serde(rename_all = "camelCase")]
181pub struct DraftView<'a> {
182 pub created_at: Datetime,
184 #[serde(borrow)]
185 pub draft: draft::Draft<'a>,
186 pub id: Tid,
188 pub updated_at: Datetime,
190}
191
192#[lexicon]
195#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
196#[serde(rename_all = "camelCase")]
197pub struct DraftWithId<'a> {
198 #[serde(borrow)]
199 pub draft: draft::Draft<'a>,
200 pub id: Tid,
202}
203
204impl<'a> LexiconSchema for Draft<'a> {
205 fn nsid() -> &'static str {
206 "app.bsky.draft.defs"
207 }
208 fn def_name() -> &'static str {
209 "draft"
210 }
211 fn lexicon_doc() -> LexiconDoc<'static> {
212 lexicon_doc_app_bsky_draft_defs()
213 }
214 fn validate(&self) -> Result<(), ConstraintError> {
215 if let Some(ref value) = self.device_id {
216 #[allow(unused_comparisons)]
217 if <str>::len(value.as_ref()) > 100usize {
218 return Err(ConstraintError::MaxLength {
219 path: ValidationPath::from_field("device_id"),
220 max: 100usize,
221 actual: <str>::len(value.as_ref()),
222 });
223 }
224 }
225 if let Some(ref value) = self.device_name {
226 #[allow(unused_comparisons)]
227 if <str>::len(value.as_ref()) > 100usize {
228 return Err(ConstraintError::MaxLength {
229 path: ValidationPath::from_field("device_name"),
230 max: 100usize,
231 actual: <str>::len(value.as_ref()),
232 });
233 }
234 }
235 if let Some(ref value) = self.langs {
236 #[allow(unused_comparisons)]
237 if value.len() > 3usize {
238 return Err(ConstraintError::MaxLength {
239 path: ValidationPath::from_field("langs"),
240 max: 3usize,
241 actual: value.len(),
242 });
243 }
244 }
245 if let Some(ref value) = self.postgate_embedding_rules {
246 #[allow(unused_comparisons)]
247 if value.len() > 5usize {
248 return Err(ConstraintError::MaxLength {
249 path: ValidationPath::from_field("postgate_embedding_rules"),
250 max: 5usize,
251 actual: value.len(),
252 });
253 }
254 }
255 {
256 let value = &self.posts;
257 #[allow(unused_comparisons)]
258 if value.len() > 100usize {
259 return Err(ConstraintError::MaxLength {
260 path: ValidationPath::from_field("posts"),
261 max: 100usize,
262 actual: value.len(),
263 });
264 }
265 }
266 {
267 let value = &self.posts;
268 #[allow(unused_comparisons)]
269 if value.len() < 1usize {
270 return Err(ConstraintError::MinLength {
271 path: ValidationPath::from_field("posts"),
272 min: 1usize,
273 actual: value.len(),
274 });
275 }
276 }
277 if let Some(ref value) = self.threadgate_allow {
278 #[allow(unused_comparisons)]
279 if value.len() > 5usize {
280 return Err(ConstraintError::MaxLength {
281 path: ValidationPath::from_field("threadgate_allow"),
282 max: 5usize,
283 actual: value.len(),
284 });
285 }
286 }
287 Ok(())
288 }
289}
290
291impl<'a> LexiconSchema for DraftEmbedCaption<'a> {
292 fn nsid() -> &'static str {
293 "app.bsky.draft.defs"
294 }
295 fn def_name() -> &'static str {
296 "draftEmbedCaption"
297 }
298 fn lexicon_doc() -> LexiconDoc<'static> {
299 lexicon_doc_app_bsky_draft_defs()
300 }
301 fn validate(&self) -> Result<(), ConstraintError> {
302 {
303 let value = &self.content;
304 #[allow(unused_comparisons)]
305 if <str>::len(value.as_ref()) > 10000usize {
306 return Err(ConstraintError::MaxLength {
307 path: ValidationPath::from_field("content"),
308 max: 10000usize,
309 actual: <str>::len(value.as_ref()),
310 });
311 }
312 }
313 Ok(())
314 }
315}
316
317impl<'a> LexiconSchema for DraftEmbedExternal<'a> {
318 fn nsid() -> &'static str {
319 "app.bsky.draft.defs"
320 }
321 fn def_name() -> &'static str {
322 "draftEmbedExternal"
323 }
324 fn lexicon_doc() -> LexiconDoc<'static> {
325 lexicon_doc_app_bsky_draft_defs()
326 }
327 fn validate(&self) -> Result<(), ConstraintError> {
328 Ok(())
329 }
330}
331
332impl<'a> LexiconSchema for DraftEmbedImage<'a> {
333 fn nsid() -> &'static str {
334 "app.bsky.draft.defs"
335 }
336 fn def_name() -> &'static str {
337 "draftEmbedImage"
338 }
339 fn lexicon_doc() -> LexiconDoc<'static> {
340 lexicon_doc_app_bsky_draft_defs()
341 }
342 fn validate(&self) -> Result<(), ConstraintError> {
343 if let Some(ref value) = self.alt {
344 {
345 let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
346 if count > 2000usize {
347 return Err(ConstraintError::MaxGraphemes {
348 path: ValidationPath::from_field("alt"),
349 max: 2000usize,
350 actual: count,
351 });
352 }
353 }
354 }
355 Ok(())
356 }
357}
358
359impl<'a> LexiconSchema for DraftEmbedLocalRef<'a> {
360 fn nsid() -> &'static str {
361 "app.bsky.draft.defs"
362 }
363 fn def_name() -> &'static str {
364 "draftEmbedLocalRef"
365 }
366 fn lexicon_doc() -> LexiconDoc<'static> {
367 lexicon_doc_app_bsky_draft_defs()
368 }
369 fn validate(&self) -> Result<(), ConstraintError> {
370 {
371 let value = &self.path;
372 #[allow(unused_comparisons)]
373 if <str>::len(value.as_ref()) > 1024usize {
374 return Err(ConstraintError::MaxLength {
375 path: ValidationPath::from_field("path"),
376 max: 1024usize,
377 actual: <str>::len(value.as_ref()),
378 });
379 }
380 }
381 {
382 let value = &self.path;
383 #[allow(unused_comparisons)]
384 if <str>::len(value.as_ref()) < 1usize {
385 return Err(ConstraintError::MinLength {
386 path: ValidationPath::from_field("path"),
387 min: 1usize,
388 actual: <str>::len(value.as_ref()),
389 });
390 }
391 }
392 Ok(())
393 }
394}
395
396impl<'a> LexiconSchema for DraftEmbedRecord<'a> {
397 fn nsid() -> &'static str {
398 "app.bsky.draft.defs"
399 }
400 fn def_name() -> &'static str {
401 "draftEmbedRecord"
402 }
403 fn lexicon_doc() -> LexiconDoc<'static> {
404 lexicon_doc_app_bsky_draft_defs()
405 }
406 fn validate(&self) -> Result<(), ConstraintError> {
407 Ok(())
408 }
409}
410
411impl<'a> LexiconSchema for DraftEmbedVideo<'a> {
412 fn nsid() -> &'static str {
413 "app.bsky.draft.defs"
414 }
415 fn def_name() -> &'static str {
416 "draftEmbedVideo"
417 }
418 fn lexicon_doc() -> LexiconDoc<'static> {
419 lexicon_doc_app_bsky_draft_defs()
420 }
421 fn validate(&self) -> Result<(), ConstraintError> {
422 if let Some(ref value) = self.alt {
423 {
424 let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
425 if count > 2000usize {
426 return Err(ConstraintError::MaxGraphemes {
427 path: ValidationPath::from_field("alt"),
428 max: 2000usize,
429 actual: count,
430 });
431 }
432 }
433 }
434 if let Some(ref value) = self.captions {
435 #[allow(unused_comparisons)]
436 if value.len() > 20usize {
437 return Err(ConstraintError::MaxLength {
438 path: ValidationPath::from_field("captions"),
439 max: 20usize,
440 actual: value.len(),
441 });
442 }
443 }
444 Ok(())
445 }
446}
447
448impl<'a> LexiconSchema for DraftPost<'a> {
449 fn nsid() -> &'static str {
450 "app.bsky.draft.defs"
451 }
452 fn def_name() -> &'static str {
453 "draftPost"
454 }
455 fn lexicon_doc() -> LexiconDoc<'static> {
456 lexicon_doc_app_bsky_draft_defs()
457 }
458 fn validate(&self) -> Result<(), ConstraintError> {
459 if let Some(ref value) = self.embed_externals {
460 #[allow(unused_comparisons)]
461 if value.len() > 1usize {
462 return Err(ConstraintError::MaxLength {
463 path: ValidationPath::from_field("embed_externals"),
464 max: 1usize,
465 actual: value.len(),
466 });
467 }
468 }
469 if let Some(ref value) = self.embed_images {
470 #[allow(unused_comparisons)]
471 if value.len() > 4usize {
472 return Err(ConstraintError::MaxLength {
473 path: ValidationPath::from_field("embed_images"),
474 max: 4usize,
475 actual: value.len(),
476 });
477 }
478 }
479 if let Some(ref value) = self.embed_records {
480 #[allow(unused_comparisons)]
481 if value.len() > 1usize {
482 return Err(ConstraintError::MaxLength {
483 path: ValidationPath::from_field("embed_records"),
484 max: 1usize,
485 actual: value.len(),
486 });
487 }
488 }
489 if let Some(ref value) = self.embed_videos {
490 #[allow(unused_comparisons)]
491 if value.len() > 1usize {
492 return Err(ConstraintError::MaxLength {
493 path: ValidationPath::from_field("embed_videos"),
494 max: 1usize,
495 actual: value.len(),
496 });
497 }
498 }
499 {
500 let value = &self.text;
501 #[allow(unused_comparisons)]
502 if <str>::len(value.as_ref()) > 10000usize {
503 return Err(ConstraintError::MaxLength {
504 path: ValidationPath::from_field("text"),
505 max: 10000usize,
506 actual: <str>::len(value.as_ref()),
507 });
508 }
509 }
510 {
511 let value = &self.text;
512 {
513 let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
514 if count > 1000usize {
515 return Err(ConstraintError::MaxGraphemes {
516 path: ValidationPath::from_field("text"),
517 max: 1000usize,
518 actual: count,
519 });
520 }
521 }
522 }
523 Ok(())
524 }
525}
526
527impl<'a> LexiconSchema for DraftView<'a> {
528 fn nsid() -> &'static str {
529 "app.bsky.draft.defs"
530 }
531 fn def_name() -> &'static str {
532 "draftView"
533 }
534 fn lexicon_doc() -> LexiconDoc<'static> {
535 lexicon_doc_app_bsky_draft_defs()
536 }
537 fn validate(&self) -> Result<(), ConstraintError> {
538 Ok(())
539 }
540}
541
542impl<'a> LexiconSchema for DraftWithId<'a> {
543 fn nsid() -> &'static str {
544 "app.bsky.draft.defs"
545 }
546 fn def_name() -> &'static str {
547 "draftWithId"
548 }
549 fn lexicon_doc() -> LexiconDoc<'static> {
550 lexicon_doc_app_bsky_draft_defs()
551 }
552 fn validate(&self) -> Result<(), ConstraintError> {
553 Ok(())
554 }
555}
556
557pub mod draft_state {
558
559 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
560 #[allow(unused)]
561 use ::core::marker::PhantomData;
562 mod sealed {
563 pub trait Sealed {}
564 }
565 pub trait State: sealed::Sealed {
567 type Posts;
568 }
569 pub struct Empty(());
571 impl sealed::Sealed for Empty {}
572 impl State for Empty {
573 type Posts = Unset;
574 }
575 pub struct SetPosts<S: State = Empty>(PhantomData<fn() -> S>);
577 impl<S: State> sealed::Sealed for SetPosts<S> {}
578 impl<S: State> State for SetPosts<S> {
579 type Posts = Set<members::posts>;
580 }
581 #[allow(non_camel_case_types)]
583 pub mod members {
584 pub struct posts(());
586 }
587}
588
589pub struct DraftBuilder<'a, S: draft_state::State> {
591 _state: PhantomData<fn() -> S>,
592 _fields: (
593 Option<CowStr<'a>>,
594 Option<CowStr<'a>>,
595 Option<Vec<Language>>,
596 Option<Vec<DisableRule<'a>>>,
597 Option<Vec<draft::DraftPost<'a>>>,
598 Option<Vec<DraftThreadgateAllowItem<'a>>>,
599 ),
600 _lifetime: PhantomData<&'a ()>,
601}
602
603impl<'a> Draft<'a> {
604 pub fn new() -> DraftBuilder<'a, draft_state::Empty> {
606 DraftBuilder::new()
607 }
608}
609
610impl<'a> DraftBuilder<'a, draft_state::Empty> {
611 pub fn new() -> Self {
613 DraftBuilder {
614 _state: PhantomData,
615 _fields: (None, None, None, None, None, None),
616 _lifetime: PhantomData,
617 }
618 }
619}
620
621impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
622 pub fn device_id(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
624 self._fields.0 = value.into();
625 self
626 }
627 pub fn maybe_device_id(mut self, value: Option<CowStr<'a>>) -> Self {
629 self._fields.0 = value;
630 self
631 }
632}
633
634impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
635 pub fn device_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
637 self._fields.1 = value.into();
638 self
639 }
640 pub fn maybe_device_name(mut self, value: Option<CowStr<'a>>) -> Self {
642 self._fields.1 = value;
643 self
644 }
645}
646
647impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
648 pub fn langs(mut self, value: impl Into<Option<Vec<Language>>>) -> Self {
650 self._fields.2 = value.into();
651 self
652 }
653 pub fn maybe_langs(mut self, value: Option<Vec<Language>>) -> Self {
655 self._fields.2 = value;
656 self
657 }
658}
659
660impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
661 pub fn postgate_embedding_rules(
663 mut self,
664 value: impl Into<Option<Vec<DisableRule<'a>>>>,
665 ) -> Self {
666 self._fields.3 = value.into();
667 self
668 }
669 pub fn maybe_postgate_embedding_rules(
671 mut self,
672 value: Option<Vec<DisableRule<'a>>>,
673 ) -> Self {
674 self._fields.3 = value;
675 self
676 }
677}
678
679impl<'a, S> DraftBuilder<'a, S>
680where
681 S: draft_state::State,
682 S::Posts: draft_state::IsUnset,
683{
684 pub fn posts(
686 mut self,
687 value: impl Into<Vec<draft::DraftPost<'a>>>,
688 ) -> DraftBuilder<'a, draft_state::SetPosts<S>> {
689 self._fields.4 = Option::Some(value.into());
690 DraftBuilder {
691 _state: PhantomData,
692 _fields: self._fields,
693 _lifetime: PhantomData,
694 }
695 }
696}
697
698impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
699 pub fn threadgate_allow(
701 mut self,
702 value: impl Into<Option<Vec<DraftThreadgateAllowItem<'a>>>>,
703 ) -> Self {
704 self._fields.5 = value.into();
705 self
706 }
707 pub fn maybe_threadgate_allow(
709 mut self,
710 value: Option<Vec<DraftThreadgateAllowItem<'a>>>,
711 ) -> Self {
712 self._fields.5 = value;
713 self
714 }
715}
716
717impl<'a, S> DraftBuilder<'a, S>
718where
719 S: draft_state::State,
720 S::Posts: draft_state::IsSet,
721{
722 pub fn build(self) -> Draft<'a> {
724 Draft {
725 device_id: self._fields.0,
726 device_name: self._fields.1,
727 langs: self._fields.2,
728 postgate_embedding_rules: self._fields.3,
729 posts: self._fields.4.unwrap(),
730 threadgate_allow: self._fields.5,
731 extra_data: Default::default(),
732 }
733 }
734 pub fn build_with_data(
736 self,
737 extra_data: BTreeMap<
738 jacquard_common::deps::smol_str::SmolStr,
739 jacquard_common::types::value::Data<'a>,
740 >,
741 ) -> Draft<'a> {
742 Draft {
743 device_id: self._fields.0,
744 device_name: self._fields.1,
745 langs: self._fields.2,
746 postgate_embedding_rules: self._fields.3,
747 posts: self._fields.4.unwrap(),
748 threadgate_allow: self._fields.5,
749 extra_data: Some(extra_data),
750 }
751 }
752}
753
754fn lexicon_doc_app_bsky_draft_defs() -> LexiconDoc<'static> {
755 #[allow(unused_imports)]
756 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
757 use jacquard_lexicon::lexicon::*;
758 use alloc::collections::BTreeMap;
759 LexiconDoc {
760 lexicon: Lexicon::Lexicon1,
761 id: CowStr::new_static("app.bsky.draft.defs"),
762 defs: {
763 let mut map = BTreeMap::new();
764 map.insert(
765 SmolStr::new_static("draft"),
766 LexUserType::Object(LexObject {
767 description: Some(
768 CowStr::new_static("A draft containing an array of draft posts."),
769 ),
770 required: Some(vec![SmolStr::new_static("posts")]),
771 properties: {
772 #[allow(unused_mut)]
773 let mut map = BTreeMap::new();
774 map.insert(
775 SmolStr::new_static("deviceId"),
776 LexObjectProperty::String(LexString {
777 description: Some(
778 CowStr::new_static(
779 "UUIDv4 identifier of the device that created this draft.",
780 ),
781 ),
782 max_length: Some(100usize),
783 ..Default::default()
784 }),
785 );
786 map.insert(
787 SmolStr::new_static("deviceName"),
788 LexObjectProperty::String(LexString {
789 description: Some(
790 CowStr::new_static(
791 "The device and/or platform on which the draft was created.",
792 ),
793 ),
794 max_length: Some(100usize),
795 ..Default::default()
796 }),
797 );
798 map.insert(
799 SmolStr::new_static("langs"),
800 LexObjectProperty::Array(LexArray {
801 description: Some(
802 CowStr::new_static(
803 "Indicates human language of posts primary text content.",
804 ),
805 ),
806 items: LexArrayItem::String(LexString {
807 format: Some(LexStringFormat::Language),
808 ..Default::default()
809 }),
810 max_length: Some(3usize),
811 ..Default::default()
812 }),
813 );
814 map.insert(
815 SmolStr::new_static("postgateEmbeddingRules"),
816 LexObjectProperty::Array(LexArray {
817 description: Some(
818 CowStr::new_static(
819 "Embedding rules for the postgates to be created when this draft is published.",
820 ),
821 ),
822 items: LexArrayItem::Union(LexRefUnion {
823 refs: vec![
824 CowStr::new_static("app.bsky.feed.postgate#disableRule")
825 ],
826 ..Default::default()
827 }),
828 max_length: Some(5usize),
829 ..Default::default()
830 }),
831 );
832 map.insert(
833 SmolStr::new_static("posts"),
834 LexObjectProperty::Array(LexArray {
835 description: Some(
836 CowStr::new_static(
837 "Array of draft posts that compose this draft.",
838 ),
839 ),
840 items: LexArrayItem::Ref(LexRef {
841 r#ref: CowStr::new_static("#draftPost"),
842 ..Default::default()
843 }),
844 min_length: Some(1usize),
845 max_length: Some(100usize),
846 ..Default::default()
847 }),
848 );
849 map.insert(
850 SmolStr::new_static("threadgateAllow"),
851 LexObjectProperty::Array(LexArray {
852 description: Some(
853 CowStr::new_static(
854 "Allow-rules for the threadgate to be created when this draft is published.",
855 ),
856 ),
857 items: LexArrayItem::Union(LexRefUnion {
858 refs: vec![
859 CowStr::new_static("app.bsky.feed.threadgate#mentionRule"),
860 CowStr::new_static("app.bsky.feed.threadgate#followerRule"),
861 CowStr::new_static("app.bsky.feed.threadgate#followingRule"),
862 CowStr::new_static("app.bsky.feed.threadgate#listRule")
863 ],
864 ..Default::default()
865 }),
866 max_length: Some(5usize),
867 ..Default::default()
868 }),
869 );
870 map
871 },
872 ..Default::default()
873 }),
874 );
875 map.insert(
876 SmolStr::new_static("draftEmbedCaption"),
877 LexUserType::Object(LexObject {
878 required: Some(
879 vec![SmolStr::new_static("lang"), SmolStr::new_static("content")],
880 ),
881 properties: {
882 #[allow(unused_mut)]
883 let mut map = BTreeMap::new();
884 map.insert(
885 SmolStr::new_static("content"),
886 LexObjectProperty::String(LexString {
887 max_length: Some(10000usize),
888 ..Default::default()
889 }),
890 );
891 map.insert(
892 SmolStr::new_static("lang"),
893 LexObjectProperty::String(LexString {
894 format: Some(LexStringFormat::Language),
895 ..Default::default()
896 }),
897 );
898 map
899 },
900 ..Default::default()
901 }),
902 );
903 map.insert(
904 SmolStr::new_static("draftEmbedExternal"),
905 LexUserType::Object(LexObject {
906 required: Some(vec![SmolStr::new_static("uri")]),
907 properties: {
908 #[allow(unused_mut)]
909 let mut map = BTreeMap::new();
910 map.insert(
911 SmolStr::new_static("uri"),
912 LexObjectProperty::String(LexString {
913 format: Some(LexStringFormat::Uri),
914 ..Default::default()
915 }),
916 );
917 map
918 },
919 ..Default::default()
920 }),
921 );
922 map.insert(
923 SmolStr::new_static("draftEmbedImage"),
924 LexUserType::Object(LexObject {
925 required: Some(vec![SmolStr::new_static("localRef")]),
926 properties: {
927 #[allow(unused_mut)]
928 let mut map = BTreeMap::new();
929 map.insert(
930 SmolStr::new_static("alt"),
931 LexObjectProperty::String(LexString {
932 max_graphemes: Some(2000usize),
933 ..Default::default()
934 }),
935 );
936 map.insert(
937 SmolStr::new_static("localRef"),
938 LexObjectProperty::Ref(LexRef {
939 r#ref: CowStr::new_static("#draftEmbedLocalRef"),
940 ..Default::default()
941 }),
942 );
943 map
944 },
945 ..Default::default()
946 }),
947 );
948 map.insert(
949 SmolStr::new_static("draftEmbedLocalRef"),
950 LexUserType::Object(LexObject {
951 required: Some(vec![SmolStr::new_static("path")]),
952 properties: {
953 #[allow(unused_mut)]
954 let mut map = BTreeMap::new();
955 map.insert(
956 SmolStr::new_static("path"),
957 LexObjectProperty::String(LexString {
958 description: Some(
959 CowStr::new_static(
960 "Local, on-device ref to file to be embedded. Embeds are currently device-bound for drafts.",
961 ),
962 ),
963 min_length: Some(1usize),
964 max_length: Some(1024usize),
965 ..Default::default()
966 }),
967 );
968 map
969 },
970 ..Default::default()
971 }),
972 );
973 map.insert(
974 SmolStr::new_static("draftEmbedRecord"),
975 LexUserType::Object(LexObject {
976 required: Some(vec![SmolStr::new_static("record")]),
977 properties: {
978 #[allow(unused_mut)]
979 let mut map = BTreeMap::new();
980 map.insert(
981 SmolStr::new_static("record"),
982 LexObjectProperty::Ref(LexRef {
983 r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
984 ..Default::default()
985 }),
986 );
987 map
988 },
989 ..Default::default()
990 }),
991 );
992 map.insert(
993 SmolStr::new_static("draftEmbedVideo"),
994 LexUserType::Object(LexObject {
995 required: Some(vec![SmolStr::new_static("localRef")]),
996 properties: {
997 #[allow(unused_mut)]
998 let mut map = BTreeMap::new();
999 map.insert(
1000 SmolStr::new_static("alt"),
1001 LexObjectProperty::String(LexString {
1002 max_graphemes: Some(2000usize),
1003 ..Default::default()
1004 }),
1005 );
1006 map.insert(
1007 SmolStr::new_static("captions"),
1008 LexObjectProperty::Array(LexArray {
1009 items: LexArrayItem::Ref(LexRef {
1010 r#ref: CowStr::new_static("#draftEmbedCaption"),
1011 ..Default::default()
1012 }),
1013 max_length: Some(20usize),
1014 ..Default::default()
1015 }),
1016 );
1017 map.insert(
1018 SmolStr::new_static("localRef"),
1019 LexObjectProperty::Ref(LexRef {
1020 r#ref: CowStr::new_static("#draftEmbedLocalRef"),
1021 ..Default::default()
1022 }),
1023 );
1024 map
1025 },
1026 ..Default::default()
1027 }),
1028 );
1029 map.insert(
1030 SmolStr::new_static("draftPost"),
1031 LexUserType::Object(LexObject {
1032 description: Some(
1033 CowStr::new_static("One of the posts that compose a draft."),
1034 ),
1035 required: Some(vec![SmolStr::new_static("text")]),
1036 properties: {
1037 #[allow(unused_mut)]
1038 let mut map = BTreeMap::new();
1039 map.insert(
1040 SmolStr::new_static("embedExternals"),
1041 LexObjectProperty::Array(LexArray {
1042 items: LexArrayItem::Ref(LexRef {
1043 r#ref: CowStr::new_static("#draftEmbedExternal"),
1044 ..Default::default()
1045 }),
1046 max_length: Some(1usize),
1047 ..Default::default()
1048 }),
1049 );
1050 map.insert(
1051 SmolStr::new_static("embedImages"),
1052 LexObjectProperty::Array(LexArray {
1053 items: LexArrayItem::Ref(LexRef {
1054 r#ref: CowStr::new_static("#draftEmbedImage"),
1055 ..Default::default()
1056 }),
1057 max_length: Some(4usize),
1058 ..Default::default()
1059 }),
1060 );
1061 map.insert(
1062 SmolStr::new_static("embedRecords"),
1063 LexObjectProperty::Array(LexArray {
1064 items: LexArrayItem::Ref(LexRef {
1065 r#ref: CowStr::new_static("#draftEmbedRecord"),
1066 ..Default::default()
1067 }),
1068 max_length: Some(1usize),
1069 ..Default::default()
1070 }),
1071 );
1072 map.insert(
1073 SmolStr::new_static("embedVideos"),
1074 LexObjectProperty::Array(LexArray {
1075 items: LexArrayItem::Ref(LexRef {
1076 r#ref: CowStr::new_static("#draftEmbedVideo"),
1077 ..Default::default()
1078 }),
1079 max_length: Some(1usize),
1080 ..Default::default()
1081 }),
1082 );
1083 map.insert(
1084 SmolStr::new_static("labels"),
1085 LexObjectProperty::Union(LexRefUnion {
1086 description: Some(
1087 CowStr::new_static(
1088 "Self-label values for this post. Effectively content warnings.",
1089 ),
1090 ),
1091 refs: vec![
1092 CowStr::new_static("com.atproto.label.defs#selfLabels")
1093 ],
1094 ..Default::default()
1095 }),
1096 );
1097 map.insert(
1098 SmolStr::new_static("text"),
1099 LexObjectProperty::String(LexString {
1100 description: Some(
1101 CowStr::new_static(
1102 "The primary post content. It has a higher limit than post contents to allow storing a larger text that can later be refined into smaller posts.",
1103 ),
1104 ),
1105 max_length: Some(10000usize),
1106 max_graphemes: Some(1000usize),
1107 ..Default::default()
1108 }),
1109 );
1110 map
1111 },
1112 ..Default::default()
1113 }),
1114 );
1115 map.insert(
1116 SmolStr::new_static("draftView"),
1117 LexUserType::Object(LexObject {
1118 description: Some(
1119 CowStr::new_static("View to present drafts data to users."),
1120 ),
1121 required: Some(
1122 vec![
1123 SmolStr::new_static("id"), SmolStr::new_static("draft"),
1124 SmolStr::new_static("createdAt"),
1125 SmolStr::new_static("updatedAt")
1126 ],
1127 ),
1128 properties: {
1129 #[allow(unused_mut)]
1130 let mut map = BTreeMap::new();
1131 map.insert(
1132 SmolStr::new_static("createdAt"),
1133 LexObjectProperty::String(LexString {
1134 description: Some(
1135 CowStr::new_static("The time the draft was created."),
1136 ),
1137 format: Some(LexStringFormat::Datetime),
1138 ..Default::default()
1139 }),
1140 );
1141 map.insert(
1142 SmolStr::new_static("draft"),
1143 LexObjectProperty::Ref(LexRef {
1144 r#ref: CowStr::new_static("#draft"),
1145 ..Default::default()
1146 }),
1147 );
1148 map.insert(
1149 SmolStr::new_static("id"),
1150 LexObjectProperty::String(LexString {
1151 description: Some(
1152 CowStr::new_static(
1153 "A TID to be used as a draft identifier.",
1154 ),
1155 ),
1156 format: Some(LexStringFormat::Tid),
1157 ..Default::default()
1158 }),
1159 );
1160 map.insert(
1161 SmolStr::new_static("updatedAt"),
1162 LexObjectProperty::String(LexString {
1163 description: Some(
1164 CowStr::new_static("The time the draft was last updated."),
1165 ),
1166 format: Some(LexStringFormat::Datetime),
1167 ..Default::default()
1168 }),
1169 );
1170 map
1171 },
1172 ..Default::default()
1173 }),
1174 );
1175 map.insert(
1176 SmolStr::new_static("draftWithId"),
1177 LexUserType::Object(LexObject {
1178 description: Some(
1179 CowStr::new_static(
1180 "A draft with an identifier, used to store drafts in private storage (stash).",
1181 ),
1182 ),
1183 required: Some(
1184 vec![SmolStr::new_static("id"), SmolStr::new_static("draft")],
1185 ),
1186 properties: {
1187 #[allow(unused_mut)]
1188 let mut map = BTreeMap::new();
1189 map.insert(
1190 SmolStr::new_static("draft"),
1191 LexObjectProperty::Ref(LexRef {
1192 r#ref: CowStr::new_static("#draft"),
1193 ..Default::default()
1194 }),
1195 );
1196 map.insert(
1197 SmolStr::new_static("id"),
1198 LexObjectProperty::String(LexString {
1199 description: Some(
1200 CowStr::new_static(
1201 "A TID to be used as a draft identifier.",
1202 ),
1203 ),
1204 format: Some(LexStringFormat::Tid),
1205 ..Default::default()
1206 }),
1207 );
1208 map
1209 },
1210 ..Default::default()
1211 }),
1212 );
1213 map
1214 },
1215 ..Default::default()
1216 }
1217}
1218
1219pub mod draft_embed_caption_state {
1220
1221 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1222 #[allow(unused)]
1223 use ::core::marker::PhantomData;
1224 mod sealed {
1225 pub trait Sealed {}
1226 }
1227 pub trait State: sealed::Sealed {
1229 type Lang;
1230 type Content;
1231 }
1232 pub struct Empty(());
1234 impl sealed::Sealed for Empty {}
1235 impl State for Empty {
1236 type Lang = Unset;
1237 type Content = Unset;
1238 }
1239 pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>);
1241 impl<S: State> sealed::Sealed for SetLang<S> {}
1242 impl<S: State> State for SetLang<S> {
1243 type Lang = Set<members::lang>;
1244 type Content = S::Content;
1245 }
1246 pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
1248 impl<S: State> sealed::Sealed for SetContent<S> {}
1249 impl<S: State> State for SetContent<S> {
1250 type Lang = S::Lang;
1251 type Content = Set<members::content>;
1252 }
1253 #[allow(non_camel_case_types)]
1255 pub mod members {
1256 pub struct lang(());
1258 pub struct content(());
1260 }
1261}
1262
1263pub struct DraftEmbedCaptionBuilder<'a, S: draft_embed_caption_state::State> {
1265 _state: PhantomData<fn() -> S>,
1266 _fields: (Option<CowStr<'a>>, Option<Language>),
1267 _lifetime: PhantomData<&'a ()>,
1268}
1269
1270impl<'a> DraftEmbedCaption<'a> {
1271 pub fn new() -> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::Empty> {
1273 DraftEmbedCaptionBuilder::new()
1274 }
1275}
1276
1277impl<'a> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::Empty> {
1278 pub fn new() -> Self {
1280 DraftEmbedCaptionBuilder {
1281 _state: PhantomData,
1282 _fields: (None, None),
1283 _lifetime: PhantomData,
1284 }
1285 }
1286}
1287
1288impl<'a, S> DraftEmbedCaptionBuilder<'a, S>
1289where
1290 S: draft_embed_caption_state::State,
1291 S::Content: draft_embed_caption_state::IsUnset,
1292{
1293 pub fn content(
1295 mut self,
1296 value: impl Into<CowStr<'a>>,
1297 ) -> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::SetContent<S>> {
1298 self._fields.0 = Option::Some(value.into());
1299 DraftEmbedCaptionBuilder {
1300 _state: PhantomData,
1301 _fields: self._fields,
1302 _lifetime: PhantomData,
1303 }
1304 }
1305}
1306
1307impl<'a, S> DraftEmbedCaptionBuilder<'a, S>
1308where
1309 S: draft_embed_caption_state::State,
1310 S::Lang: draft_embed_caption_state::IsUnset,
1311{
1312 pub fn lang(
1314 mut self,
1315 value: impl Into<Language>,
1316 ) -> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::SetLang<S>> {
1317 self._fields.1 = Option::Some(value.into());
1318 DraftEmbedCaptionBuilder {
1319 _state: PhantomData,
1320 _fields: self._fields,
1321 _lifetime: PhantomData,
1322 }
1323 }
1324}
1325
1326impl<'a, S> DraftEmbedCaptionBuilder<'a, S>
1327where
1328 S: draft_embed_caption_state::State,
1329 S::Lang: draft_embed_caption_state::IsSet,
1330 S::Content: draft_embed_caption_state::IsSet,
1331{
1332 pub fn build(self) -> DraftEmbedCaption<'a> {
1334 DraftEmbedCaption {
1335 content: self._fields.0.unwrap(),
1336 lang: self._fields.1.unwrap(),
1337 extra_data: Default::default(),
1338 }
1339 }
1340 pub fn build_with_data(
1342 self,
1343 extra_data: BTreeMap<
1344 jacquard_common::deps::smol_str::SmolStr,
1345 jacquard_common::types::value::Data<'a>,
1346 >,
1347 ) -> DraftEmbedCaption<'a> {
1348 DraftEmbedCaption {
1349 content: self._fields.0.unwrap(),
1350 lang: self._fields.1.unwrap(),
1351 extra_data: Some(extra_data),
1352 }
1353 }
1354}
1355
1356pub mod draft_embed_external_state {
1357
1358 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1359 #[allow(unused)]
1360 use ::core::marker::PhantomData;
1361 mod sealed {
1362 pub trait Sealed {}
1363 }
1364 pub trait State: sealed::Sealed {
1366 type Uri;
1367 }
1368 pub struct Empty(());
1370 impl sealed::Sealed for Empty {}
1371 impl State for Empty {
1372 type Uri = Unset;
1373 }
1374 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1376 impl<S: State> sealed::Sealed for SetUri<S> {}
1377 impl<S: State> State for SetUri<S> {
1378 type Uri = Set<members::uri>;
1379 }
1380 #[allow(non_camel_case_types)]
1382 pub mod members {
1383 pub struct uri(());
1385 }
1386}
1387
1388pub struct DraftEmbedExternalBuilder<'a, S: draft_embed_external_state::State> {
1390 _state: PhantomData<fn() -> S>,
1391 _fields: (Option<UriValue<'a>>,),
1392 _lifetime: PhantomData<&'a ()>,
1393}
1394
1395impl<'a> DraftEmbedExternal<'a> {
1396 pub fn new() -> DraftEmbedExternalBuilder<'a, draft_embed_external_state::Empty> {
1398 DraftEmbedExternalBuilder::new()
1399 }
1400}
1401
1402impl<'a> DraftEmbedExternalBuilder<'a, draft_embed_external_state::Empty> {
1403 pub fn new() -> Self {
1405 DraftEmbedExternalBuilder {
1406 _state: PhantomData,
1407 _fields: (None,),
1408 _lifetime: PhantomData,
1409 }
1410 }
1411}
1412
1413impl<'a, S> DraftEmbedExternalBuilder<'a, S>
1414where
1415 S: draft_embed_external_state::State,
1416 S::Uri: draft_embed_external_state::IsUnset,
1417{
1418 pub fn uri(
1420 mut self,
1421 value: impl Into<UriValue<'a>>,
1422 ) -> DraftEmbedExternalBuilder<'a, draft_embed_external_state::SetUri<S>> {
1423 self._fields.0 = Option::Some(value.into());
1424 DraftEmbedExternalBuilder {
1425 _state: PhantomData,
1426 _fields: self._fields,
1427 _lifetime: PhantomData,
1428 }
1429 }
1430}
1431
1432impl<'a, S> DraftEmbedExternalBuilder<'a, S>
1433where
1434 S: draft_embed_external_state::State,
1435 S::Uri: draft_embed_external_state::IsSet,
1436{
1437 pub fn build(self) -> DraftEmbedExternal<'a> {
1439 DraftEmbedExternal {
1440 uri: self._fields.0.unwrap(),
1441 extra_data: Default::default(),
1442 }
1443 }
1444 pub fn build_with_data(
1446 self,
1447 extra_data: BTreeMap<
1448 jacquard_common::deps::smol_str::SmolStr,
1449 jacquard_common::types::value::Data<'a>,
1450 >,
1451 ) -> DraftEmbedExternal<'a> {
1452 DraftEmbedExternal {
1453 uri: self._fields.0.unwrap(),
1454 extra_data: Some(extra_data),
1455 }
1456 }
1457}
1458
1459pub mod draft_embed_image_state {
1460
1461 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1462 #[allow(unused)]
1463 use ::core::marker::PhantomData;
1464 mod sealed {
1465 pub trait Sealed {}
1466 }
1467 pub trait State: sealed::Sealed {
1469 type LocalRef;
1470 }
1471 pub struct Empty(());
1473 impl sealed::Sealed for Empty {}
1474 impl State for Empty {
1475 type LocalRef = Unset;
1476 }
1477 pub struct SetLocalRef<S: State = Empty>(PhantomData<fn() -> S>);
1479 impl<S: State> sealed::Sealed for SetLocalRef<S> {}
1480 impl<S: State> State for SetLocalRef<S> {
1481 type LocalRef = Set<members::local_ref>;
1482 }
1483 #[allow(non_camel_case_types)]
1485 pub mod members {
1486 pub struct local_ref(());
1488 }
1489}
1490
1491pub struct DraftEmbedImageBuilder<'a, S: draft_embed_image_state::State> {
1493 _state: PhantomData<fn() -> S>,
1494 _fields: (Option<CowStr<'a>>, Option<draft::DraftEmbedLocalRef<'a>>),
1495 _lifetime: PhantomData<&'a ()>,
1496}
1497
1498impl<'a> DraftEmbedImage<'a> {
1499 pub fn new() -> DraftEmbedImageBuilder<'a, draft_embed_image_state::Empty> {
1501 DraftEmbedImageBuilder::new()
1502 }
1503}
1504
1505impl<'a> DraftEmbedImageBuilder<'a, draft_embed_image_state::Empty> {
1506 pub fn new() -> Self {
1508 DraftEmbedImageBuilder {
1509 _state: PhantomData,
1510 _fields: (None, None),
1511 _lifetime: PhantomData,
1512 }
1513 }
1514}
1515
1516impl<'a, S: draft_embed_image_state::State> DraftEmbedImageBuilder<'a, S> {
1517 pub fn alt(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
1519 self._fields.0 = value.into();
1520 self
1521 }
1522 pub fn maybe_alt(mut self, value: Option<CowStr<'a>>) -> Self {
1524 self._fields.0 = value;
1525 self
1526 }
1527}
1528
1529impl<'a, S> DraftEmbedImageBuilder<'a, S>
1530where
1531 S: draft_embed_image_state::State,
1532 S::LocalRef: draft_embed_image_state::IsUnset,
1533{
1534 pub fn local_ref(
1536 mut self,
1537 value: impl Into<draft::DraftEmbedLocalRef<'a>>,
1538 ) -> DraftEmbedImageBuilder<'a, draft_embed_image_state::SetLocalRef<S>> {
1539 self._fields.1 = Option::Some(value.into());
1540 DraftEmbedImageBuilder {
1541 _state: PhantomData,
1542 _fields: self._fields,
1543 _lifetime: PhantomData,
1544 }
1545 }
1546}
1547
1548impl<'a, S> DraftEmbedImageBuilder<'a, S>
1549where
1550 S: draft_embed_image_state::State,
1551 S::LocalRef: draft_embed_image_state::IsSet,
1552{
1553 pub fn build(self) -> DraftEmbedImage<'a> {
1555 DraftEmbedImage {
1556 alt: self._fields.0,
1557 local_ref: self._fields.1.unwrap(),
1558 extra_data: Default::default(),
1559 }
1560 }
1561 pub fn build_with_data(
1563 self,
1564 extra_data: BTreeMap<
1565 jacquard_common::deps::smol_str::SmolStr,
1566 jacquard_common::types::value::Data<'a>,
1567 >,
1568 ) -> DraftEmbedImage<'a> {
1569 DraftEmbedImage {
1570 alt: self._fields.0,
1571 local_ref: self._fields.1.unwrap(),
1572 extra_data: Some(extra_data),
1573 }
1574 }
1575}
1576
1577pub mod draft_embed_record_state {
1578
1579 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1580 #[allow(unused)]
1581 use ::core::marker::PhantomData;
1582 mod sealed {
1583 pub trait Sealed {}
1584 }
1585 pub trait State: sealed::Sealed {
1587 type Record;
1588 }
1589 pub struct Empty(());
1591 impl sealed::Sealed for Empty {}
1592 impl State for Empty {
1593 type Record = Unset;
1594 }
1595 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
1597 impl<S: State> sealed::Sealed for SetRecord<S> {}
1598 impl<S: State> State for SetRecord<S> {
1599 type Record = Set<members::record>;
1600 }
1601 #[allow(non_camel_case_types)]
1603 pub mod members {
1604 pub struct record(());
1606 }
1607}
1608
1609pub struct DraftEmbedRecordBuilder<'a, S: draft_embed_record_state::State> {
1611 _state: PhantomData<fn() -> S>,
1612 _fields: (Option<StrongRef<'a>>,),
1613 _lifetime: PhantomData<&'a ()>,
1614}
1615
1616impl<'a> DraftEmbedRecord<'a> {
1617 pub fn new() -> DraftEmbedRecordBuilder<'a, draft_embed_record_state::Empty> {
1619 DraftEmbedRecordBuilder::new()
1620 }
1621}
1622
1623impl<'a> DraftEmbedRecordBuilder<'a, draft_embed_record_state::Empty> {
1624 pub fn new() -> Self {
1626 DraftEmbedRecordBuilder {
1627 _state: PhantomData,
1628 _fields: (None,),
1629 _lifetime: PhantomData,
1630 }
1631 }
1632}
1633
1634impl<'a, S> DraftEmbedRecordBuilder<'a, S>
1635where
1636 S: draft_embed_record_state::State,
1637 S::Record: draft_embed_record_state::IsUnset,
1638{
1639 pub fn record(
1641 mut self,
1642 value: impl Into<StrongRef<'a>>,
1643 ) -> DraftEmbedRecordBuilder<'a, draft_embed_record_state::SetRecord<S>> {
1644 self._fields.0 = Option::Some(value.into());
1645 DraftEmbedRecordBuilder {
1646 _state: PhantomData,
1647 _fields: self._fields,
1648 _lifetime: PhantomData,
1649 }
1650 }
1651}
1652
1653impl<'a, S> DraftEmbedRecordBuilder<'a, S>
1654where
1655 S: draft_embed_record_state::State,
1656 S::Record: draft_embed_record_state::IsSet,
1657{
1658 pub fn build(self) -> DraftEmbedRecord<'a> {
1660 DraftEmbedRecord {
1661 record: self._fields.0.unwrap(),
1662 extra_data: Default::default(),
1663 }
1664 }
1665 pub fn build_with_data(
1667 self,
1668 extra_data: BTreeMap<
1669 jacquard_common::deps::smol_str::SmolStr,
1670 jacquard_common::types::value::Data<'a>,
1671 >,
1672 ) -> DraftEmbedRecord<'a> {
1673 DraftEmbedRecord {
1674 record: self._fields.0.unwrap(),
1675 extra_data: Some(extra_data),
1676 }
1677 }
1678}
1679
1680pub mod draft_embed_video_state {
1681
1682 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1683 #[allow(unused)]
1684 use ::core::marker::PhantomData;
1685 mod sealed {
1686 pub trait Sealed {}
1687 }
1688 pub trait State: sealed::Sealed {
1690 type LocalRef;
1691 }
1692 pub struct Empty(());
1694 impl sealed::Sealed for Empty {}
1695 impl State for Empty {
1696 type LocalRef = Unset;
1697 }
1698 pub struct SetLocalRef<S: State = Empty>(PhantomData<fn() -> S>);
1700 impl<S: State> sealed::Sealed for SetLocalRef<S> {}
1701 impl<S: State> State for SetLocalRef<S> {
1702 type LocalRef = Set<members::local_ref>;
1703 }
1704 #[allow(non_camel_case_types)]
1706 pub mod members {
1707 pub struct local_ref(());
1709 }
1710}
1711
1712pub struct DraftEmbedVideoBuilder<'a, S: draft_embed_video_state::State> {
1714 _state: PhantomData<fn() -> S>,
1715 _fields: (
1716 Option<CowStr<'a>>,
1717 Option<Vec<draft::DraftEmbedCaption<'a>>>,
1718 Option<draft::DraftEmbedLocalRef<'a>>,
1719 ),
1720 _lifetime: PhantomData<&'a ()>,
1721}
1722
1723impl<'a> DraftEmbedVideo<'a> {
1724 pub fn new() -> DraftEmbedVideoBuilder<'a, draft_embed_video_state::Empty> {
1726 DraftEmbedVideoBuilder::new()
1727 }
1728}
1729
1730impl<'a> DraftEmbedVideoBuilder<'a, draft_embed_video_state::Empty> {
1731 pub fn new() -> Self {
1733 DraftEmbedVideoBuilder {
1734 _state: PhantomData,
1735 _fields: (None, None, None),
1736 _lifetime: PhantomData,
1737 }
1738 }
1739}
1740
1741impl<'a, S: draft_embed_video_state::State> DraftEmbedVideoBuilder<'a, S> {
1742 pub fn alt(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
1744 self._fields.0 = value.into();
1745 self
1746 }
1747 pub fn maybe_alt(mut self, value: Option<CowStr<'a>>) -> Self {
1749 self._fields.0 = value;
1750 self
1751 }
1752}
1753
1754impl<'a, S: draft_embed_video_state::State> DraftEmbedVideoBuilder<'a, S> {
1755 pub fn captions(
1757 mut self,
1758 value: impl Into<Option<Vec<draft::DraftEmbedCaption<'a>>>>,
1759 ) -> Self {
1760 self._fields.1 = value.into();
1761 self
1762 }
1763 pub fn maybe_captions(
1765 mut self,
1766 value: Option<Vec<draft::DraftEmbedCaption<'a>>>,
1767 ) -> Self {
1768 self._fields.1 = value;
1769 self
1770 }
1771}
1772
1773impl<'a, S> DraftEmbedVideoBuilder<'a, S>
1774where
1775 S: draft_embed_video_state::State,
1776 S::LocalRef: draft_embed_video_state::IsUnset,
1777{
1778 pub fn local_ref(
1780 mut self,
1781 value: impl Into<draft::DraftEmbedLocalRef<'a>>,
1782 ) -> DraftEmbedVideoBuilder<'a, draft_embed_video_state::SetLocalRef<S>> {
1783 self._fields.2 = Option::Some(value.into());
1784 DraftEmbedVideoBuilder {
1785 _state: PhantomData,
1786 _fields: self._fields,
1787 _lifetime: PhantomData,
1788 }
1789 }
1790}
1791
1792impl<'a, S> DraftEmbedVideoBuilder<'a, S>
1793where
1794 S: draft_embed_video_state::State,
1795 S::LocalRef: draft_embed_video_state::IsSet,
1796{
1797 pub fn build(self) -> DraftEmbedVideo<'a> {
1799 DraftEmbedVideo {
1800 alt: self._fields.0,
1801 captions: self._fields.1,
1802 local_ref: self._fields.2.unwrap(),
1803 extra_data: Default::default(),
1804 }
1805 }
1806 pub fn build_with_data(
1808 self,
1809 extra_data: BTreeMap<
1810 jacquard_common::deps::smol_str::SmolStr,
1811 jacquard_common::types::value::Data<'a>,
1812 >,
1813 ) -> DraftEmbedVideo<'a> {
1814 DraftEmbedVideo {
1815 alt: self._fields.0,
1816 captions: self._fields.1,
1817 local_ref: self._fields.2.unwrap(),
1818 extra_data: Some(extra_data),
1819 }
1820 }
1821}
1822
1823pub mod draft_view_state {
1824
1825 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1826 #[allow(unused)]
1827 use ::core::marker::PhantomData;
1828 mod sealed {
1829 pub trait Sealed {}
1830 }
1831 pub trait State: sealed::Sealed {
1833 type CreatedAt;
1834 type Draft;
1835 type Id;
1836 type UpdatedAt;
1837 }
1838 pub struct Empty(());
1840 impl sealed::Sealed for Empty {}
1841 impl State for Empty {
1842 type CreatedAt = Unset;
1843 type Draft = Unset;
1844 type Id = Unset;
1845 type UpdatedAt = Unset;
1846 }
1847 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
1849 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
1850 impl<S: State> State for SetCreatedAt<S> {
1851 type CreatedAt = Set<members::created_at>;
1852 type Draft = S::Draft;
1853 type Id = S::Id;
1854 type UpdatedAt = S::UpdatedAt;
1855 }
1856 pub struct SetDraft<S: State = Empty>(PhantomData<fn() -> S>);
1858 impl<S: State> sealed::Sealed for SetDraft<S> {}
1859 impl<S: State> State for SetDraft<S> {
1860 type CreatedAt = S::CreatedAt;
1861 type Draft = Set<members::draft>;
1862 type Id = S::Id;
1863 type UpdatedAt = S::UpdatedAt;
1864 }
1865 pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
1867 impl<S: State> sealed::Sealed for SetId<S> {}
1868 impl<S: State> State for SetId<S> {
1869 type CreatedAt = S::CreatedAt;
1870 type Draft = S::Draft;
1871 type Id = Set<members::id>;
1872 type UpdatedAt = S::UpdatedAt;
1873 }
1874 pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
1876 impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
1877 impl<S: State> State for SetUpdatedAt<S> {
1878 type CreatedAt = S::CreatedAt;
1879 type Draft = S::Draft;
1880 type Id = S::Id;
1881 type UpdatedAt = Set<members::updated_at>;
1882 }
1883 #[allow(non_camel_case_types)]
1885 pub mod members {
1886 pub struct created_at(());
1888 pub struct draft(());
1890 pub struct id(());
1892 pub struct updated_at(());
1894 }
1895}
1896
1897pub struct DraftViewBuilder<'a, S: draft_view_state::State> {
1899 _state: PhantomData<fn() -> S>,
1900 _fields: (Option<Datetime>, Option<draft::Draft<'a>>, Option<Tid>, Option<Datetime>),
1901 _lifetime: PhantomData<&'a ()>,
1902}
1903
1904impl<'a> DraftView<'a> {
1905 pub fn new() -> DraftViewBuilder<'a, draft_view_state::Empty> {
1907 DraftViewBuilder::new()
1908 }
1909}
1910
1911impl<'a> DraftViewBuilder<'a, draft_view_state::Empty> {
1912 pub fn new() -> Self {
1914 DraftViewBuilder {
1915 _state: PhantomData,
1916 _fields: (None, None, None, None),
1917 _lifetime: PhantomData,
1918 }
1919 }
1920}
1921
1922impl<'a, S> DraftViewBuilder<'a, S>
1923where
1924 S: draft_view_state::State,
1925 S::CreatedAt: draft_view_state::IsUnset,
1926{
1927 pub fn created_at(
1929 mut self,
1930 value: impl Into<Datetime>,
1931 ) -> DraftViewBuilder<'a, draft_view_state::SetCreatedAt<S>> {
1932 self._fields.0 = Option::Some(value.into());
1933 DraftViewBuilder {
1934 _state: PhantomData,
1935 _fields: self._fields,
1936 _lifetime: PhantomData,
1937 }
1938 }
1939}
1940
1941impl<'a, S> DraftViewBuilder<'a, S>
1942where
1943 S: draft_view_state::State,
1944 S::Draft: draft_view_state::IsUnset,
1945{
1946 pub fn draft(
1948 mut self,
1949 value: impl Into<draft::Draft<'a>>,
1950 ) -> DraftViewBuilder<'a, draft_view_state::SetDraft<S>> {
1951 self._fields.1 = Option::Some(value.into());
1952 DraftViewBuilder {
1953 _state: PhantomData,
1954 _fields: self._fields,
1955 _lifetime: PhantomData,
1956 }
1957 }
1958}
1959
1960impl<'a, S> DraftViewBuilder<'a, S>
1961where
1962 S: draft_view_state::State,
1963 S::Id: draft_view_state::IsUnset,
1964{
1965 pub fn id(
1967 mut self,
1968 value: impl Into<Tid>,
1969 ) -> DraftViewBuilder<'a, draft_view_state::SetId<S>> {
1970 self._fields.2 = Option::Some(value.into());
1971 DraftViewBuilder {
1972 _state: PhantomData,
1973 _fields: self._fields,
1974 _lifetime: PhantomData,
1975 }
1976 }
1977}
1978
1979impl<'a, S> DraftViewBuilder<'a, S>
1980where
1981 S: draft_view_state::State,
1982 S::UpdatedAt: draft_view_state::IsUnset,
1983{
1984 pub fn updated_at(
1986 mut self,
1987 value: impl Into<Datetime>,
1988 ) -> DraftViewBuilder<'a, draft_view_state::SetUpdatedAt<S>> {
1989 self._fields.3 = Option::Some(value.into());
1990 DraftViewBuilder {
1991 _state: PhantomData,
1992 _fields: self._fields,
1993 _lifetime: PhantomData,
1994 }
1995 }
1996}
1997
1998impl<'a, S> DraftViewBuilder<'a, S>
1999where
2000 S: draft_view_state::State,
2001 S::CreatedAt: draft_view_state::IsSet,
2002 S::Draft: draft_view_state::IsSet,
2003 S::Id: draft_view_state::IsSet,
2004 S::UpdatedAt: draft_view_state::IsSet,
2005{
2006 pub fn build(self) -> DraftView<'a> {
2008 DraftView {
2009 created_at: self._fields.0.unwrap(),
2010 draft: self._fields.1.unwrap(),
2011 id: self._fields.2.unwrap(),
2012 updated_at: self._fields.3.unwrap(),
2013 extra_data: Default::default(),
2014 }
2015 }
2016 pub fn build_with_data(
2018 self,
2019 extra_data: BTreeMap<
2020 jacquard_common::deps::smol_str::SmolStr,
2021 jacquard_common::types::value::Data<'a>,
2022 >,
2023 ) -> DraftView<'a> {
2024 DraftView {
2025 created_at: self._fields.0.unwrap(),
2026 draft: self._fields.1.unwrap(),
2027 id: self._fields.2.unwrap(),
2028 updated_at: self._fields.3.unwrap(),
2029 extra_data: Some(extra_data),
2030 }
2031 }
2032}
2033
2034pub mod draft_with_id_state {
2035
2036 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2037 #[allow(unused)]
2038 use ::core::marker::PhantomData;
2039 mod sealed {
2040 pub trait Sealed {}
2041 }
2042 pub trait State: sealed::Sealed {
2044 type Id;
2045 type Draft;
2046 }
2047 pub struct Empty(());
2049 impl sealed::Sealed for Empty {}
2050 impl State for Empty {
2051 type Id = Unset;
2052 type Draft = Unset;
2053 }
2054 pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
2056 impl<S: State> sealed::Sealed for SetId<S> {}
2057 impl<S: State> State for SetId<S> {
2058 type Id = Set<members::id>;
2059 type Draft = S::Draft;
2060 }
2061 pub struct SetDraft<S: State = Empty>(PhantomData<fn() -> S>);
2063 impl<S: State> sealed::Sealed for SetDraft<S> {}
2064 impl<S: State> State for SetDraft<S> {
2065 type Id = S::Id;
2066 type Draft = Set<members::draft>;
2067 }
2068 #[allow(non_camel_case_types)]
2070 pub mod members {
2071 pub struct id(());
2073 pub struct draft(());
2075 }
2076}
2077
2078pub struct DraftWithIdBuilder<'a, S: draft_with_id_state::State> {
2080 _state: PhantomData<fn() -> S>,
2081 _fields: (Option<draft::Draft<'a>>, Option<Tid>),
2082 _lifetime: PhantomData<&'a ()>,
2083}
2084
2085impl<'a> DraftWithId<'a> {
2086 pub fn new() -> DraftWithIdBuilder<'a, draft_with_id_state::Empty> {
2088 DraftWithIdBuilder::new()
2089 }
2090}
2091
2092impl<'a> DraftWithIdBuilder<'a, draft_with_id_state::Empty> {
2093 pub fn new() -> Self {
2095 DraftWithIdBuilder {
2096 _state: PhantomData,
2097 _fields: (None, None),
2098 _lifetime: PhantomData,
2099 }
2100 }
2101}
2102
2103impl<'a, S> DraftWithIdBuilder<'a, S>
2104where
2105 S: draft_with_id_state::State,
2106 S::Draft: draft_with_id_state::IsUnset,
2107{
2108 pub fn draft(
2110 mut self,
2111 value: impl Into<draft::Draft<'a>>,
2112 ) -> DraftWithIdBuilder<'a, draft_with_id_state::SetDraft<S>> {
2113 self._fields.0 = Option::Some(value.into());
2114 DraftWithIdBuilder {
2115 _state: PhantomData,
2116 _fields: self._fields,
2117 _lifetime: PhantomData,
2118 }
2119 }
2120}
2121
2122impl<'a, S> DraftWithIdBuilder<'a, S>
2123where
2124 S: draft_with_id_state::State,
2125 S::Id: draft_with_id_state::IsUnset,
2126{
2127 pub fn id(
2129 mut self,
2130 value: impl Into<Tid>,
2131 ) -> DraftWithIdBuilder<'a, draft_with_id_state::SetId<S>> {
2132 self._fields.1 = Option::Some(value.into());
2133 DraftWithIdBuilder {
2134 _state: PhantomData,
2135 _fields: self._fields,
2136 _lifetime: PhantomData,
2137 }
2138 }
2139}
2140
2141impl<'a, S> DraftWithIdBuilder<'a, S>
2142where
2143 S: draft_with_id_state::State,
2144 S::Id: draft_with_id_state::IsSet,
2145 S::Draft: draft_with_id_state::IsSet,
2146{
2147 pub fn build(self) -> DraftWithId<'a> {
2149 DraftWithId {
2150 draft: self._fields.0.unwrap(),
2151 id: self._fields.1.unwrap(),
2152 extra_data: Default::default(),
2153 }
2154 }
2155 pub fn build_with_data(
2157 self,
2158 extra_data: BTreeMap<
2159 jacquard_common::deps::smol_str::SmolStr,
2160 jacquard_common::types::value::Data<'a>,
2161 >,
2162 ) -> DraftWithId<'a> {
2163 DraftWithId {
2164 draft: self._fields.0.unwrap(),
2165 id: self._fields.1.unwrap(),
2166 extra_data: Some(extra_data),
2167 }
2168 }
2169}