···2222#[allow(unused_imports)]
2323use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
2424use jacquard_common::deps::smol_str::SmolStr;
2525-use jacquard_common::types::string::{Did, Datetime, UriValue};
2525+use jacquard_common::types::string::{Did, AtUri, Cid, Datetime, UriValue};
2626use jacquard_common::types::value::Data;
2727use jacquard_derive::IntoStatic;
2828use jacquard_lexicon::lexicon::LexiconDoc;
···3232use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
3333use serde::{Serialize, Deserialize};
3434use crate::app_bsky::actor::ProfileViewDetailed;
3535+use crate::space_polymodel::library::ActorViewerState;
3536use crate::space_polymodel::actor;
3636-/// Polymodel actor profile view (union variant). Hydrated from the space.polymodel.actor.profile record plus SQLite-derived stats (thingCount, totalLikes). Returned when the actor authored a polymodel profile record; otherwise getProfile returns the app.bsky.actor.defs#profileViewDetailed variant.
3737+/// A list authored by the profile actor, with enough metadata for profile tabs and links into space.polymodel.graph.getList.
3838+3939+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
4040+#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
4141+pub struct ProfileListView<S: BosStr = DefaultStr> {
4242+ pub cid: Cid<S>,
4343+ pub created_at: Datetime,
4444+ #[serde(skip_serializing_if = "Option::is_none")]
4545+ pub description: Option<S>,
4646+ pub item_count: i64,
4747+ pub name: S,
4848+ #[serde(skip_serializing_if = "Option::is_none")]
4949+ pub purpose: Option<S>,
5050+ pub uri: AtUri<S>,
5151+ #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
5252+ pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
5353+}
5454+5555+/// Polymodel actor profile view (union variant). Hydrated from the space.polymodel.actor.profile record plus SQLite-derived stats and viewer relationship state. Returned when the actor authored a polymodel profile record; otherwise getProfile returns the app.bsky.actor.defs#profileViewDetailed variant.
37563857#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
3958#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
···4867 pub did: Did<S>,
4968 #[serde(skip_serializing_if = "Option::is_none")]
5069 pub display_name: Option<S>,
7070+ #[serde(skip_serializing_if = "Option::is_none")]
7171+ pub follower_count: Option<i64>,
7272+ #[serde(skip_serializing_if = "Option::is_none")]
7373+ pub following_count: Option<i64>,
5174 pub handle: S,
5275 #[serde(skip_serializing_if = "Option::is_none")]
5376 pub indexed_at: Option<Datetime>,
5477 #[serde(skip_serializing_if = "Option::is_none")]
5578 pub links: Option<Vec<UriValue<S>>>,
5679 #[serde(skip_serializing_if = "Option::is_none")]
8080+ pub lists: Option<Vec<actor::ProfileListView<S>>>,
8181+ #[serde(skip_serializing_if = "Option::is_none")]
5782 pub printers: Option<Vec<S>>,
5883 #[serde(skip_serializing_if = "Option::is_none")]
5984 pub pronouns: Option<S>,
···6388 pub thing_count: Option<i64>,
6489 #[serde(skip_serializing_if = "Option::is_none")]
6590 pub total_likes: Option<i64>,
9191+ #[serde(skip_serializing_if = "Option::is_none")]
9292+ pub viewer: Option<ActorViewerState<S>>,
6693 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
6794 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
6895}
···78105 ProfileViewDetailed(Box<ProfileViewDetailed<S>>),
79106}
80107108108+impl<S: BosStr> LexiconSchema for ProfileListView<S> {
109109+ fn nsid() -> &'static str {
110110+ "space.polymodel.actor.defs"
111111+ }
112112+ fn def_name() -> &'static str {
113113+ "profileListView"
114114+ }
115115+ fn lexicon_doc() -> LexiconDoc<'static> {
116116+ lexicon_doc_space_polymodel_actor_defs()
117117+ }
118118+ fn validate(&self) -> Result<(), ConstraintError> {
119119+ Ok(())
120120+ }
121121+}
122122+81123impl<S: BosStr> LexiconSchema for ProfileView<S> {
82124 fn nsid() -> &'static str {
83125 "space.polymodel.actor.defs"
···93135 }
94136}
95137138138+pub mod profile_list_view_state {
139139+140140+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
141141+ #[allow(unused)]
142142+ use ::core::marker::PhantomData;
143143+ mod sealed {
144144+ pub trait Sealed {}
145145+ }
146146+ /// State trait tracking which required fields have been set
147147+ pub trait State: sealed::Sealed {
148148+ type Cid;
149149+ type CreatedAt;
150150+ type ItemCount;
151151+ type Name;
152152+ type Uri;
153153+ }
154154+ /// Empty state - all required fields are unset
155155+ pub struct Empty(());
156156+ impl sealed::Sealed for Empty {}
157157+ impl State for Empty {
158158+ type Cid = Unset;
159159+ type CreatedAt = Unset;
160160+ type ItemCount = Unset;
161161+ type Name = Unset;
162162+ type Uri = Unset;
163163+ }
164164+ ///State transition - sets the `cid` field to Set
165165+ pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
166166+ impl<St: State> sealed::Sealed for SetCid<St> {}
167167+ impl<St: State> State for SetCid<St> {
168168+ type Cid = Set<members::cid>;
169169+ type CreatedAt = St::CreatedAt;
170170+ type ItemCount = St::ItemCount;
171171+ type Name = St::Name;
172172+ type Uri = St::Uri;
173173+ }
174174+ ///State transition - sets the `created_at` field to Set
175175+ pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
176176+ impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
177177+ impl<St: State> State for SetCreatedAt<St> {
178178+ type Cid = St::Cid;
179179+ type CreatedAt = Set<members::created_at>;
180180+ type ItemCount = St::ItemCount;
181181+ type Name = St::Name;
182182+ type Uri = St::Uri;
183183+ }
184184+ ///State transition - sets the `item_count` field to Set
185185+ pub struct SetItemCount<St: State = Empty>(PhantomData<fn() -> St>);
186186+ impl<St: State> sealed::Sealed for SetItemCount<St> {}
187187+ impl<St: State> State for SetItemCount<St> {
188188+ type Cid = St::Cid;
189189+ type CreatedAt = St::CreatedAt;
190190+ type ItemCount = Set<members::item_count>;
191191+ type Name = St::Name;
192192+ type Uri = St::Uri;
193193+ }
194194+ ///State transition - sets the `name` field to Set
195195+ pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
196196+ impl<St: State> sealed::Sealed for SetName<St> {}
197197+ impl<St: State> State for SetName<St> {
198198+ type Cid = St::Cid;
199199+ type CreatedAt = St::CreatedAt;
200200+ type ItemCount = St::ItemCount;
201201+ type Name = Set<members::name>;
202202+ type Uri = St::Uri;
203203+ }
204204+ ///State transition - sets the `uri` field to Set
205205+ pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
206206+ impl<St: State> sealed::Sealed for SetUri<St> {}
207207+ impl<St: State> State for SetUri<St> {
208208+ type Cid = St::Cid;
209209+ type CreatedAt = St::CreatedAt;
210210+ type ItemCount = St::ItemCount;
211211+ type Name = St::Name;
212212+ type Uri = Set<members::uri>;
213213+ }
214214+ /// Marker types for field names
215215+ #[allow(non_camel_case_types)]
216216+ pub mod members {
217217+ ///Marker type for the `cid` field
218218+ pub struct cid(());
219219+ ///Marker type for the `created_at` field
220220+ pub struct created_at(());
221221+ ///Marker type for the `item_count` field
222222+ pub struct item_count(());
223223+ ///Marker type for the `name` field
224224+ pub struct name(());
225225+ ///Marker type for the `uri` field
226226+ pub struct uri(());
227227+ }
228228+}
229229+230230+/// Builder for constructing an instance of this type.
231231+pub struct ProfileListViewBuilder<
232232+ St: profile_list_view_state::State,
233233+ S: BosStr = DefaultStr,
234234+> {
235235+ _state: PhantomData<fn() -> St>,
236236+ _fields: (
237237+ Option<Cid<S>>,
238238+ Option<Datetime>,
239239+ Option<S>,
240240+ Option<i64>,
241241+ Option<S>,
242242+ Option<S>,
243243+ Option<AtUri<S>>,
244244+ ),
245245+ _type: PhantomData<fn() -> S>,
246246+}
247247+248248+impl ProfileListView<DefaultStr> {
249249+ /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
250250+ pub fn new() -> ProfileListViewBuilder<profile_list_view_state::Empty, DefaultStr> {
251251+ ProfileListViewBuilder::new()
252252+ }
253253+}
254254+255255+impl<S: BosStr> ProfileListView<S> {
256256+ /// Create a new builder for this type
257257+ pub fn builder() -> ProfileListViewBuilder<profile_list_view_state::Empty, S> {
258258+ ProfileListViewBuilder::builder()
259259+ }
260260+}
261261+262262+impl ProfileListViewBuilder<profile_list_view_state::Empty, DefaultStr> {
263263+ /// Create a new builder with all fields unset, using the default string type, if needed
264264+ pub fn new() -> Self {
265265+ ProfileListViewBuilder {
266266+ _state: PhantomData,
267267+ _fields: (None, None, None, None, None, None, None),
268268+ _type: PhantomData,
269269+ }
270270+ }
271271+}
272272+273273+impl<S: BosStr> ProfileListViewBuilder<profile_list_view_state::Empty, S> {
274274+ /// Create a new builder with all fields unset
275275+ pub fn builder() -> Self {
276276+ ProfileListViewBuilder {
277277+ _state: PhantomData,
278278+ _fields: (None, None, None, None, None, None, None),
279279+ _type: PhantomData,
280280+ }
281281+ }
282282+}
283283+284284+impl<St, S: BosStr> ProfileListViewBuilder<St, S>
285285+where
286286+ St: profile_list_view_state::State,
287287+ St::Cid: profile_list_view_state::IsUnset,
288288+{
289289+ /// Set the `cid` field (required)
290290+ pub fn cid(
291291+ mut self,
292292+ value: impl Into<Cid<S>>,
293293+ ) -> ProfileListViewBuilder<profile_list_view_state::SetCid<St>, S> {
294294+ self._fields.0 = Option::Some(value.into());
295295+ ProfileListViewBuilder {
296296+ _state: PhantomData,
297297+ _fields: self._fields,
298298+ _type: PhantomData,
299299+ }
300300+ }
301301+}
302302+303303+impl<St, S: BosStr> ProfileListViewBuilder<St, S>
304304+where
305305+ St: profile_list_view_state::State,
306306+ St::CreatedAt: profile_list_view_state::IsUnset,
307307+{
308308+ /// Set the `createdAt` field (required)
309309+ pub fn created_at(
310310+ mut self,
311311+ value: impl Into<Datetime>,
312312+ ) -> ProfileListViewBuilder<profile_list_view_state::SetCreatedAt<St>, S> {
313313+ self._fields.1 = Option::Some(value.into());
314314+ ProfileListViewBuilder {
315315+ _state: PhantomData,
316316+ _fields: self._fields,
317317+ _type: PhantomData,
318318+ }
319319+ }
320320+}
321321+322322+impl<St: profile_list_view_state::State, S: BosStr> ProfileListViewBuilder<St, S> {
323323+ /// Set the `description` field (optional)
324324+ pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
325325+ self._fields.2 = value.into();
326326+ self
327327+ }
328328+ /// Set the `description` field to an Option value (optional)
329329+ pub fn maybe_description(mut self, value: Option<S>) -> Self {
330330+ self._fields.2 = value;
331331+ self
332332+ }
333333+}
334334+335335+impl<St, S: BosStr> ProfileListViewBuilder<St, S>
336336+where
337337+ St: profile_list_view_state::State,
338338+ St::ItemCount: profile_list_view_state::IsUnset,
339339+{
340340+ /// Set the `itemCount` field (required)
341341+ pub fn item_count(
342342+ mut self,
343343+ value: impl Into<i64>,
344344+ ) -> ProfileListViewBuilder<profile_list_view_state::SetItemCount<St>, S> {
345345+ self._fields.3 = Option::Some(value.into());
346346+ ProfileListViewBuilder {
347347+ _state: PhantomData,
348348+ _fields: self._fields,
349349+ _type: PhantomData,
350350+ }
351351+ }
352352+}
353353+354354+impl<St, S: BosStr> ProfileListViewBuilder<St, S>
355355+where
356356+ St: profile_list_view_state::State,
357357+ St::Name: profile_list_view_state::IsUnset,
358358+{
359359+ /// Set the `name` field (required)
360360+ pub fn name(
361361+ mut self,
362362+ value: impl Into<S>,
363363+ ) -> ProfileListViewBuilder<profile_list_view_state::SetName<St>, S> {
364364+ self._fields.4 = Option::Some(value.into());
365365+ ProfileListViewBuilder {
366366+ _state: PhantomData,
367367+ _fields: self._fields,
368368+ _type: PhantomData,
369369+ }
370370+ }
371371+}
372372+373373+impl<St: profile_list_view_state::State, S: BosStr> ProfileListViewBuilder<St, S> {
374374+ /// Set the `purpose` field (optional)
375375+ pub fn purpose(mut self, value: impl Into<Option<S>>) -> Self {
376376+ self._fields.5 = value.into();
377377+ self
378378+ }
379379+ /// Set the `purpose` field to an Option value (optional)
380380+ pub fn maybe_purpose(mut self, value: Option<S>) -> Self {
381381+ self._fields.5 = value;
382382+ self
383383+ }
384384+}
385385+386386+impl<St, S: BosStr> ProfileListViewBuilder<St, S>
387387+where
388388+ St: profile_list_view_state::State,
389389+ St::Uri: profile_list_view_state::IsUnset,
390390+{
391391+ /// Set the `uri` field (required)
392392+ pub fn uri(
393393+ mut self,
394394+ value: impl Into<AtUri<S>>,
395395+ ) -> ProfileListViewBuilder<profile_list_view_state::SetUri<St>, S> {
396396+ self._fields.6 = Option::Some(value.into());
397397+ ProfileListViewBuilder {
398398+ _state: PhantomData,
399399+ _fields: self._fields,
400400+ _type: PhantomData,
401401+ }
402402+ }
403403+}
404404+405405+impl<St, S: BosStr> ProfileListViewBuilder<St, S>
406406+where
407407+ St: profile_list_view_state::State,
408408+ St::Cid: profile_list_view_state::IsSet,
409409+ St::CreatedAt: profile_list_view_state::IsSet,
410410+ St::ItemCount: profile_list_view_state::IsSet,
411411+ St::Name: profile_list_view_state::IsSet,
412412+ St::Uri: profile_list_view_state::IsSet,
413413+{
414414+ /// Build the final struct.
415415+ pub fn build(self) -> ProfileListView<S> {
416416+ ProfileListView {
417417+ cid: self._fields.0.unwrap(),
418418+ created_at: self._fields.1.unwrap(),
419419+ description: self._fields.2,
420420+ item_count: self._fields.3.unwrap(),
421421+ name: self._fields.4.unwrap(),
422422+ purpose: self._fields.5,
423423+ uri: self._fields.6.unwrap(),
424424+ extra_data: Default::default(),
425425+ }
426426+ }
427427+ /// Build the final struct with custom extra_data.
428428+ pub fn build_with_data(
429429+ self,
430430+ extra_data: BTreeMap<SmolStr, Data<S>>,
431431+ ) -> ProfileListView<S> {
432432+ ProfileListView {
433433+ cid: self._fields.0.unwrap(),
434434+ created_at: self._fields.1.unwrap(),
435435+ description: self._fields.2,
436436+ item_count: self._fields.3.unwrap(),
437437+ name: self._fields.4.unwrap(),
438438+ purpose: self._fields.5,
439439+ uri: self._fields.6.unwrap(),
440440+ extra_data: Some(extra_data),
441441+ }
442442+ }
443443+}
444444+445445+fn lexicon_doc_space_polymodel_actor_defs() -> LexiconDoc<'static> {
446446+ #[allow(unused_imports)]
447447+ use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
448448+ use jacquard_lexicon::lexicon::*;
449449+ use alloc::collections::BTreeMap;
450450+ LexiconDoc {
451451+ lexicon: Lexicon::Lexicon1,
452452+ id: CowStr::new_static("space.polymodel.actor.defs"),
453453+ defs: {
454454+ let mut map = BTreeMap::new();
455455+ map.insert(
456456+ SmolStr::new_static("profileListView"),
457457+ LexUserType::Object(LexObject {
458458+ description: Some(
459459+ CowStr::new_static(
460460+ "A list authored by the profile actor, with enough metadata for profile tabs and links into space.polymodel.graph.getList.",
461461+ ),
462462+ ),
463463+ required: Some(
464464+ vec![
465465+ SmolStr::new_static("uri"), SmolStr::new_static("cid"),
466466+ SmolStr::new_static("name"),
467467+ SmolStr::new_static("itemCount"),
468468+ SmolStr::new_static("createdAt")
469469+ ],
470470+ ),
471471+ properties: {
472472+ #[allow(unused_mut)]
473473+ let mut map = BTreeMap::new();
474474+ map.insert(
475475+ SmolStr::new_static("cid"),
476476+ LexObjectProperty::String(LexString {
477477+ format: Some(LexStringFormat::Cid),
478478+ ..Default::default()
479479+ }),
480480+ );
481481+ map.insert(
482482+ SmolStr::new_static("createdAt"),
483483+ LexObjectProperty::String(LexString {
484484+ format: Some(LexStringFormat::Datetime),
485485+ ..Default::default()
486486+ }),
487487+ );
488488+ map.insert(
489489+ SmolStr::new_static("description"),
490490+ LexObjectProperty::String(LexString { ..Default::default() }),
491491+ );
492492+ map.insert(
493493+ SmolStr::new_static("itemCount"),
494494+ LexObjectProperty::Integer(LexInteger {
495495+ ..Default::default()
496496+ }),
497497+ );
498498+ map.insert(
499499+ SmolStr::new_static("name"),
500500+ LexObjectProperty::String(LexString { ..Default::default() }),
501501+ );
502502+ map.insert(
503503+ SmolStr::new_static("purpose"),
504504+ LexObjectProperty::String(LexString { ..Default::default() }),
505505+ );
506506+ map.insert(
507507+ SmolStr::new_static("uri"),
508508+ LexObjectProperty::String(LexString {
509509+ format: Some(LexStringFormat::AtUri),
510510+ ..Default::default()
511511+ }),
512512+ );
513513+ map
514514+ },
515515+ ..Default::default()
516516+ }),
517517+ );
518518+ map.insert(
519519+ SmolStr::new_static("profileView"),
520520+ LexUserType::Object(LexObject {
521521+ description: Some(
522522+ CowStr::new_static(
523523+ "Polymodel actor profile view (union variant). Hydrated from the space.polymodel.actor.profile record plus SQLite-derived stats and viewer relationship state. Returned when the actor authored a polymodel profile record; otherwise getProfile returns the app.bsky.actor.defs#profileViewDetailed variant.",
524524+ ),
525525+ ),
526526+ required: Some(
527527+ vec![
528528+ SmolStr::new_static("did"), SmolStr::new_static("handle"),
529529+ SmolStr::new_static("record")
530530+ ],
531531+ ),
532532+ properties: {
533533+ #[allow(unused_mut)]
534534+ let mut map = BTreeMap::new();
535535+ map.insert(
536536+ SmolStr::new_static("avatar"),
537537+ LexObjectProperty::String(LexString {
538538+ description: Some(
539539+ CowStr::new_static(
540540+ "Resolved avatar URL (CDN). Null until the app view resolves the polymodel profile avatar blob.",
541541+ ),
542542+ ),
543543+ format: Some(LexStringFormat::Uri),
544544+ ..Default::default()
545545+ }),
546546+ );
547547+ map.insert(
548548+ SmolStr::new_static("defaultLicense"),
549549+ LexObjectProperty::String(LexString { ..Default::default() }),
550550+ );
551551+ map.insert(
552552+ SmolStr::new_static("description"),
553553+ LexObjectProperty::String(LexString { ..Default::default() }),
554554+ );
555555+ map.insert(
556556+ SmolStr::new_static("did"),
557557+ LexObjectProperty::String(LexString {
558558+ format: Some(LexStringFormat::Did),
559559+ ..Default::default()
560560+ }),
561561+ );
562562+ map.insert(
563563+ SmolStr::new_static("displayName"),
564564+ LexObjectProperty::String(LexString { ..Default::default() }),
565565+ );
566566+ map.insert(
567567+ SmolStr::new_static("followerCount"),
568568+ LexObjectProperty::Integer(LexInteger {
569569+ ..Default::default()
570570+ }),
571571+ );
572572+ map.insert(
573573+ SmolStr::new_static("followingCount"),
574574+ LexObjectProperty::Integer(LexInteger {
575575+ ..Default::default()
576576+ }),
577577+ );
578578+ map.insert(
579579+ SmolStr::new_static("handle"),
580580+ LexObjectProperty::String(LexString { ..Default::default() }),
581581+ );
582582+ map.insert(
583583+ SmolStr::new_static("indexedAt"),
584584+ LexObjectProperty::String(LexString {
585585+ format: Some(LexStringFormat::Datetime),
586586+ ..Default::default()
587587+ }),
588588+ );
589589+ map.insert(
590590+ SmolStr::new_static("links"),
591591+ LexObjectProperty::Array(LexArray {
592592+ items: LexArrayItem::String(LexString {
593593+ format: Some(LexStringFormat::Uri),
594594+ ..Default::default()
595595+ }),
596596+ ..Default::default()
597597+ }),
598598+ );
599599+ map.insert(
600600+ SmolStr::new_static("lists"),
601601+ LexObjectProperty::Array(LexArray {
602602+ items: LexArrayItem::Ref(LexRef {
603603+ r#ref: CowStr::new_static(
604604+ "space.polymodel.actor.defs#profileListView",
605605+ ),
606606+ ..Default::default()
607607+ }),
608608+ ..Default::default()
609609+ }),
610610+ );
611611+ map.insert(
612612+ SmolStr::new_static("printers"),
613613+ LexObjectProperty::Array(LexArray {
614614+ items: LexArrayItem::String(LexString {
615615+ ..Default::default()
616616+ }),
617617+ ..Default::default()
618618+ }),
619619+ );
620620+ map.insert(
621621+ SmolStr::new_static("pronouns"),
622622+ LexObjectProperty::String(LexString { ..Default::default() }),
623623+ );
624624+ map.insert(
625625+ SmolStr::new_static("record"),
626626+ LexObjectProperty::Unknown(LexUnknown {
627627+ ..Default::default()
628628+ }),
629629+ );
630630+ map.insert(
631631+ SmolStr::new_static("thingCount"),
632632+ LexObjectProperty::Integer(LexInteger {
633633+ ..Default::default()
634634+ }),
635635+ );
636636+ map.insert(
637637+ SmolStr::new_static("totalLikes"),
638638+ LexObjectProperty::Integer(LexInteger {
639639+ ..Default::default()
640640+ }),
641641+ );
642642+ map.insert(
643643+ SmolStr::new_static("viewer"),
644644+ LexObjectProperty::Ref(LexRef {
645645+ r#ref: CowStr::new_static(
646646+ "space.polymodel.library.defs#actorViewerState",
647647+ ),
648648+ ..Default::default()
649649+ }),
650650+ );
651651+ map
652652+ },
653653+ ..Default::default()
654654+ }),
655655+ );
656656+ map.insert(
657657+ SmolStr::new_static("profileViewUnion"),
658658+ LexUserType::Union(LexRefUnion {
659659+ refs: vec![
660660+ CowStr::new_static("space.polymodel.actor.defs#profileView"),
661661+ CowStr::new_static("app.bsky.actor.defs#profileViewDetailed")
662662+ ],
663663+ closed: Some(true),
664664+ ..Default::default()
665665+ }),
666666+ );
667667+ map
668668+ },
669669+ ..Default::default()
670670+ }
671671+}
672672+96673pub mod profile_view_state {
9767498675 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
···160737 Option<S>,
161738 Option<Did<S>>,
162739 Option<S>,
740740+ Option<i64>,
741741+ Option<i64>,
163742 Option<S>,
164743 Option<Datetime>,
165744 Option<Vec<UriValue<S>>>,
745745+ Option<Vec<actor::ProfileListView<S>>>,
166746 Option<Vec<S>>,
167747 Option<S>,
168748 Option<Data<S>>,
169749 Option<i64>,
170750 Option<i64>,
751751+ Option<ActorViewerState<S>>,
171752 ),
172753 _type: PhantomData<fn() -> S>,
173754}
···205786 None,
206787 None,
207788 None,
789789+ None,
790790+ None,
791791+ None,
792792+ None,
208793 ),
209794 _type: PhantomData,
210795 }
···217802 ProfileViewBuilder {
218803 _state: PhantomData,
219804 _fields: (
805805+ None,
806806+ None,
807807+ None,
808808+ None,
220809 None,
221810 None,
222811 None,
···307896 }
308897}
309898899899+impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
900900+ /// Set the `followerCount` field (optional)
901901+ pub fn follower_count(mut self, value: impl Into<Option<i64>>) -> Self {
902902+ self._fields.5 = value.into();
903903+ self
904904+ }
905905+ /// Set the `followerCount` field to an Option value (optional)
906906+ pub fn maybe_follower_count(mut self, value: Option<i64>) -> Self {
907907+ self._fields.5 = value;
908908+ self
909909+ }
910910+}
911911+912912+impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
913913+ /// Set the `followingCount` field (optional)
914914+ pub fn following_count(mut self, value: impl Into<Option<i64>>) -> Self {
915915+ self._fields.6 = value.into();
916916+ self
917917+ }
918918+ /// Set the `followingCount` field to an Option value (optional)
919919+ pub fn maybe_following_count(mut self, value: Option<i64>) -> Self {
920920+ self._fields.6 = value;
921921+ self
922922+ }
923923+}
924924+310925impl<St, S: BosStr> ProfileViewBuilder<St, S>
311926where
312927 St: profile_view_state::State,
···317932 mut self,
318933 value: impl Into<S>,
319934 ) -> ProfileViewBuilder<profile_view_state::SetHandle<St>, S> {
320320- self._fields.5 = Option::Some(value.into());
935935+ self._fields.7 = Option::Some(value.into());
321936 ProfileViewBuilder {
322937 _state: PhantomData,
323938 _fields: self._fields,
···329944impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
330945 /// Set the `indexedAt` field (optional)
331946 pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
332332- self._fields.6 = value.into();
947947+ self._fields.8 = value.into();
333948 self
334949 }
335950 /// Set the `indexedAt` field to an Option value (optional)
336951 pub fn maybe_indexed_at(mut self, value: Option<Datetime>) -> Self {
337337- self._fields.6 = value;
952952+ self._fields.8 = value;
338953 self
339954 }
340955}
···342957impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
343958 /// Set the `links` field (optional)
344959 pub fn links(mut self, value: impl Into<Option<Vec<UriValue<S>>>>) -> Self {
345345- self._fields.7 = value.into();
960960+ self._fields.9 = value.into();
346961 self
347962 }
348963 /// Set the `links` field to an Option value (optional)
349964 pub fn maybe_links(mut self, value: Option<Vec<UriValue<S>>>) -> Self {
350350- self._fields.7 = value;
965965+ self._fields.9 = value;
966966+ self
967967+ }
968968+}
969969+970970+impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
971971+ /// Set the `lists` field (optional)
972972+ pub fn lists(
973973+ mut self,
974974+ value: impl Into<Option<Vec<actor::ProfileListView<S>>>>,
975975+ ) -> Self {
976976+ self._fields.10 = value.into();
977977+ self
978978+ }
979979+ /// Set the `lists` field to an Option value (optional)
980980+ pub fn maybe_lists(mut self, value: Option<Vec<actor::ProfileListView<S>>>) -> Self {
981981+ self._fields.10 = value;
351982 self
352983 }
353984}
···355986impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
356987 /// Set the `printers` field (optional)
357988 pub fn printers(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
358358- self._fields.8 = value.into();
989989+ self._fields.11 = value.into();
359990 self
360991 }
361992 /// Set the `printers` field to an Option value (optional)
362993 pub fn maybe_printers(mut self, value: Option<Vec<S>>) -> Self {
363363- self._fields.8 = value;
994994+ self._fields.11 = value;
364995 self
365996 }
366997}
···368999impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
3691000 /// Set the `pronouns` field (optional)
3701001 pub fn pronouns(mut self, value: impl Into<Option<S>>) -> Self {
371371- self._fields.9 = value.into();
10021002+ self._fields.12 = value.into();
3721003 self
3731004 }
3741005 /// Set the `pronouns` field to an Option value (optional)
3751006 pub fn maybe_pronouns(mut self, value: Option<S>) -> Self {
376376- self._fields.9 = value;
10071007+ self._fields.12 = value;
3771008 self
3781009 }
3791010}
···3881019 mut self,
3891020 value: impl Into<Data<S>>,
3901021 ) -> ProfileViewBuilder<profile_view_state::SetRecord<St>, S> {
391391- self._fields.10 = Option::Some(value.into());
10221022+ self._fields.13 = Option::Some(value.into());
3921023 ProfileViewBuilder {
3931024 _state: PhantomData,
3941025 _fields: self._fields,
···4001031impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
4011032 /// Set the `thingCount` field (optional)
4021033 pub fn thing_count(mut self, value: impl Into<Option<i64>>) -> Self {
403403- self._fields.11 = value.into();
10341034+ self._fields.14 = value.into();
4041035 self
4051036 }
4061037 /// Set the `thingCount` field to an Option value (optional)
4071038 pub fn maybe_thing_count(mut self, value: Option<i64>) -> Self {
408408- self._fields.11 = value;
10391039+ self._fields.14 = value;
4091040 self
4101041 }
4111042}
···4131044impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
4141045 /// Set the `totalLikes` field (optional)
4151046 pub fn total_likes(mut self, value: impl Into<Option<i64>>) -> Self {
416416- self._fields.12 = value.into();
10471047+ self._fields.15 = value.into();
4171048 self
4181049 }
4191050 /// Set the `totalLikes` field to an Option value (optional)
4201051 pub fn maybe_total_likes(mut self, value: Option<i64>) -> Self {
421421- self._fields.12 = value;
10521052+ self._fields.15 = value;
10531053+ self
10541054+ }
10551055+}
10561056+10571057+impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
10581058+ /// Set the `viewer` field (optional)
10591059+ pub fn viewer(mut self, value: impl Into<Option<ActorViewerState<S>>>) -> Self {
10601060+ self._fields.16 = value.into();
10611061+ self
10621062+ }
10631063+ /// Set the `viewer` field to an Option value (optional)
10641064+ pub fn maybe_viewer(mut self, value: Option<ActorViewerState<S>>) -> Self {
10651065+ self._fields.16 = value;
4221066 self
4231067 }
4241068}
···4381082 description: self._fields.2,
4391083 did: self._fields.3.unwrap(),
4401084 display_name: self._fields.4,
441441- handle: self._fields.5.unwrap(),
442442- indexed_at: self._fields.6,
443443- links: self._fields.7,
444444- printers: self._fields.8,
445445- pronouns: self._fields.9,
446446- record: self._fields.10.unwrap(),
447447- thing_count: self._fields.11,
448448- total_likes: self._fields.12,
10851085+ follower_count: self._fields.5,
10861086+ following_count: self._fields.6,
10871087+ handle: self._fields.7.unwrap(),
10881088+ indexed_at: self._fields.8,
10891089+ links: self._fields.9,
10901090+ lists: self._fields.10,
10911091+ printers: self._fields.11,
10921092+ pronouns: self._fields.12,
10931093+ record: self._fields.13.unwrap(),
10941094+ thing_count: self._fields.14,
10951095+ total_likes: self._fields.15,
10961096+ viewer: self._fields.16,
4491097 extra_data: Default::default(),
4501098 }
4511099 }
···4601108 description: self._fields.2,
4611109 did: self._fields.3.unwrap(),
4621110 display_name: self._fields.4,
463463- handle: self._fields.5.unwrap(),
464464- indexed_at: self._fields.6,
465465- links: self._fields.7,
466466- printers: self._fields.8,
467467- pronouns: self._fields.9,
468468- record: self._fields.10.unwrap(),
469469- thing_count: self._fields.11,
470470- total_likes: self._fields.12,
11111111+ follower_count: self._fields.5,
11121112+ following_count: self._fields.6,
11131113+ handle: self._fields.7.unwrap(),
11141114+ indexed_at: self._fields.8,
11151115+ links: self._fields.9,
11161116+ lists: self._fields.10,
11171117+ printers: self._fields.11,
11181118+ pronouns: self._fields.12,
11191119+ record: self._fields.13.unwrap(),
11201120+ thing_count: self._fields.14,
11211121+ total_likes: self._fields.15,
11221122+ viewer: self._fields.16,
4711123 extra_data: Some(extra_data),
4721124 }
473473- }
474474-}
475475-476476-fn lexicon_doc_space_polymodel_actor_defs() -> LexiconDoc<'static> {
477477- #[allow(unused_imports)]
478478- use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
479479- use jacquard_lexicon::lexicon::*;
480480- use alloc::collections::BTreeMap;
481481- LexiconDoc {
482482- lexicon: Lexicon::Lexicon1,
483483- id: CowStr::new_static("space.polymodel.actor.defs"),
484484- defs: {
485485- let mut map = BTreeMap::new();
486486- map.insert(
487487- SmolStr::new_static("profileView"),
488488- LexUserType::Object(LexObject {
489489- description: Some(
490490- CowStr::new_static(
491491- "Polymodel actor profile view (union variant). Hydrated from the space.polymodel.actor.profile record plus SQLite-derived stats (thingCount, totalLikes). Returned when the actor authored a polymodel profile record; otherwise getProfile returns the app.bsky.actor.defs#profileViewDetailed variant.",
492492- ),
493493- ),
494494- required: Some(
495495- vec![
496496- SmolStr::new_static("did"), SmolStr::new_static("handle"),
497497- SmolStr::new_static("record")
498498- ],
499499- ),
500500- properties: {
501501- #[allow(unused_mut)]
502502- let mut map = BTreeMap::new();
503503- map.insert(
504504- SmolStr::new_static("avatar"),
505505- LexObjectProperty::String(LexString {
506506- description: Some(
507507- CowStr::new_static(
508508- "Resolved avatar URL (CDN). Null until the app view resolves the polymodel profile avatar blob.",
509509- ),
510510- ),
511511- format: Some(LexStringFormat::Uri),
512512- ..Default::default()
513513- }),
514514- );
515515- map.insert(
516516- SmolStr::new_static("defaultLicense"),
517517- LexObjectProperty::String(LexString { ..Default::default() }),
518518- );
519519- map.insert(
520520- SmolStr::new_static("description"),
521521- LexObjectProperty::String(LexString { ..Default::default() }),
522522- );
523523- map.insert(
524524- SmolStr::new_static("did"),
525525- LexObjectProperty::String(LexString {
526526- format: Some(LexStringFormat::Did),
527527- ..Default::default()
528528- }),
529529- );
530530- map.insert(
531531- SmolStr::new_static("displayName"),
532532- LexObjectProperty::String(LexString { ..Default::default() }),
533533- );
534534- map.insert(
535535- SmolStr::new_static("handle"),
536536- LexObjectProperty::String(LexString { ..Default::default() }),
537537- );
538538- map.insert(
539539- SmolStr::new_static("indexedAt"),
540540- LexObjectProperty::String(LexString {
541541- format: Some(LexStringFormat::Datetime),
542542- ..Default::default()
543543- }),
544544- );
545545- map.insert(
546546- SmolStr::new_static("links"),
547547- LexObjectProperty::Array(LexArray {
548548- items: LexArrayItem::String(LexString {
549549- format: Some(LexStringFormat::Uri),
550550- ..Default::default()
551551- }),
552552- ..Default::default()
553553- }),
554554- );
555555- map.insert(
556556- SmolStr::new_static("printers"),
557557- LexObjectProperty::Array(LexArray {
558558- items: LexArrayItem::String(LexString {
559559- ..Default::default()
560560- }),
561561- ..Default::default()
562562- }),
563563- );
564564- map.insert(
565565- SmolStr::new_static("pronouns"),
566566- LexObjectProperty::String(LexString { ..Default::default() }),
567567- );
568568- map.insert(
569569- SmolStr::new_static("record"),
570570- LexObjectProperty::Unknown(LexUnknown {
571571- ..Default::default()
572572- }),
573573- );
574574- map.insert(
575575- SmolStr::new_static("thingCount"),
576576- LexObjectProperty::Integer(LexInteger {
577577- ..Default::default()
578578- }),
579579- );
580580- map.insert(
581581- SmolStr::new_static("totalLikes"),
582582- LexObjectProperty::Integer(LexInteger {
583583- ..Default::default()
584584- }),
585585- );
586586- map
587587- },
588588- ..Default::default()
589589- }),
590590- );
591591- map.insert(
592592- SmolStr::new_static("profileViewUnion"),
593593- LexUserType::Union(LexRefUnion {
594594- refs: vec![
595595- CowStr::new_static("space.polymodel.actor.defs#profileView"),
596596- CowStr::new_static("app.bsky.actor.defs#profileViewDetailed")
597597- ],
598598- closed: Some(true),
599599- ..Default::default()
600600- }),
601601- );
602602- map
603603- },
604604- ..Default::default()
6051125 }
6061126}
+3
crates/polymodel-api/src/space_polymodel/graph.rs
···44// Any manual changes will be overwritten on the next regeneration.
5566//! Generated bindings for the `space.polymodel.graph` Lexicon namespace/module.
77+pub mod create_follow;
78pub mod create_like;
89pub mod create_save;
910pub mod create_tag;
1111+pub mod delete_follow;
1012pub mod delete_like;
1113pub mod delete_save;
1214pub mod delete_tag;
1515+pub mod follow;
1316pub mod get_list;
1417pub mod like;
1518pub mod list;
···11+CREATE TABLE follows (
22+ follower_did TEXT NOT NULL,
33+ followed_did TEXT NOT NULL,
44+ rkey TEXT NOT NULL,
55+ cid TEXT NOT NULL,
66+ created_at INTEGER NOT NULL,
77+ PRIMARY KEY (follower_did, rkey),
88+ UNIQUE (follower_did, followed_did)
99+);
1010+1111+CREATE INDEX idx_follows_followed ON follows(followed_did, created_at DESC);
1212+CREATE INDEX idx_follows_follower ON follows(follower_did, created_at DESC);
+15
migrations/008_lists.sql
···11+CREATE TABLE lists (
22+ did TEXT NOT NULL,
33+ rkey TEXT NOT NULL,
44+ uri TEXT NOT NULL UNIQUE,
55+ cid TEXT NOT NULL,
66+ name TEXT NOT NULL,
77+ description TEXT,
88+ purpose TEXT,
99+ created_at INTEGER NOT NULL,
1010+ indexed_at INTEGER NOT NULL,
1111+ record_json TEXT NOT NULL,
1212+ PRIMARY KEY (did, rkey)
1313+);
1414+1515+CREATE INDEX idx_lists_did ON lists(did, created_at DESC);