// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.collab.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod accept; pub mod get_collaboration_state; pub mod get_invites; pub mod get_resource_participants; pub mod get_resource_sessions; pub mod invite; pub mod session; /// Collaboration scoped to a chapter. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Hash, jacquard_derive::IntoStatic )] pub struct Chapter; impl std::fmt::Display for Chapter { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "chapter") } } /// Full state of a collaboration relationship including version reconciliation. Tracks both current and former collaborators. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CollaborationStateView<'a> { /// The 'canonical' version URI (usually owner's) #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub canonical_uri: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub created_at: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub first_collaborator_added_at: std::option::Option< jacquard_common::types::string::Datetime, >, /// People who used to collaborate but relationship ended #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub former_participants: std::option::Option< Vec>, >, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub has_divergence: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub has_former_collaborators: std::option::Option, /// Published versions from former collaborators still exist #[serde(skip_serializing_if = "std::option::Option::is_none")] pub has_orphaned_versions: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub last_synced_at: std::option::Option, /// Current active + invited participants #[serde(borrow)] pub participants: Vec>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub published_versions: std::option::Option< Vec>, >, #[serde(borrow)] pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>, /// active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved #[serde(borrow)] pub status: CollaborationStateViewStatus<'a>, } pub mod collaboration_state_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Resource; type Participants; type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Resource = Unset; type Participants = Unset; type Status = Unset; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { type Resource = Set; type Participants = S::Participants; type Status = S::Status; } ///State transition - sets the `participants` field to Set pub struct SetParticipants(PhantomData S>); impl sealed::Sealed for SetParticipants {} impl State for SetParticipants { type Resource = S::Resource; type Participants = Set; type Status = S::Status; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { type Resource = S::Resource; type Participants = S::Participants; type Status = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `participants` field pub struct participants(()); ///Marker type for the `status` field pub struct status(()); } } /// Builder for constructing an instance of this type pub struct CollaborationStateViewBuilder<'a, S: collaboration_state_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option, ::core::option::Option< Vec>, >, ::core::option::Option, ::core::option::Option, ::core::option::Option, ::core::option::Option, ::core::option::Option>>, ::core::option::Option< Vec>, >, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> CollaborationStateView<'a> { /// Create a new builder for this type pub fn new() -> CollaborationStateViewBuilder< 'a, collaboration_state_view_state::Empty, > { CollaborationStateViewBuilder::new() } } impl<'a> CollaborationStateViewBuilder<'a, collaboration_state_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CollaborationStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `canonicalUri` field (optional) pub fn canonical_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `canonicalUri` field to an Option value (optional) pub fn maybe_canonical_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `createdAt` field (optional) pub fn created_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `createdAt` field to an Option value (optional) pub fn maybe_created_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `firstCollaboratorAddedAt` field (optional) pub fn first_collaborator_added_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `firstCollaboratorAddedAt` field to an Option value (optional) pub fn maybe_first_collaborator_added_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `formerParticipants` field (optional) pub fn former_participants( mut self, value: impl Into< Option>>, >, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `formerParticipants` field to an Option value (optional) pub fn maybe_former_participants( mut self, value: Option>>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `hasDivergence` field (optional) pub fn has_divergence(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `hasDivergence` field to an Option value (optional) pub fn maybe_has_divergence(mut self, value: Option) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `hasFormerCollaborators` field (optional) pub fn has_former_collaborators(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.5 = value.into(); self } /// Set the `hasFormerCollaborators` field to an Option value (optional) pub fn maybe_has_former_collaborators(mut self, value: Option) -> Self { self.__unsafe_private_named.5 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `hasOrphanedVersions` field (optional) pub fn has_orphaned_versions(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `hasOrphanedVersions` field to an Option value (optional) pub fn maybe_has_orphaned_versions(mut self, value: Option) -> Self { self.__unsafe_private_named.6 = value; self } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `lastSyncedAt` field (optional) pub fn last_synced_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.7 = value.into(); self } /// Set the `lastSyncedAt` field to an Option value (optional) pub fn maybe_last_synced_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.7 = value; self } } impl<'a, S> CollaborationStateViewBuilder<'a, S> where S: collaboration_state_view_state::State, S::Participants: collaboration_state_view_state::IsUnset, { /// Set the `participants` field (required) pub fn participants( mut self, value: impl Into>>, ) -> CollaborationStateViewBuilder< 'a, collaboration_state_view_state::SetParticipants, > { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); CollaborationStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: collaboration_state_view_state::State> CollaborationStateViewBuilder<'a, S> { /// Set the `publishedVersions` field (optional) pub fn published_versions( mut self, value: impl Into< Option>>, >, ) -> Self { self.__unsafe_private_named.9 = value.into(); self } /// Set the `publishedVersions` field to an Option value (optional) pub fn maybe_published_versions( mut self, value: Option>>, ) -> Self { self.__unsafe_private_named.9 = value; self } } impl<'a, S> CollaborationStateViewBuilder<'a, S> where S: collaboration_state_view_state::State, S::Resource: collaboration_state_view_state::IsUnset, { /// Set the `resource` field (required) pub fn resource( mut self, value: impl Into>, ) -> CollaborationStateViewBuilder< 'a, collaboration_state_view_state::SetResource, > { self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into()); CollaborationStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CollaborationStateViewBuilder<'a, S> where S: collaboration_state_view_state::State, S::Status: collaboration_state_view_state::IsUnset, { /// Set the `status` field (required) pub fn status( mut self, value: impl Into>, ) -> CollaborationStateViewBuilder< 'a, collaboration_state_view_state::SetStatus, > { self.__unsafe_private_named.11 = ::core::option::Option::Some(value.into()); CollaborationStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CollaborationStateViewBuilder<'a, S> where S: collaboration_state_view_state::State, S::Resource: collaboration_state_view_state::IsSet, S::Participants: collaboration_state_view_state::IsSet, S::Status: collaboration_state_view_state::IsSet, { /// Build the final struct pub fn build(self) -> CollaborationStateView<'a> { CollaborationStateView { canonical_uri: self.__unsafe_private_named.0, created_at: self.__unsafe_private_named.1, first_collaborator_added_at: self.__unsafe_private_named.2, former_participants: self.__unsafe_private_named.3, has_divergence: self.__unsafe_private_named.4, has_former_collaborators: self.__unsafe_private_named.5, has_orphaned_versions: self.__unsafe_private_named.6, last_synced_at: self.__unsafe_private_named.7, participants: self.__unsafe_private_named.8.unwrap(), published_versions: self.__unsafe_private_named.9, resource: self.__unsafe_private_named.10.unwrap(), status: self.__unsafe_private_named.11.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> CollaborationStateView<'a> { CollaborationStateView { canonical_uri: self.__unsafe_private_named.0, created_at: self.__unsafe_private_named.1, first_collaborator_added_at: self.__unsafe_private_named.2, former_participants: self.__unsafe_private_named.3, has_divergence: self.__unsafe_private_named.4, has_former_collaborators: self.__unsafe_private_named.5, has_orphaned_versions: self.__unsafe_private_named.6, last_synced_at: self.__unsafe_private_named.7, participants: self.__unsafe_private_named.8.unwrap(), published_versions: self.__unsafe_private_named.9, resource: self.__unsafe_private_named.10.unwrap(), status: self.__unsafe_private_named.11.unwrap(), extra_data: Some(extra_data), } } } /// active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum CollaborationStateViewStatus<'a> { Active, Broken, Diverged, Reconciled, Other(jacquard_common::CowStr<'a>), } impl<'a> CollaborationStateViewStatus<'a> { pub fn as_str(&self) -> &str { match self { Self::Active => "active", Self::Broken => "broken", Self::Diverged => "diverged", Self::Reconciled => "reconciled", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for CollaborationStateViewStatus<'a> { fn from(s: &'a str) -> Self { match s { "active" => Self::Active, "broken" => Self::Broken, "diverged" => Self::Diverged, "reconciled" => Self::Reconciled, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for CollaborationStateViewStatus<'a> { fn from(s: String) -> Self { match s.as_str() { "active" => Self::Active, "broken" => Self::Broken, "diverged" => Self::Diverged, "reconciled" => Self::Reconciled, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for CollaborationStateViewStatus<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for CollaborationStateViewStatus<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for CollaborationStateViewStatus<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for CollaborationStateViewStatus<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for CollaborationStateViewStatus<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for CollaborationStateViewStatus<'_> { type Output = CollaborationStateViewStatus<'static>; fn into_static(self) -> Self::Output { match self { CollaborationStateViewStatus::Active => CollaborationStateViewStatus::Active, CollaborationStateViewStatus::Broken => CollaborationStateViewStatus::Broken, CollaborationStateViewStatus::Diverged => { CollaborationStateViewStatus::Diverged } CollaborationStateViewStatus::Reconciled => { CollaborationStateViewStatus::Reconciled } CollaborationStateViewStatus::Other(v) => { CollaborationStateViewStatus::Other(v.into_static()) } } } } fn lexicon_doc_sh_weaver_collab_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("sh.weaver.collab.defs"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("chapter"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "collaborationStateView", ), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Full state of a collaboration relationship including version reconciliation. Tracks both current and former collaborators.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("resource"), ::jacquard_common::smol_str::SmolStr::new_static("status"), ::jacquard_common::smol_str::SmolStr::new_static("participants") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "canonicalUri", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "The 'canonical' version URI (usually owner's)", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "firstCollaboratorAddedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "formerParticipants", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "People who used to collaborate but relationship ended", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "#formerCollaboratorView", ), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "hasDivergence", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "hasFormerCollaborators", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "hasOrphanedVersions", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "lastSyncedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "participants", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "Current active + invited participants", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "#participantStateView", ), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "publishedVersions", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.notebook.defs#publishedVersionView", ), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("resource"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.repo.strongRef", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("status"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "formerCollaboratorView", ), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Lightweight view for 'this person used to collaborate but doesn't anymore'.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("user"), ::jacquard_common::smol_str::SmolStr::new_static("wasActiveFrom"), ::jacquard_common::smol_str::SmolStr::new_static("wasActiveUntil"), ::jacquard_common::smol_str::SmolStr::new_static("endReason") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "contributionCount", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "endReason", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "hasPublishedVersion", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "publishedVersionUri", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("user"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.actor.defs#profileViewBasic", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "wasActiveFrom", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "wasActiveUntil", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("inviteView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Hydrated view of a collaboration invite with status.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_common::smol_str::SmolStr::new_static("inviter"), ::jacquard_common::smol_str::SmolStr::new_static("invitee"), ::jacquard_common::smol_str::SmolStr::new_static("resource"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt"), ::jacquard_common::smol_str::SmolStr::new_static("status") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptUri", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Cid, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "expiresAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("invitee"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.actor.defs#profileViewBasic", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("inviter"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.actor.defs#profileViewBasic", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("message"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("resource"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.repo.strongRef", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "resourceTitle", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("scope"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("status"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("notebook"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("participantStateView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Individual participant's state in a collaboration. Distinguishes 'was collaborator' vs 'never was'.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("user"), ::jacquard_common::smol_str::SmolStr::new_static("role"), ::jacquard_common::smol_str::SmolStr::new_static("status") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acceptUri", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "If they accepted (even if later broken)", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "endReason", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Why the relationship ended, if applicable", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "firstEditAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "When they first contributed", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "inviteUri", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "lastEditAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "publishedVersion", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.repo.strongRef", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "relationshipEndedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "When left/removed/expired", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("role"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("status"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("user"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.actor.defs#profileViewBasic", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "wasCollaborator", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("sessionView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Active real-time collaboration session.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_common::smol_str::SmolStr::new_static("user"), ::jacquard_common::smol_str::SmolStr::new_static("resource"), ::jacquard_common::smol_str::SmolStr::new_static("nodeId"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "expiresAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("nodeId"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("relayUrl"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Uri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("resource"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.repo.strongRef", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("user"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "sh.weaver.actor.defs#profileViewBasic", ), }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CollaborationStateView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" } fn def_name() -> &'static str { "collaborationStateView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_collab_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Collaboration scoped to a single entry. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Hash, jacquard_derive::IntoStatic )] pub struct Entry; impl std::fmt::Display for Entry { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "entry") } } /// Lightweight view for 'this person used to collaborate but doesn't anymore'. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct FormerCollaboratorView<'a> { /// Number of diffs they created while active #[serde(skip_serializing_if = "std::option::Option::is_none")] pub contribution_count: std::option::Option, #[serde(borrow)] pub end_reason: FormerCollaboratorViewEndReason<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub has_published_version: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub published_version_uri: std::option::Option< jacquard_common::types::string::AtUri<'a>, >, #[serde(borrow)] pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>, pub was_active_from: jacquard_common::types::string::Datetime, pub was_active_until: jacquard_common::types::string::Datetime, } pub mod former_collaborator_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type EndReason; type WasActiveUntil; type User; type WasActiveFrom; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type EndReason = Unset; type WasActiveUntil = Unset; type User = Unset; type WasActiveFrom = Unset; } ///State transition - sets the `end_reason` field to Set pub struct SetEndReason(PhantomData S>); impl sealed::Sealed for SetEndReason {} impl State for SetEndReason { type EndReason = Set; type WasActiveUntil = S::WasActiveUntil; type User = S::User; type WasActiveFrom = S::WasActiveFrom; } ///State transition - sets the `was_active_until` field to Set pub struct SetWasActiveUntil(PhantomData S>); impl sealed::Sealed for SetWasActiveUntil {} impl State for SetWasActiveUntil { type EndReason = S::EndReason; type WasActiveUntil = Set; type User = S::User; type WasActiveFrom = S::WasActiveFrom; } ///State transition - sets the `user` field to Set pub struct SetUser(PhantomData S>); impl sealed::Sealed for SetUser {} impl State for SetUser { type EndReason = S::EndReason; type WasActiveUntil = S::WasActiveUntil; type User = Set; type WasActiveFrom = S::WasActiveFrom; } ///State transition - sets the `was_active_from` field to Set pub struct SetWasActiveFrom(PhantomData S>); impl sealed::Sealed for SetWasActiveFrom {} impl State for SetWasActiveFrom { type EndReason = S::EndReason; type WasActiveUntil = S::WasActiveUntil; type User = S::User; type WasActiveFrom = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `end_reason` field pub struct end_reason(()); ///Marker type for the `was_active_until` field pub struct was_active_until(()); ///Marker type for the `user` field pub struct user(()); ///Marker type for the `was_active_from` field pub struct was_active_from(()); } } /// Builder for constructing an instance of this type pub struct FormerCollaboratorViewBuilder<'a, S: former_collaborator_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> FormerCollaboratorView<'a> { /// Create a new builder for this type pub fn new() -> FormerCollaboratorViewBuilder< 'a, former_collaborator_view_state::Empty, > { FormerCollaboratorViewBuilder::new() } } impl<'a> FormerCollaboratorViewBuilder<'a, former_collaborator_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { FormerCollaboratorViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: former_collaborator_view_state::State> FormerCollaboratorViewBuilder<'a, S> { /// Set the `contributionCount` field (optional) pub fn contribution_count(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `contributionCount` field to an Option value (optional) pub fn maybe_contribution_count(mut self, value: Option) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> FormerCollaboratorViewBuilder<'a, S> where S: former_collaborator_view_state::State, S::EndReason: former_collaborator_view_state::IsUnset, { /// Set the `endReason` field (required) pub fn end_reason( mut self, value: impl Into>, ) -> FormerCollaboratorViewBuilder< 'a, former_collaborator_view_state::SetEndReason, > { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); FormerCollaboratorViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: former_collaborator_view_state::State> FormerCollaboratorViewBuilder<'a, S> { /// Set the `hasPublishedVersion` field (optional) pub fn has_published_version(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `hasPublishedVersion` field to an Option value (optional) pub fn maybe_has_published_version(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: former_collaborator_view_state::State> FormerCollaboratorViewBuilder<'a, S> { /// Set the `publishedVersionUri` field (optional) pub fn published_version_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `publishedVersionUri` field to an Option value (optional) pub fn maybe_published_version_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S> FormerCollaboratorViewBuilder<'a, S> where S: former_collaborator_view_state::State, S::User: former_collaborator_view_state::IsUnset, { /// Set the `user` field (required) pub fn user( mut self, value: impl Into>, ) -> FormerCollaboratorViewBuilder<'a, former_collaborator_view_state::SetUser> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); FormerCollaboratorViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FormerCollaboratorViewBuilder<'a, S> where S: former_collaborator_view_state::State, S::WasActiveFrom: former_collaborator_view_state::IsUnset, { /// Set the `wasActiveFrom` field (required) pub fn was_active_from( mut self, value: impl Into, ) -> FormerCollaboratorViewBuilder< 'a, former_collaborator_view_state::SetWasActiveFrom, > { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); FormerCollaboratorViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FormerCollaboratorViewBuilder<'a, S> where S: former_collaborator_view_state::State, S::WasActiveUntil: former_collaborator_view_state::IsUnset, { /// Set the `wasActiveUntil` field (required) pub fn was_active_until( mut self, value: impl Into, ) -> FormerCollaboratorViewBuilder< 'a, former_collaborator_view_state::SetWasActiveUntil, > { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); FormerCollaboratorViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FormerCollaboratorViewBuilder<'a, S> where S: former_collaborator_view_state::State, S::EndReason: former_collaborator_view_state::IsSet, S::WasActiveUntil: former_collaborator_view_state::IsSet, S::User: former_collaborator_view_state::IsSet, S::WasActiveFrom: former_collaborator_view_state::IsSet, { /// Build the final struct pub fn build(self) -> FormerCollaboratorView<'a> { FormerCollaboratorView { contribution_count: self.__unsafe_private_named.0, end_reason: self.__unsafe_private_named.1.unwrap(), has_published_version: self.__unsafe_private_named.2, published_version_uri: self.__unsafe_private_named.3, user: self.__unsafe_private_named.4.unwrap(), was_active_from: self.__unsafe_private_named.5.unwrap(), was_active_until: self.__unsafe_private_named.6.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> FormerCollaboratorView<'a> { FormerCollaboratorView { contribution_count: self.__unsafe_private_named.0, end_reason: self.__unsafe_private_named.1.unwrap(), has_published_version: self.__unsafe_private_named.2, published_version_uri: self.__unsafe_private_named.3, user: self.__unsafe_private_named.4.unwrap(), was_active_from: self.__unsafe_private_named.5.unwrap(), was_active_until: self.__unsafe_private_named.6.unwrap(), extra_data: Some(extra_data), } } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum FormerCollaboratorViewEndReason<'a> { VoluntaryLeave, InviteRevoked, InviteExpired, OwnerDeletedResource, Other(jacquard_common::CowStr<'a>), } impl<'a> FormerCollaboratorViewEndReason<'a> { pub fn as_str(&self) -> &str { match self { Self::VoluntaryLeave => "voluntary_leave", Self::InviteRevoked => "invite_revoked", Self::InviteExpired => "invite_expired", Self::OwnerDeletedResource => "owner_deleted_resource", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for FormerCollaboratorViewEndReason<'a> { fn from(s: &'a str) -> Self { match s { "voluntary_leave" => Self::VoluntaryLeave, "invite_revoked" => Self::InviteRevoked, "invite_expired" => Self::InviteExpired, "owner_deleted_resource" => Self::OwnerDeletedResource, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for FormerCollaboratorViewEndReason<'a> { fn from(s: String) -> Self { match s.as_str() { "voluntary_leave" => Self::VoluntaryLeave, "invite_revoked" => Self::InviteRevoked, "invite_expired" => Self::InviteExpired, "owner_deleted_resource" => Self::OwnerDeletedResource, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for FormerCollaboratorViewEndReason<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for FormerCollaboratorViewEndReason<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for FormerCollaboratorViewEndReason<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for FormerCollaboratorViewEndReason<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for FormerCollaboratorViewEndReason<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for FormerCollaboratorViewEndReason<'_> { type Output = FormerCollaboratorViewEndReason<'static>; fn into_static(self) -> Self::Output { match self { FormerCollaboratorViewEndReason::VoluntaryLeave => { FormerCollaboratorViewEndReason::VoluntaryLeave } FormerCollaboratorViewEndReason::InviteRevoked => { FormerCollaboratorViewEndReason::InviteRevoked } FormerCollaboratorViewEndReason::InviteExpired => { FormerCollaboratorViewEndReason::InviteExpired } FormerCollaboratorViewEndReason::OwnerDeletedResource => { FormerCollaboratorViewEndReason::OwnerDeletedResource } FormerCollaboratorViewEndReason::Other(v) => { FormerCollaboratorViewEndReason::Other(v.into_static()) } } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FormerCollaboratorView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" } fn def_name() -> &'static str { "formerCollaboratorView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_collab_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Hydrated view of a collaboration invite with status. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct InviteView<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub accept_uri: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub accepted_at: std::option::Option, #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, pub created_at: jacquard_common::types::string::Datetime, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub expires_at: std::option::Option, #[serde(borrow)] pub invitee: crate::sh_weaver::actor::ProfileViewBasic<'a>, #[serde(borrow)] pub inviter: crate::sh_weaver::actor::ProfileViewBasic<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub message: std::option::Option>, #[serde(borrow)] pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub resource_title: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub scope: std::option::Option>, #[serde(borrow)] pub status: InviteViewStatus<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, } pub mod invite_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Resource; type CreatedAt; type Status; type Invitee; type Uri; type Cid; type Inviter; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Resource = Unset; type CreatedAt = Unset; type Status = Unset; type Invitee = Unset; type Uri = Unset; type Cid = Unset; type Inviter = Unset; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { type Resource = Set; type CreatedAt = S::CreatedAt; type Status = S::Status; type Invitee = S::Invitee; type Uri = S::Uri; type Cid = S::Cid; type Inviter = S::Inviter; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Resource = S::Resource; type CreatedAt = Set; type Status = S::Status; type Invitee = S::Invitee; type Uri = S::Uri; type Cid = S::Cid; type Inviter = S::Inviter; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { type Resource = S::Resource; type CreatedAt = S::CreatedAt; type Status = Set; type Invitee = S::Invitee; type Uri = S::Uri; type Cid = S::Cid; type Inviter = S::Inviter; } ///State transition - sets the `invitee` field to Set pub struct SetInvitee(PhantomData S>); impl sealed::Sealed for SetInvitee {} impl State for SetInvitee { type Resource = S::Resource; type CreatedAt = S::CreatedAt; type Status = S::Status; type Invitee = Set; type Uri = S::Uri; type Cid = S::Cid; type Inviter = S::Inviter; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Resource = S::Resource; type CreatedAt = S::CreatedAt; type Status = S::Status; type Invitee = S::Invitee; type Uri = Set; type Cid = S::Cid; type Inviter = S::Inviter; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { type Resource = S::Resource; type CreatedAt = S::CreatedAt; type Status = S::Status; type Invitee = S::Invitee; type Uri = S::Uri; type Cid = Set; type Inviter = S::Inviter; } ///State transition - sets the `inviter` field to Set pub struct SetInviter(PhantomData S>); impl sealed::Sealed for SetInviter {} impl State for SetInviter { type Resource = S::Resource; type CreatedAt = S::CreatedAt; type Status = S::Status; type Invitee = S::Invitee; type Uri = S::Uri; type Cid = S::Cid; type Inviter = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `status` field pub struct status(()); ///Marker type for the `invitee` field pub struct invitee(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `inviter` field pub struct inviter(()); } } /// Builder for constructing an instance of this type pub struct InviteViewBuilder<'a, S: invite_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> InviteView<'a> { /// Create a new builder for this type pub fn new() -> InviteViewBuilder<'a, invite_view_state::Empty> { InviteViewBuilder::new() } } impl<'a> InviteViewBuilder<'a, invite_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `acceptUri` field (optional) pub fn accept_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `acceptUri` field to an Option value (optional) pub fn maybe_accept_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `acceptedAt` field (optional) pub fn accepted_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `acceptedAt` field to an Option value (optional) pub fn maybe_accepted_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Cid: invite_view_state::IsUnset, { /// Set the `cid` field (required) pub fn cid( mut self, value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetCid> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::CreatedAt: invite_view_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> InviteViewBuilder<'a, invite_view_state::SetCreatedAt> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `expiresAt` field (optional) pub fn expires_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `expiresAt` field to an Option value (optional) pub fn maybe_expires_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Invitee: invite_view_state::IsUnset, { /// Set the `invitee` field (required) pub fn invitee( mut self, value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetInvitee> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Inviter: invite_view_state::IsUnset, { /// Set the `inviter` field (required) pub fn inviter( mut self, value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetInviter> { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `message` field (optional) pub fn message( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.7 = value.into(); self } /// Set the `message` field to an Option value (optional) pub fn maybe_message(mut self, value: Option>) -> Self { self.__unsafe_private_named.7 = value; self } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Resource: invite_view_state::IsUnset, { /// Set the `resource` field (required) pub fn resource( mut self, value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetResource> { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `resourceTitle` field (optional) pub fn resource_title( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.9 = value.into(); self } /// Set the `resourceTitle` field to an Option value (optional) pub fn maybe_resource_title( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.9 = value; self } } impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { /// Set the `scope` field (optional) pub fn scope(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.10 = value.into(); self } /// Set the `scope` field to an Option value (optional) pub fn maybe_scope(mut self, value: Option>) -> Self { self.__unsafe_private_named.10 = value; self } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Status: invite_view_state::IsUnset, { /// Set the `status` field (required) pub fn status( mut self, value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetStatus> { self.__unsafe_private_named.11 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Uri: invite_view_state::IsUnset, { /// Set the `uri` field (required) pub fn uri( mut self, value: impl Into>, ) -> InviteViewBuilder<'a, invite_view_state::SetUri> { self.__unsafe_private_named.12 = ::core::option::Option::Some(value.into()); InviteViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, S::Resource: invite_view_state::IsSet, S::CreatedAt: invite_view_state::IsSet, S::Status: invite_view_state::IsSet, S::Invitee: invite_view_state::IsSet, S::Uri: invite_view_state::IsSet, S::Cid: invite_view_state::IsSet, S::Inviter: invite_view_state::IsSet, { /// Build the final struct pub fn build(self) -> InviteView<'a> { InviteView { accept_uri: self.__unsafe_private_named.0, accepted_at: self.__unsafe_private_named.1, cid: self.__unsafe_private_named.2.unwrap(), created_at: self.__unsafe_private_named.3.unwrap(), expires_at: self.__unsafe_private_named.4, invitee: self.__unsafe_private_named.5.unwrap(), inviter: self.__unsafe_private_named.6.unwrap(), message: self.__unsafe_private_named.7, resource: self.__unsafe_private_named.8.unwrap(), resource_title: self.__unsafe_private_named.9, scope: self.__unsafe_private_named.10, status: self.__unsafe_private_named.11.unwrap(), uri: self.__unsafe_private_named.12.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> InviteView<'a> { InviteView { accept_uri: self.__unsafe_private_named.0, accepted_at: self.__unsafe_private_named.1, cid: self.__unsafe_private_named.2.unwrap(), created_at: self.__unsafe_private_named.3.unwrap(), expires_at: self.__unsafe_private_named.4, invitee: self.__unsafe_private_named.5.unwrap(), inviter: self.__unsafe_private_named.6.unwrap(), message: self.__unsafe_private_named.7, resource: self.__unsafe_private_named.8.unwrap(), resource_title: self.__unsafe_private_named.9, scope: self.__unsafe_private_named.10, status: self.__unsafe_private_named.11.unwrap(), uri: self.__unsafe_private_named.12.unwrap(), extra_data: Some(extra_data), } } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum InviteViewScope<'a> { Notebook, Entry, Chapter, Other(jacquard_common::CowStr<'a>), } impl<'a> InviteViewScope<'a> { pub fn as_str(&self) -> &str { match self { Self::Notebook => "notebook", Self::Entry => "entry", Self::Chapter => "chapter", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for InviteViewScope<'a> { fn from(s: &'a str) -> Self { match s { "notebook" => Self::Notebook, "entry" => Self::Entry, "chapter" => Self::Chapter, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for InviteViewScope<'a> { fn from(s: String) -> Self { match s.as_str() { "notebook" => Self::Notebook, "entry" => Self::Entry, "chapter" => Self::Chapter, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for InviteViewScope<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for InviteViewScope<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for InviteViewScope<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for InviteViewScope<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for InviteViewScope<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for InviteViewScope<'_> { type Output = InviteViewScope<'static>; fn into_static(self) -> Self::Output { match self { InviteViewScope::Notebook => InviteViewScope::Notebook, InviteViewScope::Entry => InviteViewScope::Entry, InviteViewScope::Chapter => InviteViewScope::Chapter, InviteViewScope::Other(v) => InviteViewScope::Other(v.into_static()), } } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum InviteViewStatus<'a> { Pending, Accepted, Expired, Revoked, Other(jacquard_common::CowStr<'a>), } impl<'a> InviteViewStatus<'a> { pub fn as_str(&self) -> &str { match self { Self::Pending => "pending", Self::Accepted => "accepted", Self::Expired => "expired", Self::Revoked => "revoked", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for InviteViewStatus<'a> { fn from(s: &'a str) -> Self { match s { "pending" => Self::Pending, "accepted" => Self::Accepted, "expired" => Self::Expired, "revoked" => Self::Revoked, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for InviteViewStatus<'a> { fn from(s: String) -> Self { match s.as_str() { "pending" => Self::Pending, "accepted" => Self::Accepted, "expired" => Self::Expired, "revoked" => Self::Revoked, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for InviteViewStatus<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for InviteViewStatus<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for InviteViewStatus<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for InviteViewStatus<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for InviteViewStatus<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for InviteViewStatus<'_> { type Output = InviteViewStatus<'static>; fn into_static(self) -> Self::Output { match self { InviteViewStatus::Pending => InviteViewStatus::Pending, InviteViewStatus::Accepted => InviteViewStatus::Accepted, InviteViewStatus::Expired => InviteViewStatus::Expired, InviteViewStatus::Revoked => InviteViewStatus::Revoked, InviteViewStatus::Other(v) => InviteViewStatus::Other(v.into_static()), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InviteView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" } fn def_name() -> &'static str { "inviteView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_collab_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Collaboration scoped to an entire notebook. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Hash, jacquard_derive::IntoStatic )] pub struct Notebook; impl std::fmt::Display for Notebook { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "notebook") } } /// Individual participant's state in a collaboration. Distinguishes 'was collaborator' vs 'never was'. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ParticipantStateView<'a> { /// If they accepted (even if later broken) #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub accept_uri: std::option::Option>, /// Why the relationship ended, if applicable #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub end_reason: std::option::Option>, /// When they first contributed #[serde(skip_serializing_if = "std::option::Option::is_none")] pub first_edit_at: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub invite_uri: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub last_edit_at: std::option::Option, /// Their published copy if any #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub published_version: std::option::Option< crate::com_atproto::repo::strong_ref::StrongRef<'a>, >, /// When left/removed/expired #[serde(skip_serializing_if = "std::option::Option::is_none")] pub relationship_ended_at: std::option::Option< jacquard_common::types::string::Datetime, >, #[serde(borrow)] pub role: ParticipantStateViewRole<'a>, /// active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out #[serde(borrow)] pub status: ParticipantStateViewStatus<'a>, #[serde(borrow)] pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>, /// True if they ever had active collaboration status #[serde(skip_serializing_if = "std::option::Option::is_none")] pub was_collaborator: std::option::Option, } pub mod participant_state_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Status; type Role; type User; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Status = Unset; type Role = Unset; type User = Unset; } ///State transition - sets the `status` field to Set pub struct SetStatus(PhantomData S>); impl sealed::Sealed for SetStatus {} impl State for SetStatus { type Status = Set; type Role = S::Role; type User = S::User; } ///State transition - sets the `role` field to Set pub struct SetRole(PhantomData S>); impl sealed::Sealed for SetRole {} impl State for SetRole { type Status = S::Status; type Role = Set; type User = S::User; } ///State transition - sets the `user` field to Set pub struct SetUser(PhantomData S>); impl sealed::Sealed for SetUser {} impl State for SetUser { type Status = S::Status; type Role = S::Role; type User = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `status` field pub struct status(()); ///Marker type for the `role` field pub struct role(()); ///Marker type for the `user` field pub struct user(()); } } /// Builder for constructing an instance of this type pub struct ParticipantStateViewBuilder<'a, S: participant_state_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ParticipantStateView<'a> { /// Create a new builder for this type pub fn new() -> ParticipantStateViewBuilder< 'a, participant_state_view_state::Empty, > { ParticipantStateViewBuilder::new() } } impl<'a> ParticipantStateViewBuilder<'a, participant_state_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ParticipantStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `acceptUri` field (optional) pub fn accept_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `acceptUri` field to an Option value (optional) pub fn maybe_accept_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `endReason` field (optional) pub fn end_reason( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `endReason` field to an Option value (optional) pub fn maybe_end_reason( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `firstEditAt` field (optional) pub fn first_edit_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `firstEditAt` field to an Option value (optional) pub fn maybe_first_edit_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `inviteUri` field (optional) pub fn invite_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `inviteUri` field to an Option value (optional) pub fn maybe_invite_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `lastEditAt` field (optional) pub fn last_edit_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `lastEditAt` field to an Option value (optional) pub fn maybe_last_edit_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `publishedVersion` field (optional) pub fn published_version( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.5 = value.into(); self } /// Set the `publishedVersion` field to an Option value (optional) pub fn maybe_published_version( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.5 = value; self } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `relationshipEndedAt` field (optional) pub fn relationship_ended_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `relationshipEndedAt` field to an Option value (optional) pub fn maybe_relationship_ended_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.6 = value; self } } impl<'a, S> ParticipantStateViewBuilder<'a, S> where S: participant_state_view_state::State, S::Role: participant_state_view_state::IsUnset, { /// Set the `role` field (required) pub fn role( mut self, value: impl Into>, ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetRole> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); ParticipantStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ParticipantStateViewBuilder<'a, S> where S: participant_state_view_state::State, S::Status: participant_state_view_state::IsUnset, { /// Set the `status` field (required) pub fn status( mut self, value: impl Into>, ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetStatus> { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); ParticipantStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ParticipantStateViewBuilder<'a, S> where S: participant_state_view_state::State, S::User: participant_state_view_state::IsUnset, { /// Set the `user` field (required) pub fn user( mut self, value: impl Into>, ) -> ParticipantStateViewBuilder<'a, participant_state_view_state::SetUser> { self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); ParticipantStateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, S> { /// Set the `wasCollaborator` field (optional) pub fn was_collaborator(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.10 = value.into(); self } /// Set the `wasCollaborator` field to an Option value (optional) pub fn maybe_was_collaborator(mut self, value: Option) -> Self { self.__unsafe_private_named.10 = value; self } } impl<'a, S> ParticipantStateViewBuilder<'a, S> where S: participant_state_view_state::State, S::Status: participant_state_view_state::IsSet, S::Role: participant_state_view_state::IsSet, S::User: participant_state_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ParticipantStateView<'a> { ParticipantStateView { accept_uri: self.__unsafe_private_named.0, end_reason: self.__unsafe_private_named.1, first_edit_at: self.__unsafe_private_named.2, invite_uri: self.__unsafe_private_named.3, last_edit_at: self.__unsafe_private_named.4, published_version: self.__unsafe_private_named.5, relationship_ended_at: self.__unsafe_private_named.6, role: self.__unsafe_private_named.7.unwrap(), status: self.__unsafe_private_named.8.unwrap(), user: self.__unsafe_private_named.9.unwrap(), was_collaborator: self.__unsafe_private_named.10, extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> ParticipantStateView<'a> { ParticipantStateView { accept_uri: self.__unsafe_private_named.0, end_reason: self.__unsafe_private_named.1, first_edit_at: self.__unsafe_private_named.2, invite_uri: self.__unsafe_private_named.3, last_edit_at: self.__unsafe_private_named.4, published_version: self.__unsafe_private_named.5, relationship_ended_at: self.__unsafe_private_named.6, role: self.__unsafe_private_named.7.unwrap(), status: self.__unsafe_private_named.8.unwrap(), user: self.__unsafe_private_named.9.unwrap(), was_collaborator: self.__unsafe_private_named.10, extra_data: Some(extra_data), } } } /// Why the relationship ended, if applicable #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ParticipantStateViewEndReason<'a> { VoluntaryLeave, InviteRevoked, InviteExpired, OwnerDeletedResource, Other(jacquard_common::CowStr<'a>), } impl<'a> ParticipantStateViewEndReason<'a> { pub fn as_str(&self) -> &str { match self { Self::VoluntaryLeave => "voluntary_leave", Self::InviteRevoked => "invite_revoked", Self::InviteExpired => "invite_expired", Self::OwnerDeletedResource => "owner_deleted_resource", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for ParticipantStateViewEndReason<'a> { fn from(s: &'a str) -> Self { match s { "voluntary_leave" => Self::VoluntaryLeave, "invite_revoked" => Self::InviteRevoked, "invite_expired" => Self::InviteExpired, "owner_deleted_resource" => Self::OwnerDeletedResource, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for ParticipantStateViewEndReason<'a> { fn from(s: String) -> Self { match s.as_str() { "voluntary_leave" => Self::VoluntaryLeave, "invite_revoked" => Self::InviteRevoked, "invite_expired" => Self::InviteExpired, "owner_deleted_resource" => Self::OwnerDeletedResource, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for ParticipantStateViewEndReason<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for ParticipantStateViewEndReason<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for ParticipantStateViewEndReason<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewEndReason<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for ParticipantStateViewEndReason<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for ParticipantStateViewEndReason<'_> { type Output = ParticipantStateViewEndReason<'static>; fn into_static(self) -> Self::Output { match self { ParticipantStateViewEndReason::VoluntaryLeave => { ParticipantStateViewEndReason::VoluntaryLeave } ParticipantStateViewEndReason::InviteRevoked => { ParticipantStateViewEndReason::InviteRevoked } ParticipantStateViewEndReason::InviteExpired => { ParticipantStateViewEndReason::InviteExpired } ParticipantStateViewEndReason::OwnerDeletedResource => { ParticipantStateViewEndReason::OwnerDeletedResource } ParticipantStateViewEndReason::Other(v) => { ParticipantStateViewEndReason::Other(v.into_static()) } } } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ParticipantStateViewRole<'a> { Owner, Collaborator, FormerCollaborator, Other(jacquard_common::CowStr<'a>), } impl<'a> ParticipantStateViewRole<'a> { pub fn as_str(&self) -> &str { match self { Self::Owner => "owner", Self::Collaborator => "collaborator", Self::FormerCollaborator => "former_collaborator", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for ParticipantStateViewRole<'a> { fn from(s: &'a str) -> Self { match s { "owner" => Self::Owner, "collaborator" => Self::Collaborator, "former_collaborator" => Self::FormerCollaborator, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for ParticipantStateViewRole<'a> { fn from(s: String) -> Self { match s.as_str() { "owner" => Self::Owner, "collaborator" => Self::Collaborator, "former_collaborator" => Self::FormerCollaborator, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for ParticipantStateViewRole<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for ParticipantStateViewRole<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for ParticipantStateViewRole<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewRole<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for ParticipantStateViewRole<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for ParticipantStateViewRole<'_> { type Output = ParticipantStateViewRole<'static>; fn into_static(self) -> Self::Output { match self { ParticipantStateViewRole::Owner => ParticipantStateViewRole::Owner, ParticipantStateViewRole::Collaborator => { ParticipantStateViewRole::Collaborator } ParticipantStateViewRole::FormerCollaborator => { ParticipantStateViewRole::FormerCollaborator } ParticipantStateViewRole::Other(v) => { ParticipantStateViewRole::Other(v.into_static()) } } } } /// active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ParticipantStateViewStatus<'a> { Active, Invited, Left, Removed, Expired, Other(jacquard_common::CowStr<'a>), } impl<'a> ParticipantStateViewStatus<'a> { pub fn as_str(&self) -> &str { match self { Self::Active => "active", Self::Invited => "invited", Self::Left => "left", Self::Removed => "removed", Self::Expired => "expired", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for ParticipantStateViewStatus<'a> { fn from(s: &'a str) -> Self { match s { "active" => Self::Active, "invited" => Self::Invited, "left" => Self::Left, "removed" => Self::Removed, "expired" => Self::Expired, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for ParticipantStateViewStatus<'a> { fn from(s: String) -> Self { match s.as_str() { "active" => Self::Active, "invited" => Self::Invited, "left" => Self::Left, "removed" => Self::Removed, "expired" => Self::Expired, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for ParticipantStateViewStatus<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for ParticipantStateViewStatus<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for ParticipantStateViewStatus<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for ParticipantStateViewStatus<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for ParticipantStateViewStatus<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for ParticipantStateViewStatus<'_> { type Output = ParticipantStateViewStatus<'static>; fn into_static(self) -> Self::Output { match self { ParticipantStateViewStatus::Active => ParticipantStateViewStatus::Active, ParticipantStateViewStatus::Invited => ParticipantStateViewStatus::Invited, ParticipantStateViewStatus::Left => ParticipantStateViewStatus::Left, ParticipantStateViewStatus::Removed => ParticipantStateViewStatus::Removed, ParticipantStateViewStatus::Expired => ParticipantStateViewStatus::Expired, ParticipantStateViewStatus::Other(v) => { ParticipantStateViewStatus::Other(v.into_static()) } } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ParticipantStateView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" } fn def_name() -> &'static str { "participantStateView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_collab_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Active real-time collaboration session. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct SessionView<'a> { pub created_at: jacquard_common::types::string::Datetime, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub expires_at: std::option::Option, #[serde(borrow)] pub node_id: jacquard_common::CowStr<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub relay_url: std::option::Option>, #[serde(borrow)] pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(borrow)] pub user: crate::sh_weaver::actor::ProfileViewBasic<'a>, } pub mod session_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; type User; type Resource; type CreatedAt; type NodeId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; type User = Unset; type Resource = Unset; type CreatedAt = Unset; type NodeId = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Uri = Set; type User = S::User; type Resource = S::Resource; type CreatedAt = S::CreatedAt; type NodeId = S::NodeId; } ///State transition - sets the `user` field to Set pub struct SetUser(PhantomData S>); impl sealed::Sealed for SetUser {} impl State for SetUser { type Uri = S::Uri; type User = Set; type Resource = S::Resource; type CreatedAt = S::CreatedAt; type NodeId = S::NodeId; } ///State transition - sets the `resource` field to Set pub struct SetResource(PhantomData S>); impl sealed::Sealed for SetResource {} impl State for SetResource { type Uri = S::Uri; type User = S::User; type Resource = Set; type CreatedAt = S::CreatedAt; type NodeId = S::NodeId; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Uri = S::Uri; type User = S::User; type Resource = S::Resource; type CreatedAt = Set; type NodeId = S::NodeId; } ///State transition - sets the `node_id` field to Set pub struct SetNodeId(PhantomData S>); impl sealed::Sealed for SetNodeId {} impl State for SetNodeId { type Uri = S::Uri; type User = S::User; type Resource = S::Resource; type CreatedAt = S::CreatedAt; type NodeId = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `user` field pub struct user(()); ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `node_id` field pub struct node_id(()); } } /// Builder for constructing an instance of this type pub struct SessionViewBuilder<'a, S: session_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> SessionView<'a> { /// Create a new builder for this type pub fn new() -> SessionViewBuilder<'a, session_view_state::Empty> { SessionViewBuilder::new() } } impl<'a> SessionViewBuilder<'a, session_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { SessionViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, S::CreatedAt: session_view_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> SessionViewBuilder<'a, session_view_state::SetCreatedAt> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); SessionViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: session_view_state::State> SessionViewBuilder<'a, S> { /// Set the `expiresAt` field (optional) pub fn expires_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `expiresAt` field to an Option value (optional) pub fn maybe_expires_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, S::NodeId: session_view_state::IsUnset, { /// Set the `nodeId` field (required) pub fn node_id( mut self, value: impl Into>, ) -> SessionViewBuilder<'a, session_view_state::SetNodeId> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); SessionViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: session_view_state::State> SessionViewBuilder<'a, S> { /// Set the `relayUrl` field (optional) pub fn relay_url( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `relayUrl` field to an Option value (optional) pub fn maybe_relay_url( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, S::Resource: session_view_state::IsUnset, { /// Set the `resource` field (required) pub fn resource( mut self, value: impl Into>, ) -> SessionViewBuilder<'a, session_view_state::SetResource> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); SessionViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, S::Uri: session_view_state::IsUnset, { /// Set the `uri` field (required) pub fn uri( mut self, value: impl Into>, ) -> SessionViewBuilder<'a, session_view_state::SetUri> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); SessionViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, S::User: session_view_state::IsUnset, { /// Set the `user` field (required) pub fn user( mut self, value: impl Into>, ) -> SessionViewBuilder<'a, session_view_state::SetUser> { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); SessionViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, S::Uri: session_view_state::IsSet, S::User: session_view_state::IsSet, S::Resource: session_view_state::IsSet, S::CreatedAt: session_view_state::IsSet, S::NodeId: session_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SessionView<'a> { SessionView { created_at: self.__unsafe_private_named.0.unwrap(), expires_at: self.__unsafe_private_named.1, node_id: self.__unsafe_private_named.2.unwrap(), relay_url: self.__unsafe_private_named.3, resource: self.__unsafe_private_named.4.unwrap(), uri: self.__unsafe_private_named.5.unwrap(), user: self.__unsafe_private_named.6.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> SessionView<'a> { SessionView { created_at: self.__unsafe_private_named.0.unwrap(), expires_at: self.__unsafe_private_named.1, node_id: self.__unsafe_private_named.2.unwrap(), relay_url: self.__unsafe_private_named.3, resource: self.__unsafe_private_named.4.unwrap(), uri: self.__unsafe_private_named.5.unwrap(), user: self.__unsafe_private_named.6.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SessionView<'a> { fn nsid() -> &'static str { "sh.weaver.collab.defs" } fn def_name() -> &'static str { "sessionView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_collab_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }