// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: chat.bsky.actor.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod declaration; pub mod delete_account; pub mod export_account_data; #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ProfileViewBasic<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub associated: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub avatar: std::option::Option>, /// Set to true when the actor cannot actively participate in conversations #[serde(skip_serializing_if = "std::option::Option::is_none")] pub chat_disabled: std::option::Option, #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub display_name: std::option::Option>, #[serde(borrow)] pub handle: jacquard_common::types::string::Handle<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub labels: std::option::Option>>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub verification: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub viewer: std::option::Option>, } pub mod profile_view_basic_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 Handle; type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Handle = Unset; type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type Handle = Set; type Did = S::Did; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Handle = S::Handle; type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `did` field pub struct did(()); } } /// Builder for constructing an instance of this type pub struct ProfileViewBasicBuilder<'a, S: profile_view_basic_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>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ProfileViewBasic<'a> { /// Create a new builder for this type pub fn new() -> ProfileViewBasicBuilder<'a, profile_view_basic_state::Empty> { ProfileViewBasicBuilder::new() } } impl<'a> ProfileViewBasicBuilder<'a, profile_view_basic_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ProfileViewBasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `associated` field (optional) pub fn associated( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `associated` field to an Option value (optional) pub fn maybe_associated( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `avatar` field (optional) pub fn avatar( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `avatar` field to an Option value (optional) pub fn maybe_avatar( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `chatDisabled` field (optional) pub fn chat_disabled(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `chatDisabled` field to an Option value (optional) pub fn maybe_chat_disabled(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> ProfileViewBasicBuilder<'a, S> where S: profile_view_basic_state::State, S::Did: profile_view_basic_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> ProfileViewBasicBuilder<'a, profile_view_basic_state::SetDid> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); ProfileViewBasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `displayName` field (optional) pub fn display_name( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `displayName` field to an Option value (optional) pub fn maybe_display_name( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> ProfileViewBasicBuilder<'a, S> where S: profile_view_basic_state::State, S::Handle: profile_view_basic_state::IsUnset, { /// Set the `handle` field (required) pub fn handle( mut self, value: impl Into>, ) -> ProfileViewBasicBuilder<'a, profile_view_basic_state::SetHandle> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); ProfileViewBasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `labels` field (optional) pub fn labels( mut self, value: impl Into>>>, ) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `labels` field to an Option value (optional) pub fn maybe_labels( mut self, value: Option>>, ) -> Self { self.__unsafe_private_named.6 = value; self } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `verification` field (optional) pub fn verification( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.7 = value.into(); self } /// Set the `verification` field to an Option value (optional) pub fn maybe_verification( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.7 = value; self } } impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { /// Set the `viewer` field (optional) pub fn viewer( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.8 = value.into(); self } /// Set the `viewer` field to an Option value (optional) pub fn maybe_viewer( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.8 = value; self } } impl<'a, S> ProfileViewBasicBuilder<'a, S> where S: profile_view_basic_state::State, S::Handle: profile_view_basic_state::IsSet, S::Did: profile_view_basic_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileViewBasic<'a> { ProfileViewBasic { associated: self.__unsafe_private_named.0, avatar: self.__unsafe_private_named.1, chat_disabled: self.__unsafe_private_named.2, did: self.__unsafe_private_named.3.unwrap(), display_name: self.__unsafe_private_named.4, handle: self.__unsafe_private_named.5.unwrap(), labels: self.__unsafe_private_named.6, verification: self.__unsafe_private_named.7, viewer: self.__unsafe_private_named.8, 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>, >, ) -> ProfileViewBasic<'a> { ProfileViewBasic { associated: self.__unsafe_private_named.0, avatar: self.__unsafe_private_named.1, chat_disabled: self.__unsafe_private_named.2, did: self.__unsafe_private_named.3.unwrap(), display_name: self.__unsafe_private_named.4, handle: self.__unsafe_private_named.5.unwrap(), labels: self.__unsafe_private_named.6, verification: self.__unsafe_private_named.7, viewer: self.__unsafe_private_named.8, extra_data: Some(extra_data), } } } fn lexicon_doc_chat_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("chat.bsky.actor.defs"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("profileViewBasic"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_common::smol_str::SmolStr::new_static("handle") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "associated", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "app.bsky.actor.defs#profileAssociated", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("avatar"), ::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( "chatDisabled", ), ::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("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), 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( "displayName", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: Some(640usize), min_graphemes: None, max_graphemes: Some(64usize), r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("handle"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Handle, ), 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("labels"), ::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( "com.atproto.label.defs#label", ), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "verification", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "app.bsky.actor.defs#verificationState", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("viewer"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "app.bsky.actor.defs#viewerState", ), }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileViewBasic<'a> { fn nsid() -> &'static str { "chat.bsky.actor.defs" } fn def_name() -> &'static str { "profileViewBasic" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_chat_bsky_actor_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.display_name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 640usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "display_name", ), max: 640usize, actual: ::len(value.as_ref()), }); } } if let Some(ref value) = self.display_name { { let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( value.as_ref(), true, ) .count(); if count > 64usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "display_name", ), max: 64usize, actual: count, }); } } } Ok(()) } }