1pub mod declaration;
10pub mod delete_account;
11pub mod export_account_data;
12pub mod get_status;
13
14#[allow(unused_imports)]
15use alloc::collections::BTreeMap;
16
17#[allow(unused_imports)]
18use core::marker::PhantomData;
19use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
20
21#[allow(unused_imports)]
22use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
23use jacquard_common::deps::smol_str::SmolStr;
24use jacquard_common::types::string::{Datetime, Did, Handle, UriValue};
25use jacquard_common::types::value::Data;
26use jacquard_derive::{IntoStatic, open_union};
27use jacquard_lexicon::lexicon::LexiconDoc;
28use jacquard_lexicon::schema::LexiconSchema;
29
30use crate::app_bsky::actor::ProfileAssociated;
31use crate::app_bsky::actor::VerificationState;
32use crate::app_bsky::actor::ViewerState;
33use crate::chat_bsky::actor;
34use crate::com_atproto::label::Label;
35#[allow(unused_imports)]
36use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
37use serde::{Deserialize, Serialize};
38
39#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
40#[serde(
41 rename_all = "camelCase",
42 bound(deserialize = "S: Deserialize<'de> + BosStr")
43)]
44pub struct DirectConvoMember<S: BosStr = DefaultStr> {
45 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
46 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
47}
48
49#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
52#[serde(
53 rename_all = "camelCase",
54 bound(deserialize = "S: Deserialize<'de> + BosStr")
55)]
56pub struct GroupConvoMember<S: BosStr = DefaultStr> {
57 #[serde(skip_serializing_if = "Option::is_none")]
59 pub added_by: Option<actor::ProfileViewBasic<S>>,
60 pub role: actor::MemberRole<S>,
62 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
63 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
64}
65
66#[derive(Debug, Clone, PartialEq, Eq, Hash)]
67pub enum MemberRole<S: BosStr = DefaultStr> {
68 Owner,
69 Standard,
70 Other(S),
71}
72
73impl<S: BosStr> MemberRole<S> {
74 pub fn as_str(&self) -> &str {
75 match self {
76 Self::Owner => "owner",
77 Self::Standard => "standard",
78 Self::Other(s) => s.as_ref(),
79 }
80 }
81 pub fn from_value(s: S) -> Self {
83 match s.as_ref() {
84 "owner" => Self::Owner,
85 "standard" => Self::Standard,
86 _ => Self::Other(s),
87 }
88 }
89}
90
91impl<S: BosStr> AsRef<str> for MemberRole<S> {
92 fn as_ref(&self) -> &str {
93 self.as_str()
94 }
95}
96
97impl<S: BosStr> core::fmt::Display for MemberRole<S> {
98 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
99 write!(f, "{}", self.as_str())
100 }
101}
102
103impl<S: BosStr> Serialize for MemberRole<S> {
104 fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
105 where
106 Ser: serde::Serializer,
107 {
108 serializer.serialize_str(self.as_str())
109 }
110}
111
112impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for MemberRole<S> {
113 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
114 where
115 D: serde::Deserializer<'de>,
116 {
117 let s = S::deserialize(deserializer)?;
118 Ok(Self::from_value(s))
119 }
120}
121
122impl<S: BosStr> jacquard_common::IntoStatic for MemberRole<S>
123where
124 S: BosStr + jacquard_common::IntoStatic,
125 S::Output: BosStr,
126{
127 type Output = MemberRole<S::Output>;
128 fn into_static(self) -> Self::Output {
129 match self {
130 MemberRole::Owner => MemberRole::Owner,
131 MemberRole::Standard => MemberRole::Standard,
132 MemberRole::Other(v) => MemberRole::Other(v.into_static()),
133 }
134 }
135}
136
137#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
140#[serde(
141 rename_all = "camelCase",
142 bound(deserialize = "S: Deserialize<'de> + BosStr")
143)]
144pub struct PastGroupConvoMember<S: BosStr = DefaultStr> {
145 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
146 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
147}
148
149#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
150#[serde(
151 rename_all = "camelCase",
152 bound(deserialize = "S: Deserialize<'de> + BosStr")
153)]
154pub struct ProfileViewBasic<S: BosStr = DefaultStr> {
155 #[serde(skip_serializing_if = "Option::is_none")]
156 pub associated: Option<ProfileAssociated<S>>,
157 #[serde(skip_serializing_if = "Option::is_none")]
158 pub avatar: Option<UriValue<S>>,
159 #[serde(skip_serializing_if = "Option::is_none")]
161 pub chat_disabled: Option<bool>,
162 #[serde(skip_serializing_if = "Option::is_none")]
163 pub created_at: Option<Datetime>,
164 pub did: Did<S>,
165 #[serde(skip_serializing_if = "Option::is_none")]
166 pub display_name: Option<S>,
167 pub handle: Handle<S>,
168 #[serde(skip_serializing_if = "Option::is_none")]
170 pub kind: Option<ProfileViewBasicKind<S>>,
171 #[serde(skip_serializing_if = "Option::is_none")]
172 pub labels: Option<Vec<Label<S>>>,
173 #[serde(skip_serializing_if = "Option::is_none")]
174 pub verification: Option<VerificationState<S>>,
175 #[serde(skip_serializing_if = "Option::is_none")]
176 pub viewer: Option<ViewerState<S>>,
177 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
178 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
179}
180
181#[open_union]
182#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
183#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
184pub enum ProfileViewBasicKind<S: BosStr = DefaultStr> {
185 #[serde(rename = "chat.bsky.actor.defs#directConvoMember")]
186 DirectConvoMember(Box<actor::DirectConvoMember<S>>),
187 #[serde(rename = "chat.bsky.actor.defs#groupConvoMember")]
188 GroupConvoMember(Box<actor::GroupConvoMember<S>>),
189 #[serde(rename = "chat.bsky.actor.defs#pastGroupConvoMember")]
190 PastGroupConvoMember(Box<actor::PastGroupConvoMember<S>>),
191}
192
193impl<S: BosStr> LexiconSchema for DirectConvoMember<S> {
194 fn nsid() -> &'static str {
195 "chat.bsky.actor.defs"
196 }
197 fn def_name() -> &'static str {
198 "directConvoMember"
199 }
200 fn lexicon_doc() -> LexiconDoc<'static> {
201 lexicon_doc_chat_bsky_actor_defs()
202 }
203 fn validate(&self) -> Result<(), ConstraintError> {
204 Ok(())
205 }
206}
207
208impl<S: BosStr> LexiconSchema for GroupConvoMember<S> {
209 fn nsid() -> &'static str {
210 "chat.bsky.actor.defs"
211 }
212 fn def_name() -> &'static str {
213 "groupConvoMember"
214 }
215 fn lexicon_doc() -> LexiconDoc<'static> {
216 lexicon_doc_chat_bsky_actor_defs()
217 }
218 fn validate(&self) -> Result<(), ConstraintError> {
219 Ok(())
220 }
221}
222
223impl<S: BosStr> LexiconSchema for PastGroupConvoMember<S> {
224 fn nsid() -> &'static str {
225 "chat.bsky.actor.defs"
226 }
227 fn def_name() -> &'static str {
228 "pastGroupConvoMember"
229 }
230 fn lexicon_doc() -> LexiconDoc<'static> {
231 lexicon_doc_chat_bsky_actor_defs()
232 }
233 fn validate(&self) -> Result<(), ConstraintError> {
234 Ok(())
235 }
236}
237
238impl<S: BosStr> LexiconSchema for ProfileViewBasic<S> {
239 fn nsid() -> &'static str {
240 "chat.bsky.actor.defs"
241 }
242 fn def_name() -> &'static str {
243 "profileViewBasic"
244 }
245 fn lexicon_doc() -> LexiconDoc<'static> {
246 lexicon_doc_chat_bsky_actor_defs()
247 }
248 fn validate(&self) -> Result<(), ConstraintError> {
249 if let Some(ref value) = self.display_name {
250 #[allow(unused_comparisons)]
251 if <str>::len(value.as_ref()) > 640usize {
252 return Err(ConstraintError::MaxLength {
253 path: ValidationPath::from_field("display_name"),
254 max: 640usize,
255 actual: <str>::len(value.as_ref()),
256 });
257 }
258 }
259 if let Some(ref value) = self.display_name {
260 {
261 let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
262 if count > 64usize {
263 return Err(ConstraintError::MaxGraphemes {
264 path: ValidationPath::from_field("display_name"),
265 max: 64usize,
266 actual: count,
267 });
268 }
269 }
270 }
271 Ok(())
272 }
273}
274
275fn lexicon_doc_chat_bsky_actor_defs() -> LexiconDoc<'static> {
276 use alloc::collections::BTreeMap;
277 #[allow(unused_imports)]
278 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
279 use jacquard_lexicon::lexicon::*;
280 LexiconDoc {
281 lexicon: Lexicon::Lexicon1,
282 id: CowStr::new_static("chat.bsky.actor.defs"),
283 defs: {
284 let mut map = BTreeMap::new();
285 map.insert(
286 SmolStr::new_static("directConvoMember"),
287 LexUserType::Object(LexObject {
288 properties: {
289 #[allow(unused_mut)]
290 let mut map = BTreeMap::new();
291 map
292 },
293 ..Default::default()
294 }),
295 );
296 map.insert(
297 SmolStr::new_static("groupConvoMember"),
298 LexUserType::Object(LexObject {
299 description: Some(CowStr::new_static("A current group convo member.")),
300 required: Some(vec![SmolStr::new_static("role")]),
301 properties: {
302 #[allow(unused_mut)]
303 let mut map = BTreeMap::new();
304 map.insert(
305 SmolStr::new_static("addedBy"),
306 LexObjectProperty::Ref(LexRef {
307 r#ref: CowStr::new_static("#profileViewBasic"),
308 ..Default::default()
309 }),
310 );
311 map.insert(
312 SmolStr::new_static("role"),
313 LexObjectProperty::Ref(LexRef {
314 r#ref: CowStr::new_static("#memberRole"),
315 ..Default::default()
316 }),
317 );
318 map
319 },
320 ..Default::default()
321 }),
322 );
323 map.insert(
324 SmolStr::new_static("memberRole"),
325 LexUserType::String(LexString {
326 ..Default::default()
327 }),
328 );
329 map.insert(
330 SmolStr::new_static("pastGroupConvoMember"),
331 LexUserType::Object(LexObject {
332 description: Some(CowStr::new_static("A past group convo member.")),
333 required: Some(vec![]),
334 properties: {
335 #[allow(unused_mut)]
336 let mut map = BTreeMap::new();
337 map
338 },
339 ..Default::default()
340 }),
341 );
342 map.insert(
343 SmolStr::new_static("profileViewBasic"),
344 LexUserType::Object(LexObject {
345 required: Some(
346 vec![SmolStr::new_static("did"), SmolStr::new_static("handle")],
347 ),
348 properties: {
349 #[allow(unused_mut)]
350 let mut map = BTreeMap::new();
351 map.insert(
352 SmolStr::new_static("associated"),
353 LexObjectProperty::Ref(LexRef {
354 r#ref: CowStr::new_static(
355 "app.bsky.actor.defs#profileAssociated",
356 ),
357 ..Default::default()
358 }),
359 );
360 map.insert(
361 SmolStr::new_static("avatar"),
362 LexObjectProperty::String(LexString {
363 format: Some(LexStringFormat::Uri),
364 ..Default::default()
365 }),
366 );
367 map.insert(
368 SmolStr::new_static("chatDisabled"),
369 LexObjectProperty::Boolean(LexBoolean {
370 ..Default::default()
371 }),
372 );
373 map.insert(
374 SmolStr::new_static("createdAt"),
375 LexObjectProperty::String(LexString {
376 format: Some(LexStringFormat::Datetime),
377 ..Default::default()
378 }),
379 );
380 map.insert(
381 SmolStr::new_static("did"),
382 LexObjectProperty::String(LexString {
383 format: Some(LexStringFormat::Did),
384 ..Default::default()
385 }),
386 );
387 map.insert(
388 SmolStr::new_static("displayName"),
389 LexObjectProperty::String(LexString {
390 max_length: Some(640usize),
391 max_graphemes: Some(64usize),
392 ..Default::default()
393 }),
394 );
395 map.insert(
396 SmolStr::new_static("handle"),
397 LexObjectProperty::String(LexString {
398 format: Some(LexStringFormat::Handle),
399 ..Default::default()
400 }),
401 );
402 map.insert(
403 SmolStr::new_static("kind"),
404 LexObjectProperty::Union(LexRefUnion {
405 description: Some(
406 CowStr::new_static(
407 "Union field that has data specific to different kinds of convos.",
408 ),
409 ),
410 refs: vec![
411 CowStr::new_static("#directConvoMember"),
412 CowStr::new_static("#groupConvoMember"),
413 CowStr::new_static("#pastGroupConvoMember")
414 ],
415 ..Default::default()
416 }),
417 );
418 map.insert(
419 SmolStr::new_static("labels"),
420 LexObjectProperty::Array(LexArray {
421 items: LexArrayItem::Ref(LexRef {
422 r#ref: CowStr::new_static("com.atproto.label.defs#label"),
423 ..Default::default()
424 }),
425 ..Default::default()
426 }),
427 );
428 map.insert(
429 SmolStr::new_static("verification"),
430 LexObjectProperty::Ref(LexRef {
431 r#ref: CowStr::new_static(
432 "app.bsky.actor.defs#verificationState",
433 ),
434 ..Default::default()
435 }),
436 );
437 map.insert(
438 SmolStr::new_static("viewer"),
439 LexObjectProperty::Ref(LexRef {
440 r#ref: CowStr::new_static(
441 "app.bsky.actor.defs#viewerState",
442 ),
443 ..Default::default()
444 }),
445 );
446 map
447 },
448 ..Default::default()
449 }),
450 );
451 map
452 },
453 ..Default::default()
454 }
455}
456
457pub mod group_convo_member_state {
458
459 pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
460 #[allow(unused)]
461 use ::core::marker::PhantomData;
462 mod sealed {
463 pub trait Sealed {}
464 }
465 pub trait State: sealed::Sealed {
467 type Role;
468 }
469 pub struct Empty(());
471 impl sealed::Sealed for Empty {}
472 impl State for Empty {
473 type Role = Unset;
474 }
475 pub struct SetRole<St: State = Empty>(PhantomData<fn() -> St>);
477 impl<St: State> sealed::Sealed for SetRole<St> {}
478 impl<St: State> State for SetRole<St> {
479 type Role = Set<members::role>;
480 }
481 #[allow(non_camel_case_types)]
483 pub mod members {
484 pub struct role(());
486 }
487}
488
489pub struct GroupConvoMemberBuilder<St: group_convo_member_state::State, S: BosStr = DefaultStr> {
491 _state: PhantomData<fn() -> St>,
492 _fields: (
493 Option<actor::ProfileViewBasic<S>>,
494 Option<actor::MemberRole<S>>,
495 ),
496 _type: PhantomData<fn() -> S>,
497}
498
499impl GroupConvoMember<DefaultStr> {
500 pub fn new() -> GroupConvoMemberBuilder<group_convo_member_state::Empty, DefaultStr> {
502 GroupConvoMemberBuilder::new()
503 }
504}
505
506impl<S: BosStr> GroupConvoMember<S> {
507 pub fn builder() -> GroupConvoMemberBuilder<group_convo_member_state::Empty, S> {
509 GroupConvoMemberBuilder::builder()
510 }
511}
512
513impl GroupConvoMemberBuilder<group_convo_member_state::Empty, DefaultStr> {
514 pub fn new() -> Self {
516 GroupConvoMemberBuilder {
517 _state: PhantomData,
518 _fields: (None, None),
519 _type: PhantomData,
520 }
521 }
522}
523
524impl<S: BosStr> GroupConvoMemberBuilder<group_convo_member_state::Empty, S> {
525 pub fn builder() -> Self {
527 GroupConvoMemberBuilder {
528 _state: PhantomData,
529 _fields: (None, None),
530 _type: PhantomData,
531 }
532 }
533}
534
535impl<St: group_convo_member_state::State, S: BosStr> GroupConvoMemberBuilder<St, S> {
536 pub fn added_by(mut self, value: impl Into<Option<actor::ProfileViewBasic<S>>>) -> Self {
538 self._fields.0 = value.into();
539 self
540 }
541 pub fn maybe_added_by(mut self, value: Option<actor::ProfileViewBasic<S>>) -> Self {
543 self._fields.0 = value;
544 self
545 }
546}
547
548impl<St, S: BosStr> GroupConvoMemberBuilder<St, S>
549where
550 St: group_convo_member_state::State,
551 St::Role: group_convo_member_state::IsUnset,
552{
553 pub fn role(
555 mut self,
556 value: impl Into<actor::MemberRole<S>>,
557 ) -> GroupConvoMemberBuilder<group_convo_member_state::SetRole<St>, S> {
558 self._fields.1 = Option::Some(value.into());
559 GroupConvoMemberBuilder {
560 _state: PhantomData,
561 _fields: self._fields,
562 _type: PhantomData,
563 }
564 }
565}
566
567impl<St, S: BosStr> GroupConvoMemberBuilder<St, S>
568where
569 St: group_convo_member_state::State,
570 St::Role: group_convo_member_state::IsSet,
571{
572 pub fn build(self) -> GroupConvoMember<S> {
574 GroupConvoMember {
575 added_by: self._fields.0,
576 role: self._fields.1.unwrap(),
577 extra_data: Default::default(),
578 }
579 }
580 pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> GroupConvoMember<S> {
582 GroupConvoMember {
583 added_by: self._fields.0,
584 role: self._fields.1.unwrap(),
585 extra_data: Some(extra_data),
586 }
587 }
588}
589
590pub mod profile_view_basic_state {
591
592 pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
593 #[allow(unused)]
594 use ::core::marker::PhantomData;
595 mod sealed {
596 pub trait Sealed {}
597 }
598 pub trait State: sealed::Sealed {
600 type Did;
601 type Handle;
602 }
603 pub struct Empty(());
605 impl sealed::Sealed for Empty {}
606 impl State for Empty {
607 type Did = Unset;
608 type Handle = Unset;
609 }
610 pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
612 impl<St: State> sealed::Sealed for SetDid<St> {}
613 impl<St: State> State for SetDid<St> {
614 type Did = Set<members::did>;
615 type Handle = St::Handle;
616 }
617 pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
619 impl<St: State> sealed::Sealed for SetHandle<St> {}
620 impl<St: State> State for SetHandle<St> {
621 type Did = St::Did;
622 type Handle = Set<members::handle>;
623 }
624 #[allow(non_camel_case_types)]
626 pub mod members {
627 pub struct did(());
629 pub struct handle(());
631 }
632}
633
634pub struct ProfileViewBasicBuilder<St: profile_view_basic_state::State, S: BosStr = DefaultStr> {
636 _state: PhantomData<fn() -> St>,
637 _fields: (
638 Option<ProfileAssociated<S>>,
639 Option<UriValue<S>>,
640 Option<bool>,
641 Option<Datetime>,
642 Option<Did<S>>,
643 Option<S>,
644 Option<Handle<S>>,
645 Option<ProfileViewBasicKind<S>>,
646 Option<Vec<Label<S>>>,
647 Option<VerificationState<S>>,
648 Option<ViewerState<S>>,
649 ),
650 _type: PhantomData<fn() -> S>,
651}
652
653impl ProfileViewBasic<DefaultStr> {
654 pub fn new() -> ProfileViewBasicBuilder<profile_view_basic_state::Empty, DefaultStr> {
656 ProfileViewBasicBuilder::new()
657 }
658}
659
660impl<S: BosStr> ProfileViewBasic<S> {
661 pub fn builder() -> ProfileViewBasicBuilder<profile_view_basic_state::Empty, S> {
663 ProfileViewBasicBuilder::builder()
664 }
665}
666
667impl ProfileViewBasicBuilder<profile_view_basic_state::Empty, DefaultStr> {
668 pub fn new() -> Self {
670 ProfileViewBasicBuilder {
671 _state: PhantomData,
672 _fields: (
673 None, None, None, None, None, None, None, None, None, None, None,
674 ),
675 _type: PhantomData,
676 }
677 }
678}
679
680impl<S: BosStr> ProfileViewBasicBuilder<profile_view_basic_state::Empty, S> {
681 pub fn builder() -> Self {
683 ProfileViewBasicBuilder {
684 _state: PhantomData,
685 _fields: (
686 None, None, None, None, None, None, None, None, None, None, None,
687 ),
688 _type: PhantomData,
689 }
690 }
691}
692
693impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
694 pub fn associated(mut self, value: impl Into<Option<ProfileAssociated<S>>>) -> Self {
696 self._fields.0 = value.into();
697 self
698 }
699 pub fn maybe_associated(mut self, value: Option<ProfileAssociated<S>>) -> Self {
701 self._fields.0 = value;
702 self
703 }
704}
705
706impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
707 pub fn avatar(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
709 self._fields.1 = value.into();
710 self
711 }
712 pub fn maybe_avatar(mut self, value: Option<UriValue<S>>) -> Self {
714 self._fields.1 = value;
715 self
716 }
717}
718
719impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
720 pub fn chat_disabled(mut self, value: impl Into<Option<bool>>) -> Self {
722 self._fields.2 = value.into();
723 self
724 }
725 pub fn maybe_chat_disabled(mut self, value: Option<bool>) -> Self {
727 self._fields.2 = value;
728 self
729 }
730}
731
732impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
733 pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
735 self._fields.3 = value.into();
736 self
737 }
738 pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
740 self._fields.3 = value;
741 self
742 }
743}
744
745impl<St, S: BosStr> ProfileViewBasicBuilder<St, S>
746where
747 St: profile_view_basic_state::State,
748 St::Did: profile_view_basic_state::IsUnset,
749{
750 pub fn did(
752 mut self,
753 value: impl Into<Did<S>>,
754 ) -> ProfileViewBasicBuilder<profile_view_basic_state::SetDid<St>, S> {
755 self._fields.4 = Option::Some(value.into());
756 ProfileViewBasicBuilder {
757 _state: PhantomData,
758 _fields: self._fields,
759 _type: PhantomData,
760 }
761 }
762}
763
764impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
765 pub fn display_name(mut self, value: impl Into<Option<S>>) -> Self {
767 self._fields.5 = value.into();
768 self
769 }
770 pub fn maybe_display_name(mut self, value: Option<S>) -> Self {
772 self._fields.5 = value;
773 self
774 }
775}
776
777impl<St, S: BosStr> ProfileViewBasicBuilder<St, S>
778where
779 St: profile_view_basic_state::State,
780 St::Handle: profile_view_basic_state::IsUnset,
781{
782 pub fn handle(
784 mut self,
785 value: impl Into<Handle<S>>,
786 ) -> ProfileViewBasicBuilder<profile_view_basic_state::SetHandle<St>, S> {
787 self._fields.6 = Option::Some(value.into());
788 ProfileViewBasicBuilder {
789 _state: PhantomData,
790 _fields: self._fields,
791 _type: PhantomData,
792 }
793 }
794}
795
796impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
797 pub fn kind(mut self, value: impl Into<Option<ProfileViewBasicKind<S>>>) -> Self {
799 self._fields.7 = value.into();
800 self
801 }
802 pub fn maybe_kind(mut self, value: Option<ProfileViewBasicKind<S>>) -> Self {
804 self._fields.7 = value;
805 self
806 }
807}
808
809impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
810 pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
812 self._fields.8 = value.into();
813 self
814 }
815 pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
817 self._fields.8 = value;
818 self
819 }
820}
821
822impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
823 pub fn verification(mut self, value: impl Into<Option<VerificationState<S>>>) -> Self {
825 self._fields.9 = value.into();
826 self
827 }
828 pub fn maybe_verification(mut self, value: Option<VerificationState<S>>) -> Self {
830 self._fields.9 = value;
831 self
832 }
833}
834
835impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
836 pub fn viewer(mut self, value: impl Into<Option<ViewerState<S>>>) -> Self {
838 self._fields.10 = value.into();
839 self
840 }
841 pub fn maybe_viewer(mut self, value: Option<ViewerState<S>>) -> Self {
843 self._fields.10 = value;
844 self
845 }
846}
847
848impl<St, S: BosStr> ProfileViewBasicBuilder<St, S>
849where
850 St: profile_view_basic_state::State,
851 St::Did: profile_view_basic_state::IsSet,
852 St::Handle: profile_view_basic_state::IsSet,
853{
854 pub fn build(self) -> ProfileViewBasic<S> {
856 ProfileViewBasic {
857 associated: self._fields.0,
858 avatar: self._fields.1,
859 chat_disabled: self._fields.2,
860 created_at: self._fields.3,
861 did: self._fields.4.unwrap(),
862 display_name: self._fields.5,
863 handle: self._fields.6.unwrap(),
864 kind: self._fields.7,
865 labels: self._fields.8,
866 verification: self._fields.9,
867 viewer: self._fields.10,
868 extra_data: Default::default(),
869 }
870 }
871 pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ProfileViewBasic<S> {
873 ProfileViewBasic {
874 associated: self._fields.0,
875 avatar: self._fields.1,
876 chat_disabled: self._fields.2,
877 created_at: self._fields.3,
878 did: self._fields.4.unwrap(),
879 display_name: self._fields.5,
880 handle: self._fields.6.unwrap(),
881 kind: self._fields.7,
882 labels: self._fields.8,
883 verification: self._fields.9,
884 viewer: self._fields.10,
885 extra_data: Some(extra_data),
886 }
887 }
888}