atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.collab.defs
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8pub mod accept;
9pub mod get_collaboration_state;
10pub mod get_invites;
11pub mod get_resource_participants;
12pub mod get_resource_sessions;
13pub mod invite;
14pub mod session;
15
16/// Collaboration scoped to a chapter.
17#[derive(
18 serde::Serialize,
19 serde::Deserialize,
20 Debug,
21 Clone,
22 PartialEq,
23 Eq,
24 Hash,
25 jacquard_derive::IntoStatic
26)]
27pub struct Chapter;
28impl std::fmt::Display for Chapter {
29 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30 write!(f, "chapter")
31 }
32}
33
34/// Full state of a collaboration relationship including version reconciliation. Tracks both current and former collaborators.
35#[jacquard_derive::lexicon]
36#[derive(
37 serde::Serialize,
38 serde::Deserialize,
39 Debug,
40 Clone,
41 PartialEq,
42 Eq,
43 jacquard_derive::IntoStatic
44)]
45#[serde(rename_all = "camelCase")]
46pub struct CollaborationStateView<'a> {
47 /// The 'canonical' version URI (usually owner's)
48 #[serde(skip_serializing_if = "std::option::Option::is_none")]
49 #[serde(borrow)]
50 pub canonical_uri: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
51 #[serde(skip_serializing_if = "std::option::Option::is_none")]
52 pub created_at: std::option::Option<jacquard_common::types::string::Datetime>,
53 #[serde(skip_serializing_if = "std::option::Option::is_none")]
54 pub first_collaborator_added_at: std::option::Option<
55 jacquard_common::types::string::Datetime,
56 >,
57 /// People who used to collaborate but relationship ended
58 #[serde(skip_serializing_if = "std::option::Option::is_none")]
59 #[serde(borrow)]
60 pub former_participants: std::option::Option<
61 Vec<crate::sh_weaver::collab::FormerCollaboratorView<'a>>,
62 >,
63 #[serde(skip_serializing_if = "std::option::Option::is_none")]
64 pub has_divergence: std::option::Option<bool>,
65 #[serde(skip_serializing_if = "std::option::Option::is_none")]
66 pub has_former_collaborators: std::option::Option<bool>,
67 /// Published versions from former collaborators still exist
68 #[serde(skip_serializing_if = "std::option::Option::is_none")]
69 pub has_orphaned_versions: std::option::Option<bool>,
70 #[serde(skip_serializing_if = "std::option::Option::is_none")]
71 pub last_synced_at: std::option::Option<jacquard_common::types::string::Datetime>,
72 /// Current active + invited participants
73 #[serde(borrow)]
74 pub participants: Vec<crate::sh_weaver::collab::ParticipantStateView<'a>>,
75 #[serde(skip_serializing_if = "std::option::Option::is_none")]
76 #[serde(borrow)]
77 pub published_versions: std::option::Option<
78 Vec<crate::sh_weaver::notebook::PublishedVersionView<'a>>,
79 >,
80 #[serde(borrow)]
81 pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
82 /// active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved
83 #[serde(borrow)]
84 pub status: CollaborationStateViewStatus<'a>,
85}
86
87pub mod collaboration_state_view_state {
88
89 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
90 #[allow(unused)]
91 use ::core::marker::PhantomData;
92 mod sealed {
93 pub trait Sealed {}
94 }
95 /// State trait tracking which required fields have been set
96 pub trait State: sealed::Sealed {
97 type Resource;
98 type Participants;
99 type Status;
100 }
101 /// Empty state - all required fields are unset
102 pub struct Empty(());
103 impl sealed::Sealed for Empty {}
104 impl State for Empty {
105 type Resource = Unset;
106 type Participants = Unset;
107 type Status = Unset;
108 }
109 ///State transition - sets the `resource` field to Set
110 pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>);
111 impl<S: State> sealed::Sealed for SetResource<S> {}
112 impl<S: State> State for SetResource<S> {
113 type Resource = Set<members::resource>;
114 type Participants = S::Participants;
115 type Status = S::Status;
116 }
117 ///State transition - sets the `participants` field to Set
118 pub struct SetParticipants<S: State = Empty>(PhantomData<fn() -> S>);
119 impl<S: State> sealed::Sealed for SetParticipants<S> {}
120 impl<S: State> State for SetParticipants<S> {
121 type Resource = S::Resource;
122 type Participants = Set<members::participants>;
123 type Status = S::Status;
124 }
125 ///State transition - sets the `status` field to Set
126 pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
127 impl<S: State> sealed::Sealed for SetStatus<S> {}
128 impl<S: State> State for SetStatus<S> {
129 type Resource = S::Resource;
130 type Participants = S::Participants;
131 type Status = Set<members::status>;
132 }
133 /// Marker types for field names
134 #[allow(non_camel_case_types)]
135 pub mod members {
136 ///Marker type for the `resource` field
137 pub struct resource(());
138 ///Marker type for the `participants` field
139 pub struct participants(());
140 ///Marker type for the `status` field
141 pub struct status(());
142 }
143}
144
145/// Builder for constructing an instance of this type
146pub struct CollaborationStateViewBuilder<'a, S: collaboration_state_view_state::State> {
147 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
148 __unsafe_private_named: (
149 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
150 ::core::option::Option<jacquard_common::types::string::Datetime>,
151 ::core::option::Option<jacquard_common::types::string::Datetime>,
152 ::core::option::Option<
153 Vec<crate::sh_weaver::collab::FormerCollaboratorView<'a>>,
154 >,
155 ::core::option::Option<bool>,
156 ::core::option::Option<bool>,
157 ::core::option::Option<bool>,
158 ::core::option::Option<jacquard_common::types::string::Datetime>,
159 ::core::option::Option<Vec<crate::sh_weaver::collab::ParticipantStateView<'a>>>,
160 ::core::option::Option<
161 Vec<crate::sh_weaver::notebook::PublishedVersionView<'a>>,
162 >,
163 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
164 ::core::option::Option<CollaborationStateViewStatus<'a>>,
165 ),
166 _phantom: ::core::marker::PhantomData<&'a ()>,
167}
168
169impl<'a> CollaborationStateView<'a> {
170 /// Create a new builder for this type
171 pub fn new() -> CollaborationStateViewBuilder<
172 'a,
173 collaboration_state_view_state::Empty,
174 > {
175 CollaborationStateViewBuilder::new()
176 }
177}
178
179impl<'a> CollaborationStateViewBuilder<'a, collaboration_state_view_state::Empty> {
180 /// Create a new builder with all fields unset
181 pub fn new() -> Self {
182 CollaborationStateViewBuilder {
183 _phantom_state: ::core::marker::PhantomData,
184 __unsafe_private_named: (
185 None,
186 None,
187 None,
188 None,
189 None,
190 None,
191 None,
192 None,
193 None,
194 None,
195 None,
196 None,
197 ),
198 _phantom: ::core::marker::PhantomData,
199 }
200 }
201}
202
203impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
204 /// Set the `canonicalUri` field (optional)
205 pub fn canonical_uri(
206 mut self,
207 value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
208 ) -> Self {
209 self.__unsafe_private_named.0 = value.into();
210 self
211 }
212 /// Set the `canonicalUri` field to an Option value (optional)
213 pub fn maybe_canonical_uri(
214 mut self,
215 value: Option<jacquard_common::types::string::AtUri<'a>>,
216 ) -> Self {
217 self.__unsafe_private_named.0 = value;
218 self
219 }
220}
221
222impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
223 /// Set the `createdAt` field (optional)
224 pub fn created_at(
225 mut self,
226 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
227 ) -> Self {
228 self.__unsafe_private_named.1 = value.into();
229 self
230 }
231 /// Set the `createdAt` field to an Option value (optional)
232 pub fn maybe_created_at(
233 mut self,
234 value: Option<jacquard_common::types::string::Datetime>,
235 ) -> Self {
236 self.__unsafe_private_named.1 = value;
237 self
238 }
239}
240
241impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
242 /// Set the `firstCollaboratorAddedAt` field (optional)
243 pub fn first_collaborator_added_at(
244 mut self,
245 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
246 ) -> Self {
247 self.__unsafe_private_named.2 = value.into();
248 self
249 }
250 /// Set the `firstCollaboratorAddedAt` field to an Option value (optional)
251 pub fn maybe_first_collaborator_added_at(
252 mut self,
253 value: Option<jacquard_common::types::string::Datetime>,
254 ) -> Self {
255 self.__unsafe_private_named.2 = value;
256 self
257 }
258}
259
260impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
261 /// Set the `formerParticipants` field (optional)
262 pub fn former_participants(
263 mut self,
264 value: impl Into<
265 Option<Vec<crate::sh_weaver::collab::FormerCollaboratorView<'a>>>,
266 >,
267 ) -> Self {
268 self.__unsafe_private_named.3 = value.into();
269 self
270 }
271 /// Set the `formerParticipants` field to an Option value (optional)
272 pub fn maybe_former_participants(
273 mut self,
274 value: Option<Vec<crate::sh_weaver::collab::FormerCollaboratorView<'a>>>,
275 ) -> Self {
276 self.__unsafe_private_named.3 = value;
277 self
278 }
279}
280
281impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
282 /// Set the `hasDivergence` field (optional)
283 pub fn has_divergence(mut self, value: impl Into<Option<bool>>) -> Self {
284 self.__unsafe_private_named.4 = value.into();
285 self
286 }
287 /// Set the `hasDivergence` field to an Option value (optional)
288 pub fn maybe_has_divergence(mut self, value: Option<bool>) -> Self {
289 self.__unsafe_private_named.4 = value;
290 self
291 }
292}
293
294impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
295 /// Set the `hasFormerCollaborators` field (optional)
296 pub fn has_former_collaborators(mut self, value: impl Into<Option<bool>>) -> Self {
297 self.__unsafe_private_named.5 = value.into();
298 self
299 }
300 /// Set the `hasFormerCollaborators` field to an Option value (optional)
301 pub fn maybe_has_former_collaborators(mut self, value: Option<bool>) -> Self {
302 self.__unsafe_private_named.5 = value;
303 self
304 }
305}
306
307impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
308 /// Set the `hasOrphanedVersions` field (optional)
309 pub fn has_orphaned_versions(mut self, value: impl Into<Option<bool>>) -> Self {
310 self.__unsafe_private_named.6 = value.into();
311 self
312 }
313 /// Set the `hasOrphanedVersions` field to an Option value (optional)
314 pub fn maybe_has_orphaned_versions(mut self, value: Option<bool>) -> Self {
315 self.__unsafe_private_named.6 = value;
316 self
317 }
318}
319
320impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
321 /// Set the `lastSyncedAt` field (optional)
322 pub fn last_synced_at(
323 mut self,
324 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
325 ) -> Self {
326 self.__unsafe_private_named.7 = value.into();
327 self
328 }
329 /// Set the `lastSyncedAt` field to an Option value (optional)
330 pub fn maybe_last_synced_at(
331 mut self,
332 value: Option<jacquard_common::types::string::Datetime>,
333 ) -> Self {
334 self.__unsafe_private_named.7 = value;
335 self
336 }
337}
338
339impl<'a, S> CollaborationStateViewBuilder<'a, S>
340where
341 S: collaboration_state_view_state::State,
342 S::Participants: collaboration_state_view_state::IsUnset,
343{
344 /// Set the `participants` field (required)
345 pub fn participants(
346 mut self,
347 value: impl Into<Vec<crate::sh_weaver::collab::ParticipantStateView<'a>>>,
348 ) -> CollaborationStateViewBuilder<
349 'a,
350 collaboration_state_view_state::SetParticipants<S>,
351 > {
352 self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
353 CollaborationStateViewBuilder {
354 _phantom_state: ::core::marker::PhantomData,
355 __unsafe_private_named: self.__unsafe_private_named,
356 _phantom: ::core::marker::PhantomData,
357 }
358 }
359}
360
361impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> {
362 /// Set the `publishedVersions` field (optional)
363 pub fn published_versions(
364 mut self,
365 value: impl Into<
366 Option<Vec<crate::sh_weaver::notebook::PublishedVersionView<'a>>>,
367 >,
368 ) -> Self {
369 self.__unsafe_private_named.9 = value.into();
370 self
371 }
372 /// Set the `publishedVersions` field to an Option value (optional)
373 pub fn maybe_published_versions(
374 mut self,
375 value: Option<Vec<crate::sh_weaver::notebook::PublishedVersionView<'a>>>,
376 ) -> Self {
377 self.__unsafe_private_named.9 = value;
378 self
379 }
380}
381
382impl<'a, S> CollaborationStateViewBuilder<'a, S>
383where
384 S: collaboration_state_view_state::State,
385 S::Resource: collaboration_state_view_state::IsUnset,
386{
387 /// Set the `resource` field (required)
388 pub fn resource(
389 mut self,
390 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
391 ) -> CollaborationStateViewBuilder<
392 'a,
393 collaboration_state_view_state::SetResource<S>,
394 > {
395 self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into());
396 CollaborationStateViewBuilder {
397 _phantom_state: ::core::marker::PhantomData,
398 __unsafe_private_named: self.__unsafe_private_named,
399 _phantom: ::core::marker::PhantomData,
400 }
401 }
402}
403
404impl<'a, S> CollaborationStateViewBuilder<'a, S>
405where
406 S: collaboration_state_view_state::State,
407 S::Status: collaboration_state_view_state::IsUnset,
408{
409 /// Set the `status` field (required)
410 pub fn status(
411 mut self,
412 value: impl Into<CollaborationStateViewStatus<'a>>,
413 ) -> CollaborationStateViewBuilder<
414 'a,
415 collaboration_state_view_state::SetStatus<S>,
416 > {
417 self.__unsafe_private_named.11 = ::core::option::Option::Some(value.into());
418 CollaborationStateViewBuilder {
419 _phantom_state: ::core::marker::PhantomData,
420 __unsafe_private_named: self.__unsafe_private_named,
421 _phantom: ::core::marker::PhantomData,
422 }
423 }
424}
425
426impl<'a, S> CollaborationStateViewBuilder<'a, S>
427where
428 S: collaboration_state_view_state::State,
429 S::Resource: collaboration_state_view_state::IsSet,
430 S::Participants: collaboration_state_view_state::IsSet,
431 S::Status: collaboration_state_view_state::IsSet,
432{
433 /// Build the final struct
434 pub fn build(self) -> CollaborationStateView<'a> {
435 CollaborationStateView {
436 canonical_uri: self.__unsafe_private_named.0,
437 created_at: self.__unsafe_private_named.1,
438 first_collaborator_added_at: self.__unsafe_private_named.2,
439 former_participants: self.__unsafe_private_named.3,
440 has_divergence: self.__unsafe_private_named.4,
441 has_former_collaborators: self.__unsafe_private_named.5,
442 has_orphaned_versions: self.__unsafe_private_named.6,
443 last_synced_at: self.__unsafe_private_named.7,
444 participants: self.__unsafe_private_named.8.unwrap(),
445 published_versions: self.__unsafe_private_named.9,
446 resource: self.__unsafe_private_named.10.unwrap(),
447 status: self.__unsafe_private_named.11.unwrap(),
448 extra_data: Default::default(),
449 }
450 }
451 /// Build the final struct with custom extra_data
452 pub fn build_with_data(
453 self,
454 extra_data: std::collections::BTreeMap<
455 jacquard_common::smol_str::SmolStr,
456 jacquard_common::types::value::Data<'a>,
457 >,
458 ) -> CollaborationStateView<'a> {
459 CollaborationStateView {
460 canonical_uri: self.__unsafe_private_named.0,
461 created_at: self.__unsafe_private_named.1,
462 first_collaborator_added_at: self.__unsafe_private_named.2,
463 former_participants: self.__unsafe_private_named.3,
464 has_divergence: self.__unsafe_private_named.4,
465 has_former_collaborators: self.__unsafe_private_named.5,
466 has_orphaned_versions: self.__unsafe_private_named.6,
467 last_synced_at: self.__unsafe_private_named.7,
468 participants: self.__unsafe_private_named.8.unwrap(),
469 published_versions: self.__unsafe_private_named.9,
470 resource: self.__unsafe_private_named.10.unwrap(),
471 status: self.__unsafe_private_named.11.unwrap(),
472 extra_data: Some(extra_data),
473 }
474 }
475}
476
477/// active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved
478#[derive(Debug, Clone, PartialEq, Eq, Hash)]
479pub enum CollaborationStateViewStatus<'a> {
480 Active,
481 Broken,
482 Diverged,
483 Reconciled,
484 Other(jacquard_common::CowStr<'a>),
485}
486
487impl<'a> CollaborationStateViewStatus<'a> {
488 pub fn as_str(&self) -> &str {
489 match self {
490 Self::Active => "active",
491 Self::Broken => "broken",
492 Self::Diverged => "diverged",
493 Self::Reconciled => "reconciled",
494 Self::Other(s) => s.as_ref(),
495 }
496 }
497}
498
499impl<'a> From<&'a str> for CollaborationStateViewStatus<'a> {
500 fn from(s: &'a str) -> Self {
501 match s {
502 "active" => Self::Active,
503 "broken" => Self::Broken,
504 "diverged" => Self::Diverged,
505 "reconciled" => Self::Reconciled,
506 _ => Self::Other(jacquard_common::CowStr::from(s)),
507 }
508 }
509}
510
511impl<'a> From<String> for CollaborationStateViewStatus<'a> {
512 fn from(s: String) -> Self {
513 match s.as_str() {
514 "active" => Self::Active,
515 "broken" => Self::Broken,
516 "diverged" => Self::Diverged,
517 "reconciled" => Self::Reconciled,
518 _ => Self::Other(jacquard_common::CowStr::from(s)),
519 }
520 }
521}
522
523impl<'a> core::fmt::Display for CollaborationStateViewStatus<'a> {
524 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
525 write!(f, "{}", self.as_str())
526 }
527}
528
529impl<'a> AsRef<str> for CollaborationStateViewStatus<'a> {
530 fn as_ref(&self) -> &str {
531 self.as_str()
532 }
533}
534
535impl<'a> serde::Serialize for CollaborationStateViewStatus<'a> {
536 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
537 where
538 S: serde::Serializer,
539 {
540 serializer.serialize_str(self.as_str())
541 }
542}
543
544impl<'de, 'a> serde::Deserialize<'de> for CollaborationStateViewStatus<'a>
545where
546 'de: 'a,
547{
548 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
549 where
550 D: serde::Deserializer<'de>,
551 {
552 let s = <&'de str>::deserialize(deserializer)?;
553 Ok(Self::from(s))
554 }
555}
556
557impl<'a> Default for CollaborationStateViewStatus<'a> {
558 fn default() -> Self {
559 Self::Other(Default::default())
560 }
561}
562
563impl jacquard_common::IntoStatic for CollaborationStateViewStatus<'_> {
564 type Output = CollaborationStateViewStatus<'static>;
565 fn into_static(self) -> Self::Output {
566 match self {
567 CollaborationStateViewStatus::Active => CollaborationStateViewStatus::Active,
568 CollaborationStateViewStatus::Broken => CollaborationStateViewStatus::Broken,
569 CollaborationStateViewStatus::Diverged => {
570 CollaborationStateViewStatus::Diverged
571 }
572 CollaborationStateViewStatus::Reconciled => {
573 CollaborationStateViewStatus::Reconciled
574 }
575 CollaborationStateViewStatus::Other(v) => {
576 CollaborationStateViewStatus::Other(v.into_static())
577 }
578 }
579 }
580}
581
582fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
583 'static,
584> {
585 ::jacquard_lexicon::lexicon::LexiconDoc {
586 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
587 id: ::jacquard_common::CowStr::new_static("sh.weaver.collab.defs"),
588 revision: None,
589 description: None,
590 defs: {
591 let mut map = ::alloc::collections::BTreeMap::new();
592 map.insert(
593 ::jacquard_common::smol_str::SmolStr::new_static("chapter"),
594 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
595 description: None,
596 }),
597 );
598 map.insert(
599 ::jacquard_common::smol_str::SmolStr::new_static(
600 "collaborationStateView",
601 ),
602 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
603 description: Some(
604 ::jacquard_common::CowStr::new_static(
605 "Full state of a collaboration relationship including version reconciliation. Tracks both current and former collaborators.",
606 ),
607 ),
608 required: Some(
609 vec![
610 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
611 ::jacquard_common::smol_str::SmolStr::new_static("status"),
612 ::jacquard_common::smol_str::SmolStr::new_static("participants")
613 ],
614 ),
615 nullable: None,
616 properties: {
617 #[allow(unused_mut)]
618 let mut map = ::alloc::collections::BTreeMap::new();
619 map.insert(
620 ::jacquard_common::smol_str::SmolStr::new_static(
621 "canonicalUri",
622 ),
623 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
624 description: Some(
625 ::jacquard_common::CowStr::new_static(
626 "The 'canonical' version URI (usually owner's)",
627 ),
628 ),
629 format: Some(
630 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
631 ),
632 default: None,
633 min_length: None,
634 max_length: None,
635 min_graphemes: None,
636 max_graphemes: None,
637 r#enum: None,
638 r#const: None,
639 known_values: None,
640 }),
641 );
642 map.insert(
643 ::jacquard_common::smol_str::SmolStr::new_static(
644 "createdAt",
645 ),
646 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
647 description: None,
648 format: Some(
649 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
650 ),
651 default: None,
652 min_length: None,
653 max_length: None,
654 min_graphemes: None,
655 max_graphemes: None,
656 r#enum: None,
657 r#const: None,
658 known_values: None,
659 }),
660 );
661 map.insert(
662 ::jacquard_common::smol_str::SmolStr::new_static(
663 "firstCollaboratorAddedAt",
664 ),
665 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
666 description: None,
667 format: Some(
668 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
669 ),
670 default: None,
671 min_length: None,
672 max_length: None,
673 min_graphemes: None,
674 max_graphemes: None,
675 r#enum: None,
676 r#const: None,
677 known_values: None,
678 }),
679 );
680 map.insert(
681 ::jacquard_common::smol_str::SmolStr::new_static(
682 "formerParticipants",
683 ),
684 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
685 description: Some(
686 ::jacquard_common::CowStr::new_static(
687 "People who used to collaborate but relationship ended",
688 ),
689 ),
690 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
691 description: None,
692 r#ref: ::jacquard_common::CowStr::new_static(
693 "#formerCollaboratorView",
694 ),
695 }),
696 min_length: None,
697 max_length: None,
698 }),
699 );
700 map.insert(
701 ::jacquard_common::smol_str::SmolStr::new_static(
702 "hasDivergence",
703 ),
704 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
705 description: None,
706 default: None,
707 r#const: None,
708 }),
709 );
710 map.insert(
711 ::jacquard_common::smol_str::SmolStr::new_static(
712 "hasFormerCollaborators",
713 ),
714 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
715 description: None,
716 default: None,
717 r#const: None,
718 }),
719 );
720 map.insert(
721 ::jacquard_common::smol_str::SmolStr::new_static(
722 "hasOrphanedVersions",
723 ),
724 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
725 description: None,
726 default: None,
727 r#const: None,
728 }),
729 );
730 map.insert(
731 ::jacquard_common::smol_str::SmolStr::new_static(
732 "lastSyncedAt",
733 ),
734 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
735 description: None,
736 format: Some(
737 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
738 ),
739 default: None,
740 min_length: None,
741 max_length: None,
742 min_graphemes: None,
743 max_graphemes: None,
744 r#enum: None,
745 r#const: None,
746 known_values: None,
747 }),
748 );
749 map.insert(
750 ::jacquard_common::smol_str::SmolStr::new_static(
751 "participants",
752 ),
753 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
754 description: Some(
755 ::jacquard_common::CowStr::new_static(
756 "Current active + invited participants",
757 ),
758 ),
759 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
760 description: None,
761 r#ref: ::jacquard_common::CowStr::new_static(
762 "#participantStateView",
763 ),
764 }),
765 min_length: None,
766 max_length: None,
767 }),
768 );
769 map.insert(
770 ::jacquard_common::smol_str::SmolStr::new_static(
771 "publishedVersions",
772 ),
773 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
774 description: None,
775 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
776 description: None,
777 r#ref: ::jacquard_common::CowStr::new_static(
778 "sh.weaver.notebook.defs#publishedVersionView",
779 ),
780 }),
781 min_length: None,
782 max_length: None,
783 }),
784 );
785 map.insert(
786 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
787 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
788 description: None,
789 r#ref: ::jacquard_common::CowStr::new_static(
790 "com.atproto.repo.strongRef",
791 ),
792 }),
793 );
794 map.insert(
795 ::jacquard_common::smol_str::SmolStr::new_static("status"),
796 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
797 description: Some(
798 ::jacquard_common::CowStr::new_static(
799 "active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved",
800 ),
801 ),
802 format: None,
803 default: None,
804 min_length: None,
805 max_length: None,
806 min_graphemes: None,
807 max_graphemes: None,
808 r#enum: None,
809 r#const: None,
810 known_values: None,
811 }),
812 );
813 map
814 },
815 }),
816 );
817 map.insert(
818 ::jacquard_common::smol_str::SmolStr::new_static("entry"),
819 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
820 description: None,
821 }),
822 );
823 map.insert(
824 ::jacquard_common::smol_str::SmolStr::new_static(
825 "formerCollaboratorView",
826 ),
827 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
828 description: Some(
829 ::jacquard_common::CowStr::new_static(
830 "Lightweight view for 'this person used to collaborate but doesn't anymore'.",
831 ),
832 ),
833 required: Some(
834 vec![
835 ::jacquard_common::smol_str::SmolStr::new_static("user"),
836 ::jacquard_common::smol_str::SmolStr::new_static("wasActiveFrom"),
837 ::jacquard_common::smol_str::SmolStr::new_static("wasActiveUntil"),
838 ::jacquard_common::smol_str::SmolStr::new_static("endReason")
839 ],
840 ),
841 nullable: None,
842 properties: {
843 #[allow(unused_mut)]
844 let mut map = ::alloc::collections::BTreeMap::new();
845 map.insert(
846 ::jacquard_common::smol_str::SmolStr::new_static(
847 "contributionCount",
848 ),
849 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
850 description: None,
851 default: None,
852 minimum: None,
853 maximum: None,
854 r#enum: None,
855 r#const: None,
856 }),
857 );
858 map.insert(
859 ::jacquard_common::smol_str::SmolStr::new_static(
860 "endReason",
861 ),
862 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
863 description: None,
864 format: None,
865 default: None,
866 min_length: None,
867 max_length: None,
868 min_graphemes: None,
869 max_graphemes: None,
870 r#enum: None,
871 r#const: None,
872 known_values: None,
873 }),
874 );
875 map.insert(
876 ::jacquard_common::smol_str::SmolStr::new_static(
877 "hasPublishedVersion",
878 ),
879 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
880 description: None,
881 default: None,
882 r#const: None,
883 }),
884 );
885 map.insert(
886 ::jacquard_common::smol_str::SmolStr::new_static(
887 "publishedVersionUri",
888 ),
889 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
890 description: None,
891 format: Some(
892 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
893 ),
894 default: None,
895 min_length: None,
896 max_length: None,
897 min_graphemes: None,
898 max_graphemes: None,
899 r#enum: None,
900 r#const: None,
901 known_values: None,
902 }),
903 );
904 map.insert(
905 ::jacquard_common::smol_str::SmolStr::new_static("user"),
906 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
907 description: None,
908 r#ref: ::jacquard_common::CowStr::new_static(
909 "sh.weaver.actor.defs#profileViewBasic",
910 ),
911 }),
912 );
913 map.insert(
914 ::jacquard_common::smol_str::SmolStr::new_static(
915 "wasActiveFrom",
916 ),
917 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
918 description: None,
919 format: Some(
920 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
921 ),
922 default: None,
923 min_length: None,
924 max_length: None,
925 min_graphemes: None,
926 max_graphemes: None,
927 r#enum: None,
928 r#const: None,
929 known_values: None,
930 }),
931 );
932 map.insert(
933 ::jacquard_common::smol_str::SmolStr::new_static(
934 "wasActiveUntil",
935 ),
936 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
937 description: None,
938 format: Some(
939 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
940 ),
941 default: None,
942 min_length: None,
943 max_length: None,
944 min_graphemes: None,
945 max_graphemes: None,
946 r#enum: None,
947 r#const: None,
948 known_values: None,
949 }),
950 );
951 map
952 },
953 }),
954 );
955 map.insert(
956 ::jacquard_common::smol_str::SmolStr::new_static("inviteView"),
957 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
958 description: Some(
959 ::jacquard_common::CowStr::new_static(
960 "Hydrated view of a collaboration invite with status.",
961 ),
962 ),
963 required: Some(
964 vec![
965 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
966 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
967 ::jacquard_common::smol_str::SmolStr::new_static("inviter"),
968 ::jacquard_common::smol_str::SmolStr::new_static("invitee"),
969 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
970 ::jacquard_common::smol_str::SmolStr::new_static("createdAt"),
971 ::jacquard_common::smol_str::SmolStr::new_static("status")
972 ],
973 ),
974 nullable: None,
975 properties: {
976 #[allow(unused_mut)]
977 let mut map = ::alloc::collections::BTreeMap::new();
978 map.insert(
979 ::jacquard_common::smol_str::SmolStr::new_static(
980 "acceptUri",
981 ),
982 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
983 description: None,
984 format: Some(
985 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
986 ),
987 default: None,
988 min_length: None,
989 max_length: None,
990 min_graphemes: None,
991 max_graphemes: None,
992 r#enum: None,
993 r#const: None,
994 known_values: None,
995 }),
996 );
997 map.insert(
998 ::jacquard_common::smol_str::SmolStr::new_static(
999 "acceptedAt",
1000 ),
1001 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1002 description: None,
1003 format: Some(
1004 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1005 ),
1006 default: None,
1007 min_length: None,
1008 max_length: None,
1009 min_graphemes: None,
1010 max_graphemes: None,
1011 r#enum: None,
1012 r#const: None,
1013 known_values: None,
1014 }),
1015 );
1016 map.insert(
1017 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
1018 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1019 description: None,
1020 format: Some(
1021 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
1022 ),
1023 default: None,
1024 min_length: None,
1025 max_length: None,
1026 min_graphemes: None,
1027 max_graphemes: None,
1028 r#enum: None,
1029 r#const: None,
1030 known_values: None,
1031 }),
1032 );
1033 map.insert(
1034 ::jacquard_common::smol_str::SmolStr::new_static(
1035 "createdAt",
1036 ),
1037 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1038 description: None,
1039 format: Some(
1040 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1041 ),
1042 default: None,
1043 min_length: None,
1044 max_length: None,
1045 min_graphemes: None,
1046 max_graphemes: None,
1047 r#enum: None,
1048 r#const: None,
1049 known_values: None,
1050 }),
1051 );
1052 map.insert(
1053 ::jacquard_common::smol_str::SmolStr::new_static(
1054 "expiresAt",
1055 ),
1056 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1057 description: None,
1058 format: Some(
1059 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1060 ),
1061 default: None,
1062 min_length: None,
1063 max_length: None,
1064 min_graphemes: None,
1065 max_graphemes: None,
1066 r#enum: None,
1067 r#const: None,
1068 known_values: None,
1069 }),
1070 );
1071 map.insert(
1072 ::jacquard_common::smol_str::SmolStr::new_static("invitee"),
1073 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1074 description: None,
1075 r#ref: ::jacquard_common::CowStr::new_static(
1076 "sh.weaver.actor.defs#profileViewBasic",
1077 ),
1078 }),
1079 );
1080 map.insert(
1081 ::jacquard_common::smol_str::SmolStr::new_static("inviter"),
1082 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1083 description: None,
1084 r#ref: ::jacquard_common::CowStr::new_static(
1085 "sh.weaver.actor.defs#profileViewBasic",
1086 ),
1087 }),
1088 );
1089 map.insert(
1090 ::jacquard_common::smol_str::SmolStr::new_static("message"),
1091 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1092 description: None,
1093 format: None,
1094 default: None,
1095 min_length: None,
1096 max_length: None,
1097 min_graphemes: None,
1098 max_graphemes: None,
1099 r#enum: None,
1100 r#const: None,
1101 known_values: None,
1102 }),
1103 );
1104 map.insert(
1105 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
1106 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1107 description: None,
1108 r#ref: ::jacquard_common::CowStr::new_static(
1109 "com.atproto.repo.strongRef",
1110 ),
1111 }),
1112 );
1113 map.insert(
1114 ::jacquard_common::smol_str::SmolStr::new_static(
1115 "resourceTitle",
1116 ),
1117 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1118 description: None,
1119 format: None,
1120 default: None,
1121 min_length: None,
1122 max_length: None,
1123 min_graphemes: None,
1124 max_graphemes: None,
1125 r#enum: None,
1126 r#const: None,
1127 known_values: None,
1128 }),
1129 );
1130 map.insert(
1131 ::jacquard_common::smol_str::SmolStr::new_static("scope"),
1132 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1133 description: None,
1134 format: None,
1135 default: None,
1136 min_length: None,
1137 max_length: None,
1138 min_graphemes: None,
1139 max_graphemes: None,
1140 r#enum: None,
1141 r#const: None,
1142 known_values: None,
1143 }),
1144 );
1145 map.insert(
1146 ::jacquard_common::smol_str::SmolStr::new_static("status"),
1147 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1148 description: None,
1149 format: None,
1150 default: None,
1151 min_length: None,
1152 max_length: None,
1153 min_graphemes: None,
1154 max_graphemes: None,
1155 r#enum: None,
1156 r#const: None,
1157 known_values: None,
1158 }),
1159 );
1160 map.insert(
1161 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
1162 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1163 description: None,
1164 format: Some(
1165 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
1166 ),
1167 default: None,
1168 min_length: None,
1169 max_length: None,
1170 min_graphemes: None,
1171 max_graphemes: None,
1172 r#enum: None,
1173 r#const: None,
1174 known_values: None,
1175 }),
1176 );
1177 map
1178 },
1179 }),
1180 );
1181 map.insert(
1182 ::jacquard_common::smol_str::SmolStr::new_static("notebook"),
1183 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
1184 description: None,
1185 }),
1186 );
1187 map.insert(
1188 ::jacquard_common::smol_str::SmolStr::new_static("participantStateView"),
1189 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
1190 description: Some(
1191 ::jacquard_common::CowStr::new_static(
1192 "Individual participant's state in a collaboration. Distinguishes 'was collaborator' vs 'never was'.",
1193 ),
1194 ),
1195 required: Some(
1196 vec![
1197 ::jacquard_common::smol_str::SmolStr::new_static("user"),
1198 ::jacquard_common::smol_str::SmolStr::new_static("role"),
1199 ::jacquard_common::smol_str::SmolStr::new_static("status")
1200 ],
1201 ),
1202 nullable: None,
1203 properties: {
1204 #[allow(unused_mut)]
1205 let mut map = ::alloc::collections::BTreeMap::new();
1206 map.insert(
1207 ::jacquard_common::smol_str::SmolStr::new_static(
1208 "acceptUri",
1209 ),
1210 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1211 description: Some(
1212 ::jacquard_common::CowStr::new_static(
1213 "If they accepted (even if later broken)",
1214 ),
1215 ),
1216 format: Some(
1217 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
1218 ),
1219 default: None,
1220 min_length: None,
1221 max_length: None,
1222 min_graphemes: None,
1223 max_graphemes: None,
1224 r#enum: None,
1225 r#const: None,
1226 known_values: None,
1227 }),
1228 );
1229 map.insert(
1230 ::jacquard_common::smol_str::SmolStr::new_static(
1231 "endReason",
1232 ),
1233 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1234 description: Some(
1235 ::jacquard_common::CowStr::new_static(
1236 "Why the relationship ended, if applicable",
1237 ),
1238 ),
1239 format: None,
1240 default: None,
1241 min_length: None,
1242 max_length: None,
1243 min_graphemes: None,
1244 max_graphemes: None,
1245 r#enum: None,
1246 r#const: None,
1247 known_values: None,
1248 }),
1249 );
1250 map.insert(
1251 ::jacquard_common::smol_str::SmolStr::new_static(
1252 "firstEditAt",
1253 ),
1254 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1255 description: Some(
1256 ::jacquard_common::CowStr::new_static(
1257 "When they first contributed",
1258 ),
1259 ),
1260 format: Some(
1261 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1262 ),
1263 default: None,
1264 min_length: None,
1265 max_length: None,
1266 min_graphemes: None,
1267 max_graphemes: None,
1268 r#enum: None,
1269 r#const: None,
1270 known_values: None,
1271 }),
1272 );
1273 map.insert(
1274 ::jacquard_common::smol_str::SmolStr::new_static(
1275 "inviteUri",
1276 ),
1277 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1278 description: None,
1279 format: Some(
1280 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
1281 ),
1282 default: None,
1283 min_length: None,
1284 max_length: None,
1285 min_graphemes: None,
1286 max_graphemes: None,
1287 r#enum: None,
1288 r#const: None,
1289 known_values: None,
1290 }),
1291 );
1292 map.insert(
1293 ::jacquard_common::smol_str::SmolStr::new_static(
1294 "lastEditAt",
1295 ),
1296 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1297 description: None,
1298 format: Some(
1299 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1300 ),
1301 default: None,
1302 min_length: None,
1303 max_length: None,
1304 min_graphemes: None,
1305 max_graphemes: None,
1306 r#enum: None,
1307 r#const: None,
1308 known_values: None,
1309 }),
1310 );
1311 map.insert(
1312 ::jacquard_common::smol_str::SmolStr::new_static(
1313 "publishedVersion",
1314 ),
1315 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1316 description: None,
1317 r#ref: ::jacquard_common::CowStr::new_static(
1318 "com.atproto.repo.strongRef",
1319 ),
1320 }),
1321 );
1322 map.insert(
1323 ::jacquard_common::smol_str::SmolStr::new_static(
1324 "relationshipEndedAt",
1325 ),
1326 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1327 description: Some(
1328 ::jacquard_common::CowStr::new_static(
1329 "When left/removed/expired",
1330 ),
1331 ),
1332 format: Some(
1333 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1334 ),
1335 default: None,
1336 min_length: None,
1337 max_length: None,
1338 min_graphemes: None,
1339 max_graphemes: None,
1340 r#enum: None,
1341 r#const: None,
1342 known_values: None,
1343 }),
1344 );
1345 map.insert(
1346 ::jacquard_common::smol_str::SmolStr::new_static("role"),
1347 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1348 description: None,
1349 format: None,
1350 default: None,
1351 min_length: None,
1352 max_length: None,
1353 min_graphemes: None,
1354 max_graphemes: None,
1355 r#enum: None,
1356 r#const: None,
1357 known_values: None,
1358 }),
1359 );
1360 map.insert(
1361 ::jacquard_common::smol_str::SmolStr::new_static("status"),
1362 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1363 description: Some(
1364 ::jacquard_common::CowStr::new_static(
1365 "active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out",
1366 ),
1367 ),
1368 format: None,
1369 default: None,
1370 min_length: None,
1371 max_length: None,
1372 min_graphemes: None,
1373 max_graphemes: None,
1374 r#enum: None,
1375 r#const: None,
1376 known_values: None,
1377 }),
1378 );
1379 map.insert(
1380 ::jacquard_common::smol_str::SmolStr::new_static("user"),
1381 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1382 description: None,
1383 r#ref: ::jacquard_common::CowStr::new_static(
1384 "sh.weaver.actor.defs#profileViewBasic",
1385 ),
1386 }),
1387 );
1388 map.insert(
1389 ::jacquard_common::smol_str::SmolStr::new_static(
1390 "wasCollaborator",
1391 ),
1392 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
1393 description: None,
1394 default: None,
1395 r#const: None,
1396 }),
1397 );
1398 map
1399 },
1400 }),
1401 );
1402 map.insert(
1403 ::jacquard_common::smol_str::SmolStr::new_static("sessionView"),
1404 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
1405 description: Some(
1406 ::jacquard_common::CowStr::new_static(
1407 "Active real-time collaboration session.",
1408 ),
1409 ),
1410 required: Some(
1411 vec![
1412 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
1413 ::jacquard_common::smol_str::SmolStr::new_static("user"),
1414 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
1415 ::jacquard_common::smol_str::SmolStr::new_static("nodeId"),
1416 ::jacquard_common::smol_str::SmolStr::new_static("createdAt")
1417 ],
1418 ),
1419 nullable: None,
1420 properties: {
1421 #[allow(unused_mut)]
1422 let mut map = ::alloc::collections::BTreeMap::new();
1423 map.insert(
1424 ::jacquard_common::smol_str::SmolStr::new_static(
1425 "createdAt",
1426 ),
1427 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1428 description: None,
1429 format: Some(
1430 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1431 ),
1432 default: None,
1433 min_length: None,
1434 max_length: None,
1435 min_graphemes: None,
1436 max_graphemes: None,
1437 r#enum: None,
1438 r#const: None,
1439 known_values: None,
1440 }),
1441 );
1442 map.insert(
1443 ::jacquard_common::smol_str::SmolStr::new_static(
1444 "expiresAt",
1445 ),
1446 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1447 description: None,
1448 format: Some(
1449 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
1450 ),
1451 default: None,
1452 min_length: None,
1453 max_length: None,
1454 min_graphemes: None,
1455 max_graphemes: None,
1456 r#enum: None,
1457 r#const: None,
1458 known_values: None,
1459 }),
1460 );
1461 map.insert(
1462 ::jacquard_common::smol_str::SmolStr::new_static("nodeId"),
1463 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1464 description: None,
1465 format: None,
1466 default: None,
1467 min_length: None,
1468 max_length: None,
1469 min_graphemes: None,
1470 max_graphemes: None,
1471 r#enum: None,
1472 r#const: None,
1473 known_values: None,
1474 }),
1475 );
1476 map.insert(
1477 ::jacquard_common::smol_str::SmolStr::new_static("relayUrl"),
1478 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1479 description: None,
1480 format: Some(
1481 ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
1482 ),
1483 default: None,
1484 min_length: None,
1485 max_length: None,
1486 min_graphemes: None,
1487 max_graphemes: None,
1488 r#enum: None,
1489 r#const: None,
1490 known_values: None,
1491 }),
1492 );
1493 map.insert(
1494 ::jacquard_common::smol_str::SmolStr::new_static("resource"),
1495 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1496 description: None,
1497 r#ref: ::jacquard_common::CowStr::new_static(
1498 "com.atproto.repo.strongRef",
1499 ),
1500 }),
1501 );
1502 map.insert(
1503 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
1504 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
1505 description: None,
1506 format: Some(
1507 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
1508 ),
1509 default: None,
1510 min_length: None,
1511 max_length: None,
1512 min_graphemes: None,
1513 max_graphemes: None,
1514 r#enum: None,
1515 r#const: None,
1516 known_values: None,
1517 }),
1518 );
1519 map.insert(
1520 ::jacquard_common::smol_str::SmolStr::new_static("user"),
1521 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
1522 description: None,
1523 r#ref: ::jacquard_common::CowStr::new_static(
1524 "sh.weaver.actor.defs#profileViewBasic",
1525 ),
1526 }),
1527 );
1528 map
1529 },
1530 }),
1531 );
1532 map
1533 },
1534 }
1535}
1536
1537impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CollaborationStateView<'a> {
1538 fn nsid() -> &'static str {
1539 "sh.weaver.collab.defs"
1540 }
1541 fn def_name() -> &'static str {
1542 "collaborationStateView"
1543 }
1544 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1545 lexicon_doc_sh_weaver_collab_defs()
1546 }
1547 fn validate(
1548 &self,
1549 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1550 Ok(())
1551 }
1552}
1553
1554/// Collaboration scoped to a single entry.
1555#[derive(
1556 serde::Serialize,
1557 serde::Deserialize,
1558 Debug,
1559 Clone,
1560 PartialEq,
1561 Eq,
1562 Hash,
1563 jacquard_derive::IntoStatic
1564)]
1565pub struct Entry;
1566impl std::fmt::Display for Entry {
1567 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1568 write!(f, "entry")
1569 }
1570}
1571
1572/// Lightweight view for 'this person used to collaborate but doesn't anymore'.
1573#[jacquard_derive::lexicon]
1574#[derive(
1575 serde::Serialize,
1576 serde::Deserialize,
1577 Debug,
1578 Clone,
1579 PartialEq,
1580 Eq,
1581 jacquard_derive::IntoStatic
1582)]
1583#[serde(rename_all = "camelCase")]
1584pub struct FormerCollaboratorView<'a> {
1585 /// Number of diffs they created while active
1586 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1587 pub contribution_count: std::option::Option<i64>,
1588 #[serde(borrow)]
1589 pub end_reason: FormerCollaboratorViewEndReason<'a>,
1590 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1591 pub has_published_version: std::option::Option<bool>,
1592 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1593 #[serde(borrow)]
1594 pub published_version_uri: std::option::Option<
1595 jacquard_common::types::string::AtUri<'a>,
1596 >,
1597 #[serde(borrow)]
1598 pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>,
1599 pub was_active_from: jacquard_common::types::string::Datetime,
1600 pub was_active_until: jacquard_common::types::string::Datetime,
1601}
1602
1603pub mod former_collaborator_view_state {
1604
1605 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1606 #[allow(unused)]
1607 use ::core::marker::PhantomData;
1608 mod sealed {
1609 pub trait Sealed {}
1610 }
1611 /// State trait tracking which required fields have been set
1612 pub trait State: sealed::Sealed {
1613 type EndReason;
1614 type WasActiveUntil;
1615 type User;
1616 type WasActiveFrom;
1617 }
1618 /// Empty state - all required fields are unset
1619 pub struct Empty(());
1620 impl sealed::Sealed for Empty {}
1621 impl State for Empty {
1622 type EndReason = Unset;
1623 type WasActiveUntil = Unset;
1624 type User = Unset;
1625 type WasActiveFrom = Unset;
1626 }
1627 ///State transition - sets the `end_reason` field to Set
1628 pub struct SetEndReason<S: State = Empty>(PhantomData<fn() -> S>);
1629 impl<S: State> sealed::Sealed for SetEndReason<S> {}
1630 impl<S: State> State for SetEndReason<S> {
1631 type EndReason = Set<members::end_reason>;
1632 type WasActiveUntil = S::WasActiveUntil;
1633 type User = S::User;
1634 type WasActiveFrom = S::WasActiveFrom;
1635 }
1636 ///State transition - sets the `was_active_until` field to Set
1637 pub struct SetWasActiveUntil<S: State = Empty>(PhantomData<fn() -> S>);
1638 impl<S: State> sealed::Sealed for SetWasActiveUntil<S> {}
1639 impl<S: State> State for SetWasActiveUntil<S> {
1640 type EndReason = S::EndReason;
1641 type WasActiveUntil = Set<members::was_active_until>;
1642 type User = S::User;
1643 type WasActiveFrom = S::WasActiveFrom;
1644 }
1645 ///State transition - sets the `user` field to Set
1646 pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>);
1647 impl<S: State> sealed::Sealed for SetUser<S> {}
1648 impl<S: State> State for SetUser<S> {
1649 type EndReason = S::EndReason;
1650 type WasActiveUntil = S::WasActiveUntil;
1651 type User = Set<members::user>;
1652 type WasActiveFrom = S::WasActiveFrom;
1653 }
1654 ///State transition - sets the `was_active_from` field to Set
1655 pub struct SetWasActiveFrom<S: State = Empty>(PhantomData<fn() -> S>);
1656 impl<S: State> sealed::Sealed for SetWasActiveFrom<S> {}
1657 impl<S: State> State for SetWasActiveFrom<S> {
1658 type EndReason = S::EndReason;
1659 type WasActiveUntil = S::WasActiveUntil;
1660 type User = S::User;
1661 type WasActiveFrom = Set<members::was_active_from>;
1662 }
1663 /// Marker types for field names
1664 #[allow(non_camel_case_types)]
1665 pub mod members {
1666 ///Marker type for the `end_reason` field
1667 pub struct end_reason(());
1668 ///Marker type for the `was_active_until` field
1669 pub struct was_active_until(());
1670 ///Marker type for the `user` field
1671 pub struct user(());
1672 ///Marker type for the `was_active_from` field
1673 pub struct was_active_from(());
1674 }
1675}
1676
1677/// Builder for constructing an instance of this type
1678pub struct FormerCollaboratorViewBuilder<'a, S: former_collaborator_view_state::State> {
1679 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1680 __unsafe_private_named: (
1681 ::core::option::Option<i64>,
1682 ::core::option::Option<FormerCollaboratorViewEndReason<'a>>,
1683 ::core::option::Option<bool>,
1684 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
1685 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
1686 ::core::option::Option<jacquard_common::types::string::Datetime>,
1687 ::core::option::Option<jacquard_common::types::string::Datetime>,
1688 ),
1689 _phantom: ::core::marker::PhantomData<&'a ()>,
1690}
1691
1692impl<'a> FormerCollaboratorView<'a> {
1693 /// Create a new builder for this type
1694 pub fn new() -> FormerCollaboratorViewBuilder<
1695 'a,
1696 former_collaborator_view_state::Empty,
1697 > {
1698 FormerCollaboratorViewBuilder::new()
1699 }
1700}
1701
1702impl<'a> FormerCollaboratorViewBuilder<'a, former_collaborator_view_state::Empty> {
1703 /// Create a new builder with all fields unset
1704 pub fn new() -> Self {
1705 FormerCollaboratorViewBuilder {
1706 _phantom_state: ::core::marker::PhantomData,
1707 __unsafe_private_named: (None, None, None, None, None, None, None),
1708 _phantom: ::core::marker::PhantomData,
1709 }
1710 }
1711}
1712
1713impl<'a, S: former_collaborator_view_state::State> FormerCollaboratorViewBuilder<'a, S> {
1714 /// Set the `contributionCount` field (optional)
1715 pub fn contribution_count(mut self, value: impl Into<Option<i64>>) -> Self {
1716 self.__unsafe_private_named.0 = value.into();
1717 self
1718 }
1719 /// Set the `contributionCount` field to an Option value (optional)
1720 pub fn maybe_contribution_count(mut self, value: Option<i64>) -> Self {
1721 self.__unsafe_private_named.0 = value;
1722 self
1723 }
1724}
1725
1726impl<'a, S> FormerCollaboratorViewBuilder<'a, S>
1727where
1728 S: former_collaborator_view_state::State,
1729 S::EndReason: former_collaborator_view_state::IsUnset,
1730{
1731 /// Set the `endReason` field (required)
1732 pub fn end_reason(
1733 mut self,
1734 value: impl Into<FormerCollaboratorViewEndReason<'a>>,
1735 ) -> FormerCollaboratorViewBuilder<
1736 'a,
1737 former_collaborator_view_state::SetEndReason<S>,
1738 > {
1739 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1740 FormerCollaboratorViewBuilder {
1741 _phantom_state: ::core::marker::PhantomData,
1742 __unsafe_private_named: self.__unsafe_private_named,
1743 _phantom: ::core::marker::PhantomData,
1744 }
1745 }
1746}
1747
1748impl<'a, S: former_collaborator_view_state::State> FormerCollaboratorViewBuilder<'a, S> {
1749 /// Set the `hasPublishedVersion` field (optional)
1750 pub fn has_published_version(mut self, value: impl Into<Option<bool>>) -> Self {
1751 self.__unsafe_private_named.2 = value.into();
1752 self
1753 }
1754 /// Set the `hasPublishedVersion` field to an Option value (optional)
1755 pub fn maybe_has_published_version(mut self, value: Option<bool>) -> Self {
1756 self.__unsafe_private_named.2 = value;
1757 self
1758 }
1759}
1760
1761impl<'a, S: former_collaborator_view_state::State> FormerCollaboratorViewBuilder<'a, S> {
1762 /// Set the `publishedVersionUri` field (optional)
1763 pub fn published_version_uri(
1764 mut self,
1765 value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
1766 ) -> Self {
1767 self.__unsafe_private_named.3 = value.into();
1768 self
1769 }
1770 /// Set the `publishedVersionUri` field to an Option value (optional)
1771 pub fn maybe_published_version_uri(
1772 mut self,
1773 value: Option<jacquard_common::types::string::AtUri<'a>>,
1774 ) -> Self {
1775 self.__unsafe_private_named.3 = value;
1776 self
1777 }
1778}
1779
1780impl<'a, S> FormerCollaboratorViewBuilder<'a, S>
1781where
1782 S: former_collaborator_view_state::State,
1783 S::User: former_collaborator_view_state::IsUnset,
1784{
1785 /// Set the `user` field (required)
1786 pub fn user(
1787 mut self,
1788 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
1789 ) -> FormerCollaboratorViewBuilder<'a, former_collaborator_view_state::SetUser<S>> {
1790 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
1791 FormerCollaboratorViewBuilder {
1792 _phantom_state: ::core::marker::PhantomData,
1793 __unsafe_private_named: self.__unsafe_private_named,
1794 _phantom: ::core::marker::PhantomData,
1795 }
1796 }
1797}
1798
1799impl<'a, S> FormerCollaboratorViewBuilder<'a, S>
1800where
1801 S: former_collaborator_view_state::State,
1802 S::WasActiveFrom: former_collaborator_view_state::IsUnset,
1803{
1804 /// Set the `wasActiveFrom` field (required)
1805 pub fn was_active_from(
1806 mut self,
1807 value: impl Into<jacquard_common::types::string::Datetime>,
1808 ) -> FormerCollaboratorViewBuilder<
1809 'a,
1810 former_collaborator_view_state::SetWasActiveFrom<S>,
1811 > {
1812 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
1813 FormerCollaboratorViewBuilder {
1814 _phantom_state: ::core::marker::PhantomData,
1815 __unsafe_private_named: self.__unsafe_private_named,
1816 _phantom: ::core::marker::PhantomData,
1817 }
1818 }
1819}
1820
1821impl<'a, S> FormerCollaboratorViewBuilder<'a, S>
1822where
1823 S: former_collaborator_view_state::State,
1824 S::WasActiveUntil: former_collaborator_view_state::IsUnset,
1825{
1826 /// Set the `wasActiveUntil` field (required)
1827 pub fn was_active_until(
1828 mut self,
1829 value: impl Into<jacquard_common::types::string::Datetime>,
1830 ) -> FormerCollaboratorViewBuilder<
1831 'a,
1832 former_collaborator_view_state::SetWasActiveUntil<S>,
1833 > {
1834 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
1835 FormerCollaboratorViewBuilder {
1836 _phantom_state: ::core::marker::PhantomData,
1837 __unsafe_private_named: self.__unsafe_private_named,
1838 _phantom: ::core::marker::PhantomData,
1839 }
1840 }
1841}
1842
1843impl<'a, S> FormerCollaboratorViewBuilder<'a, S>
1844where
1845 S: former_collaborator_view_state::State,
1846 S::EndReason: former_collaborator_view_state::IsSet,
1847 S::WasActiveUntil: former_collaborator_view_state::IsSet,
1848 S::User: former_collaborator_view_state::IsSet,
1849 S::WasActiveFrom: former_collaborator_view_state::IsSet,
1850{
1851 /// Build the final struct
1852 pub fn build(self) -> FormerCollaboratorView<'a> {
1853 FormerCollaboratorView {
1854 contribution_count: self.__unsafe_private_named.0,
1855 end_reason: self.__unsafe_private_named.1.unwrap(),
1856 has_published_version: self.__unsafe_private_named.2,
1857 published_version_uri: self.__unsafe_private_named.3,
1858 user: self.__unsafe_private_named.4.unwrap(),
1859 was_active_from: self.__unsafe_private_named.5.unwrap(),
1860 was_active_until: self.__unsafe_private_named.6.unwrap(),
1861 extra_data: Default::default(),
1862 }
1863 }
1864 /// Build the final struct with custom extra_data
1865 pub fn build_with_data(
1866 self,
1867 extra_data: std::collections::BTreeMap<
1868 jacquard_common::smol_str::SmolStr,
1869 jacquard_common::types::value::Data<'a>,
1870 >,
1871 ) -> FormerCollaboratorView<'a> {
1872 FormerCollaboratorView {
1873 contribution_count: self.__unsafe_private_named.0,
1874 end_reason: self.__unsafe_private_named.1.unwrap(),
1875 has_published_version: self.__unsafe_private_named.2,
1876 published_version_uri: self.__unsafe_private_named.3,
1877 user: self.__unsafe_private_named.4.unwrap(),
1878 was_active_from: self.__unsafe_private_named.5.unwrap(),
1879 was_active_until: self.__unsafe_private_named.6.unwrap(),
1880 extra_data: Some(extra_data),
1881 }
1882 }
1883}
1884
1885#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1886pub enum FormerCollaboratorViewEndReason<'a> {
1887 VoluntaryLeave,
1888 InviteRevoked,
1889 InviteExpired,
1890 OwnerDeletedResource,
1891 Other(jacquard_common::CowStr<'a>),
1892}
1893
1894impl<'a> FormerCollaboratorViewEndReason<'a> {
1895 pub fn as_str(&self) -> &str {
1896 match self {
1897 Self::VoluntaryLeave => "voluntary_leave",
1898 Self::InviteRevoked => "invite_revoked",
1899 Self::InviteExpired => "invite_expired",
1900 Self::OwnerDeletedResource => "owner_deleted_resource",
1901 Self::Other(s) => s.as_ref(),
1902 }
1903 }
1904}
1905
1906impl<'a> From<&'a str> for FormerCollaboratorViewEndReason<'a> {
1907 fn from(s: &'a str) -> Self {
1908 match s {
1909 "voluntary_leave" => Self::VoluntaryLeave,
1910 "invite_revoked" => Self::InviteRevoked,
1911 "invite_expired" => Self::InviteExpired,
1912 "owner_deleted_resource" => Self::OwnerDeletedResource,
1913 _ => Self::Other(jacquard_common::CowStr::from(s)),
1914 }
1915 }
1916}
1917
1918impl<'a> From<String> for FormerCollaboratorViewEndReason<'a> {
1919 fn from(s: String) -> Self {
1920 match s.as_str() {
1921 "voluntary_leave" => Self::VoluntaryLeave,
1922 "invite_revoked" => Self::InviteRevoked,
1923 "invite_expired" => Self::InviteExpired,
1924 "owner_deleted_resource" => Self::OwnerDeletedResource,
1925 _ => Self::Other(jacquard_common::CowStr::from(s)),
1926 }
1927 }
1928}
1929
1930impl<'a> core::fmt::Display for FormerCollaboratorViewEndReason<'a> {
1931 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1932 write!(f, "{}", self.as_str())
1933 }
1934}
1935
1936impl<'a> AsRef<str> for FormerCollaboratorViewEndReason<'a> {
1937 fn as_ref(&self) -> &str {
1938 self.as_str()
1939 }
1940}
1941
1942impl<'a> serde::Serialize for FormerCollaboratorViewEndReason<'a> {
1943 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1944 where
1945 S: serde::Serializer,
1946 {
1947 serializer.serialize_str(self.as_str())
1948 }
1949}
1950
1951impl<'de, 'a> serde::Deserialize<'de> for FormerCollaboratorViewEndReason<'a>
1952where
1953 'de: 'a,
1954{
1955 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1956 where
1957 D: serde::Deserializer<'de>,
1958 {
1959 let s = <&'de str>::deserialize(deserializer)?;
1960 Ok(Self::from(s))
1961 }
1962}
1963
1964impl<'a> Default for FormerCollaboratorViewEndReason<'a> {
1965 fn default() -> Self {
1966 Self::Other(Default::default())
1967 }
1968}
1969
1970impl jacquard_common::IntoStatic for FormerCollaboratorViewEndReason<'_> {
1971 type Output = FormerCollaboratorViewEndReason<'static>;
1972 fn into_static(self) -> Self::Output {
1973 match self {
1974 FormerCollaboratorViewEndReason::VoluntaryLeave => {
1975 FormerCollaboratorViewEndReason::VoluntaryLeave
1976 }
1977 FormerCollaboratorViewEndReason::InviteRevoked => {
1978 FormerCollaboratorViewEndReason::InviteRevoked
1979 }
1980 FormerCollaboratorViewEndReason::InviteExpired => {
1981 FormerCollaboratorViewEndReason::InviteExpired
1982 }
1983 FormerCollaboratorViewEndReason::OwnerDeletedResource => {
1984 FormerCollaboratorViewEndReason::OwnerDeletedResource
1985 }
1986 FormerCollaboratorViewEndReason::Other(v) => {
1987 FormerCollaboratorViewEndReason::Other(v.into_static())
1988 }
1989 }
1990 }
1991}
1992
1993impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FormerCollaboratorView<'a> {
1994 fn nsid() -> &'static str {
1995 "sh.weaver.collab.defs"
1996 }
1997 fn def_name() -> &'static str {
1998 "formerCollaboratorView"
1999 }
2000 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
2001 lexicon_doc_sh_weaver_collab_defs()
2002 }
2003 fn validate(
2004 &self,
2005 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
2006 Ok(())
2007 }
2008}
2009
2010/// Hydrated view of a collaboration invite with status.
2011#[jacquard_derive::lexicon]
2012#[derive(
2013 serde::Serialize,
2014 serde::Deserialize,
2015 Debug,
2016 Clone,
2017 PartialEq,
2018 Eq,
2019 jacquard_derive::IntoStatic
2020)]
2021#[serde(rename_all = "camelCase")]
2022pub struct InviteView<'a> {
2023 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2024 #[serde(borrow)]
2025 pub accept_uri: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
2026 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2027 pub accepted_at: std::option::Option<jacquard_common::types::string::Datetime>,
2028 #[serde(borrow)]
2029 pub cid: jacquard_common::types::string::Cid<'a>,
2030 pub created_at: jacquard_common::types::string::Datetime,
2031 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2032 pub expires_at: std::option::Option<jacquard_common::types::string::Datetime>,
2033 #[serde(borrow)]
2034 pub invitee: crate::sh_weaver::actor::ProfileViewBasic<'a>,
2035 #[serde(borrow)]
2036 pub inviter: crate::sh_weaver::actor::ProfileViewBasic<'a>,
2037 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2038 #[serde(borrow)]
2039 pub message: std::option::Option<jacquard_common::CowStr<'a>>,
2040 #[serde(borrow)]
2041 pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
2042 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2043 #[serde(borrow)]
2044 pub resource_title: std::option::Option<jacquard_common::CowStr<'a>>,
2045 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2046 #[serde(borrow)]
2047 pub scope: std::option::Option<InviteViewScope<'a>>,
2048 #[serde(borrow)]
2049 pub status: InviteViewStatus<'a>,
2050 #[serde(borrow)]
2051 pub uri: jacquard_common::types::string::AtUri<'a>,
2052}
2053
2054pub mod invite_view_state {
2055
2056 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2057 #[allow(unused)]
2058 use ::core::marker::PhantomData;
2059 mod sealed {
2060 pub trait Sealed {}
2061 }
2062 /// State trait tracking which required fields have been set
2063 pub trait State: sealed::Sealed {
2064 type Resource;
2065 type CreatedAt;
2066 type Status;
2067 type Invitee;
2068 type Uri;
2069 type Cid;
2070 type Inviter;
2071 }
2072 /// Empty state - all required fields are unset
2073 pub struct Empty(());
2074 impl sealed::Sealed for Empty {}
2075 impl State for Empty {
2076 type Resource = Unset;
2077 type CreatedAt = Unset;
2078 type Status = Unset;
2079 type Invitee = Unset;
2080 type Uri = Unset;
2081 type Cid = Unset;
2082 type Inviter = Unset;
2083 }
2084 ///State transition - sets the `resource` field to Set
2085 pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>);
2086 impl<S: State> sealed::Sealed for SetResource<S> {}
2087 impl<S: State> State for SetResource<S> {
2088 type Resource = Set<members::resource>;
2089 type CreatedAt = S::CreatedAt;
2090 type Status = S::Status;
2091 type Invitee = S::Invitee;
2092 type Uri = S::Uri;
2093 type Cid = S::Cid;
2094 type Inviter = S::Inviter;
2095 }
2096 ///State transition - sets the `created_at` field to Set
2097 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
2098 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
2099 impl<S: State> State for SetCreatedAt<S> {
2100 type Resource = S::Resource;
2101 type CreatedAt = Set<members::created_at>;
2102 type Status = S::Status;
2103 type Invitee = S::Invitee;
2104 type Uri = S::Uri;
2105 type Cid = S::Cid;
2106 type Inviter = S::Inviter;
2107 }
2108 ///State transition - sets the `status` field to Set
2109 pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
2110 impl<S: State> sealed::Sealed for SetStatus<S> {}
2111 impl<S: State> State for SetStatus<S> {
2112 type Resource = S::Resource;
2113 type CreatedAt = S::CreatedAt;
2114 type Status = Set<members::status>;
2115 type Invitee = S::Invitee;
2116 type Uri = S::Uri;
2117 type Cid = S::Cid;
2118 type Inviter = S::Inviter;
2119 }
2120 ///State transition - sets the `invitee` field to Set
2121 pub struct SetInvitee<S: State = Empty>(PhantomData<fn() -> S>);
2122 impl<S: State> sealed::Sealed for SetInvitee<S> {}
2123 impl<S: State> State for SetInvitee<S> {
2124 type Resource = S::Resource;
2125 type CreatedAt = S::CreatedAt;
2126 type Status = S::Status;
2127 type Invitee = Set<members::invitee>;
2128 type Uri = S::Uri;
2129 type Cid = S::Cid;
2130 type Inviter = S::Inviter;
2131 }
2132 ///State transition - sets the `uri` field to Set
2133 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
2134 impl<S: State> sealed::Sealed for SetUri<S> {}
2135 impl<S: State> State for SetUri<S> {
2136 type Resource = S::Resource;
2137 type CreatedAt = S::CreatedAt;
2138 type Status = S::Status;
2139 type Invitee = S::Invitee;
2140 type Uri = Set<members::uri>;
2141 type Cid = S::Cid;
2142 type Inviter = S::Inviter;
2143 }
2144 ///State transition - sets the `cid` field to Set
2145 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
2146 impl<S: State> sealed::Sealed for SetCid<S> {}
2147 impl<S: State> State for SetCid<S> {
2148 type Resource = S::Resource;
2149 type CreatedAt = S::CreatedAt;
2150 type Status = S::Status;
2151 type Invitee = S::Invitee;
2152 type Uri = S::Uri;
2153 type Cid = Set<members::cid>;
2154 type Inviter = S::Inviter;
2155 }
2156 ///State transition - sets the `inviter` field to Set
2157 pub struct SetInviter<S: State = Empty>(PhantomData<fn() -> S>);
2158 impl<S: State> sealed::Sealed for SetInviter<S> {}
2159 impl<S: State> State for SetInviter<S> {
2160 type Resource = S::Resource;
2161 type CreatedAt = S::CreatedAt;
2162 type Status = S::Status;
2163 type Invitee = S::Invitee;
2164 type Uri = S::Uri;
2165 type Cid = S::Cid;
2166 type Inviter = Set<members::inviter>;
2167 }
2168 /// Marker types for field names
2169 #[allow(non_camel_case_types)]
2170 pub mod members {
2171 ///Marker type for the `resource` field
2172 pub struct resource(());
2173 ///Marker type for the `created_at` field
2174 pub struct created_at(());
2175 ///Marker type for the `status` field
2176 pub struct status(());
2177 ///Marker type for the `invitee` field
2178 pub struct invitee(());
2179 ///Marker type for the `uri` field
2180 pub struct uri(());
2181 ///Marker type for the `cid` field
2182 pub struct cid(());
2183 ///Marker type for the `inviter` field
2184 pub struct inviter(());
2185 }
2186}
2187
2188/// Builder for constructing an instance of this type
2189pub struct InviteViewBuilder<'a, S: invite_view_state::State> {
2190 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
2191 __unsafe_private_named: (
2192 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
2193 ::core::option::Option<jacquard_common::types::string::Datetime>,
2194 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
2195 ::core::option::Option<jacquard_common::types::string::Datetime>,
2196 ::core::option::Option<jacquard_common::types::string::Datetime>,
2197 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
2198 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
2199 ::core::option::Option<jacquard_common::CowStr<'a>>,
2200 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
2201 ::core::option::Option<jacquard_common::CowStr<'a>>,
2202 ::core::option::Option<InviteViewScope<'a>>,
2203 ::core::option::Option<InviteViewStatus<'a>>,
2204 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
2205 ),
2206 _phantom: ::core::marker::PhantomData<&'a ()>,
2207}
2208
2209impl<'a> InviteView<'a> {
2210 /// Create a new builder for this type
2211 pub fn new() -> InviteViewBuilder<'a, invite_view_state::Empty> {
2212 InviteViewBuilder::new()
2213 }
2214}
2215
2216impl<'a> InviteViewBuilder<'a, invite_view_state::Empty> {
2217 /// Create a new builder with all fields unset
2218 pub fn new() -> Self {
2219 InviteViewBuilder {
2220 _phantom_state: ::core::marker::PhantomData,
2221 __unsafe_private_named: (
2222 None,
2223 None,
2224 None,
2225 None,
2226 None,
2227 None,
2228 None,
2229 None,
2230 None,
2231 None,
2232 None,
2233 None,
2234 None,
2235 ),
2236 _phantom: ::core::marker::PhantomData,
2237 }
2238 }
2239}
2240
2241impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
2242 /// Set the `acceptUri` field (optional)
2243 pub fn accept_uri(
2244 mut self,
2245 value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
2246 ) -> Self {
2247 self.__unsafe_private_named.0 = value.into();
2248 self
2249 }
2250 /// Set the `acceptUri` field to an Option value (optional)
2251 pub fn maybe_accept_uri(
2252 mut self,
2253 value: Option<jacquard_common::types::string::AtUri<'a>>,
2254 ) -> Self {
2255 self.__unsafe_private_named.0 = value;
2256 self
2257 }
2258}
2259
2260impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
2261 /// Set the `acceptedAt` field (optional)
2262 pub fn accepted_at(
2263 mut self,
2264 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
2265 ) -> Self {
2266 self.__unsafe_private_named.1 = value.into();
2267 self
2268 }
2269 /// Set the `acceptedAt` field to an Option value (optional)
2270 pub fn maybe_accepted_at(
2271 mut self,
2272 value: Option<jacquard_common::types::string::Datetime>,
2273 ) -> Self {
2274 self.__unsafe_private_named.1 = value;
2275 self
2276 }
2277}
2278
2279impl<'a, S> InviteViewBuilder<'a, S>
2280where
2281 S: invite_view_state::State,
2282 S::Cid: invite_view_state::IsUnset,
2283{
2284 /// Set the `cid` field (required)
2285 pub fn cid(
2286 mut self,
2287 value: impl Into<jacquard_common::types::string::Cid<'a>>,
2288 ) -> InviteViewBuilder<'a, invite_view_state::SetCid<S>> {
2289 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
2290 InviteViewBuilder {
2291 _phantom_state: ::core::marker::PhantomData,
2292 __unsafe_private_named: self.__unsafe_private_named,
2293 _phantom: ::core::marker::PhantomData,
2294 }
2295 }
2296}
2297
2298impl<'a, S> InviteViewBuilder<'a, S>
2299where
2300 S: invite_view_state::State,
2301 S::CreatedAt: invite_view_state::IsUnset,
2302{
2303 /// Set the `createdAt` field (required)
2304 pub fn created_at(
2305 mut self,
2306 value: impl Into<jacquard_common::types::string::Datetime>,
2307 ) -> InviteViewBuilder<'a, invite_view_state::SetCreatedAt<S>> {
2308 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
2309 InviteViewBuilder {
2310 _phantom_state: ::core::marker::PhantomData,
2311 __unsafe_private_named: self.__unsafe_private_named,
2312 _phantom: ::core::marker::PhantomData,
2313 }
2314 }
2315}
2316
2317impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
2318 /// Set the `expiresAt` field (optional)
2319 pub fn expires_at(
2320 mut self,
2321 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
2322 ) -> Self {
2323 self.__unsafe_private_named.4 = value.into();
2324 self
2325 }
2326 /// Set the `expiresAt` field to an Option value (optional)
2327 pub fn maybe_expires_at(
2328 mut self,
2329 value: Option<jacquard_common::types::string::Datetime>,
2330 ) -> Self {
2331 self.__unsafe_private_named.4 = value;
2332 self
2333 }
2334}
2335
2336impl<'a, S> InviteViewBuilder<'a, S>
2337where
2338 S: invite_view_state::State,
2339 S::Invitee: invite_view_state::IsUnset,
2340{
2341 /// Set the `invitee` field (required)
2342 pub fn invitee(
2343 mut self,
2344 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
2345 ) -> InviteViewBuilder<'a, invite_view_state::SetInvitee<S>> {
2346 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
2347 InviteViewBuilder {
2348 _phantom_state: ::core::marker::PhantomData,
2349 __unsafe_private_named: self.__unsafe_private_named,
2350 _phantom: ::core::marker::PhantomData,
2351 }
2352 }
2353}
2354
2355impl<'a, S> InviteViewBuilder<'a, S>
2356where
2357 S: invite_view_state::State,
2358 S::Inviter: invite_view_state::IsUnset,
2359{
2360 /// Set the `inviter` field (required)
2361 pub fn inviter(
2362 mut self,
2363 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
2364 ) -> InviteViewBuilder<'a, invite_view_state::SetInviter<S>> {
2365 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
2366 InviteViewBuilder {
2367 _phantom_state: ::core::marker::PhantomData,
2368 __unsafe_private_named: self.__unsafe_private_named,
2369 _phantom: ::core::marker::PhantomData,
2370 }
2371 }
2372}
2373
2374impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
2375 /// Set the `message` field (optional)
2376 pub fn message(
2377 mut self,
2378 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
2379 ) -> Self {
2380 self.__unsafe_private_named.7 = value.into();
2381 self
2382 }
2383 /// Set the `message` field to an Option value (optional)
2384 pub fn maybe_message(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
2385 self.__unsafe_private_named.7 = value;
2386 self
2387 }
2388}
2389
2390impl<'a, S> InviteViewBuilder<'a, S>
2391where
2392 S: invite_view_state::State,
2393 S::Resource: invite_view_state::IsUnset,
2394{
2395 /// Set the `resource` field (required)
2396 pub fn resource(
2397 mut self,
2398 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
2399 ) -> InviteViewBuilder<'a, invite_view_state::SetResource<S>> {
2400 self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
2401 InviteViewBuilder {
2402 _phantom_state: ::core::marker::PhantomData,
2403 __unsafe_private_named: self.__unsafe_private_named,
2404 _phantom: ::core::marker::PhantomData,
2405 }
2406 }
2407}
2408
2409impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
2410 /// Set the `resourceTitle` field (optional)
2411 pub fn resource_title(
2412 mut self,
2413 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
2414 ) -> Self {
2415 self.__unsafe_private_named.9 = value.into();
2416 self
2417 }
2418 /// Set the `resourceTitle` field to an Option value (optional)
2419 pub fn maybe_resource_title(
2420 mut self,
2421 value: Option<jacquard_common::CowStr<'a>>,
2422 ) -> Self {
2423 self.__unsafe_private_named.9 = value;
2424 self
2425 }
2426}
2427
2428impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
2429 /// Set the `scope` field (optional)
2430 pub fn scope(mut self, value: impl Into<Option<InviteViewScope<'a>>>) -> Self {
2431 self.__unsafe_private_named.10 = value.into();
2432 self
2433 }
2434 /// Set the `scope` field to an Option value (optional)
2435 pub fn maybe_scope(mut self, value: Option<InviteViewScope<'a>>) -> Self {
2436 self.__unsafe_private_named.10 = value;
2437 self
2438 }
2439}
2440
2441impl<'a, S> InviteViewBuilder<'a, S>
2442where
2443 S: invite_view_state::State,
2444 S::Status: invite_view_state::IsUnset,
2445{
2446 /// Set the `status` field (required)
2447 pub fn status(
2448 mut self,
2449 value: impl Into<InviteViewStatus<'a>>,
2450 ) -> InviteViewBuilder<'a, invite_view_state::SetStatus<S>> {
2451 self.__unsafe_private_named.11 = ::core::option::Option::Some(value.into());
2452 InviteViewBuilder {
2453 _phantom_state: ::core::marker::PhantomData,
2454 __unsafe_private_named: self.__unsafe_private_named,
2455 _phantom: ::core::marker::PhantomData,
2456 }
2457 }
2458}
2459
2460impl<'a, S> InviteViewBuilder<'a, S>
2461where
2462 S: invite_view_state::State,
2463 S::Uri: invite_view_state::IsUnset,
2464{
2465 /// Set the `uri` field (required)
2466 pub fn uri(
2467 mut self,
2468 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
2469 ) -> InviteViewBuilder<'a, invite_view_state::SetUri<S>> {
2470 self.__unsafe_private_named.12 = ::core::option::Option::Some(value.into());
2471 InviteViewBuilder {
2472 _phantom_state: ::core::marker::PhantomData,
2473 __unsafe_private_named: self.__unsafe_private_named,
2474 _phantom: ::core::marker::PhantomData,
2475 }
2476 }
2477}
2478
2479impl<'a, S> InviteViewBuilder<'a, S>
2480where
2481 S: invite_view_state::State,
2482 S::Resource: invite_view_state::IsSet,
2483 S::CreatedAt: invite_view_state::IsSet,
2484 S::Status: invite_view_state::IsSet,
2485 S::Invitee: invite_view_state::IsSet,
2486 S::Uri: invite_view_state::IsSet,
2487 S::Cid: invite_view_state::IsSet,
2488 S::Inviter: invite_view_state::IsSet,
2489{
2490 /// Build the final struct
2491 pub fn build(self) -> InviteView<'a> {
2492 InviteView {
2493 accept_uri: self.__unsafe_private_named.0,
2494 accepted_at: self.__unsafe_private_named.1,
2495 cid: self.__unsafe_private_named.2.unwrap(),
2496 created_at: self.__unsafe_private_named.3.unwrap(),
2497 expires_at: self.__unsafe_private_named.4,
2498 invitee: self.__unsafe_private_named.5.unwrap(),
2499 inviter: self.__unsafe_private_named.6.unwrap(),
2500 message: self.__unsafe_private_named.7,
2501 resource: self.__unsafe_private_named.8.unwrap(),
2502 resource_title: self.__unsafe_private_named.9,
2503 scope: self.__unsafe_private_named.10,
2504 status: self.__unsafe_private_named.11.unwrap(),
2505 uri: self.__unsafe_private_named.12.unwrap(),
2506 extra_data: Default::default(),
2507 }
2508 }
2509 /// Build the final struct with custom extra_data
2510 pub fn build_with_data(
2511 self,
2512 extra_data: std::collections::BTreeMap<
2513 jacquard_common::smol_str::SmolStr,
2514 jacquard_common::types::value::Data<'a>,
2515 >,
2516 ) -> InviteView<'a> {
2517 InviteView {
2518 accept_uri: self.__unsafe_private_named.0,
2519 accepted_at: self.__unsafe_private_named.1,
2520 cid: self.__unsafe_private_named.2.unwrap(),
2521 created_at: self.__unsafe_private_named.3.unwrap(),
2522 expires_at: self.__unsafe_private_named.4,
2523 invitee: self.__unsafe_private_named.5.unwrap(),
2524 inviter: self.__unsafe_private_named.6.unwrap(),
2525 message: self.__unsafe_private_named.7,
2526 resource: self.__unsafe_private_named.8.unwrap(),
2527 resource_title: self.__unsafe_private_named.9,
2528 scope: self.__unsafe_private_named.10,
2529 status: self.__unsafe_private_named.11.unwrap(),
2530 uri: self.__unsafe_private_named.12.unwrap(),
2531 extra_data: Some(extra_data),
2532 }
2533 }
2534}
2535
2536#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2537pub enum InviteViewScope<'a> {
2538 Notebook,
2539 Entry,
2540 Chapter,
2541 Other(jacquard_common::CowStr<'a>),
2542}
2543
2544impl<'a> InviteViewScope<'a> {
2545 pub fn as_str(&self) -> &str {
2546 match self {
2547 Self::Notebook => "notebook",
2548 Self::Entry => "entry",
2549 Self::Chapter => "chapter",
2550 Self::Other(s) => s.as_ref(),
2551 }
2552 }
2553}
2554
2555impl<'a> From<&'a str> for InviteViewScope<'a> {
2556 fn from(s: &'a str) -> Self {
2557 match s {
2558 "notebook" => Self::Notebook,
2559 "entry" => Self::Entry,
2560 "chapter" => Self::Chapter,
2561 _ => Self::Other(jacquard_common::CowStr::from(s)),
2562 }
2563 }
2564}
2565
2566impl<'a> From<String> for InviteViewScope<'a> {
2567 fn from(s: String) -> Self {
2568 match s.as_str() {
2569 "notebook" => Self::Notebook,
2570 "entry" => Self::Entry,
2571 "chapter" => Self::Chapter,
2572 _ => Self::Other(jacquard_common::CowStr::from(s)),
2573 }
2574 }
2575}
2576
2577impl<'a> core::fmt::Display for InviteViewScope<'a> {
2578 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2579 write!(f, "{}", self.as_str())
2580 }
2581}
2582
2583impl<'a> AsRef<str> for InviteViewScope<'a> {
2584 fn as_ref(&self) -> &str {
2585 self.as_str()
2586 }
2587}
2588
2589impl<'a> serde::Serialize for InviteViewScope<'a> {
2590 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2591 where
2592 S: serde::Serializer,
2593 {
2594 serializer.serialize_str(self.as_str())
2595 }
2596}
2597
2598impl<'de, 'a> serde::Deserialize<'de> for InviteViewScope<'a>
2599where
2600 'de: 'a,
2601{
2602 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2603 where
2604 D: serde::Deserializer<'de>,
2605 {
2606 let s = <&'de str>::deserialize(deserializer)?;
2607 Ok(Self::from(s))
2608 }
2609}
2610
2611impl<'a> Default for InviteViewScope<'a> {
2612 fn default() -> Self {
2613 Self::Other(Default::default())
2614 }
2615}
2616
2617impl jacquard_common::IntoStatic for InviteViewScope<'_> {
2618 type Output = InviteViewScope<'static>;
2619 fn into_static(self) -> Self::Output {
2620 match self {
2621 InviteViewScope::Notebook => InviteViewScope::Notebook,
2622 InviteViewScope::Entry => InviteViewScope::Entry,
2623 InviteViewScope::Chapter => InviteViewScope::Chapter,
2624 InviteViewScope::Other(v) => InviteViewScope::Other(v.into_static()),
2625 }
2626 }
2627}
2628
2629#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2630pub enum InviteViewStatus<'a> {
2631 Pending,
2632 Accepted,
2633 Expired,
2634 Revoked,
2635 Other(jacquard_common::CowStr<'a>),
2636}
2637
2638impl<'a> InviteViewStatus<'a> {
2639 pub fn as_str(&self) -> &str {
2640 match self {
2641 Self::Pending => "pending",
2642 Self::Accepted => "accepted",
2643 Self::Expired => "expired",
2644 Self::Revoked => "revoked",
2645 Self::Other(s) => s.as_ref(),
2646 }
2647 }
2648}
2649
2650impl<'a> From<&'a str> for InviteViewStatus<'a> {
2651 fn from(s: &'a str) -> Self {
2652 match s {
2653 "pending" => Self::Pending,
2654 "accepted" => Self::Accepted,
2655 "expired" => Self::Expired,
2656 "revoked" => Self::Revoked,
2657 _ => Self::Other(jacquard_common::CowStr::from(s)),
2658 }
2659 }
2660}
2661
2662impl<'a> From<String> for InviteViewStatus<'a> {
2663 fn from(s: String) -> Self {
2664 match s.as_str() {
2665 "pending" => Self::Pending,
2666 "accepted" => Self::Accepted,
2667 "expired" => Self::Expired,
2668 "revoked" => Self::Revoked,
2669 _ => Self::Other(jacquard_common::CowStr::from(s)),
2670 }
2671 }
2672}
2673
2674impl<'a> core::fmt::Display for InviteViewStatus<'a> {
2675 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2676 write!(f, "{}", self.as_str())
2677 }
2678}
2679
2680impl<'a> AsRef<str> for InviteViewStatus<'a> {
2681 fn as_ref(&self) -> &str {
2682 self.as_str()
2683 }
2684}
2685
2686impl<'a> serde::Serialize for InviteViewStatus<'a> {
2687 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2688 where
2689 S: serde::Serializer,
2690 {
2691 serializer.serialize_str(self.as_str())
2692 }
2693}
2694
2695impl<'de, 'a> serde::Deserialize<'de> for InviteViewStatus<'a>
2696where
2697 'de: 'a,
2698{
2699 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2700 where
2701 D: serde::Deserializer<'de>,
2702 {
2703 let s = <&'de str>::deserialize(deserializer)?;
2704 Ok(Self::from(s))
2705 }
2706}
2707
2708impl<'a> Default for InviteViewStatus<'a> {
2709 fn default() -> Self {
2710 Self::Other(Default::default())
2711 }
2712}
2713
2714impl jacquard_common::IntoStatic for InviteViewStatus<'_> {
2715 type Output = InviteViewStatus<'static>;
2716 fn into_static(self) -> Self::Output {
2717 match self {
2718 InviteViewStatus::Pending => InviteViewStatus::Pending,
2719 InviteViewStatus::Accepted => InviteViewStatus::Accepted,
2720 InviteViewStatus::Expired => InviteViewStatus::Expired,
2721 InviteViewStatus::Revoked => InviteViewStatus::Revoked,
2722 InviteViewStatus::Other(v) => InviteViewStatus::Other(v.into_static()),
2723 }
2724 }
2725}
2726
2727impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InviteView<'a> {
2728 fn nsid() -> &'static str {
2729 "sh.weaver.collab.defs"
2730 }
2731 fn def_name() -> &'static str {
2732 "inviteView"
2733 }
2734 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
2735 lexicon_doc_sh_weaver_collab_defs()
2736 }
2737 fn validate(
2738 &self,
2739 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
2740 Ok(())
2741 }
2742}
2743
2744/// Collaboration scoped to an entire notebook.
2745#[derive(
2746 serde::Serialize,
2747 serde::Deserialize,
2748 Debug,
2749 Clone,
2750 PartialEq,
2751 Eq,
2752 Hash,
2753 jacquard_derive::IntoStatic
2754)]
2755pub struct Notebook;
2756impl std::fmt::Display for Notebook {
2757 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2758 write!(f, "notebook")
2759 }
2760}
2761
2762/// Individual participant's state in a collaboration. Distinguishes 'was collaborator' vs 'never was'.
2763#[jacquard_derive::lexicon]
2764#[derive(
2765 serde::Serialize,
2766 serde::Deserialize,
2767 Debug,
2768 Clone,
2769 PartialEq,
2770 Eq,
2771 jacquard_derive::IntoStatic
2772)]
2773#[serde(rename_all = "camelCase")]
2774pub struct ParticipantStateView<'a> {
2775 /// If they accepted (even if later broken)
2776 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2777 #[serde(borrow)]
2778 pub accept_uri: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
2779 /// Why the relationship ended, if applicable
2780 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2781 #[serde(borrow)]
2782 pub end_reason: std::option::Option<ParticipantStateViewEndReason<'a>>,
2783 /// When they first contributed
2784 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2785 pub first_edit_at: std::option::Option<jacquard_common::types::string::Datetime>,
2786 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2787 #[serde(borrow)]
2788 pub invite_uri: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
2789 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2790 pub last_edit_at: std::option::Option<jacquard_common::types::string::Datetime>,
2791 /// Their published copy if any
2792 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2793 #[serde(borrow)]
2794 pub published_version: std::option::Option<
2795 crate::com_atproto::repo::strong_ref::StrongRef<'a>,
2796 >,
2797 /// When left/removed/expired
2798 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2799 pub relationship_ended_at: std::option::Option<
2800 jacquard_common::types::string::Datetime,
2801 >,
2802 #[serde(borrow)]
2803 pub role: ParticipantStateViewRole<'a>,
2804 /// active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out
2805 #[serde(borrow)]
2806 pub status: ParticipantStateViewStatus<'a>,
2807 #[serde(borrow)]
2808 pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>,
2809 /// True if they ever had active collaboration status
2810 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2811 pub was_collaborator: std::option::Option<bool>,
2812}
2813
2814pub mod participant_state_view_state {
2815
2816 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2817 #[allow(unused)]
2818 use ::core::marker::PhantomData;
2819 mod sealed {
2820 pub trait Sealed {}
2821 }
2822 /// State trait tracking which required fields have been set
2823 pub trait State: sealed::Sealed {
2824 type Status;
2825 type Role;
2826 type User;
2827 }
2828 /// Empty state - all required fields are unset
2829 pub struct Empty(());
2830 impl sealed::Sealed for Empty {}
2831 impl State for Empty {
2832 type Status = Unset;
2833 type Role = Unset;
2834 type User = Unset;
2835 }
2836 ///State transition - sets the `status` field to Set
2837 pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
2838 impl<S: State> sealed::Sealed for SetStatus<S> {}
2839 impl<S: State> State for SetStatus<S> {
2840 type Status = Set<members::status>;
2841 type Role = S::Role;
2842 type User = S::User;
2843 }
2844 ///State transition - sets the `role` field to Set
2845 pub struct SetRole<S: State = Empty>(PhantomData<fn() -> S>);
2846 impl<S: State> sealed::Sealed for SetRole<S> {}
2847 impl<S: State> State for SetRole<S> {
2848 type Status = S::Status;
2849 type Role = Set<members::role>;
2850 type User = S::User;
2851 }
2852 ///State transition - sets the `user` field to Set
2853 pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>);
2854 impl<S: State> sealed::Sealed for SetUser<S> {}
2855 impl<S: State> State for SetUser<S> {
2856 type Status = S::Status;
2857 type Role = S::Role;
2858 type User = Set<members::user>;
2859 }
2860 /// Marker types for field names
2861 #[allow(non_camel_case_types)]
2862 pub mod members {
2863 ///Marker type for the `status` field
2864 pub struct status(());
2865 ///Marker type for the `role` field
2866 pub struct role(());
2867 ///Marker type for the `user` field
2868 pub struct user(());
2869 }
2870}
2871
2872/// Builder for constructing an instance of this type
2873pub struct ParticipantStateViewBuilder<'a, S: participant_state_view_state::State> {
2874 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
2875 __unsafe_private_named: (
2876 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
2877 ::core::option::Option<ParticipantStateViewEndReason<'a>>,
2878 ::core::option::Option<jacquard_common::types::string::Datetime>,
2879 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
2880 ::core::option::Option<jacquard_common::types::string::Datetime>,
2881 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
2882 ::core::option::Option<jacquard_common::types::string::Datetime>,
2883 ::core::option::Option<ParticipantStateViewRole<'a>>,
2884 ::core::option::Option<ParticipantStateViewStatus<'a>>,
2885 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
2886 ::core::option::Option<bool>,
2887 ),
2888 _phantom: ::core::marker::PhantomData<&'a ()>,
2889}
2890
2891impl<'a> ParticipantStateView<'a> {
2892 /// Create a new builder for this type
2893 pub fn new() -> ParticipantStateViewBuilder<
2894 'a,
2895 participant_state_view_state::Empty,
2896 > {
2897 ParticipantStateViewBuilder::new()
2898 }
2899}
2900
2901impl<'a> ParticipantStateViewBuilder<'a, participant_state_view_state::Empty> {
2902 /// Create a new builder with all fields unset
2903 pub fn new() -> Self {
2904 ParticipantStateViewBuilder {
2905 _phantom_state: ::core::marker::PhantomData,
2906 __unsafe_private_named: (
2907 None,
2908 None,
2909 None,
2910 None,
2911 None,
2912 None,
2913 None,
2914 None,
2915 None,
2916 None,
2917 None,
2918 ),
2919 _phantom: ::core::marker::PhantomData,
2920 }
2921 }
2922}
2923
2924impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
2925 /// Set the `acceptUri` field (optional)
2926 pub fn accept_uri(
2927 mut self,
2928 value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
2929 ) -> Self {
2930 self.__unsafe_private_named.0 = value.into();
2931 self
2932 }
2933 /// Set the `acceptUri` field to an Option value (optional)
2934 pub fn maybe_accept_uri(
2935 mut self,
2936 value: Option<jacquard_common::types::string::AtUri<'a>>,
2937 ) -> Self {
2938 self.__unsafe_private_named.0 = value;
2939 self
2940 }
2941}
2942
2943impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
2944 /// Set the `endReason` field (optional)
2945 pub fn end_reason(
2946 mut self,
2947 value: impl Into<Option<ParticipantStateViewEndReason<'a>>>,
2948 ) -> Self {
2949 self.__unsafe_private_named.1 = value.into();
2950 self
2951 }
2952 /// Set the `endReason` field to an Option value (optional)
2953 pub fn maybe_end_reason(
2954 mut self,
2955 value: Option<ParticipantStateViewEndReason<'a>>,
2956 ) -> Self {
2957 self.__unsafe_private_named.1 = value;
2958 self
2959 }
2960}
2961
2962impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
2963 /// Set the `firstEditAt` field (optional)
2964 pub fn first_edit_at(
2965 mut self,
2966 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
2967 ) -> Self {
2968 self.__unsafe_private_named.2 = value.into();
2969 self
2970 }
2971 /// Set the `firstEditAt` field to an Option value (optional)
2972 pub fn maybe_first_edit_at(
2973 mut self,
2974 value: Option<jacquard_common::types::string::Datetime>,
2975 ) -> Self {
2976 self.__unsafe_private_named.2 = value;
2977 self
2978 }
2979}
2980
2981impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
2982 /// Set the `inviteUri` field (optional)
2983 pub fn invite_uri(
2984 mut self,
2985 value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
2986 ) -> Self {
2987 self.__unsafe_private_named.3 = value.into();
2988 self
2989 }
2990 /// Set the `inviteUri` field to an Option value (optional)
2991 pub fn maybe_invite_uri(
2992 mut self,
2993 value: Option<jacquard_common::types::string::AtUri<'a>>,
2994 ) -> Self {
2995 self.__unsafe_private_named.3 = value;
2996 self
2997 }
2998}
2999
3000impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
3001 /// Set the `lastEditAt` field (optional)
3002 pub fn last_edit_at(
3003 mut self,
3004 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
3005 ) -> Self {
3006 self.__unsafe_private_named.4 = value.into();
3007 self
3008 }
3009 /// Set the `lastEditAt` field to an Option value (optional)
3010 pub fn maybe_last_edit_at(
3011 mut self,
3012 value: Option<jacquard_common::types::string::Datetime>,
3013 ) -> Self {
3014 self.__unsafe_private_named.4 = value;
3015 self
3016 }
3017}
3018
3019impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
3020 /// Set the `publishedVersion` field (optional)
3021 pub fn published_version(
3022 mut self,
3023 value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
3024 ) -> Self {
3025 self.__unsafe_private_named.5 = value.into();
3026 self
3027 }
3028 /// Set the `publishedVersion` field to an Option value (optional)
3029 pub fn maybe_published_version(
3030 mut self,
3031 value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
3032 ) -> Self {
3033 self.__unsafe_private_named.5 = value;
3034 self
3035 }
3036}
3037
3038impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
3039 /// Set the `relationshipEndedAt` field (optional)
3040 pub fn relationship_ended_at(
3041 mut self,
3042 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
3043 ) -> Self {
3044 self.__unsafe_private_named.6 = value.into();
3045 self
3046 }
3047 /// Set the `relationshipEndedAt` field to an Option value (optional)
3048 pub fn maybe_relationship_ended_at(
3049 mut self,
3050 value: Option<jacquard_common::types::string::Datetime>,
3051 ) -> Self {
3052 self.__unsafe_private_named.6 = value;
3053 self
3054 }
3055}
3056
3057impl<'a, S> ParticipantStateViewBuilder<'a, S>
3058where
3059 S: participant_state_view_state::State,
3060 S::Role: participant_state_view_state::IsUnset,
3061{
3062 /// Set the `role` field (required)
3063 pub fn role(
3064 mut self,
3065 value: impl Into<ParticipantStateViewRole<'a>>,
3066 ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetRole<S>> {
3067 self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
3068 ParticipantStateViewBuilder {
3069 _phantom_state: ::core::marker::PhantomData,
3070 __unsafe_private_named: self.__unsafe_private_named,
3071 _phantom: ::core::marker::PhantomData,
3072 }
3073 }
3074}
3075
3076impl<'a, S> ParticipantStateViewBuilder<'a, S>
3077where
3078 S: participant_state_view_state::State,
3079 S::Status: participant_state_view_state::IsUnset,
3080{
3081 /// Set the `status` field (required)
3082 pub fn status(
3083 mut self,
3084 value: impl Into<ParticipantStateViewStatus<'a>>,
3085 ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetStatus<S>> {
3086 self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
3087 ParticipantStateViewBuilder {
3088 _phantom_state: ::core::marker::PhantomData,
3089 __unsafe_private_named: self.__unsafe_private_named,
3090 _phantom: ::core::marker::PhantomData,
3091 }
3092 }
3093}
3094
3095impl<'a, S> ParticipantStateViewBuilder<'a, S>
3096where
3097 S: participant_state_view_state::State,
3098 S::User: participant_state_view_state::IsUnset,
3099{
3100 /// Set the `user` field (required)
3101 pub fn user(
3102 mut self,
3103 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
3104 ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetUser<S>> {
3105 self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into());
3106 ParticipantStateViewBuilder {
3107 _phantom_state: ::core::marker::PhantomData,
3108 __unsafe_private_named: self.__unsafe_private_named,
3109 _phantom: ::core::marker::PhantomData,
3110 }
3111 }
3112}
3113
3114impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> {
3115 /// Set the `wasCollaborator` field (optional)
3116 pub fn was_collaborator(mut self, value: impl Into<Option<bool>>) -> Self {
3117 self.__unsafe_private_named.10 = value.into();
3118 self
3119 }
3120 /// Set the `wasCollaborator` field to an Option value (optional)
3121 pub fn maybe_was_collaborator(mut self, value: Option<bool>) -> Self {
3122 self.__unsafe_private_named.10 = value;
3123 self
3124 }
3125}
3126
3127impl<'a, S> ParticipantStateViewBuilder<'a, S>
3128where
3129 S: participant_state_view_state::State,
3130 S::Status: participant_state_view_state::IsSet,
3131 S::Role: participant_state_view_state::IsSet,
3132 S::User: participant_state_view_state::IsSet,
3133{
3134 /// Build the final struct
3135 pub fn build(self) -> ParticipantStateView<'a> {
3136 ParticipantStateView {
3137 accept_uri: self.__unsafe_private_named.0,
3138 end_reason: self.__unsafe_private_named.1,
3139 first_edit_at: self.__unsafe_private_named.2,
3140 invite_uri: self.__unsafe_private_named.3,
3141 last_edit_at: self.__unsafe_private_named.4,
3142 published_version: self.__unsafe_private_named.5,
3143 relationship_ended_at: self.__unsafe_private_named.6,
3144 role: self.__unsafe_private_named.7.unwrap(),
3145 status: self.__unsafe_private_named.8.unwrap(),
3146 user: self.__unsafe_private_named.9.unwrap(),
3147 was_collaborator: self.__unsafe_private_named.10,
3148 extra_data: Default::default(),
3149 }
3150 }
3151 /// Build the final struct with custom extra_data
3152 pub fn build_with_data(
3153 self,
3154 extra_data: std::collections::BTreeMap<
3155 jacquard_common::smol_str::SmolStr,
3156 jacquard_common::types::value::Data<'a>,
3157 >,
3158 ) -> ParticipantStateView<'a> {
3159 ParticipantStateView {
3160 accept_uri: self.__unsafe_private_named.0,
3161 end_reason: self.__unsafe_private_named.1,
3162 first_edit_at: self.__unsafe_private_named.2,
3163 invite_uri: self.__unsafe_private_named.3,
3164 last_edit_at: self.__unsafe_private_named.4,
3165 published_version: self.__unsafe_private_named.5,
3166 relationship_ended_at: self.__unsafe_private_named.6,
3167 role: self.__unsafe_private_named.7.unwrap(),
3168 status: self.__unsafe_private_named.8.unwrap(),
3169 user: self.__unsafe_private_named.9.unwrap(),
3170 was_collaborator: self.__unsafe_private_named.10,
3171 extra_data: Some(extra_data),
3172 }
3173 }
3174}
3175
3176/// Why the relationship ended, if applicable
3177#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3178pub enum ParticipantStateViewEndReason<'a> {
3179 VoluntaryLeave,
3180 InviteRevoked,
3181 InviteExpired,
3182 OwnerDeletedResource,
3183 Other(jacquard_common::CowStr<'a>),
3184}
3185
3186impl<'a> ParticipantStateViewEndReason<'a> {
3187 pub fn as_str(&self) -> &str {
3188 match self {
3189 Self::VoluntaryLeave => "voluntary_leave",
3190 Self::InviteRevoked => "invite_revoked",
3191 Self::InviteExpired => "invite_expired",
3192 Self::OwnerDeletedResource => "owner_deleted_resource",
3193 Self::Other(s) => s.as_ref(),
3194 }
3195 }
3196}
3197
3198impl<'a> From<&'a str> for ParticipantStateViewEndReason<'a> {
3199 fn from(s: &'a str) -> Self {
3200 match s {
3201 "voluntary_leave" => Self::VoluntaryLeave,
3202 "invite_revoked" => Self::InviteRevoked,
3203 "invite_expired" => Self::InviteExpired,
3204 "owner_deleted_resource" => Self::OwnerDeletedResource,
3205 _ => Self::Other(jacquard_common::CowStr::from(s)),
3206 }
3207 }
3208}
3209
3210impl<'a> From<String> for ParticipantStateViewEndReason<'a> {
3211 fn from(s: String) -> Self {
3212 match s.as_str() {
3213 "voluntary_leave" => Self::VoluntaryLeave,
3214 "invite_revoked" => Self::InviteRevoked,
3215 "invite_expired" => Self::InviteExpired,
3216 "owner_deleted_resource" => Self::OwnerDeletedResource,
3217 _ => Self::Other(jacquard_common::CowStr::from(s)),
3218 }
3219 }
3220}
3221
3222impl<'a> core::fmt::Display for ParticipantStateViewEndReason<'a> {
3223 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3224 write!(f, "{}", self.as_str())
3225 }
3226}
3227
3228impl<'a> AsRef<str> for ParticipantStateViewEndReason<'a> {
3229 fn as_ref(&self) -> &str {
3230 self.as_str()
3231 }
3232}
3233
3234impl<'a> serde::Serialize for ParticipantStateViewEndReason<'a> {
3235 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3236 where
3237 S: serde::Serializer,
3238 {
3239 serializer.serialize_str(self.as_str())
3240 }
3241}
3242
3243impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewEndReason<'a>
3244where
3245 'de: 'a,
3246{
3247 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3248 where
3249 D: serde::Deserializer<'de>,
3250 {
3251 let s = <&'de str>::deserialize(deserializer)?;
3252 Ok(Self::from(s))
3253 }
3254}
3255
3256impl<'a> Default for ParticipantStateViewEndReason<'a> {
3257 fn default() -> Self {
3258 Self::Other(Default::default())
3259 }
3260}
3261
3262impl jacquard_common::IntoStatic for ParticipantStateViewEndReason<'_> {
3263 type Output = ParticipantStateViewEndReason<'static>;
3264 fn into_static(self) -> Self::Output {
3265 match self {
3266 ParticipantStateViewEndReason::VoluntaryLeave => {
3267 ParticipantStateViewEndReason::VoluntaryLeave
3268 }
3269 ParticipantStateViewEndReason::InviteRevoked => {
3270 ParticipantStateViewEndReason::InviteRevoked
3271 }
3272 ParticipantStateViewEndReason::InviteExpired => {
3273 ParticipantStateViewEndReason::InviteExpired
3274 }
3275 ParticipantStateViewEndReason::OwnerDeletedResource => {
3276 ParticipantStateViewEndReason::OwnerDeletedResource
3277 }
3278 ParticipantStateViewEndReason::Other(v) => {
3279 ParticipantStateViewEndReason::Other(v.into_static())
3280 }
3281 }
3282 }
3283}
3284
3285#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3286pub enum ParticipantStateViewRole<'a> {
3287 Owner,
3288 Collaborator,
3289 FormerCollaborator,
3290 Other(jacquard_common::CowStr<'a>),
3291}
3292
3293impl<'a> ParticipantStateViewRole<'a> {
3294 pub fn as_str(&self) -> &str {
3295 match self {
3296 Self::Owner => "owner",
3297 Self::Collaborator => "collaborator",
3298 Self::FormerCollaborator => "former_collaborator",
3299 Self::Other(s) => s.as_ref(),
3300 }
3301 }
3302}
3303
3304impl<'a> From<&'a str> for ParticipantStateViewRole<'a> {
3305 fn from(s: &'a str) -> Self {
3306 match s {
3307 "owner" => Self::Owner,
3308 "collaborator" => Self::Collaborator,
3309 "former_collaborator" => Self::FormerCollaborator,
3310 _ => Self::Other(jacquard_common::CowStr::from(s)),
3311 }
3312 }
3313}
3314
3315impl<'a> From<String> for ParticipantStateViewRole<'a> {
3316 fn from(s: String) -> Self {
3317 match s.as_str() {
3318 "owner" => Self::Owner,
3319 "collaborator" => Self::Collaborator,
3320 "former_collaborator" => Self::FormerCollaborator,
3321 _ => Self::Other(jacquard_common::CowStr::from(s)),
3322 }
3323 }
3324}
3325
3326impl<'a> core::fmt::Display for ParticipantStateViewRole<'a> {
3327 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3328 write!(f, "{}", self.as_str())
3329 }
3330}
3331
3332impl<'a> AsRef<str> for ParticipantStateViewRole<'a> {
3333 fn as_ref(&self) -> &str {
3334 self.as_str()
3335 }
3336}
3337
3338impl<'a> serde::Serialize for ParticipantStateViewRole<'a> {
3339 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3340 where
3341 S: serde::Serializer,
3342 {
3343 serializer.serialize_str(self.as_str())
3344 }
3345}
3346
3347impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewRole<'a>
3348where
3349 'de: 'a,
3350{
3351 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3352 where
3353 D: serde::Deserializer<'de>,
3354 {
3355 let s = <&'de str>::deserialize(deserializer)?;
3356 Ok(Self::from(s))
3357 }
3358}
3359
3360impl<'a> Default for ParticipantStateViewRole<'a> {
3361 fn default() -> Self {
3362 Self::Other(Default::default())
3363 }
3364}
3365
3366impl jacquard_common::IntoStatic for ParticipantStateViewRole<'_> {
3367 type Output = ParticipantStateViewRole<'static>;
3368 fn into_static(self) -> Self::Output {
3369 match self {
3370 ParticipantStateViewRole::Owner => ParticipantStateViewRole::Owner,
3371 ParticipantStateViewRole::Collaborator => {
3372 ParticipantStateViewRole::Collaborator
3373 }
3374 ParticipantStateViewRole::FormerCollaborator => {
3375 ParticipantStateViewRole::FormerCollaborator
3376 }
3377 ParticipantStateViewRole::Other(v) => {
3378 ParticipantStateViewRole::Other(v.into_static())
3379 }
3380 }
3381 }
3382}
3383
3384/// active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out
3385#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3386pub enum ParticipantStateViewStatus<'a> {
3387 Active,
3388 Invited,
3389 Left,
3390 Removed,
3391 Expired,
3392 Other(jacquard_common::CowStr<'a>),
3393}
3394
3395impl<'a> ParticipantStateViewStatus<'a> {
3396 pub fn as_str(&self) -> &str {
3397 match self {
3398 Self::Active => "active",
3399 Self::Invited => "invited",
3400 Self::Left => "left",
3401 Self::Removed => "removed",
3402 Self::Expired => "expired",
3403 Self::Other(s) => s.as_ref(),
3404 }
3405 }
3406}
3407
3408impl<'a> From<&'a str> for ParticipantStateViewStatus<'a> {
3409 fn from(s: &'a str) -> Self {
3410 match s {
3411 "active" => Self::Active,
3412 "invited" => Self::Invited,
3413 "left" => Self::Left,
3414 "removed" => Self::Removed,
3415 "expired" => Self::Expired,
3416 _ => Self::Other(jacquard_common::CowStr::from(s)),
3417 }
3418 }
3419}
3420
3421impl<'a> From<String> for ParticipantStateViewStatus<'a> {
3422 fn from(s: String) -> Self {
3423 match s.as_str() {
3424 "active" => Self::Active,
3425 "invited" => Self::Invited,
3426 "left" => Self::Left,
3427 "removed" => Self::Removed,
3428 "expired" => Self::Expired,
3429 _ => Self::Other(jacquard_common::CowStr::from(s)),
3430 }
3431 }
3432}
3433
3434impl<'a> core::fmt::Display for ParticipantStateViewStatus<'a> {
3435 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3436 write!(f, "{}", self.as_str())
3437 }
3438}
3439
3440impl<'a> AsRef<str> for ParticipantStateViewStatus<'a> {
3441 fn as_ref(&self) -> &str {
3442 self.as_str()
3443 }
3444}
3445
3446impl<'a> serde::Serialize for ParticipantStateViewStatus<'a> {
3447 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3448 where
3449 S: serde::Serializer,
3450 {
3451 serializer.serialize_str(self.as_str())
3452 }
3453}
3454
3455impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewStatus<'a>
3456where
3457 'de: 'a,
3458{
3459 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3460 where
3461 D: serde::Deserializer<'de>,
3462 {
3463 let s = <&'de str>::deserialize(deserializer)?;
3464 Ok(Self::from(s))
3465 }
3466}
3467
3468impl<'a> Default for ParticipantStateViewStatus<'a> {
3469 fn default() -> Self {
3470 Self::Other(Default::default())
3471 }
3472}
3473
3474impl jacquard_common::IntoStatic for ParticipantStateViewStatus<'_> {
3475 type Output = ParticipantStateViewStatus<'static>;
3476 fn into_static(self) -> Self::Output {
3477 match self {
3478 ParticipantStateViewStatus::Active => ParticipantStateViewStatus::Active,
3479 ParticipantStateViewStatus::Invited => ParticipantStateViewStatus::Invited,
3480 ParticipantStateViewStatus::Left => ParticipantStateViewStatus::Left,
3481 ParticipantStateViewStatus::Removed => ParticipantStateViewStatus::Removed,
3482 ParticipantStateViewStatus::Expired => ParticipantStateViewStatus::Expired,
3483 ParticipantStateViewStatus::Other(v) => {
3484 ParticipantStateViewStatus::Other(v.into_static())
3485 }
3486 }
3487 }
3488}
3489
3490impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ParticipantStateView<'a> {
3491 fn nsid() -> &'static str {
3492 "sh.weaver.collab.defs"
3493 }
3494 fn def_name() -> &'static str {
3495 "participantStateView"
3496 }
3497 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
3498 lexicon_doc_sh_weaver_collab_defs()
3499 }
3500 fn validate(
3501 &self,
3502 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
3503 Ok(())
3504 }
3505}
3506
3507/// Active real-time collaboration session.
3508#[jacquard_derive::lexicon]
3509#[derive(
3510 serde::Serialize,
3511 serde::Deserialize,
3512 Debug,
3513 Clone,
3514 PartialEq,
3515 Eq,
3516 jacquard_derive::IntoStatic
3517)]
3518#[serde(rename_all = "camelCase")]
3519pub struct SessionView<'a> {
3520 pub created_at: jacquard_common::types::string::Datetime,
3521 #[serde(skip_serializing_if = "std::option::Option::is_none")]
3522 pub expires_at: std::option::Option<jacquard_common::types::string::Datetime>,
3523 #[serde(borrow)]
3524 pub node_id: jacquard_common::CowStr<'a>,
3525 #[serde(skip_serializing_if = "std::option::Option::is_none")]
3526 #[serde(borrow)]
3527 pub relay_url: std::option::Option<jacquard_common::types::string::Uri<'a>>,
3528 #[serde(borrow)]
3529 pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
3530 #[serde(borrow)]
3531 pub uri: jacquard_common::types::string::AtUri<'a>,
3532 #[serde(borrow)]
3533 pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>,
3534}
3535
3536pub mod session_view_state {
3537
3538 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
3539 #[allow(unused)]
3540 use ::core::marker::PhantomData;
3541 mod sealed {
3542 pub trait Sealed {}
3543 }
3544 /// State trait tracking which required fields have been set
3545 pub trait State: sealed::Sealed {
3546 type Uri;
3547 type User;
3548 type Resource;
3549 type CreatedAt;
3550 type NodeId;
3551 }
3552 /// Empty state - all required fields are unset
3553 pub struct Empty(());
3554 impl sealed::Sealed for Empty {}
3555 impl State for Empty {
3556 type Uri = Unset;
3557 type User = Unset;
3558 type Resource = Unset;
3559 type CreatedAt = Unset;
3560 type NodeId = Unset;
3561 }
3562 ///State transition - sets the `uri` field to Set
3563 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
3564 impl<S: State> sealed::Sealed for SetUri<S> {}
3565 impl<S: State> State for SetUri<S> {
3566 type Uri = Set<members::uri>;
3567 type User = S::User;
3568 type Resource = S::Resource;
3569 type CreatedAt = S::CreatedAt;
3570 type NodeId = S::NodeId;
3571 }
3572 ///State transition - sets the `user` field to Set
3573 pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>);
3574 impl<S: State> sealed::Sealed for SetUser<S> {}
3575 impl<S: State> State for SetUser<S> {
3576 type Uri = S::Uri;
3577 type User = Set<members::user>;
3578 type Resource = S::Resource;
3579 type CreatedAt = S::CreatedAt;
3580 type NodeId = S::NodeId;
3581 }
3582 ///State transition - sets the `resource` field to Set
3583 pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>);
3584 impl<S: State> sealed::Sealed for SetResource<S> {}
3585 impl<S: State> State for SetResource<S> {
3586 type Uri = S::Uri;
3587 type User = S::User;
3588 type Resource = Set<members::resource>;
3589 type CreatedAt = S::CreatedAt;
3590 type NodeId = S::NodeId;
3591 }
3592 ///State transition - sets the `created_at` field to Set
3593 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
3594 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
3595 impl<S: State> State for SetCreatedAt<S> {
3596 type Uri = S::Uri;
3597 type User = S::User;
3598 type Resource = S::Resource;
3599 type CreatedAt = Set<members::created_at>;
3600 type NodeId = S::NodeId;
3601 }
3602 ///State transition - sets the `node_id` field to Set
3603 pub struct SetNodeId<S: State = Empty>(PhantomData<fn() -> S>);
3604 impl<S: State> sealed::Sealed for SetNodeId<S> {}
3605 impl<S: State> State for SetNodeId<S> {
3606 type Uri = S::Uri;
3607 type User = S::User;
3608 type Resource = S::Resource;
3609 type CreatedAt = S::CreatedAt;
3610 type NodeId = Set<members::node_id>;
3611 }
3612 /// Marker types for field names
3613 #[allow(non_camel_case_types)]
3614 pub mod members {
3615 ///Marker type for the `uri` field
3616 pub struct uri(());
3617 ///Marker type for the `user` field
3618 pub struct user(());
3619 ///Marker type for the `resource` field
3620 pub struct resource(());
3621 ///Marker type for the `created_at` field
3622 pub struct created_at(());
3623 ///Marker type for the `node_id` field
3624 pub struct node_id(());
3625 }
3626}
3627
3628/// Builder for constructing an instance of this type
3629pub struct SessionViewBuilder<'a, S: session_view_state::State> {
3630 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
3631 __unsafe_private_named: (
3632 ::core::option::Option<jacquard_common::types::string::Datetime>,
3633 ::core::option::Option<jacquard_common::types::string::Datetime>,
3634 ::core::option::Option<jacquard_common::CowStr<'a>>,
3635 ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
3636 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
3637 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
3638 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
3639 ),
3640 _phantom: ::core::marker::PhantomData<&'a ()>,
3641}
3642
3643impl<'a> SessionView<'a> {
3644 /// Create a new builder for this type
3645 pub fn new() -> SessionViewBuilder<'a, session_view_state::Empty> {
3646 SessionViewBuilder::new()
3647 }
3648}
3649
3650impl<'a> SessionViewBuilder<'a, session_view_state::Empty> {
3651 /// Create a new builder with all fields unset
3652 pub fn new() -> Self {
3653 SessionViewBuilder {
3654 _phantom_state: ::core::marker::PhantomData,
3655 __unsafe_private_named: (None, None, None, None, None, None, None),
3656 _phantom: ::core::marker::PhantomData,
3657 }
3658 }
3659}
3660
3661impl<'a, S> SessionViewBuilder<'a, S>
3662where
3663 S: session_view_state::State,
3664 S::CreatedAt: session_view_state::IsUnset,
3665{
3666 /// Set the `createdAt` field (required)
3667 pub fn created_at(
3668 mut self,
3669 value: impl Into<jacquard_common::types::string::Datetime>,
3670 ) -> SessionViewBuilder<'a, session_view_state::SetCreatedAt<S>> {
3671 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
3672 SessionViewBuilder {
3673 _phantom_state: ::core::marker::PhantomData,
3674 __unsafe_private_named: self.__unsafe_private_named,
3675 _phantom: ::core::marker::PhantomData,
3676 }
3677 }
3678}
3679
3680impl<'a, S: session_view_state::State> SessionViewBuilder<'a, S> {
3681 /// Set the `expiresAt` field (optional)
3682 pub fn expires_at(
3683 mut self,
3684 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
3685 ) -> Self {
3686 self.__unsafe_private_named.1 = value.into();
3687 self
3688 }
3689 /// Set the `expiresAt` field to an Option value (optional)
3690 pub fn maybe_expires_at(
3691 mut self,
3692 value: Option<jacquard_common::types::string::Datetime>,
3693 ) -> Self {
3694 self.__unsafe_private_named.1 = value;
3695 self
3696 }
3697}
3698
3699impl<'a, S> SessionViewBuilder<'a, S>
3700where
3701 S: session_view_state::State,
3702 S::NodeId: session_view_state::IsUnset,
3703{
3704 /// Set the `nodeId` field (required)
3705 pub fn node_id(
3706 mut self,
3707 value: impl Into<jacquard_common::CowStr<'a>>,
3708 ) -> SessionViewBuilder<'a, session_view_state::SetNodeId<S>> {
3709 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
3710 SessionViewBuilder {
3711 _phantom_state: ::core::marker::PhantomData,
3712 __unsafe_private_named: self.__unsafe_private_named,
3713 _phantom: ::core::marker::PhantomData,
3714 }
3715 }
3716}
3717
3718impl<'a, S: session_view_state::State> SessionViewBuilder<'a, S> {
3719 /// Set the `relayUrl` field (optional)
3720 pub fn relay_url(
3721 mut self,
3722 value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>,
3723 ) -> Self {
3724 self.__unsafe_private_named.3 = value.into();
3725 self
3726 }
3727 /// Set the `relayUrl` field to an Option value (optional)
3728 pub fn maybe_relay_url(
3729 mut self,
3730 value: Option<jacquard_common::types::string::Uri<'a>>,
3731 ) -> Self {
3732 self.__unsafe_private_named.3 = value;
3733 self
3734 }
3735}
3736
3737impl<'a, S> SessionViewBuilder<'a, S>
3738where
3739 S: session_view_state::State,
3740 S::Resource: session_view_state::IsUnset,
3741{
3742 /// Set the `resource` field (required)
3743 pub fn resource(
3744 mut self,
3745 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
3746 ) -> SessionViewBuilder<'a, session_view_state::SetResource<S>> {
3747 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
3748 SessionViewBuilder {
3749 _phantom_state: ::core::marker::PhantomData,
3750 __unsafe_private_named: self.__unsafe_private_named,
3751 _phantom: ::core::marker::PhantomData,
3752 }
3753 }
3754}
3755
3756impl<'a, S> SessionViewBuilder<'a, S>
3757where
3758 S: session_view_state::State,
3759 S::Uri: session_view_state::IsUnset,
3760{
3761 /// Set the `uri` field (required)
3762 pub fn uri(
3763 mut self,
3764 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
3765 ) -> SessionViewBuilder<'a, session_view_state::SetUri<S>> {
3766 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
3767 SessionViewBuilder {
3768 _phantom_state: ::core::marker::PhantomData,
3769 __unsafe_private_named: self.__unsafe_private_named,
3770 _phantom: ::core::marker::PhantomData,
3771 }
3772 }
3773}
3774
3775impl<'a, S> SessionViewBuilder<'a, S>
3776where
3777 S: session_view_state::State,
3778 S::User: session_view_state::IsUnset,
3779{
3780 /// Set the `user` field (required)
3781 pub fn user(
3782 mut self,
3783 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>,
3784 ) -> SessionViewBuilder<'a, session_view_state::SetUser<S>> {
3785 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
3786 SessionViewBuilder {
3787 _phantom_state: ::core::marker::PhantomData,
3788 __unsafe_private_named: self.__unsafe_private_named,
3789 _phantom: ::core::marker::PhantomData,
3790 }
3791 }
3792}
3793
3794impl<'a, S> SessionViewBuilder<'a, S>
3795where
3796 S: session_view_state::State,
3797 S::Uri: session_view_state::IsSet,
3798 S::User: session_view_state::IsSet,
3799 S::Resource: session_view_state::IsSet,
3800 S::CreatedAt: session_view_state::IsSet,
3801 S::NodeId: session_view_state::IsSet,
3802{
3803 /// Build the final struct
3804 pub fn build(self) -> SessionView<'a> {
3805 SessionView {
3806 created_at: self.__unsafe_private_named.0.unwrap(),
3807 expires_at: self.__unsafe_private_named.1,
3808 node_id: self.__unsafe_private_named.2.unwrap(),
3809 relay_url: self.__unsafe_private_named.3,
3810 resource: self.__unsafe_private_named.4.unwrap(),
3811 uri: self.__unsafe_private_named.5.unwrap(),
3812 user: self.__unsafe_private_named.6.unwrap(),
3813 extra_data: Default::default(),
3814 }
3815 }
3816 /// Build the final struct with custom extra_data
3817 pub fn build_with_data(
3818 self,
3819 extra_data: std::collections::BTreeMap<
3820 jacquard_common::smol_str::SmolStr,
3821 jacquard_common::types::value::Data<'a>,
3822 >,
3823 ) -> SessionView<'a> {
3824 SessionView {
3825 created_at: self.__unsafe_private_named.0.unwrap(),
3826 expires_at: self.__unsafe_private_named.1,
3827 node_id: self.__unsafe_private_named.2.unwrap(),
3828 relay_url: self.__unsafe_private_named.3,
3829 resource: self.__unsafe_private_named.4.unwrap(),
3830 uri: self.__unsafe_private_named.5.unwrap(),
3831 user: self.__unsafe_private_named.6.unwrap(),
3832 extra_data: Some(extra_data),
3833 }
3834 }
3835}
3836
3837impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SessionView<'a> {
3838 fn nsid() -> &'static str {
3839 "sh.weaver.collab.defs"
3840 }
3841 fn def_name() -> &'static str {
3842 "sessionView"
3843 }
3844 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
3845 lexicon_doc_sh_weaver_collab_defs()
3846 }
3847 fn validate(
3848 &self,
3849 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
3850 Ok(())
3851 }
3852}