// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.notebook.authors // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// A single author in a Weaver notebook. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct AuthorListItem<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] pub index: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub profile: std::option::Option>, } pub mod author_list_item_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 ProfileIndex; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type ProfileIndex = Unset; } ///State transition - sets the `profile_index` field to Set pub struct SetProfileIndex(PhantomData S>); impl sealed::Sealed for SetProfileIndex {} impl State for SetProfileIndex { type ProfileIndex = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `profile_index` field pub struct profile_index(()); } } /// Builder for constructing an instance of this type pub struct AuthorListItemBuilder<'a, S: author_list_item_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> AuthorListItem<'a> { /// Create a new builder for this type pub fn new() -> AuthorListItemBuilder<'a, author_list_item_state::Empty> { AuthorListItemBuilder::new() } } impl<'a> AuthorListItemBuilder<'a, author_list_item_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { AuthorListItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: author_list_item_state::State> AuthorListItemBuilder<'a, S> { /// Set the `index` field (optional) pub fn index(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `index` field to an Option value (optional) pub fn maybe_index(mut self, value: Option) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: author_list_item_state::State> AuthorListItemBuilder<'a, S> { /// Set the `profile` field (optional) pub fn profile( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `profile` field to an Option value (optional) pub fn maybe_profile(mut self, value: Option>) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> AuthorListItemBuilder<'a, S> where S: author_list_item_state::State, S::ProfileIndex: author_list_item_state::IsSet, { /// Build the final struct pub fn build(self) -> AuthorListItem<'a> { AuthorListItem { index: self.__unsafe_private_named.0, profile: self.__unsafe_private_named.1, 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>, >, ) -> AuthorListItem<'a> { AuthorListItem { index: self.__unsafe_private_named.0, profile: self.__unsafe_private_named.1, extra_data: Some(extra_data), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum AuthorListItemProfile<'a> { #[serde(rename = "app.bsky.actor.defs#profileViewBasic")] ProfileViewBasic(Box>), #[serde(rename = "sh.weaver.actor.defs#profileView")] ProfileView(Box>), } fn lexicon_doc_sh_weaver_notebook_authors() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("sh.weaver.notebook.authors"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("authorListItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "A single author in a Weaver notebook.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("profile, index") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("index"), ::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("profile"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("app.bsky.actor.defs#profileViewBasic"), ::jacquard_common::CowStr::new_static("sh.weaver.actor.defs#profileView") ], closed: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { description: Some( ::jacquard_common::CowStr::new_static( "Authors of a Weaver notebook.", ), ), key: Some(::jacquard_common::CowStr::new_static("tid")), record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("authorList") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "authorList", ), ::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( "#authorListItem", ), }), min_length: None, max_length: 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 }, }), }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AuthorListItem<'a> { fn nsid() -> &'static str { "sh.weaver.notebook.authors" } fn def_name() -> &'static str { "authorListItem" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_notebook_authors() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Authors of a Weaver notebook. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Authors<'a> { #[serde(borrow)] pub author_list: Vec>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub created_at: std::option::Option, } pub mod authors_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 AuthorList; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type AuthorList = Unset; } ///State transition - sets the `author_list` field to Set pub struct SetAuthorList(PhantomData S>); impl sealed::Sealed for SetAuthorList {} impl State for SetAuthorList { type AuthorList = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `author_list` field pub struct author_list(()); } } /// Builder for constructing an instance of this type pub struct AuthorsBuilder<'a, S: authors_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option< Vec>, >, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Authors<'a> { /// Create a new builder for this type pub fn new() -> AuthorsBuilder<'a, authors_state::Empty> { AuthorsBuilder::new() } } impl<'a> AuthorsBuilder<'a, authors_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { AuthorsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AuthorsBuilder<'a, S> where S: authors_state::State, S::AuthorList: authors_state::IsUnset, { /// Set the `authorList` field (required) pub fn author_list( mut self, value: impl Into>>, ) -> AuthorsBuilder<'a, authors_state::SetAuthorList> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); AuthorsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: authors_state::State> AuthorsBuilder<'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> AuthorsBuilder<'a, S> where S: authors_state::State, S::AuthorList: authors_state::IsSet, { /// Build the final struct pub fn build(self) -> Authors<'a> { Authors { author_list: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1, 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>, >, ) -> Authors<'a> { Authors { author_list: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1, extra_data: Some(extra_data), } } } impl<'a> Authors<'a> { pub fn uri( uri: impl Into>, ) -> Result< jacquard_common::types::uri::RecordUri<'a, AuthorsRecord>, jacquard_common::types::uri::UriError, > { jacquard_common::types::uri::RecordUri::try_from_uri( jacquard_common::types::string::AtUri::new_cow(uri.into())?, ) } } /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct AuthorsGetRecordOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cid: std::option::Option>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(borrow)] pub value: Authors<'a>, } impl From> for Authors<'_> { fn from(output: AuthorsGetRecordOutput<'_>) -> Self { use jacquard_common::IntoStatic; output.value.into_static() } } impl jacquard_common::types::collection::Collection for Authors<'_> { const NSID: &'static str = "sh.weaver.notebook.authors"; type Record = AuthorsRecord; } /// Marker type for deserializing records from this collection. #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct AuthorsRecord; impl jacquard_common::xrpc::XrpcResp for AuthorsRecord { const NSID: &'static str = "sh.weaver.notebook.authors"; const ENCODING: &'static str = "application/json"; type Output<'de> = AuthorsGetRecordOutput<'de>; type Err<'de> = jacquard_common::types::collection::RecordError<'de>; } impl jacquard_common::types::collection::Collection for AuthorsRecord { const NSID: &'static str = "sh.weaver.notebook.authors"; type Record = AuthorsRecord; } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Authors<'a> { fn nsid() -> &'static str { "sh.weaver.notebook.authors" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_notebook_authors() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }