A better Rust ATProto crate
at oauth 6.1 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.unspecced.getPostThreadV2 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)] 17#[builder(start_fn = new)] 18#[serde(rename_all = "camelCase")] 19pub struct GetPostThreadV2<'a> { 20 ///(default: true) 21 #[serde(skip_serializing_if = "std::option::Option::is_none")] 22 pub above: std::option::Option<bool>, 23 #[serde(borrow)] 24 pub anchor: jacquard_common::types::string::AtUri<'a>, 25 ///(default: 6, min: 0, max: 20) 26 #[serde(skip_serializing_if = "std::option::Option::is_none")] 27 pub below: std::option::Option<i64>, 28 ///(default: 10, min: 0, max: 100) 29 #[serde(skip_serializing_if = "std::option::Option::is_none")] 30 pub branching_factor: std::option::Option<i64>, 31 ///(default: false) 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 pub prioritize_followed_users: std::option::Option<bool>, 34 ///(default: "oldest") 35 #[serde(skip_serializing_if = "std::option::Option::is_none")] 36 #[serde(borrow)] 37 #[builder(into)] 38 pub sort: std::option::Option<jacquard_common::CowStr<'a>>, 39} 40 41impl jacquard_common::IntoStatic for GetPostThreadV2<'_> { 42 type Output = GetPostThreadV2<'static>; 43 fn into_static(self) -> Self::Output { 44 GetPostThreadV2 { 45 above: self.above.into_static(), 46 anchor: self.anchor.into_static(), 47 below: self.below.into_static(), 48 branching_factor: self.branching_factor.into_static(), 49 prioritize_followed_users: self.prioritize_followed_users.into_static(), 50 sort: self.sort.into_static(), 51 } 52 } 53} 54 55#[jacquard_derive::lexicon] 56#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 57#[serde(rename_all = "camelCase")] 58pub struct GetPostThreadV2Output<'a> { 59 ///Whether this thread has additional replies. If true, a call can be made to the `getPostThreadOtherV2` endpoint to retrieve them. 60 pub has_other_replies: bool, 61 ///A flat list of thread items. The depth of each item is indicated by the depth property inside the item. 62 #[serde(borrow)] 63 pub thread: Vec<jacquard_common::types::value::Data<'a>>, 64 #[serde(skip_serializing_if = "std::option::Option::is_none")] 65 #[serde(borrow)] 66 pub threadgate: std::option::Option<crate::app_bsky::feed::ThreadgateView<'a>>, 67} 68 69impl jacquard_common::IntoStatic for GetPostThreadV2Output<'_> { 70 type Output = GetPostThreadV2Output<'static>; 71 fn into_static(self) -> Self::Output { 72 GetPostThreadV2Output { 73 has_other_replies: self.has_other_replies.into_static(), 74 thread: self.thread.into_static(), 75 threadgate: self.threadgate.into_static(), 76 extra_data: self.extra_data.into_static(), 77 } 78 } 79} 80 81impl jacquard_common::types::xrpc::XrpcRequest for GetPostThreadV2<'_> { 82 const NSID: &'static str = "app.bsky.unspecced.getPostThreadV2"; 83 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; 84 const OUTPUT_ENCODING: &'static str = "application/json"; 85 type Output<'de> = GetPostThreadV2Output<'de>; 86 type Err<'de> = jacquard_common::types::xrpc::GenericError<'de>; 87} 88 89#[jacquard_derive::lexicon] 90#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 91#[serde(rename_all = "camelCase")] 92pub struct ThreadItem<'a> { 93 ///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. 94 pub depth: i64, 95 #[serde(borrow)] 96 pub uri: jacquard_common::types::string::AtUri<'a>, 97 #[serde(borrow)] 98 pub value: ThreadItemRecordValue<'a>, 99} 100 101#[jacquard_derive::open_union] 102#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 103#[serde(tag = "$type")] 104#[serde(bound(deserialize = "'de: 'a"))] 105pub enum ThreadItemRecordValue<'a> { 106 #[serde(rename = "app.bsky.unspecced.defs#threadItemPost")] 107 DefsThreadItemPost(Box<crate::app_bsky::unspecced::ThreadItemPost<'a>>), 108 #[serde(rename = "app.bsky.unspecced.defs#threadItemNoUnauthenticated")] 109 DefsThreadItemNoUnauthenticated( 110 Box<crate::app_bsky::unspecced::ThreadItemNoUnauthenticated<'a>>, 111 ), 112 #[serde(rename = "app.bsky.unspecced.defs#threadItemNotFound")] 113 DefsThreadItemNotFound(Box<crate::app_bsky::unspecced::ThreadItemNotFound<'a>>), 114 #[serde(rename = "app.bsky.unspecced.defs#threadItemBlocked")] 115 DefsThreadItemBlocked(Box<crate::app_bsky::unspecced::ThreadItemBlocked<'a>>), 116} 117 118impl jacquard_common::IntoStatic for ThreadItemRecordValue<'_> { 119 type Output = ThreadItemRecordValue<'static>; 120 fn into_static(self) -> Self::Output { 121 match self { 122 ThreadItemRecordValue::DefsThreadItemPost(v) => { 123 ThreadItemRecordValue::DefsThreadItemPost(v.into_static()) 124 } 125 ThreadItemRecordValue::DefsThreadItemNoUnauthenticated(v) => { 126 ThreadItemRecordValue::DefsThreadItemNoUnauthenticated(v.into_static()) 127 } 128 ThreadItemRecordValue::DefsThreadItemNotFound(v) => { 129 ThreadItemRecordValue::DefsThreadItemNotFound(v.into_static()) 130 } 131 ThreadItemRecordValue::DefsThreadItemBlocked(v) => { 132 ThreadItemRecordValue::DefsThreadItemBlocked(v.into_static()) 133 } 134 ThreadItemRecordValue::Unknown(v) => { 135 ThreadItemRecordValue::Unknown(v.into_static()) 136 } 137 } 138 } 139} 140 141impl jacquard_common::IntoStatic for ThreadItem<'_> { 142 type Output = ThreadItem<'static>; 143 fn into_static(self) -> Self::Output { 144 ThreadItem { 145 depth: self.depth.into_static(), 146 uri: self.uri.into_static(), 147 value: self.value.into_static(), 148 extra_data: self.extra_data.into_static(), 149 } 150 } 151}