#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::AtUri;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::unspecced::ThreadItemPost;
use crate::app_bsky::unspecced::get_post_thread_other_v2;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetPostThreadOtherV2<S: BosStr = DefaultStr> {
pub anchor: AtUri<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetPostThreadOtherV2Output<S: BosStr = DefaultStr> {
pub thread: Vec<get_post_thread_other_v2::ThreadItem<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ThreadItem<S: BosStr = DefaultStr> {
pub depth: i64,
pub uri: AtUri<S>,
pub value: ThreadItemPost<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetPostThreadOtherV2Response;
impl jacquard_common::xrpc::XrpcResp for GetPostThreadOtherV2Response {
const NSID: &'static str = "app.bsky.unspecced.getPostThreadOtherV2";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetPostThreadOtherV2Output<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetPostThreadOtherV2<S> {
const NSID: &'static str = "app.bsky.unspecced.getPostThreadOtherV2";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetPostThreadOtherV2Response;
}
pub struct GetPostThreadOtherV2Request;
impl jacquard_common::xrpc::XrpcEndpoint for GetPostThreadOtherV2Request {
const PATH: &'static str = "/xrpc/app.bsky.unspecced.getPostThreadOtherV2";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetPostThreadOtherV2<S>;
type Response = GetPostThreadOtherV2Response;
}
impl<S: BosStr> LexiconSchema for ThreadItem<S> {
fn nsid() -> &'static str {
"app.bsky.unspecced.getPostThreadOtherV2"
}
fn def_name() -> &'static str {
"threadItem"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_unspecced_getPostThreadOtherV2()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod get_post_thread_other_v2_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Anchor;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Anchor = Unset;
}
pub struct SetAnchor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAnchor<St> {}
impl<St: State> State for SetAnchor<St> {
type Anchor = Set<members::anchor>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct anchor(());
}
}
pub struct GetPostThreadOtherV2Builder<
S: BosStr,
St: get_post_thread_other_v2_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetPostThreadOtherV2<S> {
pub fn new() -> GetPostThreadOtherV2Builder<
S,
get_post_thread_other_v2_state::Empty,
> {
GetPostThreadOtherV2Builder::new()
}
}
impl<S: BosStr> GetPostThreadOtherV2Builder<S, get_post_thread_other_v2_state::Empty> {
pub fn new() -> Self {
GetPostThreadOtherV2Builder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetPostThreadOtherV2Builder<S, St>
where
St: get_post_thread_other_v2_state::State,
St::Anchor: get_post_thread_other_v2_state::IsUnset,
{
pub fn anchor(
mut self,
value: impl Into<AtUri<S>>,
) -> GetPostThreadOtherV2Builder<S, get_post_thread_other_v2_state::SetAnchor<St>> {
self._fields.0 = Option::Some(value.into());
GetPostThreadOtherV2Builder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetPostThreadOtherV2Builder<S, St>
where
St: get_post_thread_other_v2_state::State,
St::Anchor: get_post_thread_other_v2_state::IsSet,
{
pub fn build(self) -> GetPostThreadOtherV2<S> {
GetPostThreadOtherV2 {
anchor: self._fields.0.unwrap(),
}
}
}
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 {}
}
pub trait State: sealed::Sealed {
type Depth;
type Uri;
type Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Depth = Unset;
type Uri = Unset;
type Value = Unset;
}
pub struct SetDepth<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDepth<St> {}
impl<St: State> State for SetDepth<St> {
type Depth = Set<members::depth>;
type Uri = St::Uri;
type Value = St::Value;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Depth = St::Depth;
type Uri = Set<members::uri>;
type Value = St::Value;
}
pub struct SetValue<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetValue<St> {}
impl<St: State> State for SetValue<St> {
type Depth = St::Depth;
type Uri = St::Uri;
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct depth(());
pub struct uri(());
pub struct value(());
}
}
pub struct ThreadItemBuilder<S: BosStr, St: thread_item_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<AtUri<S>>, Option<ThreadItemPost<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ThreadItem<S> {
pub fn new() -> ThreadItemBuilder<S, thread_item_state::Empty> {
ThreadItemBuilder::new()
}
}
impl<S: BosStr> ThreadItemBuilder<S, thread_item_state::Empty> {
pub fn new() -> Self {
ThreadItemBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ThreadItemBuilder<S, St>
where
St: thread_item_state::State,
St::Depth: thread_item_state::IsUnset,
{
pub fn depth(
mut self,
value: impl Into<i64>,
) -> ThreadItemBuilder<S, thread_item_state::SetDepth<St>> {
self._fields.0 = Option::Some(value.into());
ThreadItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ThreadItemBuilder<S, St>
where
St: thread_item_state::State,
St::Uri: thread_item_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ThreadItemBuilder<S, thread_item_state::SetUri<St>> {
self._fields.1 = Option::Some(value.into());
ThreadItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ThreadItemBuilder<S, St>
where
St: thread_item_state::State,
St::Value: thread_item_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<ThreadItemPost<S>>,
) -> ThreadItemBuilder<S, thread_item_state::SetValue<St>> {
self._fields.2 = Option::Some(value.into());
ThreadItemBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ThreadItemBuilder<S, St>
where
St: thread_item_state::State,
St::Depth: thread_item_state::IsSet,
St::Uri: thread_item_state::IsSet,
St::Value: thread_item_state::IsSet,
{
pub fn build(self) -> ThreadItem<S> {
ThreadItem {
depth: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
value: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ThreadItem<S> {
ThreadItem {
depth: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
value: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_unspecced_getPostThreadOtherV2() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("app.bsky.unspecced.getPostThreadOtherV2"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(
LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![SmolStr::new_static("anchor")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("anchor"),
LexXrpcParametersProperty::String(LexString {
description: Some(
CowStr::new_static(
"Reference (AT-URI) to post record. This is the anchor post.",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("threadItem"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("depth"),
SmolStr::new_static("value")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("depth"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("app.bsky.unspecced.defs#threadItemPost")
],
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}