// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: app.bsky.unspecced.getPostThreadV2 // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct GetPostThreadV2<'a> { /// (default: true) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub above: std::option::Option, #[serde(borrow)] pub anchor: jacquard_common::types::string::AtUri<'a>, ///(default: 6, min: 0, max: 20) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub below: std::option::Option, ///(default: 10, min: 0, max: 100) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub branching_factor: std::option::Option, ///(default: "oldest") #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub sort: std::option::Option>, } pub mod get_post_thread_v2_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 Anchor; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Anchor = Unset; } ///State transition - sets the `anchor` field to Set pub struct SetAnchor(PhantomData S>); impl sealed::Sealed for SetAnchor {} impl State for SetAnchor { type Anchor = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `anchor` field pub struct anchor(()); } } /// Builder for constructing an instance of this type pub struct GetPostThreadV2Builder<'a, S: get_post_thread_v2_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>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> GetPostThreadV2<'a> { /// Create a new builder for this type pub fn new() -> GetPostThreadV2Builder<'a, get_post_thread_v2_state::Empty> { GetPostThreadV2Builder::new() } } impl<'a> GetPostThreadV2Builder<'a, get_post_thread_v2_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { GetPostThreadV2Builder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: get_post_thread_v2_state::State> GetPostThreadV2Builder<'a, S> { /// Set the `above` field (optional) pub fn above(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `above` field to an Option value (optional) pub fn maybe_above(mut self, value: Option) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> GetPostThreadV2Builder<'a, S> where S: get_post_thread_v2_state::State, S::Anchor: get_post_thread_v2_state::IsUnset, { /// Set the `anchor` field (required) pub fn anchor( mut self, value: impl Into>, ) -> GetPostThreadV2Builder<'a, get_post_thread_v2_state::SetAnchor> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); GetPostThreadV2Builder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: get_post_thread_v2_state::State> GetPostThreadV2Builder<'a, S> { /// Set the `below` field (optional) pub fn below(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `below` field to an Option value (optional) pub fn maybe_below(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: get_post_thread_v2_state::State> GetPostThreadV2Builder<'a, S> { /// Set the `branchingFactor` field (optional) pub fn branching_factor(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `branchingFactor` field to an Option value (optional) pub fn maybe_branching_factor(mut self, value: Option) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S: get_post_thread_v2_state::State> GetPostThreadV2Builder<'a, S> { /// Set the `sort` field (optional) pub fn sort( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `sort` field to an Option value (optional) pub fn maybe_sort(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> GetPostThreadV2Builder<'a, S> where S: get_post_thread_v2_state::State, S::Anchor: get_post_thread_v2_state::IsSet, { /// Build the final struct pub fn build(self) -> GetPostThreadV2<'a> { GetPostThreadV2 { above: self.__unsafe_private_named.0, anchor: self.__unsafe_private_named.1.unwrap(), below: self.__unsafe_private_named.2, branching_factor: self.__unsafe_private_named.3, sort: self.__unsafe_private_named.4, } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct GetPostThreadV2Output<'a> { /// Whether this thread has additional replies. If true, a call can be made to the `getPostThreadOtherV2` endpoint to retrieve them. pub has_other_replies: bool, /// A flat list of thread items. The depth of each item is indicated by the depth property inside the item. #[serde(borrow)] pub thread: Vec>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub threadgate: std::option::Option>, } /// Response type for ///app.bsky.unspecced.getPostThreadV2 pub struct GetPostThreadV2Response; impl jacquard_common::xrpc::XrpcResp for GetPostThreadV2Response { const NSID: &'static str = "app.bsky.unspecced.getPostThreadV2"; const ENCODING: &'static str = "application/json"; type Output<'de> = GetPostThreadV2Output<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for GetPostThreadV2<'a> { const NSID: &'static str = "app.bsky.unspecced.getPostThreadV2"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = GetPostThreadV2Response; } /// Endpoint type for ///app.bsky.unspecced.getPostThreadV2 pub struct GetPostThreadV2Request; impl jacquard_common::xrpc::XrpcEndpoint for GetPostThreadV2Request { const PATH: &'static str = "/xrpc/app.bsky.unspecced.getPostThreadV2"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = GetPostThreadV2<'de>; type Response = GetPostThreadV2Response; } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ThreadItem<'a> { /// The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths. pub depth: i64, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(borrow)] pub value: ThreadItemValue<'a>, } pub mod thread_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 Value; type Uri; type Depth; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Value = Unset; type Uri = Unset; type Depth = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { type Value = Set; type Uri = S::Uri; type Depth = S::Depth; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Value = S::Value; type Uri = Set; type Depth = S::Depth; } ///State transition - sets the `depth` field to Set pub struct SetDepth(PhantomData S>); impl sealed::Sealed for SetDepth {} impl State for SetDepth { type Value = S::Value; type Uri = S::Uri; type Depth = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `value` field pub struct value(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `depth` field pub struct depth(()); } } /// Builder for constructing an instance of this type pub struct ThreadItemBuilder<'a, S: thread_item_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> ThreadItem<'a> { /// Create a new builder for this type pub fn new() -> ThreadItemBuilder<'a, thread_item_state::Empty> { ThreadItemBuilder::new() } } impl<'a> ThreadItemBuilder<'a, thread_item_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ThreadItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, S::Depth: thread_item_state::IsUnset, { /// Set the `depth` field (required) pub fn depth( mut self, value: impl Into, ) -> ThreadItemBuilder<'a, thread_item_state::SetDepth> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ThreadItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, S::Uri: thread_item_state::IsUnset, { /// Set the `uri` field (required) pub fn uri( mut self, value: impl Into>, ) -> ThreadItemBuilder<'a, thread_item_state::SetUri> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); ThreadItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, S::Value: thread_item_state::IsUnset, { /// Set the `value` field (required) pub fn value( mut self, value: impl Into>, ) -> ThreadItemBuilder<'a, thread_item_state::SetValue> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); ThreadItemBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, S::Value: thread_item_state::IsSet, S::Uri: thread_item_state::IsSet, S::Depth: thread_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ThreadItem<'a> { ThreadItem { depth: self.__unsafe_private_named.0.unwrap(), uri: self.__unsafe_private_named.1.unwrap(), value: 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>, >, ) -> ThreadItem<'a> { ThreadItem { depth: self.__unsafe_private_named.0.unwrap(), uri: self.__unsafe_private_named.1.unwrap(), value: 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 ThreadItemValue<'a> { #[serde(rename = "app.bsky.unspecced.defs#threadItemPost")] ThreadItemPost(Box>), #[serde(rename = "app.bsky.unspecced.defs#threadItemNoUnauthenticated")] ThreadItemNoUnauthenticated( Box>, ), #[serde(rename = "app.bsky.unspecced.defs#threadItemNotFound")] ThreadItemNotFound(Box>), #[serde(rename = "app.bsky.unspecced.defs#threadItemBlocked")] ThreadItemBlocked(Box>), } fn lexicon_doc_app_bsky_unspecced_getPostThreadV2() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("app.bsky.unspecced.getPostThreadV2"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { description: None, parameters: Some( ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("anchor") ], ), properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("above"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("anchor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Reference (AT-URI) to post record. This is the anchor post, and the thread will be built around it. It can be any post in the tree, not necessarily a root post.", ), ), 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("below"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::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( "branchingFactor", ), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::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("sort"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Sorting for the thread replies.", ), ), 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 }, }), ), output: None, errors: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("threadItem"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_common::smol_str::SmolStr::new_static("depth"), ::jacquard_common::smol_str::SmolStr::new_static("value") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("depth"), ::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("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("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("app.bsky.unspecced.defs#threadItemPost"), ::jacquard_common::CowStr::new_static("app.bsky.unspecced.defs#threadItemNoUnauthenticated"), ::jacquard_common::CowStr::new_static("app.bsky.unspecced.defs#threadItemNotFound"), ::jacquard_common::CowStr::new_static("app.bsky.unspecced.defs#threadItemBlocked") ], closed: None, }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThreadItem<'a> { fn nsid() -> &'static str { "app.bsky.unspecced.getPostThreadV2" } fn def_name() -> &'static str { "threadItem" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_app_bsky_unspecced_getPostThreadV2() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }