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