A better Rust ATProto crate
at lifetimes 3.5 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.feed.getFeed 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 GetFeed<'a> { 21 #[serde(skip_serializing_if = "std::option::Option::is_none")] 22 #[serde(borrow)] 23 #[builder(into)] 24 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 25 #[serde(borrow)] 26 pub feed: jacquard_common::types::string::AtUri<'a>, 27 ///(default: 50, min: 1, max: 100) 28 #[serde(skip_serializing_if = "std::option::Option::is_none")] 29 pub limit: std::option::Option<i64>, 30} 31 32#[jacquard_derive::lexicon] 33#[derive( 34 serde::Serialize, 35 serde::Deserialize, 36 Debug, 37 Clone, 38 PartialEq, 39 Eq, 40 jacquard_derive::IntoStatic 41)] 42#[serde(rename_all = "camelCase")] 43pub struct GetFeedOutput<'a> { 44 #[serde(skip_serializing_if = "std::option::Option::is_none")] 45 #[serde(borrow)] 46 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 47 #[serde(borrow)] 48 pub feed: Vec<crate::app_bsky::feed::FeedViewPost<'a>>, 49} 50 51#[jacquard_derive::open_union] 52#[derive( 53 serde::Serialize, 54 serde::Deserialize, 55 Debug, 56 Clone, 57 PartialEq, 58 Eq, 59 thiserror::Error, 60 miette::Diagnostic 61)] 62#[serde(tag = "error", content = "message")] 63#[serde(bound(deserialize = "'de: 'a"))] 64pub enum GetFeedError<'a> { 65 #[serde(rename = "UnknownFeed")] 66 UnknownFeed(std::option::Option<String>), 67} 68 69impl std::fmt::Display for GetFeedError<'_> { 70 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 71 match self { 72 Self::UnknownFeed(msg) => { 73 write!(f, "UnknownFeed")?; 74 if let Some(msg) = msg { 75 write!(f, ": {}", msg)?; 76 } 77 Ok(()) 78 } 79 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 80 } 81 } 82} 83 84impl jacquard_common::IntoStatic for GetFeedError<'_> { 85 type Output = GetFeedError<'static>; 86 fn into_static(self) -> Self::Output { 87 match self { 88 GetFeedError::UnknownFeed(v) => GetFeedError::UnknownFeed(v.into_static()), 89 GetFeedError::Unknown(v) => GetFeedError::Unknown(v.into_static()), 90 } 91 } 92} 93 94///Response type for 95///app.bsky.feed.getFeed 96pub struct GetFeedResponse; 97impl jacquard_common::xrpc::XrpcResp for GetFeedResponse { 98 const NSID: &'static str = "app.bsky.feed.getFeed"; 99 const ENCODING: &'static str = "application/json"; 100 type Output<'de> = GetFeedOutput<'de>; 101 type Err<'de> = GetFeedError<'de>; 102} 103 104impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetFeed<'de> { 105 const NSID: &'static str = "app.bsky.feed.getFeed"; 106 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 107 type Response = GetFeedResponse; 108} 109 110///Endpoint type for 111///app.bsky.feed.getFeed 112pub struct GetFeedRequest; 113impl jacquard_common::xrpc::XrpcEndpoint for GetFeedRequest { 114 const PATH: &'static str = "/xrpc/app.bsky.feed.getFeed"; 115 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 116 type Request<'de> = GetFeed<'de>; 117 type Response = GetFeedResponse; 118}