// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: app.bsky.bookmark.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod create_bookmark; pub mod delete_bookmark; pub mod get_bookmarks; /// Object used to store bookmark data in stash. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Bookmark<'a> { /// A strong ref to the record to be bookmarked. Currently, only `app.bsky.feed.post` records are supported. #[serde(borrow)] pub subject: crate::com_atproto::repo::strong_ref::StrongRef<'a>, } pub mod bookmark_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 Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Subject = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `subject` field pub struct subject(()); } } /// Builder for constructing an instance of this type pub struct BookmarkBuilder<'a, S: bookmark_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Bookmark<'a> { /// Create a new builder for this type pub fn new() -> BookmarkBuilder<'a, bookmark_state::Empty> { BookmarkBuilder::new() } } impl<'a> BookmarkBuilder<'a, bookmark_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { BookmarkBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BookmarkBuilder<'a, S> where S: bookmark_state::State, S::Subject: bookmark_state::IsUnset, { /// Set the `subject` field (required) pub fn subject( mut self, value: impl Into>, ) -> BookmarkBuilder<'a, bookmark_state::SetSubject> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); BookmarkBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BookmarkBuilder<'a, S> where S: bookmark_state::State, S::Subject: bookmark_state::IsSet, { /// Build the final struct pub fn build(self) -> Bookmark<'a> { Bookmark { subject: self.__unsafe_private_named.0.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>, >, ) -> Bookmark<'a> { Bookmark { subject: self.__unsafe_private_named.0.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_app_bsky_bookmark_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("app.bsky.bookmark.defs"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("bookmark"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Object used to store bookmark data in stash.", ), ), required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("subject")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.repo.strongRef", ), }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("bookmarkView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_common::smol_str::SmolStr::new_static("item") ], ), 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("item"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("app.bsky.feed.defs#blockedPost"), ::jacquard_common::CowStr::new_static("app.bsky.feed.defs#notFoundPost"), ::jacquard_common::CowStr::new_static("app.bsky.feed.defs#postView") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.repo.strongRef", ), }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bookmark<'a> { fn nsid() -> &'static str { "app.bsky.bookmark.defs" } fn def_name() -> &'static str { "bookmark" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_app_bsky_bookmark_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct BookmarkView<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] pub created_at: std::option::Option, #[serde(borrow)] pub item: BookmarkViewItem<'a>, /// A strong ref to the bookmarked record. #[serde(borrow)] pub subject: crate::com_atproto::repo::strong_ref::StrongRef<'a>, } pub mod bookmark_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 Item; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Item = Unset; type Subject = Unset; } ///State transition - sets the `item` field to Set pub struct SetItem(PhantomData S>); impl sealed::Sealed for SetItem {} impl State for SetItem { type Item = Set; type Subject = S::Subject; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { type Item = S::Item; type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `item` field pub struct item(()); ///Marker type for the `subject` field pub struct subject(()); } } /// Builder for constructing an instance of this type pub struct BookmarkViewBuilder<'a, S: bookmark_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> BookmarkView<'a> { /// Create a new builder for this type pub fn new() -> BookmarkViewBuilder<'a, bookmark_view_state::Empty> { BookmarkViewBuilder::new() } } impl<'a> BookmarkViewBuilder<'a, bookmark_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { BookmarkViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: bookmark_view_state::State> BookmarkViewBuilder<'a, S> { /// Set the `createdAt` field (optional) pub fn created_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.0 = 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.0 = value; self } } impl<'a, S> BookmarkViewBuilder<'a, S> where S: bookmark_view_state::State, S::Item: bookmark_view_state::IsUnset, { /// Set the `item` field (required) pub fn item( mut self, value: impl Into>, ) -> BookmarkViewBuilder<'a, bookmark_view_state::SetItem> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); BookmarkViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BookmarkViewBuilder<'a, S> where S: bookmark_view_state::State, S::Subject: bookmark_view_state::IsUnset, { /// Set the `subject` field (required) pub fn subject( mut self, value: impl Into>, ) -> BookmarkViewBuilder<'a, bookmark_view_state::SetSubject> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); BookmarkViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BookmarkViewBuilder<'a, S> where S: bookmark_view_state::State, S::Item: bookmark_view_state::IsSet, S::Subject: bookmark_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BookmarkView<'a> { BookmarkView { created_at: self.__unsafe_private_named.0, item: self.__unsafe_private_named.1.unwrap(), subject: self.__unsafe_private_named.2.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>, >, ) -> BookmarkView<'a> { BookmarkView { created_at: self.__unsafe_private_named.0, item: self.__unsafe_private_named.1.unwrap(), subject: self.__unsafe_private_named.2.unwrap(), 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 BookmarkViewItem<'a> { #[serde(rename = "app.bsky.feed.defs#blockedPost")] BlockedPost(Box>), #[serde(rename = "app.bsky.feed.defs#notFoundPost")] NotFoundPost(Box>), #[serde(rename = "app.bsky.feed.defs#postView")] PostView(Box>), } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BookmarkView<'a> { fn nsid() -> &'static str { "app.bsky.bookmark.defs" } fn def_name() -> &'static str { "bookmarkView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_app_bsky_bookmark_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }