jacquard_api/app_bsky/feed/
get_post_thread.rs

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: GetPostThreadOutputThread<'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 GetPostThreadOutputThread<'a> {
63    #[serde(rename = "app.bsky.feed.defs#threadViewPost")]
64    ThreadViewPost(Box<crate::app_bsky::feed::ThreadViewPost<'a>>),
65    #[serde(rename = "app.bsky.feed.defs#notFoundPost")]
66    NotFoundPost(Box<crate::app_bsky::feed::NotFoundPost<'a>>),
67    #[serde(rename = "app.bsky.feed.defs#blockedPost")]
68    BlockedPost(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    jacquard_derive::IntoStatic
82)]
83#[serde(tag = "error", content = "message")]
84#[serde(bound(deserialize = "'de: 'a"))]
85pub enum GetPostThreadError<'a> {
86    #[serde(rename = "NotFound")]
87    NotFound(std::option::Option<String>),
88}
89
90impl std::fmt::Display for GetPostThreadError<'_> {
91    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
92        match self {
93            Self::NotFound(msg) => {
94                write!(f, "NotFound")?;
95                if let Some(msg) = msg {
96                    write!(f, ": {}", msg)?;
97                }
98                Ok(())
99            }
100            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
101        }
102    }
103}
104
105///Response type for
106///app.bsky.feed.getPostThread
107pub struct GetPostThreadResponse;
108impl jacquard_common::xrpc::XrpcResp for GetPostThreadResponse {
109    const NSID: &'static str = "app.bsky.feed.getPostThread";
110    const ENCODING: &'static str = "application/json";
111    type Output<'de> = GetPostThreadOutput<'de>;
112    type Err<'de> = GetPostThreadError<'de>;
113}
114
115impl<'a> jacquard_common::xrpc::XrpcRequest for GetPostThread<'a> {
116    const NSID: &'static str = "app.bsky.feed.getPostThread";
117    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
118    type Response = GetPostThreadResponse;
119}
120
121///Endpoint type for
122///app.bsky.feed.getPostThread
123pub struct GetPostThreadRequest;
124impl jacquard_common::xrpc::XrpcEndpoint for GetPostThreadRequest {
125    const PATH: &'static str = "/xrpc/app.bsky.feed.getPostThread";
126    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
127    type Request<'de> = GetPostThread<'de>;
128    type Response = GetPostThreadResponse;
129}