1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.feed.getPostThread
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 bon::Builder,
16 jacquard_derive::IntoStatic
17)]
18#[builder(start_fn = new)]
19#[serde(rename_all = "camelCase")]
20pub struct GetPostThread<'a> {
21 ///(default: 6, min: 0, max: 1000)
22 #[serde(skip_serializing_if = "std::option::Option::is_none")]
23 pub depth: std::option::Option<i64>,
24 ///(default: 80, min: 0, max: 1000)
25 #[serde(skip_serializing_if = "std::option::Option::is_none")]
26 pub parent_height: std::option::Option<i64>,
27 #[serde(borrow)]
28 pub uri: jacquard_common::types::string::AtUri<'a>,
29}
30
31#[jacquard_derive::lexicon]
32#[derive(
33 serde::Serialize,
34 serde::Deserialize,
35 Debug,
36 Clone,
37 PartialEq,
38 Eq,
39 jacquard_derive::IntoStatic
40)]
41#[serde(rename_all = "camelCase")]
42pub struct GetPostThreadOutput<'a> {
43 #[serde(borrow)]
44 pub thread: GetPostThreadOutputRecordThread<'a>,
45 #[serde(skip_serializing_if = "std::option::Option::is_none")]
46 #[serde(borrow)]
47 pub threadgate: std::option::Option<crate::app_bsky::feed::ThreadgateView<'a>>,
48}
49
50#[jacquard_derive::open_union]
51#[derive(
52 serde::Serialize,
53 serde::Deserialize,
54 Debug,
55 Clone,
56 PartialEq,
57 Eq,
58 jacquard_derive::IntoStatic
59)]
60#[serde(tag = "$type")]
61#[serde(bound(deserialize = "'de: 'a"))]
62pub enum GetPostThreadOutputRecordThread<'a> {
63 #[serde(rename = "app.bsky.feed.defs#threadViewPost")]
64 DefsThreadViewPost(Box<crate::app_bsky::feed::ThreadViewPost<'a>>),
65 #[serde(rename = "app.bsky.feed.defs#notFoundPost")]
66 DefsNotFoundPost(Box<crate::app_bsky::feed::NotFoundPost<'a>>),
67 #[serde(rename = "app.bsky.feed.defs#blockedPost")]
68 DefsBlockedPost(Box<crate::app_bsky::feed::BlockedPost<'a>>),
69}
70
71#[jacquard_derive::open_union]
72#[derive(
73 serde::Serialize,
74 serde::Deserialize,
75 Debug,
76 Clone,
77 PartialEq,
78 Eq,
79 thiserror::Error,
80 miette::Diagnostic
81)]
82#[serde(tag = "error", content = "message")]
83#[serde(bound(deserialize = "'de: 'a"))]
84pub enum GetPostThreadError<'a> {
85 #[serde(rename = "NotFound")]
86 NotFound(std::option::Option<String>),
87}
88
89impl std::fmt::Display for GetPostThreadError<'_> {
90 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
91 match self {
92 Self::NotFound(msg) => {
93 write!(f, "NotFound")?;
94 if let Some(msg) = msg {
95 write!(f, ": {}", msg)?;
96 }
97 Ok(())
98 }
99 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
100 }
101 }
102}
103
104impl jacquard_common::IntoStatic for GetPostThreadError<'_> {
105 type Output = GetPostThreadError<'static>;
106 fn into_static(self) -> Self::Output {
107 match self {
108 GetPostThreadError::NotFound(v) => {
109 GetPostThreadError::NotFound(v.into_static())
110 }
111 GetPostThreadError::Unknown(v) => {
112 GetPostThreadError::Unknown(v.into_static())
113 }
114 }
115 }
116}
117
118///Response type for
119///app.bsky.feed.getPostThread
120pub struct GetPostThreadResponse;
121impl jacquard_common::xrpc::XrpcResp for GetPostThreadResponse {
122 const NSID: &'static str = "app.bsky.feed.getPostThread";
123 const ENCODING: &'static str = "application/json";
124 type Output<'de> = GetPostThreadOutput<'de>;
125 type Err<'de> = GetPostThreadError<'de>;
126}
127
128impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetPostThread<'de> {
129 const NSID: &'static str = "app.bsky.feed.getPostThread";
130 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
131 type Response = GetPostThreadResponse;
132}
133
134///Endpoint type for
135///app.bsky.feed.getPostThread
136pub struct GetPostThreadRequest;
137impl jacquard_common::xrpc::XrpcEndpoint for GetPostThreadRequest {
138 const PATH: &'static str = "/xrpc/app.bsky.feed.getPostThread";
139 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
140 type Request<'de> = GetPostThread<'de>;
141 type Response = GetPostThreadResponse;
142}